set name to each library

This commit is contained in:
Yuichi Nishiwaki 2013-12-07 18:59:13 -08:00
parent 35b99d11a8
commit 7cdcbd4604
3 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@
struct pic_lib {
PIC_OBJECT_HEADER
pic_value name;
struct pic_senv *senv;
struct xhash *exports;
};

View File

@ -399,6 +399,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
}
case PIC_TT_LIB: {
struct pic_lib *lib = (struct pic_lib *)obj;
gc_mark(pic, lib->name);
gc_mark_object(pic, (struct pic_object *)lib->senv);
break;
}

View File

@ -12,6 +12,7 @@ pic_make_library(pic_state *pic, pic_value name)
lib = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB);
lib->senv = pic_core_syntactic_env(pic);
lib->exports = xh_new();
lib->name = name;
/* register! */
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);