Bug fixes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 5 Jun 2020 02:19:32 +0000 (21:19 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 5 Jun 2020 02:19:32 +0000 (21:19 -0500)
Makefile
include/onyxwasm.h
onyx
src/onyxwasm.c

index e3213a833968f042fe98baf785fdd6bd3b056f43..c1561f1d6e1cf12b5eac760cb7f7d5b73c3863b5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ OBJ_FILES=\
        src/onyxparser.o \
        src/onyxmsgs.o \
        src/onyxutils.o \
+       src/onyxwasm.o \
        src/onyx.o
 
 CC=gcc
index 030dfa6711a4fc85d9607cae1d39bbc4f353f4a7..e7808e75bce6ecac08967ef77077b8e0bdc6ccee 100644 (file)
@@ -6,12 +6,12 @@
 
 #include "onyxparser.h"
 
-typedef enum WasmType : char {
-       WASM_TYPE_INT32 = 0x7F,
-       WASM_TYPE_INT64 = 0x7E,
-       WASM_TYPE_FLOAT32 = 0x7D,
-       WASM_TYPE_FLOAT64 = 0x7C
-} WasmType;
+typedef char WasmType;
+
+extern const WasmType WASM_TYPE_INT32;
+extern const WasmType WASM_TYPE_INT64;
+extern const WasmType WASM_TYPE_FLOAT32;
+extern const WasmType WASM_TYPE_FLOAT64;
 
 typedef struct WasmFuncType {
        // NOTE: For now, WASM only allows for 1 return value.
diff --git a/onyx b/onyx
index 9aa7cdd2befeeb8ce1182c390ca6a2105ad0ae42..802912fcda459d7d00a6b0b5bf66102f79dbddfe 100755 (executable)
Binary files a/onyx and b/onyx differ
index 3c1f5fa752323a5a13d9d818c907775020c1ca33..ab9d349789df5d21a3e8391296ff8aba9f92710c 100644 (file)
@@ -1,5 +1,10 @@
 #include "onyxwasm.h"
 
+const WasmType WASM_TYPE_INT32 = 0x7F;
+const WasmType WASM_TYPE_INT64 = 0x7E;
+const WasmType WASM_TYPE_FLOAT32 = 0x7D;
+const WasmType WASM_TYPE_FLOAT64 = 0x7C;
+
 static WasmType onyx_type_to_wasm_type(OnyxTypeInfo* type) {
        if (type->is_bool) return WASM_TYPE_INT32;
        if (type->is_int) {
@@ -88,6 +93,6 @@ OnyxWasmModule onyx_wasm_generate_module(bh_allocator alloc, OnyxAstNode* progra
 }
 
 void onyx_wasm_module_free(OnyxWasmModule* module) {
-       bh_arr_free(module.functypes);
-       bh_arr_free(module.funcs);
+       bh_arr_free(module->functypes);
+       bh_arr_free(module->funcs);
 }