use register_core_symbol macro to initialize pic_state
This commit is contained in:
parent
ad3c268f81
commit
673b66a723
52
src/state.c
52
src/state.c
|
@ -82,31 +82,35 @@ pic_open(int argc, char *argv[], char **envp)
|
||||||
/* native stack marker */
|
/* native stack marker */
|
||||||
pic->native_stack_start = &t;
|
pic->native_stack_start = &t;
|
||||||
|
|
||||||
|
#define register_core_symbol(pic,slot,name) do { \
|
||||||
|
pic->slot = pic_intern_cstr(pic, name); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
ai = pic_gc_arena_preserve(pic);
|
ai = pic_gc_arena_preserve(pic);
|
||||||
pic->sDEFINE = pic_intern_cstr(pic, "define");
|
register_core_symbol(pic, sDEFINE, "define");
|
||||||
pic->sLAMBDA = pic_intern_cstr(pic, "lambda");
|
register_core_symbol(pic, sLAMBDA, "lambda");
|
||||||
pic->sIF = pic_intern_cstr(pic, "if");
|
register_core_symbol(pic, sIF, "if");
|
||||||
pic->sBEGIN = pic_intern_cstr(pic, "begin");
|
register_core_symbol(pic, sBEGIN, "begin");
|
||||||
pic->sSETBANG = pic_intern_cstr(pic, "set!");
|
register_core_symbol(pic, sSETBANG, "set!");
|
||||||
pic->sQUOTE = pic_intern_cstr(pic, "quote");
|
register_core_symbol(pic, sQUOTE, "quote");
|
||||||
pic->sQUASIQUOTE = pic_intern_cstr(pic, "quasiquote");
|
register_core_symbol(pic, sQUASIQUOTE, "quasiquote");
|
||||||
pic->sUNQUOTE = pic_intern_cstr(pic, "unquote");
|
register_core_symbol(pic, sUNQUOTE, "unquote");
|
||||||
pic->sUNQUOTE_SPLICING = pic_intern_cstr(pic, "unquote-splicing");
|
register_core_symbol(pic, sUNQUOTE_SPLICING, "unquote-splicing");
|
||||||
pic->sDEFINE_SYNTAX = pic_intern_cstr(pic, "define-syntax");
|
register_core_symbol(pic, sDEFINE_SYNTAX, "define-syntax");
|
||||||
pic->sDEFINE_MACRO = pic_intern_cstr(pic, "define-macro");
|
register_core_symbol(pic, sCONS, "cons");
|
||||||
pic->sCONS = pic_intern_cstr(pic, "cons");
|
register_core_symbol(pic, sCAR, "car");
|
||||||
pic->sCAR = pic_intern_cstr(pic, "car");
|
register_core_symbol(pic, sCDR, "cdr");
|
||||||
pic->sCDR = pic_intern_cstr(pic, "cdr");
|
register_core_symbol(pic, sNILP, "null?");
|
||||||
pic->sNILP = pic_intern_cstr(pic, "null?");
|
register_core_symbol(pic, sADD, "+");
|
||||||
pic->sADD = pic_intern_cstr(pic, "+");
|
register_core_symbol(pic, sSUB, "-");
|
||||||
pic->sSUB = pic_intern_cstr(pic, "-");
|
register_core_symbol(pic, sMUL, "*");
|
||||||
pic->sMUL = pic_intern_cstr(pic, "*");
|
register_core_symbol(pic, sDIV, "/");
|
||||||
pic->sDIV = pic_intern_cstr(pic, "/");
|
register_core_symbol(pic, sEQ, "=");
|
||||||
pic->sEQ = pic_intern_cstr(pic, "=");
|
register_core_symbol(pic, sLT, "<");
|
||||||
pic->sLT = pic_intern_cstr(pic, "<");
|
register_core_symbol(pic, sLE, "<=");
|
||||||
pic->sLE = pic_intern_cstr(pic, "<=");
|
register_core_symbol(pic, sGT, ">");
|
||||||
pic->sGT = pic_intern_cstr(pic, ">");
|
register_core_symbol(pic, sGE, ">=");
|
||||||
pic->sGE = pic_intern_cstr(pic, ">=");
|
pic_gc_arena_restore(pic, ai);
|
||||||
pic_gc_arena_restore(pic, ai);
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
|
||||||
pic_init_core(pic);
|
pic_init_core(pic);
|
||||||
|
|
Loading…
Reference in New Issue