diff --git a/userland/src/lib/fileops.wast b/userland/src/lib/fileops.wast index 97559bd..2369746 100644 --- a/userland/src/lib/fileops.wast +++ b/userland/src/lib/fileops.wast @@ -17,67 +17,67 @@ ;; functions (func $openFile (result i32) ;; open stdout - (i32.const 200) - (i32.const 42) - (call $open)) + (call $open + (i32.const 200) + (i32.const 42))) (func $writeHelloWorld (param $fd i32) ;; write hello world - (get_local $fd) - (i32.const 230) - (i32.const 14) - (call $write) + (call $write + (get_local $fd) + (i32.const 230) + (i32.const 14)) (drop)) (func $readHello (param $fd i32) ;; read hello world - (get_local $fd) - (i32.const 255) - (i32.const 14) - (call $read) + (call $read + (get_local $fd) + (i32.const 255) + (i32.const 14)) (drop)) (func $removeFile - (i32.const 200) - (call $unlink) + (call $unlink + (i32.const 200)) (drop)) (func $main (result i32) (local $fd i32) ;; set $fd to the file descriptor - (call $openFile) - (set_local $fd) + (set_local $fd + (call $openFile)) - (get_local $fd) - (call $writeHelloWorld) + (call $writeHelloWorld + (get_local $fd)) ;; close file - (get_local $fd) - (call $close) + (call $close + (get_local $fd)) ;; set $fd to the new file descriptor - (call $openFile) - (set_local $fd) + (set_local $fd + (call $openFile)) ;; read Hello, World - (get_local $fd) - (call $readHello) + (call $readHello + (get_local $fd)) ;; istty - (get_local $fd) - (call $istty) + (call $istty + (get_local $fd)) (drop) ;; close file again - (get_local $fd) - (call $close) + (call $close + (get_local $fd)) ;; unlink filename (call $removeFile) ;; return 0 - (i32.const 0) - (set_local $fd) + (set_local $fd + (i32.const 0)) (drop)) (export "main" (func $main)))