Example #1
0
pic_value
pic_callcc(pic_state *pic, struct pic_proc *proc)
{
  struct pic_cont cont;

  pic_save_point(pic, &cont);

  if (PIC_SETJMP(pic, cont.jmp)) {
    return pic_values_by_list(pic, cont.results);
  }
  else {
    pic_value val;

    val = pic_apply1(pic, proc, pic_obj_value(pic_make_cont(pic, &cont)));

    pic->cc = pic->cc->prev;

    return val;
  }
}
Example #2
0
pic_value
pic_callcc(pic_state *pic, struct pic_proc *proc)
{
  struct pic_cont *cont = pic_malloc(pic, sizeof(struct pic_cont));

  pic_save_point(pic, cont);

  if (PIC_SETJMP(pic, cont->jmp.buf)) {
    pic->jmp = pic->jmp->prev;

    return pic_values_by_list(pic, cont->results);
  }
  else {
    pic_value val;

    val = pic_apply1(pic, proc, pic_obj_value(pic_make_cont(pic, cont)));

    pic->jmp = pic->jmp->prev;

    return val;
  }
}