mrb_value mrb_load_irep_file(mrb_state *mrb, FILE* fp) { int n = mrb_read_irep_file(mrb, fp); if (n < 0) { irep_error(mrb, n); return mrb_nil_value(); } return mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); }
mrb_value mrb_load_irep(mrb_state *mrb, const char *bin) { int n = mrb_read_irep(mrb, bin); if (n < 0) { irep_error(mrb, n); return mrb_nil_value(); } return mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); }
mrb_value mrb_load_irep(mrb_state *mrb, const uint8_t *bin) { int32_t n; n = mrb_read_irep(mrb, bin); if (n < 0) { irep_error(mrb, n); return mrb_nil_value(); } return mrb_context_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb), 0); }
MRB_API mrb_value mrb_load_irep_cxt(mrb_state *mrb, const uint8_t *bin, mrbc_context *c) { mrb_irep *irep = mrb_read_irep(mrb, bin); struct RProc *proc; if (!irep) { irep_error(mrb); return mrb_nil_value(); } proc = mrb_proc_new(mrb, irep); mrb_irep_decref(mrb, irep); if (c && c->no_exec) return mrb_obj_value(proc); return mrb_top_run(mrb, proc, mrb_top_self(mrb), 0); }
static mrb_value load_irep(mrb_state *mrb, mrb_irep *irep, mrbc_context *c) { struct RProc *proc; if (!irep) { irep_error(mrb); return mrb_nil_value(); } proc = mrb_proc_new(mrb, irep); proc->c = NULL; mrb_irep_decref(mrb, irep); if (c && c->dump_result) mrb_codedump_all(mrb, proc); if (c && c->no_exec) return mrb_obj_value(proc); return mrb_top_run(mrb, proc, mrb_top_self(mrb), 0); }
mrb_value mrb_load_irep_file_cxt(mrb_state *mrb, FILE* fp, mrbc_context *c) { mrb_irep *irep = mrb_read_irep_file(mrb, fp); mrb_value val; struct RProc *proc; if (!irep) { irep_error(mrb); return mrb_nil_value(); } proc = mrb_proc_new(mrb, irep); mrb_irep_decref(mrb, irep); if (c && c->no_exec) return mrb_obj_value(proc); val = mrb_toplevel_run(mrb, proc); return val; }