-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
37 lines (31 loc) · 1.01 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <include/wasm/vm/vm.h>
#include <include/tool/error/error_handle.h>
#include "include/wasm/wasm_reader/wasm_reader.h"
#include "include/debug.h"
#include "cmd/wcasm-objdump/include/dump.h"
#define INIT_MAIN() do{ \
init_opNames(); \
init_op(); \
}while (0)
bool stack_test();
int main() {
INIT_MAIN();
if (!stack_test()) {
errorExit("stack op wrong\n");
}
const char *filename = "/home/kingdo/go/src/github.com/Kingdo777/wasmgo-book/code/rust/examples/target/wasm32-unknown-unknown/release/ch01_hw.wasm";
filename = "/home/kingdo/go/src/github.com/Kingdo777/wasmgo-book/code/js/ch01_hw.wasm";
// filename = "/home/kingdo/go/src/github.com/Kingdo777/wasmgo-book/code/wat/ch09_calc.wasm";
vm *v = createVM();
wasm_reader *wr = createWasmReader();
module *m = createModule(filename);
decode_module(wr, m);
#ifdef DUMP_SEGMENT
wcasm_objdump(m);
#endif
exec(v, m);
free_module(wr, m);
destroy_wasm_reader(wr);
destroyVM(v);
return 0;
}