-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
45 lines (33 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
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <stdlib.h>
#include "vm.h"
#include "forth.h"
#include "stack.h"
DictDebug junk; // Make sure DictDebug symbol does not optimise out
Stack data_stack;
Stack return_stack;
Stack control_stack;
jmp_buf cold_boot;
jmp_buf warm_boot;
int main (int argc, char **argv) {
mem_init(0);
// do_abort jumps to here
if (setjmp(abort_jmp) != 0) {
dropline(); /* discard rest of input line if we longjmp'd here */
}
stack_init(&data_stack, EXC_DS_UNDER, EXC_DS_OVER);
// do_quit() jumps to here
if (setjmp(quit_jmp) != 0) {
dropline(); /* discard rest of input line if we longjmp'd here */
}
stack_init(&return_stack, EXC_RS_UNDER, EXC_RS_OVER);
stack_init(&control_stack, EXC_CS_UNDER, EXC_CS_OVER);
exception_init();
interpreter_state = S_INTERPRET;
docolon_mode = DM_NORMAL;
// Run the interpreter
while (1) {
do_interpret(NULL);
}
exit(0);
}