picrin/src/proc.c

30 lines
703 B
C
Raw Normal View History

2013-10-21 04:35:14 -04:00
#include "picrin.h"
#include "picrin/proc.h"
#include "picrin/irep.h"
struct pic_proc *
2013-10-23 13:02:07 -04:00
pic_proc_new(pic_state *pic, struct pic_irep *irep, struct pic_env *env)
2013-10-21 04:35:14 -04:00
{
struct pic_proc *proc;
proc = (struct pic_proc *)pic_obj_alloc(pic, sizeof(struct pic_proc *), PIC_TT_PROC);
proc->cfunc_p = false;
proc->u.irep = irep;
2013-10-23 13:02:07 -04:00
proc->env = env;
2013-10-21 04:35:14 -04:00
proc->aux = pic_undef_value();
return proc;
}
struct pic_proc *
pic_proc_new_cfunc(pic_state *pic, pic_func_t cfunc, pic_value aux)
{
struct pic_proc *proc;
proc = (struct pic_proc *)pic_obj_alloc(pic, sizeof(struct pic_proc *), PIC_TT_PROC);
proc->cfunc_p = true;
proc->u.cfunc = cfunc;
2013-10-23 13:02:07 -04:00
proc->env = NULL;
2013-10-21 04:35:14 -04:00
proc->aux = aux;
return proc;
}