use proc_env in callcc implementation

This commit is contained in:
Yuichi Nishiwaki 2015-06-01 19:47:40 +09:00
parent 0ea80d1f34
commit 9573c6db65
2 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,7 @@ cont_call(pic_state *pic)
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
e = pic_data_ptr(pic_attr_ref(pic, pic_obj_value(pic_get_proc(pic)), "@@escape")); e = pic_data_ptr(pic_proc_env_ref(pic, pic_get_proc(pic), "escape"));
((struct pic_cont *)e->data)->results = pic_list_by_array(pic, argc, argv); ((struct pic_cont *)e->data)->results = pic_list_by_array(pic, argc, argv);
pic_load_point(pic, e->data); pic_load_point(pic, e->data);
@ -121,7 +121,7 @@ pic_make_cont(pic_state *pic, struct pic_cont *cont)
e = pic_data_alloc(pic, &cont_type, cont); e = pic_data_alloc(pic, &cont_type, cont);
/* save the escape continuation in proc */ /* save the escape continuation in proc */
pic_attr_set(pic, pic_obj_value(c), "@@escape", pic_obj_value(e)); pic_proc_env_set(pic, c, "escape", pic_obj_value(e));
return c; return c;
} }

View File

@ -73,7 +73,7 @@ native_exception_handler(pic_state *pic)
pic->err = err; pic->err = err;
cont = pic_proc_ptr(pic_attr_ref(pic, pic_obj_value(pic_get_proc(pic)), "@@escape")); cont = pic_proc_ptr(pic_proc_env_ref(pic, pic_get_proc(pic), "cont"));
pic_apply1(pic, cont, pic_false_value()); pic_apply1(pic, cont, pic_false_value());
@ -89,7 +89,7 @@ pic_push_try(pic_state *pic, struct pic_proc *cont)
handler = pic_make_proc(pic, native_exception_handler, "(native-exception-handler)"); handler = pic_make_proc(pic, native_exception_handler, "(native-exception-handler)");
pic_attr_set(pic, pic_obj_value(handler), "@@escape", pic_obj_value(cont)); pic_proc_env_set(pic, handler, "cont", pic_obj_value(cont));
if (pic->xp >= pic->xpend) { if (pic->xp >= pic->xpend) {
xp_len = (size_t)(pic->xpend - pic->xpbase) * 2; xp_len = (size_t)(pic->xpend - pic->xpbase) * 2;