diff --git a/cont.c b/cont.c index c542399d..8fba3c78 100644 --- a/cont.c +++ b/cont.c @@ -205,19 +205,19 @@ restore_cont(pic_state *pic, struct pic_cont *cont) longjmp(tmp->jmp, 1); } -static void -walk_to_block(pic_state *pic, struct pic_winder *here, struct pic_winder *there) +void +pic_wind(pic_state *pic, struct pic_winder *here, struct pic_winder *there) { if (here == there) return; if (here->depth < there->depth) { - walk_to_block(pic, here, there->prev); + pic_wind(pic, here, there->prev); pic_apply0(pic, there->in); } else { pic_apply0(pic, there->out); - walk_to_block(pic, here->prev, there); + pic_wind(pic, here->prev, there); } } @@ -264,7 +264,7 @@ cont_call(pic_state *pic) cont->results = pic_list_by_array(pic, argc, argv); /* execute guard handlers */ - walk_to_block(pic, pic->wind, cont->wind); + pic_wind(pic, pic->wind, cont->wind); restore_cont(pic, cont); } diff --git a/include/picrin/cont.h b/include/picrin/cont.h index 587a46d1..740a1175 100644 --- a/include/picrin/cont.h +++ b/include/picrin/cont.h @@ -47,6 +47,7 @@ pic_value pic_values_by_list(pic_state *, pic_value); size_t pic_receive(pic_state *, size_t, pic_value *); pic_value pic_callcc(pic_state *, struct pic_proc *); +void pic_wind(pic_state *, struct pic_winder *, struct pic_winder *); #if defined(__cplusplus) }