set name to each library
This commit is contained in:
parent
35b99d11a8
commit
7cdcbd4604
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
struct pic_lib {
|
struct pic_lib {
|
||||||
PIC_OBJECT_HEADER
|
PIC_OBJECT_HEADER
|
||||||
|
pic_value name;
|
||||||
struct pic_senv *senv;
|
struct pic_senv *senv;
|
||||||
struct xhash *exports;
|
struct xhash *exports;
|
||||||
};
|
};
|
||||||
|
|
1
src/gc.c
1
src/gc.c
|
@ -399,6 +399,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
|
||||||
}
|
}
|
||||||
case PIC_TT_LIB: {
|
case PIC_TT_LIB: {
|
||||||
struct pic_lib *lib = (struct pic_lib *)obj;
|
struct pic_lib *lib = (struct pic_lib *)obj;
|
||||||
|
gc_mark(pic, lib->name);
|
||||||
gc_mark_object(pic, (struct pic_object *)lib->senv);
|
gc_mark_object(pic, (struct pic_object *)lib->senv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB);
|
||||||
lib->senv = pic_core_syntactic_env(pic);
|
lib->senv = pic_core_syntactic_env(pic);
|
||||||
lib->exports = xh_new();
|
lib->exports = xh_new();
|
||||||
|
lib->name = name;
|
||||||
|
|
||||||
/* register! */
|
/* register! */
|
||||||
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);
|
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);
|
||||||
|
|
Loading…
Reference in New Issue