From 51253c00b936f550daf01be75087f5e4c57804c6 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 25 Oct 2013 00:37:20 +0900 Subject: [PATCH] add procedure? --- src/init.c | 2 ++ src/proc.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/init.c b/src/init.c index f189e6ff..93886a2c 100644 --- a/src/init.c +++ b/src/init.c @@ -6,6 +6,7 @@ void pic_init_number(pic_state *); void pic_init_time(pic_state *); void pic_init_system(pic_state *); void pic_init_file(pic_state *); +void pic_init_proc(pic_state *); #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_system(pic); DONE; pic_init_file(pic); DONE; + pic_init_proc(pic); DONE; } diff --git a/src/proc.c b/src/proc.c index 7020f3a2..66f6cbee 100644 --- a/src/proc.c +++ b/src/proc.c @@ -27,3 +27,19 @@ pic_proc_new_cfunc(pic_state *pic, pic_func_t cfunc, pic_value aux) proc->aux = aux; 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); +}