cleaning up more things
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 31 Dec 2020 04:22:15 +0000 (22:22 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 31 Dec 2020 04:22:15 +0000 (22:22 -0600)
bin/onyx-js [new file with mode: 0755]
bin/test
onyxcmd.js [deleted file]

diff --git a/bin/onyx-js b/bin/onyx-js
new file mode 100755 (executable)
index 0000000..757f30f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env node
+
+const fs = require('fs');
+const buf = fs.readFileSync(process.argv[2]);
+
+let wasm_memory;
+
+const ENV = {
+    host: {
+        print_str(ptr, len) {
+            const data = new Uint8Array(wasm_memory, ptr, len);
+            const str  = new TextDecoder().decode(data);
+            process.stdout.write(str);
+        }
+    }   
+}
+
+WebAssembly.instantiate(new Uint8Array(buf), ENV)
+    .then(res => {
+        const lib = res.instance.exports;
+        wasm_memory = lib.memory.buffer;
+
+        lib._start();
+    });
+
index 01d8dd6a27dd9bd838a15341282bc3f462eed6e0..8de7a61939fa0b658cf6cd995c1c6af7de3f600a 100755 (executable)
--- a/bin/test
+++ b/bin/test
@@ -13,7 +13,7 @@ for test_file in ./tests/*.onyx ; do
         continue
     fi
     
-    if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then
+    if ! ./bin/onyx-js "./tests/$name.wasm" > ./tmpoutput; then
         echo "❌ Failed to run $name.onyx."
         failed=1
         continue
diff --git a/onyxcmd.js b/onyxcmd.js
deleted file mode 100644 (file)
index cd00752..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-const fs = require('fs');
-const buf = fs.readFileSync(process.argv[2]);
-
-let wasm_memory;
-
-const ENV = {
-    host: {
-        print_str(ptr, len) {
-            const data = new Uint8Array(wasm_memory, ptr, len);
-            const str  = new TextDecoder().decode(data);
-            process.stdout.write(str);
-        }
-    }   
-}
-
-WebAssembly.instantiate(new Uint8Array(buf), ENV)
-    .then(res => {
-        const lib = res.instance.exports;
-        wasm_memory = lib.memory.buffer;
-
-        lib._start();
-    });
-