add picrin/proc.h

This commit is contained in:
Yuichi Nishiwaki 2013-10-15 13:21:40 +09:00
parent 5874b7a350
commit 6a10162c2c
4 changed files with 17 additions and 7 deletions

14
include/picrin/proc.h Normal file
View File

@ -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

View File

@ -45,17 +45,11 @@ struct pic_symbol {
char *name; char *name;
}; };
struct pic_proc { struct pic_proc;
PIC_OBJECT_HEADER
union {
struct pic_irep *irep;
} u;
};
#define pic_object_ptr(o) ((struct pic_object *)o.u.data) #define pic_object_ptr(o) ((struct pic_object *)o.u.data)
#define pic_pair_ptr(o) ((struct pic_pair *)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_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); enum pic_tt pic_type(pic_value);

View File

@ -3,6 +3,7 @@
#include "picrin.h" #include "picrin.h"
#include "picrin/gc.h" #include "picrin/gc.h"
#include "picrin/irep.h" #include "picrin/irep.h"
#include "picrin/proc.h"
#if GC_DEBUG #if GC_DEBUG
# include <stdio.h> # include <stdio.h>

View File

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "picrin.h" #include "picrin.h"
#include "picrin/proc.h"
void void
pic_debug(pic_state *pic, pic_value obj) pic_debug(pic_state *pic, pic_value obj)