This commit is contained in:
Yuichi Nishiwaki 2016-07-11 01:12:36 +09:00
parent 896ff3abd1
commit 0f17caae6c
2 changed files with 8 additions and 9 deletions

View File

@ -56,7 +56,7 @@ typedef void *(*pic_allocf)(void *userdata, void *ptr, size_t n);
pic_state *pic_open(pic_allocf f, void *userdata); pic_state *pic_open(pic_allocf f, void *userdata);
void pic_close(pic_state *); void pic_close(pic_state *);
int pic_get_args(pic_state *, const char *fmt, ...); void pic_add_feature(pic_state *, const char *feature);
void *pic_malloc(pic_state *, size_t); void *pic_malloc(pic_state *, size_t);
void *pic_realloc(pic_state *, void *, size_t); void *pic_realloc(pic_state *, void *, size_t);
@ -71,11 +71,10 @@ void pic_leave(pic_state *, size_t);
pic_value pic_protect(pic_state *, pic_value); pic_value pic_protect(pic_state *, pic_value);
void pic_gc(pic_state *); void pic_gc(pic_state *);
void pic_add_feature(pic_state *, const char *feature); int pic_get_args(pic_state *, const char *fmt, ...);
void pic_defun(pic_state *, const char *name, pic_func_t f); void pic_defun(pic_state *, const char *name, pic_func_t f);
void pic_defvar(pic_state *, const char *name, pic_value v, pic_value conv); void pic_defvar(pic_state *, const char *name, pic_value v, pic_value conv);
void pic_define(pic_state *, const char *lib, const char *name, pic_value v); void pic_define(pic_state *, const char *lib, const char *name, pic_value v);
pic_value pic_ref(pic_state *, const char *lib, const char *name); pic_value pic_ref(pic_state *, const char *lib, const char *name);
void pic_set(pic_state *, const char *lib, const char *name, pic_value v); void pic_set(pic_state *, const char *lib, const char *name, pic_value v);

View File

@ -240,7 +240,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
} }
static pic_value static pic_value
vm_gref(pic_state *pic, pic_value uid) global_ref(pic_state *pic, pic_value uid)
{ {
pic_value val; pic_value val;
@ -255,7 +255,7 @@ vm_gref(pic_state *pic, pic_value uid)
} }
static void static void
vm_gset(pic_state *pic, pic_value uid, pic_value value) global_set(pic_state *pic, pic_value uid, pic_value value)
{ {
if (! pic_weak_has(pic, pic->globals, uid)) { if (! pic_weak_has(pic, pic->globals, uid)) {
pic_error(pic, "undefined variable", 1, uid); pic_error(pic, "undefined variable", 1, uid);
@ -415,11 +415,11 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv)
NEXT; NEXT;
} }
CASE(OP_GREF) { CASE(OP_GREF) {
PUSH(vm_gref(pic, pic_obj_value(pic->ci->irep->pool[c.a]))); PUSH(global_ref(pic, pic_obj_value(pic->ci->irep->pool[c.a])));
NEXT; NEXT;
} }
CASE(OP_GSET) { CASE(OP_GSET) {
vm_gset(pic, pic_obj_value(pic->ci->irep->pool[c.a]), POP()); global_set(pic, pic_obj_value(pic->ci->irep->pool[c.a]), POP());
PUSH(pic_undef_value(pic)); PUSH(pic_undef_value(pic));
NEXT; NEXT;
} }
@ -858,7 +858,7 @@ pic_ref(pic_state *pic, const char *lib, const char *name)
env = pic_library_environment(pic, lib); env = pic_library_environment(pic, lib);
return vm_gref(pic, pic_find_identifier(pic, sym, env)); return global_ref(pic, pic_find_identifier(pic, sym, env));
} }
void void
@ -870,7 +870,7 @@ pic_set(pic_state *pic, const char *lib, const char *name, pic_value val)
env = pic_library_environment(pic, lib); env = pic_library_environment(pic, lib);
vm_gset(pic, pic_find_identifier(pic, sym, env), val); global_set(pic, pic_find_identifier(pic, sym, env), val);
} }
pic_value pic_value