Ejemplo n.º 1
0
void *
pic_alloca(pic_state *pic, size_t n)
{
  static const pic_data_type t = { "pic_alloca", pic_free };

  return pic_data(pic, pic_data_value(pic, pic_malloc(pic, n), &t));
}
Ejemplo n.º 2
0
static pic_value
pic_callcc(pic_state *pic, pic_value proc)
{
  struct fullcont *cont = pic_malloc(pic, sizeof(struct fullcont));

  if (setjmp(cont->jmp) != 0) {
    return pic_valuesk(pic, cont->retc, cont->retv);
  } else {
    pic_value c[1];

    save_cont(pic, cont);

    /* save the continuation object in proc */
    c[0] = pic_lambda(pic, cont_call, 1, pic_data_value(pic, cont, &cont_type));

    return pic_applyk(pic, proc, 1, c);
  }
}