diff --git a/experiments/waforth2c/waforth.c b/experiments/waforth2c/waforth.c index f47c997..fed58ac 100644 --- a/experiments/waforth2c/waforth.c +++ b/experiments/waforth2c/waforth.c @@ -8,7 +8,7 @@ #include "waforth.gen/waforth_modules.h" void (*Z_shellZ_emitZ_vi)(u32); -u32 (*Z_shellZ_keyZ_iv)(void); +u32 (*Z_shellZ_getcZ_iv)(void); void (*Z_shellZ_loadZ_viii)(u32, u32, u32); void (*Z_shellZ_debugZ_vi)(u32); wasm_rt_table_t (*Z_envZ_table); @@ -22,7 +22,7 @@ static void shellEmit(u32 c) { static int bufferIndex; char* buffer = "main\n"; -static u32 shellKey() { +static u32 shellGetC() { if (bufferIndex >= strlen(buffer)) { return -1; } @@ -51,7 +51,7 @@ void waforth_init() { } Z_shellZ_emitZ_vi = &shellEmit; - Z_shellZ_keyZ_iv = &shellKey; + Z_shellZ_getcZ_iv = &shellGetC; Z_shellZ_loadZ_viii = &shellLoad; Z_shellZ_debugZ_vi = &shellDebug; diff --git a/experiments/waforth2c/waforth2c.js b/experiments/waforth2c/waforth2c.js index ac614c0..405b4e5 100755 --- a/experiments/waforth2c/waforth2c.js +++ b/experiments/waforth2c/waforth2c.js @@ -44,7 +44,7 @@ WebAssembly.instantiate(coreWasm, { process.stdout.write(String.fromCharCode(c)); }, - key: () => { + getc: () => { if (buffer.length === 0) { return -1; } diff --git a/src/shell/WAForth.js b/src/shell/WAForth.js index cd08429..706330a 100644 --- a/src/shell/WAForth.js +++ b/src/shell/WAForth.js @@ -35,7 +35,7 @@ class WAForth { emit: this.onEmit, - key: () => { + getc: () => { if (buffer.length === 0) { return -1; } diff --git a/src/waforth.wat b/src/waforth.wat index f7af1cf..0228b8f 100644 --- a/src/waforth.wat +++ b/src/waforth.wat @@ -147,7 +147,7 @@ (module (import "shell" "emit" (func $shell_emit (param i32))) - (import "shell" "key" (func $shell_key (result i32))) + (import "shell" "getc" (func $shell_getc (result i32))) (import "shell" "load" (func $shell_load (param i32 i32 i32))) (import "shell" "debug" (func $shell_debug (param i32))) @@ -1838,7 +1838,7 @@ EOF (set_global $inputBufferSize (i32.const 0)) (block $endLoop (loop $loop - (br_if $endLoop (i32.eq (tee_local $char (call $shell_key)) (i32.const -1))) + (br_if $endLoop (i32.eq (tee_local $char (call $shell_getc)) (i32.const -1))) (i32.store8 (i32.add (i32.const !inputBufferBase) (get_global $inputBufferSize)) (get_local $char)) (set_global $inputBufferSize (i32.add (get_global $inputBufferSize) (i32.const 1)))