rename scope_global_define -> global_def
This commit is contained in:
parent
faac3f7e9d
commit
e7d38ea165
|
@ -1435,7 +1435,7 @@ pic_compile(pic_state *pic, pic_value obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
scope_global_define(pic_state *pic, pic_sym sym)
|
global_def(pic_state *pic, pic_sym sym)
|
||||||
{
|
{
|
||||||
xh_entry *e;
|
xh_entry *e;
|
||||||
|
|
||||||
|
@ -1450,26 +1450,6 @@ scope_global_define(pic_state *pic, pic_sym sym)
|
||||||
return e->val;
|
return e->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
pic_define(pic_state *pic, const char *name, pic_value val)
|
|
||||||
{
|
|
||||||
int idx;
|
|
||||||
pic_sym sym, gsym;
|
|
||||||
|
|
||||||
sym = pic_intern_cstr(pic, name);
|
|
||||||
gsym = pic_gensym(pic, sym);
|
|
||||||
|
|
||||||
/* push to the global arena */
|
|
||||||
idx = scope_global_define(pic, gsym);
|
|
||||||
pic->globals[idx] = val;
|
|
||||||
|
|
||||||
/* register to the senv */
|
|
||||||
xh_put_int(pic->lib->senv->tbl, sym, gsym);
|
|
||||||
|
|
||||||
/* export! */
|
|
||||||
pic_export(pic, pic_intern_cstr(pic, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
global_ref(pic_state *pic, const char *name)
|
global_ref(pic_state *pic, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -1487,6 +1467,26 @@ global_ref(pic_state *pic, const char *name)
|
||||||
return e->val;
|
return e->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pic_define(pic_state *pic, const char *name, pic_value val)
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
pic_sym sym, gsym;
|
||||||
|
|
||||||
|
sym = pic_intern_cstr(pic, name);
|
||||||
|
gsym = pic_gensym(pic, sym);
|
||||||
|
|
||||||
|
/* push to the global arena */
|
||||||
|
idx = global_def(pic, gsym);
|
||||||
|
pic->globals[idx] = val;
|
||||||
|
|
||||||
|
/* register to the senv */
|
||||||
|
xh_put_int(pic->lib->senv->tbl, sym, gsym);
|
||||||
|
|
||||||
|
/* export! */
|
||||||
|
pic_export(pic, pic_intern_cstr(pic, name));
|
||||||
|
}
|
||||||
|
|
||||||
pic_value
|
pic_value
|
||||||
pic_ref(pic_state *pic, const char *name)
|
pic_ref(pic_state *pic, const char *name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue