add pic_funcall
This commit is contained in:
parent
13fec26c59
commit
fe375a7224
|
@ -135,6 +135,8 @@ void pic_define(pic_state *, const char *, pic_value); /* automatic export */
|
|||
pic_value pic_ref(pic_state *, const char *);
|
||||
void pic_set(pic_state *, const char *, pic_value);
|
||||
|
||||
pic_value pic_funcall(pic_state *pic, const char *name, pic_list args);
|
||||
|
||||
struct pic_proc *pic_get_proc(pic_state *);
|
||||
int pic_get_args(pic_state *, const char *, ...);
|
||||
void pic_defun(pic_state *, const char *, pic_func_t);
|
||||
|
|
12
src/vm.c
12
src/vm.c
|
@ -444,6 +444,18 @@ pic_set(pic_state *pic, const char *name, pic_value value)
|
|||
pic->globals[gid] = value;
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_funcall(pic_state *pic, const char *name, pic_list args)
|
||||
{
|
||||
pic_value proc;
|
||||
|
||||
proc = pic_ref(pic, name);
|
||||
|
||||
pic_assert_type(pic, proc, proc);
|
||||
|
||||
return pic_apply(pic, pic_proc_ptr(proc), args);
|
||||
}
|
||||
|
||||
void
|
||||
pic_defun(pic_state *pic, const char *name, pic_func_t cfunc)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue