Exemplo 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));
}
Exemplo n.º 2
0
PIC_NORETURN static pic_value
cont_call(pic_state *pic)
{
  int argc, i;
  pic_value *argv, *retv;
  struct fullcont *cont;

  pic_get_args(pic, "*", &argc, &argv);

  retv = pic_alloca(pic, sizeof(pic_value) * argc);
  for (i = 0; i < argc; ++i) {
    retv[i] = argv[i];
  }

  cont = pic_data(pic, pic_closure_ref(pic, 0));
  cont->retc = argc;
  cont->retv = retv;

  /* execute guard handlers */
  pic_wind(pic, pic->cp, cont->cp);

  restore_cont(pic, cont);
}