remove struct pic_picjmp
This commit is contained in:
@@ -47,11 +47,6 @@ typedef struct pic_state pic_state;
|
||||
#include "picrin/read.h"
|
||||
#include "picrin/gc.h"
|
||||
|
||||
typedef struct pic_jmpbuf {
|
||||
PIC_JMPBUF buf;
|
||||
struct pic_jmpbuf *prev;
|
||||
} pic_jmpbuf;
|
||||
|
||||
typedef struct pic_checkpoint {
|
||||
PIC_OBJECT_HEADER
|
||||
struct pic_proc *in;
|
||||
@@ -78,7 +73,7 @@ struct pic_state {
|
||||
|
||||
pic_allocf allocf;
|
||||
|
||||
pic_jmpbuf *jmp;
|
||||
struct pic_cont *cc;
|
||||
pic_checkpoint *cp;
|
||||
|
||||
pic_value *sp;
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct pic_cont {
|
||||
pic_jmpbuf jmp;
|
||||
PIC_JMPBUF jmp;
|
||||
|
||||
pic_checkpoint *cp;
|
||||
|
||||
@@ -18,12 +18,13 @@ struct pic_cont {
|
||||
ptrdiff_t ci_offset;
|
||||
ptrdiff_t xp_offset;
|
||||
size_t arena_idx;
|
||||
pic_value ptable;
|
||||
|
||||
pic_code *ip;
|
||||
|
||||
pic_value ptable;
|
||||
|
||||
pic_value results;
|
||||
|
||||
struct pic_cont *prev;
|
||||
};
|
||||
|
||||
void pic_save_point(pic_state *, struct pic_cont *);
|
||||
|
||||
@@ -30,21 +30,21 @@ struct pic_error *pic_make_error(pic_state *, pic_sym *, const char *, pic_list)
|
||||
pic_catch_(PIC_GENSYM(label))
|
||||
#define pic_try_(cont, handler) \
|
||||
do { \
|
||||
struct pic_cont *cont = pic_malloc(pic, sizeof(struct pic_cont)); \
|
||||
pic_save_point(pic, cont); \
|
||||
if (PIC_SETJMP(pic, cont->jmp.buf) == 0) { \
|
||||
struct pic_cont cont; \
|
||||
pic_save_point(pic, &cont); \
|
||||
if (PIC_SETJMP(pic, cont.jmp) == 0) { \
|
||||
extern pic_value pic_native_exception_handler(pic_state *); \
|
||||
struct pic_proc *handler; \
|
||||
handler = pic_make_proc(pic, pic_native_exception_handler, "(native-exception-handler)"); \
|
||||
pic_proc_env_set(pic, handler, "cont", pic_obj_value(pic_make_cont(pic, cont))); \
|
||||
pic_proc_env_set(pic, handler, "cont", pic_obj_value(pic_make_cont(pic, &cont))); \
|
||||
do { \
|
||||
pic_push_handler(pic, handler);
|
||||
#define pic_catch_(label) \
|
||||
pic_pop_handler(pic); \
|
||||
pic_pop_handler(pic); \
|
||||
} while (0); \
|
||||
pic->jmp = pic->jmp->prev; \
|
||||
pic->cc = pic->cc->prev; \
|
||||
} else { \
|
||||
pic->jmp = pic->jmp->prev; \
|
||||
pic->cc = pic->cc->prev; \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0); \
|
||||
|
||||
Reference in New Issue
Block a user