Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'c89-porting'
Browse files Browse the repository at this point in the history
  • Loading branch information
nyuichi committed Jan 26, 2015
2 parents 15ce163 + 6bdfac4 commit 343d2e5
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions extlib/benz/include/picrin/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit 343d2e5

Please sign in to comment.