cleanup pic_push_try

This commit is contained in:
Yuichi Nishiwaki 2015-06-02 05:14:43 +09:00
parent e0c837baee
commit 1e3bb6f1bb
2 changed files with 7 additions and 9 deletions

View File

@ -81,14 +81,12 @@ native_exception_handler(pic_state *pic)
}
void
pic_push_try(pic_state *pic, struct pic_escape *escape)
pic_push_try(pic_state *pic, struct pic_proc *cont)
{
struct pic_proc *cont, *handler;
struct pic_proc *handler;
size_t xp_len;
ptrdiff_t xp_offset;
cont = pic_make_econt(pic, escape);
handler = pic_make_proc(pic, native_exception_handler, "(native-exception-handler)");
pic_attr_set(pic, pic_obj_value(handler), "@@escape", pic_obj_value(cont));

View File

@ -33,11 +33,11 @@ struct pic_error *pic_make_error(pic_state *, pic_sym *, const char *, pic_list)
struct pic_escape *escape = pic_malloc(pic, sizeof(struct pic_escape)); \
pic_save_point(pic, escape); \
if (PIC_SETJMP(pic, (void *)escape->jmp) == 0) { \
pic_push_try(pic, escape); \
do
do { \
pic_push_try(pic, pic_make_econt(pic, escape));
#define pic_catch_(label) \
while (0); \
pic_pop_try(pic); \
pic_pop_try(pic); \
} while (0); \
} else { \
goto label; \
} \
@ -45,7 +45,7 @@ struct pic_error *pic_make_error(pic_state *, pic_sym *, const char *, pic_list)
if (0) \
label:
void pic_push_try(pic_state *, struct pic_escape *);
void pic_push_try(pic_state *, struct pic_proc *);
void pic_pop_try(pic_state *);
pic_value pic_raise_continuable(pic_state *, pic_value);