add definition of pic_set

This commit is contained in:
Yuichi Nishiwaki 2014-09-15 15:36:27 +09:00
parent 8bbbbff9a2
commit 7d64852b88
1 changed files with 14 additions and 0 deletions

14
vm.c
View File

@ -445,6 +445,20 @@ pic_ref(pic_state *pic, struct pic_lib *lib, const char *name)
return xh_val(xh_get_int(&pic->globals, rename), pic_value); return xh_val(xh_get_int(&pic->globals, rename), pic_value);
} }
void
pic_set(pic_state *pic, struct pic_lib *lib, const char *name, pic_value val)
{
pic_sym sym, rename;
sym = pic_intern_cstr(pic, name);
if (! pic_find_rename(pic, lib->env, sym, &rename)) {
pic_errorf(pic, "symbol \"%s\" not defined in library ~s", name, lib->name);
}
xh_put_int(&pic->globals, rename, &val);
}
pic_value pic_value
pic_funcall(pic_state *pic, const char *name, pic_list args) pic_funcall(pic_state *pic, const char *name, pic_list args)
{ {