struct pic_proc * -> pic_value

This commit is contained in:
Yuichi Nishiwaki
2016-02-20 00:03:16 +09:00
parent 0d8a45191a
commit 5254e80932
18 changed files with 128 additions and 171 deletions
+12 -13
View File
@@ -54,7 +54,6 @@ typedef struct {
struct pic_object;
struct pic_symbol;
struct pic_string;
struct pic_proc;
struct pic_port;
struct pic_error;
struct pic_env;
@@ -85,7 +84,7 @@ void pic_gc(pic_state *);
void pic_add_feature(pic_state *, const char *feature);
void pic_defun(pic_state *, const char *name, pic_func_t f);
void pic_defvar(pic_state *, const char *name, pic_value v, struct pic_proc *conv);
void pic_defvar(pic_state *, const char *name, pic_value v, pic_value conv);
void pic_define(pic_state *, const char *lib, const char *name, pic_value v);
pic_value pic_ref(pic_state *, const char *lib, const char *name);
@@ -111,12 +110,12 @@ PIC_NORETURN void pic_errorf(pic_state *, const char *fmt, ...);
PIC_NORETURN void pic_error(pic_state *, const char *type, const char *msg, pic_value irrs);
PIC_NORETURN void pic_raise(pic_state *, pic_value v);
struct pic_proc *pic_lambda(pic_state *, pic_func_t f, int n, ...);
struct pic_proc *pic_vlambda(pic_state *, pic_func_t f, int n, va_list);
pic_value pic_call(pic_state *, struct pic_proc *proc, int, ...);
pic_value pic_vcall(pic_state *, struct pic_proc *proc, int, va_list);
pic_value pic_apply(pic_state *, struct pic_proc *proc, int n, pic_value *argv);
pic_value pic_applyk(pic_state *, struct pic_proc *proc, int n, pic_value *argv);
pic_value pic_lambda(pic_state *, pic_func_t f, int n, ...);
pic_value pic_vlambda(pic_state *, pic_func_t f, int n, va_list);
pic_value pic_call(pic_state *, pic_value proc, int, ...);
pic_value pic_vcall(pic_state *, pic_value proc, int, va_list);
pic_value pic_apply(pic_state *, pic_value proc, int n, pic_value *argv);
pic_value pic_applyk(pic_state *, pic_value proc, int n, pic_value *argv);
PIC_INLINE int pic_int(pic_state *, pic_value i);
PIC_INLINE double pic_float(pic_state *, pic_value f);
@@ -301,7 +300,7 @@ pic_value pic_eval(pic_state *, pic_value, const char *);
void pic_load(pic_state *, struct pic_port *);
void pic_load_cstr(pic_state *, const char *);
struct pic_proc *pic_make_var(pic_state *, pic_value, struct pic_proc *);
pic_value pic_make_var(pic_state *, pic_value init, pic_value conv);
bool pic_data_type_p(pic_state *, pic_value, const pic_data_type *);
@@ -320,14 +319,14 @@ bool pic_data_type_p(pic_state *, pic_value, const pic_data_type *);
pic_catch_(PIC_GENSYM(label))
#define pic_try_(cont, handler) \
do { \
extern void pic_push_handler(pic_state *, struct pic_proc *); \
extern struct pic_proc *pic_pop_handler(pic_state *); \
extern void pic_push_handler(pic_state *, pic_value proc); \
extern pic_value pic_pop_handler(pic_state *); \
extern pic_value pic_native_exception_handler(pic_state *); \
struct pic_cont cont; \
pic_save_point(pic, &cont); \
if (PIC_SETJMP(pic, cont.jmp) == 0) { \
struct pic_proc *handler; \
handler = pic_lambda(pic, pic_native_exception_handler, 1, pic_obj_value(pic_make_cont(pic, &cont))); \
pic_value handler; \
handler = pic_lambda(pic, pic_native_exception_handler, 1, pic_make_cont(pic, &cont)); \
do { \
pic_push_handler(pic, handler);
#define pic_catch_(label) \
+1 -1
View File
@@ -31,7 +31,7 @@ struct pic_cont {
void pic_save_point(pic_state *, struct pic_cont *);
void pic_load_point(pic_state *, struct pic_cont *);
struct pic_proc *pic_make_cont(pic_state *, struct pic_cont *);
pic_value pic_make_cont(pic_state *, struct pic_cont *);
void pic_wind(pic_state *, pic_checkpoint *, pic_checkpoint *);
+3 -3
View File
@@ -125,12 +125,12 @@ struct pic_port {
#define pic_vec_ptr(pic, o) ((struct pic_vector *)pic_obj_ptr(o))
#define pic_dict_ptr(pic, o) ((struct pic_dict *)pic_obj_ptr(o))
#define pic_data_ptr(pic, o) ((struct pic_data *)pic_obj_ptr(o))
#define pic_proc_ptr(pic, o) ((struct pic_proc *)pic_obj_ptr(o))
#define pic_sym_ptr(v) ((pic_sym *)pic_obj_ptr(v))
#define pic_id_ptr(v) ((pic_id *)pic_obj_ptr(v))
#define pic_str_ptr(o) ((struct pic_string *)pic_obj_ptr(o))
#define pic_weak_ptr(v) ((struct pic_weak *)pic_obj_ptr(v))
#define pic_context_ptr(o) ((struct pic_context *)pic_obj_ptr(o))
#define pic_proc_ptr(o) ((struct pic_proc *)pic_obj_ptr(o))
#define pic_rec_ptr(v) ((struct pic_record *)pic_obj_ptr(v))
#define pic_error_ptr(v) ((struct pic_error *)pic_obj_ptr(v))
#define pic_port_ptr(v) ((struct pic_port *)pic_obj_ptr(v))
@@ -157,8 +157,8 @@ struct pic_object *pic_obj_alloc(pic_state *, size_t, int type);
} while (0)
pic_id *pic_make_identifier(pic_state *, pic_id *, struct pic_env *);
struct pic_proc *pic_make_proc(pic_state *, pic_func_t, int, pic_value *);
struct pic_proc *pic_make_proc_irep(pic_state *, struct pic_irep *, struct pic_context *);
pic_value pic_make_proc(pic_state *, pic_func_t, int, pic_value *);
pic_value pic_make_proc_irep(pic_state *, struct pic_irep *, struct pic_context *);
struct pic_record *pic_make_rec(pic_state *, pic_value, pic_value);
struct pic_error *pic_make_error(pic_state *, const char *, const char *, pic_value);
struct pic_env *pic_make_env(pic_state *, struct pic_env *);