skopy/lib/include/fun.h

35 lines
696 B
C

#ifndef SK_FUN_H
#define SK_FUN_H
#include "commons.h"
extern int FunId;
struct closure
{
int id;
struct value* value;
};
struct fun
{
int id;
int base;
struct prog* prog;
struct sym* sym;
struct vec closures;
};
void closure_init(struct closure* self, int id, struct value* value);
struct closure* closure_new_clone(struct closure* self);
void closure_free(struct closure* self);
void fun_init(struct fun* self, struct prog* new_prog, int base);
void fun_free(struct fun* self);
struct fun* fun_new_clone(struct fun* self);
void fun_capture(struct fun* self, int id, struct value* value);
struct closure* fun_try_get_closure(struct fun* self, int id);
#endif