Merge branch 'c89-porting'

This commit is contained in:
Yuichi Nishiwaki 2015-01-26 11:44:41 +09:00
commit 343d2e542e
1 changed files with 17 additions and 9 deletions

View File

@ -28,16 +28,24 @@ struct pic_error *pic_make_error(pic_state *, pic_sym *, const char *, pic_list)
#define pic_try \
pic_try_(PIC_GENSYM(escape))
#define pic_catch \
pic_catch_(PIC_GENSYM(label))
#define pic_try_(escape) \
struct pic_escape *escape = pic_alloc(pic, sizeof(struct pic_escape)); \
pic_save_point(pic, escape); \
if (setjmp(escape->jmp) == 0) { \
pic_push_try(pic, escape); \
do
#define pic_catch \
while (0); \
pic_pop_try(pic); \
} else
do { \
struct pic_escape *escape = pic_alloc(pic, sizeof(struct pic_escape)); \
pic_save_point(pic, escape); \
if (setjmp(escape->jmp) == 0) { \
pic_push_try(pic, escape); \
do
#define pic_catch_(label) \
while (0); \
pic_pop_try(pic); \
} else { \
goto label; \
} \
} while (0); \
if (0) \
label:
void pic_push_try(pic_state *, struct pic_escape *);
void pic_pop_try(pic_state *);