publish pic_callcc
This commit is contained in:
parent
3ff7d5b208
commit
acb513aa16
|
@ -50,6 +50,8 @@ struct pic_cont {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
pic_value pic_callcc(pic_state *, struct pic_proc *);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
19
src/cont.c
19
src/cont.c
|
@ -150,13 +150,10 @@ cont_call(pic_state *pic)
|
||||||
return pic_undef_value();
|
return pic_undef_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
pic_value
|
||||||
pic_cont_callcc(pic_state *pic)
|
pic_callcc(pic_state *pic, struct pic_proc *proc)
|
||||||
{
|
{
|
||||||
struct pic_cont *cont;
|
struct pic_cont *cont;
|
||||||
struct pic_proc *cb;
|
|
||||||
|
|
||||||
pic_get_args(pic, "l", &cb);
|
|
||||||
|
|
||||||
save_cont(pic, &cont);
|
save_cont(pic, &cont);
|
||||||
if (setjmp(cont->jmp)) {
|
if (setjmp(cont->jmp)) {
|
||||||
|
@ -171,10 +168,20 @@ pic_cont_callcc(pic_state *pic)
|
||||||
pic_proc_cv_init(pic, c, 1);
|
pic_proc_cv_init(pic, c, 1);
|
||||||
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont));
|
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont));
|
||||||
|
|
||||||
return pic_apply_argv(pic, cb, 1, pic_obj_value(c));
|
return pic_apply_argv(pic, proc, 1, pic_obj_value(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pic_value
|
||||||
|
pic_cont_callcc(pic_state *pic)
|
||||||
|
{
|
||||||
|
struct pic_proc *cb;
|
||||||
|
|
||||||
|
pic_get_args(pic, "l", &cb);
|
||||||
|
|
||||||
|
return pic_callcc(pic, cb);
|
||||||
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_cont_dynamic_wind(pic_state *pic)
|
pic_cont_dynamic_wind(pic_state *pic)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue