diff --git a/include/vm.h b/include/vm.h index 2cfe68f..20355a0 100644 --- a/include/vm.h +++ b/include/vm.h @@ -128,6 +128,7 @@ struct string *string_format(struct string *fmt, union vm_value arg, enum string void vm_stack_trace(void); _Noreturn void _vm_error(const char *fmt, ...); _Noreturn void vm_exit(int code); +_Noreturn void vm_reset(void); #ifdef __ANDROID__ // Report the error with a message box and exit. diff --git a/src/hll/vmSystem.c b/src/hll/vmSystem.c index d05a440..a7df8e0 100644 --- a/src/hll/vmSystem.c +++ b/src/hll/vmSystem.c @@ -49,8 +49,15 @@ void vmSystem_CurrentTime(struct page **page) date[6].i = tm->tm_wday; } -//void vmSystem_Reset(void); -//void vmSystem_Shutdown(void); +static void vmSystem_Reset(void) +{ + vm_reset(); +} + +static void vmSystem_Shutdown(void) +{ + vm_exit(0); +} static int vmSystem_OpenWeb(struct string *url) { @@ -62,8 +69,8 @@ HLL_WARN_UNIMPLEMENTED(0, int, vmSystem, AddURLMenu, struct string *title, struc HLL_LIBRARY(vmSystem, HLL_EXPORT(Init, vmSystem_Init), HLL_EXPORT(CurrentTime, vmSystem_CurrentTime), - HLL_TODO_EXPORT(Reset, vmSystem_Reset), - HLL_TODO_EXPORT(Shutdown, vmSystem_Shutdown), + HLL_EXPORT(Reset, vmSystem_Reset), + HLL_EXPORT(Shutdown, vmSystem_Shutdown), HLL_EXPORT(OpenWeb, vmSystem_OpenWeb), HLL_EXPORT(AddURLMenu, vmSystem_AddURLMenu) ); diff --git a/src/vm.c b/src/vm.c index 5546c5e..01b9cc5 100644 --- a/src/vm.c +++ b/src/vm.c @@ -458,8 +458,6 @@ static const SDL_MessageBoxButtonData buttons[] = { { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Cancel" }, }; -static _Noreturn void vm_reset(void); - static struct string *get_func_stack_name(int index) { int i = call_stack_ptr - (1 + index); @@ -2337,7 +2335,7 @@ static void vm_free(void) static jmp_buf reset_buf; -static _Noreturn void vm_reset(void) +_Noreturn void vm_reset(void) { vm_free(); longjmp(reset_buf, 1);