From d40c8b59211538248678fe5c88b3bd85188575e5 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 15 Oct 2013 21:52:14 +0900 Subject: [PATCH] add cfunc_p flag to pic_proc --- include/picrin/proc.h | 1 + src/vm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/picrin/proc.h b/include/picrin/proc.h index 9558ca67..629a28c0 100644 --- a/include/picrin/proc.h +++ b/include/picrin/proc.h @@ -3,6 +3,7 @@ struct pic_proc { PIC_OBJECT_HEADER + bool cfunc_p; union { pic_value (*cfunc)(pic_state *); struct pic_irep *irep; diff --git a/src/vm.c b/src/vm.c index 5453c6fc..a0ea1224 100644 --- a/src/vm.c +++ b/src/vm.c @@ -61,6 +61,7 @@ pic_defun(pic_state *pic, const char *name, pic_func_t cfunc) struct pic_pair *cell; proc = (struct pic_proc *)pic_obj_alloc(pic, sizeof(struct pic_proc), PIC_TT_PROC); + proc->cfunc_p = true; proc->u.cfunc = cfunc; cell = pic_env_define(pic, pic_intern_cstr(pic, name), pic->global_env); cell->cdr = pic_obj_value(proc); @@ -281,6 +282,7 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env) proc = (struct pic_proc *)pic_obj_alloc(pic, sizeof(struct pic_proc), PIC_TT_PROC); + proc->cfunc_p = false; proc->u.irep = irep = (struct pic_irep *)pic_alloc(pic, sizeof(struct pic_irep)); irep->code = code = (struct pic_code *)pic_alloc(pic, sizeof(struct pic_code) * 1024); irep->clen = 0;