trying to make ctrl-c work on windows.

This commit is contained in:
Brad Nelson
2022-12-31 23:02:15 -08:00
parent b720575fb2
commit 1b52ba02d1

View File

@ -25,6 +25,15 @@ enum {
#undef Z
};
static BOOL WINAPI forth_ctrl_handler(DWORD fdwCtrlType) {
if (fdwCtrlType == CTRL_C_EVENT ||
fdwCtrlType == CTRL_BREAK_EVENT) {
// RaiseException(EXCEPTION_BREAKPOINT, 0, 0, 0);
return TRUE;
}
return FALSE;
}
static cell_t *forth_run(cell_t *init_rp) {
static const BUILTIN_WORD builtins[] = {
#define Z(flags, name, op, code) \
@ -45,6 +54,7 @@ static cell_t *forth_run(cell_t *init_rp) {
}
register cell_t *ip, *rp, *sp, tos, w;
register float *fp, ft;
SetConsoleCtrlHandler(forth_ctrl_handler, TRUE);
rp = init_rp; UNPARK;
for (;;) {
__try {