diff --git a/include/picrin.h b/include/picrin.h index 3ddea47e..c576b0e3 100644 --- a/include/picrin.h +++ b/include/picrin.h @@ -71,6 +71,8 @@ typedef struct { pic_code *ip; + struct pic_lib *lib; + pic_sym sDEFINE, sLAMBDA, sIF, sBEGIN, sQUOTE, sSETBANG; pic_sym sQUASIQUOTE, sUNQUOTE, sUNQUOTE_SPLICING; pic_sym sDEFINE_SYNTAX; @@ -90,9 +92,7 @@ typedef struct { xhash globals; xhash macros; - - pic_value lib_tbl; - struct pic_lib *lib; + pic_value libs; xhash rlabels; diff --git a/src/gc.c b/src/gc.c index 465704dd..f224d758 100644 --- a/src/gc.c +++ b/src/gc.c @@ -594,7 +594,7 @@ gc_mark_phase(pic_state *pic) } /* library table */ - gc_mark(pic, pic->lib_tbl); + gc_mark(pic, pic->libs); } static void diff --git a/src/lib.c b/src/lib.c index cb6ce5b2..b45bb71a 100644 --- a/src/lib.c +++ b/src/lib.c @@ -35,7 +35,7 @@ pic_make_library(pic_state *pic, pic_value name) xh_init_int(&lib->exports, sizeof(pic_sym)); /* register! */ - pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl); + pic->libs = pic_acons(pic, name, pic_obj_value(lib), pic->libs); return lib; } @@ -57,7 +57,7 @@ pic_find_library(pic_state *pic, pic_value spec) { pic_value v; - v = pic_assoc(pic, spec, pic->lib_tbl, NULL); + v = pic_assoc(pic, spec, pic->libs, NULL); if (pic_false_p(v)) { return NULL; } diff --git a/src/state.c b/src/state.c index d203f6a2..4a6ad837 100644 --- a/src/state.c +++ b/src/state.c @@ -55,7 +55,7 @@ pic_open(int argc, char *argv[], char **envp) xh_init_int(&pic->macros, sizeof(struct pic_macro *)); /* libraries */ - pic->lib_tbl = pic_nil_value(); + pic->libs = pic_nil_value(); pic->lib = NULL; /* reader */ @@ -162,7 +162,7 @@ pic_close(pic_state *pic) pic->arena_idx = 0; pic->err = NULL; xh_clear(&pic->macros); - pic->lib_tbl = pic_nil_value(); + pic->libs = pic_nil_value(); /* free all heap objects */ pic_gc_run(pic);