add pic_get_proc
This commit is contained in:
parent
89eceec7f8
commit
0d28f246de
|
@ -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);
|
||||
|
||||
|
|
11
src/vm.c
11
src/vm.c
|
@ -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, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue