add procedure?

This commit is contained in:
Yuichi Nishiwaki 2013-10-25 00:37:20 +09:00
parent c782912212
commit 51253c00b9
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@ void pic_init_number(pic_state *);
void pic_init_time(pic_state *); void pic_init_time(pic_state *);
void pic_init_system(pic_state *); void pic_init_system(pic_state *);
void pic_init_file(pic_state *); void pic_init_file(pic_state *);
void pic_init_proc(pic_state *);
#define DONE pic_gc_arena_restore(pic, ai); #define DONE pic_gc_arena_restore(pic, ai);
@ -21,4 +22,5 @@ pic_init_core(pic_state *pic)
pic_init_time(pic); DONE; pic_init_time(pic); DONE;
pic_init_system(pic); DONE; pic_init_system(pic); DONE;
pic_init_file(pic); DONE; pic_init_file(pic); DONE;
pic_init_proc(pic); DONE;
} }

View File

@ -27,3 +27,19 @@ pic_proc_new_cfunc(pic_state *pic, pic_func_t cfunc, pic_value aux)
proc->aux = aux; proc->aux = aux;
return proc; return proc;
} }
static pic_value
pic_proc_proc_p(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
return pic_bool_value(pic_proc_p(v));
}
void
pic_init_proc(pic_state *pic)
{
pic_defun(pic, "procedure?", pic_proc_proc_p);
}