add pic_defined_p

This commit is contained in:
Yuichi Nishiwaki 2014-09-15 14:40:18 +09:00
parent a615eace09
commit 8bbbbff9a2
2 changed files with 7 additions and 0 deletions

View File

@ -144,6 +144,7 @@ void pic_close(pic_state *);
void pic_add_feature(pic_state *, const char *); void pic_add_feature(pic_state *, const char *);
void pic_define(pic_state *, const char *, pic_value); /* automatic export */ void pic_define(pic_state *, const char *, pic_value); /* automatic export */
bool pic_defined_p(pic_state *, struct pic_lib *, const char *);
pic_value pic_ref(pic_state *, struct pic_lib *, const char *); pic_value pic_ref(pic_state *, struct pic_lib *, const char *);
void pic_set(pic_state *, struct pic_lib *, const char *, pic_value); void pic_set(pic_state *, struct pic_lib *, const char *, pic_value);
pic_value pic_funcall(pic_state *pic, const char *name, pic_list args); pic_value pic_funcall(pic_state *pic, const char *name, pic_list args);

6
vm.c
View File

@ -425,6 +425,12 @@ pic_define(pic_state *pic, const char *name, pic_value val)
pic_export(pic, sym); pic_export(pic, sym);
} }
bool
pic_defined_p(pic_state *pic, struct pic_lib *lib, const char *name)
{
return pic_find_rename(pic, lib->env, pic_intern_cstr(pic, name), NULL);
}
pic_value pic_value
pic_ref(pic_state *pic, struct pic_lib *lib, const char *name) pic_ref(pic_state *pic, struct pic_lib *lib, const char *name)
{ {