From d351ac01362230f70e0eb0a75fe4c269d2bb7da2 Mon Sep 17 00:00:00 2001 From: Steve Akinyemi Date: Fri, 23 Nov 2018 13:20:12 +0100 Subject: [PATCH] Remove old emscripten examples --- examples/em_abort.wat | 31 ---------------------------- examples/em_exit.wat | 27 ------------------------ examples/em_read_file.wat | 43 --------------------------------------- 3 files changed, 101 deletions(-) delete mode 100644 examples/em_abort.wat delete mode 100644 examples/em_exit.wat delete mode 100644 examples/em_read_file.wat diff --git a/examples/em_abort.wat b/examples/em_abort.wat deleted file mode 100644 index 1eb282754..000000000 --- a/examples/em_abort.wat +++ /dev/null @@ -1,31 +0,0 @@ -(module - (type $t1 (func (param i32 i32) (result i32))) - (type $t2 (func (param i32))) - (type $t3 (func )) - (func $printf (import "env" "printf") (type $t1)) - (func $abort (import "env" "abort") (type $t2)) - (func $_abort (import "env" "_abort") (type $t3)) - (func $abort_on_cannot_grow_memory (import "env" "abortOnCannotGrowMemory") (type $t3)) - (memory 1) - (data (i32.const 0) ">>> First\00") - (data (i32.const 24) ">>> Second\00") - (data (i32.const 48) "Aborting abruptly!\00") - (func $main (export "main") - ;; print ">>> First" - (call $printf (i32.const 0) (i32.const 0)) - (drop) - - ;; aborts - (call $_abort) ;; () - - ;; aborts - (call $abort_on_cannot_grow_memory) ;; () - - ;; aborts - (call $abort (i32.const 48)) ;; (message: u32) - - ;; print ">>> Second" - (call $printf (i32.const 24) (i32.const 0)) - (drop) - ) -) diff --git a/examples/em_exit.wat b/examples/em_exit.wat deleted file mode 100644 index 507985f35..000000000 --- a/examples/em_exit.wat +++ /dev/null @@ -1,27 +0,0 @@ -(module - (type $t1 (func (param i32))) - (func $putchar (import "env" "putchar") (type $t1)) - (func $sys_exit (import "env" "___syscall1") (type $t1)) - (memory 1) - (func $main (export "main") - ;; print "Hello" - (call $putchar (i32.const 72)) - (call $putchar (i32.const 101)) - (call $putchar (i32.const 108)) - (call $putchar (i32.const 108)) - (call $putchar (i32.const 111)) - (call $putchar (i32.const 32)) - - ;; exit abruptly - (call $sys_exit (i32.const 255)) ;; (status: c_int) -> c_int - - ;; print " World!" - (call $putchar (i32.const 87)) - (call $putchar (i32.const 111)) - (call $putchar (i32.const 114)) - (call $putchar (i32.const 108)) - (call $putchar (i32.const 100)) - (call $putchar (i32.const 33)) - (call $putchar (i32.const 10)) - ) -) diff --git a/examples/em_read_file.wat b/examples/em_read_file.wat deleted file mode 100644 index 7678e2519..000000000 --- a/examples/em_read_file.wat +++ /dev/null @@ -1,43 +0,0 @@ -(module - (type $t1 (func (param i32))) - (type $t2 (func (param i32 i32 i32) (result i32))) - (type $t3 (func (param i32) (result i32))) - (type $t4 (func (param i32 i32) (result i32))) - (func $putchar (import "env" "putchar") (type $t1)) - (func $printf (import "env" "printf") (type $t4)) - (func $sys_open (import "env" "___syscall5") (type $t2)) - (func $sys_read (import "env" "___syscall3") (type $t2)) - (func $sys_close (import "env" "___syscall6") (type $t3)) - (memory 1) - (data $filename (i32.const 0) "/Users/xxxx/Desktop/hello.txt\00") - (func $main (export "main") - ;; declare variables - (local $string_buf_addr i32) - (local $string_buf_len i32) - (local $file_access_flag i32) - (local $file_permission_flag i32) - (local $file_descriptor i32) - - ;; set variables - (set_local $string_buf_addr (i32.const 72)) ;; string_buf_addr at offset 72 - (set_local $string_buf_len (i32.const 10)) ;; string_buf_len is 5 - (set_local $file_access_flag (i32.const 02)) ;; file_access_flag has O_RDWR permission - (set_local $file_permission_flag (i32.const 700)) ;; file_permission_flag has S_IRWXU permission - - ;; open file - (call $sys_open (i32.const 0) (get_local $file_access_flag) (get_local $file_permission_flag)) ;; (path: u32, flags: c_int, mode: c_int) -> c_int - (set_local $file_descriptor) ;; set file_descriptor to the value returned by sys_open - - ;; read file content - (call $sys_read (get_local $file_descriptor) (get_local $string_buf_addr) (get_local $string_buf_len)) ;; (fd: c_int, buf: u32, count: size_t) -> ssize_t - (drop) ;; ignoring errors - - ;; close file - (call $sys_close (get_local $file_descriptor)) ;; (fd: c_int) -> c_int - (drop) ;; ignoring errors - - ;; print file content - (call $printf (get_local $string_buf_addr) (i32.const 0)) - (drop) ;; ignoring errors - ) -)