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(); }
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); }
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(); }
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); }