示例#1
0
文件: load.c 项目: hopkinsr/picrin
static pic_value
pic_load_load(pic_state *pic)
{
  pic_value envid;
  char *fn;

  pic_get_args(pic, "z|o", &fn, &envid);

  pic_load(pic, fn);

  return pic_undef_value();
}
示例#2
0
文件: load.c 项目: simple555a/picrin
void
pic_load_cstr(pic_state *pic, const char *src)
{
    struct pic_port *port = pic_open_input_string(pic, src);

    pic_try {
        pic_load(pic, port);
    }
    pic_catch {
        pic_close_port(pic, port);
        pic_raise(pic, pic->err);
    }

    pic_close_port(pic, port);
}
示例#3
0
文件: load.c 项目: ktakashi/picrin
static pic_value
pic_load_load(pic_state *pic)
{
  pic_value envid;
  char *fn;
  struct pic_port *port;

  pic_get_args(pic, "z|o", &fn, &envid);

  port = pic_open_file(pic, fn, PIC_PORT_IN | PIC_PORT_TEXT);

  pic_load(pic, port);

  pic_close_port(pic, port);

  return pic_undef_value();
}
示例#4
0
文件: load.c 项目: koba-e964/picrin
static pic_value
pic_load_load(pic_state *pic)
{
  pic_value envid, port;
  char *fn;
  FILE *fp;

  pic_get_args(pic, "z|o", &fn, &envid);

  fp = fopen(fn, "r");
  if (fp == NULL) {
    pic_error(pic, "load: could not open file", 1, pic_cstr_value(pic, fn));
  }

  port = pic_fopen(pic, fp, "r");

  pic_load(pic, port);

  pic_fclose(pic, port);

  return pic_undef_value(pic);
}