From 6a10162c2cdb87bedcb2dac319ab4fe5ce07a330 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 15 Oct 2013 13:21:40 +0900 Subject: [PATCH] add picrin/proc.h --- include/picrin/proc.h | 14 ++++++++++++++ include/picrin/value.h | 8 +------- src/gc.c | 1 + src/write.c | 1 + 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 include/picrin/proc.h diff --git a/include/picrin/proc.h b/include/picrin/proc.h new file mode 100644 index 00000000..9558ca67 --- /dev/null +++ b/include/picrin/proc.h @@ -0,0 +1,14 @@ +#ifndef PROC_H__ +#define PROC_H__ + +struct pic_proc { + PIC_OBJECT_HEADER + union { + pic_value (*cfunc)(pic_state *); + struct pic_irep *irep; + } u; +}; + +#define pic_proc_ptr(o) ((struct pic_proc *)o.u.data) + +#endif diff --git a/include/picrin/value.h b/include/picrin/value.h index 6334b5b7..a85d6660 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -45,17 +45,11 @@ struct pic_symbol { char *name; }; -struct pic_proc { - PIC_OBJECT_HEADER - union { - struct pic_irep *irep; - } u; -}; +struct pic_proc; #define pic_object_ptr(o) ((struct pic_object *)o.u.data) #define pic_pair_ptr(o) ((struct pic_pair *)o.u.data) #define pic_symbol_ptr(o) ((struct pic_symbol *)o.u.data) -#define pic_proc_ptr(o) ((struct pic_proc *)o.u.data) enum pic_tt pic_type(pic_value); diff --git a/src/gc.c b/src/gc.c index e1edfcee..160e1996 100644 --- a/src/gc.c +++ b/src/gc.c @@ -3,6 +3,7 @@ #include "picrin.h" #include "picrin/gc.h" #include "picrin/irep.h" +#include "picrin/proc.h" #if GC_DEBUG # include diff --git a/src/write.c b/src/write.c index 5a4b2c56..a6ca251c 100644 --- a/src/write.c +++ b/src/write.c @@ -2,6 +2,7 @@ #include #include "picrin.h" +#include "picrin/proc.h" void pic_debug(pic_state *pic, pic_value obj)