add pic_get_proc

This commit is contained in:
Yuichi Nishiwaki 2013-11-09 14:12:59 +09:00
parent 89eceec7f8
commit 0d28f246de
2 changed files with 12 additions and 0 deletions

View File

@ -74,6 +74,7 @@ void pic_gc_arena_restore(pic_state *, int);
pic_state *pic_open(int argc, char *argv[], char **envp);
void pic_close(pic_state *);
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);

View File

@ -10,6 +10,17 @@
#define GET_OPERAND(pic,n) ((pic)->ci->fp[(n)])
struct pic_proc *
pic_get_proc(pic_state *pic)
{
pic_value v = GET_OPERAND(pic,0);
if (! pic_proc_p(v)) {
pic_error(pic, "fatal error");
}
return pic_proc_ptr(v);
}
int
pic_get_args(pic_state *pic, const char *format, ...)
{