s/lib->senv/lib->env/g
This commit is contained in:
parent
7a2f8abd9c
commit
72422343c0
|
@ -12,7 +12,7 @@ extern "C" {
|
|||
struct pic_lib {
|
||||
PIC_OBJECT_HEADER
|
||||
pic_value name;
|
||||
struct pic_senv *senv;
|
||||
struct pic_senv *env;
|
||||
xhash exports;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static void pop_scope(analyze_state *);
|
|||
#define register_renamed_symbol(pic, state, slot, lib, id) do { \
|
||||
pic_sym sym, gsym; \
|
||||
sym = pic_intern_cstr(pic, id); \
|
||||
if (! pic_find_rename(pic, lib->senv, sym, &gsym)) { \
|
||||
if (! pic_find_rename(pic, lib->env, sym, &gsym)) { \
|
||||
pic_error(pic, "internal error! native VM procedure not found"); \
|
||||
} \
|
||||
state->slot = gsym; \
|
||||
|
|
2
src/gc.c
2
src/gc.c
|
@ -463,7 +463,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);
|
||||
gc_mark_object(pic, (struct pic_object *)lib->env);
|
||||
break;
|
||||
}
|
||||
case PIC_TT_VAR: {
|
||||
|
|
16
src/init.c
16
src/init.c
|
@ -62,14 +62,14 @@ pic_init_core(pic_state *pic)
|
|||
pic_deflibrary ("(scheme base)") {
|
||||
|
||||
/* load core syntaces */
|
||||
pic->lib->senv = pic_null_syntactic_environment(pic);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sDEFINE, pic->rDEFINE);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sSETBANG, pic->rSETBANG);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sQUOTE, pic->rQUOTE);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sLAMBDA, pic->rLAMBDA);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sIF, pic->rIF);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sBEGIN, pic->rBEGIN);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->senv, pic->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX);
|
||||
pic->lib->env = pic_null_syntactic_environment(pic);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE, pic->rDEFINE);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sSETBANG, pic->rSETBANG);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sQUOTE, pic->rQUOTE);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sLAMBDA, pic->rLAMBDA);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sIF, pic->rIF);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sBEGIN, pic->rBEGIN);
|
||||
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX);
|
||||
|
||||
pic_init_bool(pic); DONE;
|
||||
pic_init_pair(pic); DONE;
|
||||
|
|
|
@ -27,7 +27,7 @@ pic_make_library(pic_state *pic, pic_value name)
|
|||
senv = pic_null_syntactic_environment(pic);
|
||||
|
||||
lib = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB);
|
||||
lib->senv = senv;
|
||||
lib->env = senv;
|
||||
lib->name = name;
|
||||
xh_init_int(&lib->exports, sizeof(pic_sym));
|
||||
|
||||
|
@ -78,7 +78,7 @@ pic_import(pic_state *pic, pic_value spec)
|
|||
printf("* importing %s as %s\n", pic_symbol_name(pic, xh_key(it.e, pic_sym)), pic_symbol_name(pic, xh_val(it.e, pic_sym)));
|
||||
#endif
|
||||
|
||||
pic_put_rename(pic, pic->lib->senv, xh_key(it.e, pic_sym), xh_val(it.e, pic_sym));
|
||||
pic_put_rename(pic, pic->lib->env, xh_key(it.e, pic_sym), xh_val(it.e, pic_sym));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ pic_export(pic_state *pic, pic_sym sym)
|
|||
{
|
||||
pic_sym rename;
|
||||
|
||||
if (! pic_find_rename(pic, pic->lib->senv, sym, &rename)) {
|
||||
if (! pic_find_rename(pic, pic->lib->env, sym, &rename)) {
|
||||
pic_errorf(pic, "export: symbol not defined %s", pic_symbol_name(pic, sym));
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ pic_export_as(pic_state *pic, pic_sym sym, pic_sym as)
|
|||
{
|
||||
pic_sym rename;
|
||||
|
||||
if (! pic_find_rename(pic, pic->lib->senv, sym, &rename)) {
|
||||
if (! pic_find_rename(pic, pic->lib->env, sym, &rename)) {
|
||||
pic_errorf(pic, "export: symbol not defined %s", pic_symbol_name(pic, sym));
|
||||
}
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ pic_macroexpand(pic_state *pic, pic_value expr)
|
|||
puts("");
|
||||
#endif
|
||||
|
||||
v = macroexpand(pic, expr, pic->lib->senv);
|
||||
v = macroexpand(pic, expr, pic->lib->env);
|
||||
|
||||
#if DEBUG
|
||||
puts("after expand:");
|
||||
|
@ -528,7 +528,7 @@ pic_define_syntactic_keyword(pic_state *pic, struct pic_senv *senv, pic_sym sym,
|
|||
{
|
||||
pic_put_rename(pic, senv, sym, rsym);
|
||||
|
||||
if (pic->lib && pic->lib->senv == senv) {
|
||||
if (pic->lib && pic->lib->env == senv) {
|
||||
pic_export(pic, sym);
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ pic_defmacro(pic_state *pic, const char *name, struct pic_proc *macro)
|
|||
|
||||
/* symbol registration */
|
||||
sym = pic_intern_cstr(pic, name);
|
||||
rename = pic_add_rename(pic, pic->lib->senv, sym);
|
||||
rename = pic_add_rename(pic, pic->lib->env, sym);
|
||||
define_macro(pic, rename, macro, NULL);
|
||||
|
||||
/* auto export! */
|
||||
|
@ -591,7 +591,7 @@ pic_macro_macroexpand_1(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "o", &expr);
|
||||
|
||||
val = macroexpand_one(pic, expr, pic->lib->senv);
|
||||
val = macroexpand_one(pic, expr, pic->lib->env);
|
||||
if (pic_undef_p(val)) {
|
||||
return pic_values2(pic, expr, pic_false_value());
|
||||
}
|
||||
|
|
4
src/vm.c
4
src/vm.c
|
@ -376,7 +376,7 @@ global_ref(pic_state *pic, const char *name)
|
|||
pic_sym sym, rename;
|
||||
|
||||
sym = pic_intern_cstr(pic, name);
|
||||
if (! pic_find_rename(pic, pic->lib->senv, sym, &rename)) {
|
||||
if (! pic_find_rename(pic, pic->lib->env, sym, &rename)) {
|
||||
return SIZE_MAX;
|
||||
}
|
||||
if (! (e = xh_get_int(&pic->global_tbl, rename))) {
|
||||
|
@ -398,7 +398,7 @@ global_def(pic_state *pic, const char *name)
|
|||
}
|
||||
|
||||
/* register to the senv */
|
||||
rename = pic_add_rename(pic, pic->lib->senv, sym);
|
||||
rename = pic_add_rename(pic, pic->lib->env, sym);
|
||||
|
||||
/* register to the global table */
|
||||
gidx = pic->glen++;
|
||||
|
|
Loading…
Reference in New Issue