#include "test.h" #include "debug.h" #include "vm.h" #include #include #include #include #include #include #include #ifdef __EMSCRIPTEN__ #include #endif VM vm = {0}; void mainloop() { if (!step_vm(&vm)) { #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); /* this should "kill" the app. */ #else core_dump(&vm); exit(0); #endif } } int main(int argc, char **argv) { vm.frames_size = FRAMES_SIZE; vm.stack_size = STACK_SIZE; vm.memory_size = MEMORY_SIZE; vm.frames[vm.fp].allocated.end = test_add_function_compile(vm.memory); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(mainloop, 0, 1); #else while (1) { mainloop(); } #endif }