MRuby-Binding: Make code compile with latest mruby master

This commit is contained in:
Jonas Kulla 2013-12-27 04:36:24 +01:00
parent 231e38ae8e
commit bd63bc9cd2
5 changed files with 2138 additions and 2120 deletions

View File

@ -153,8 +153,8 @@ showExcMessageBox(mrb_state *mrb, mrb_value exc)
{
/* Display actual exception in a message box */
mrb_value mesg = mrb_funcall(mrb, exc, "message", 0);
mrb_value line = mrb_attr_get(mrb, exc, mrb_intern2(mrb, "line", 4));
mrb_value file = mrb_attr_get(mrb, exc, mrb_intern2(mrb, "file", 4));
mrb_value line = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "line"));
mrb_value file = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "file"));
const char *excClass = mrb_class_name(mrb, mrb_class(mrb, exc));
char msgBoxText[512];
@ -225,9 +225,9 @@ runMrbFile(mrb_state *mrb, const char *filename)
return;
}
int n = mrb_read_irep_file(mrb, f);
mrb_irep *irep = mrb_read_irep_file(mrb, f);
if (n < 0)
if (!irep)
{
static char buffer[256];
snprintf(buffer, sizeof(buffer), "Unable to read compiled script '%s'", filename);
@ -236,7 +236,8 @@ runMrbFile(mrb_state *mrb, const char *filename)
return;
}
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
RProc *proc = mrb_proc_new(mrb, irep);
mrb_run(mrb, proc, mrb_top_self(mrb));
fclose(f);
}

View File

@ -113,7 +113,7 @@ MrbData::MrbData(mrb_state *mrb)
exc[ArgumentError] = mrb_class_get(mrb, "ArgumentError");
for (int i = 0; i < symDataN; ++i)
symbols[symData[i].ind] = mrb_intern(mrb, symData[i].str);
symbols[symData[i].ind] = mrb_intern_cstr(mrb, symData[i].str);
mrb_gc_arena_restore(mrb, arena);
}

View File

@ -93,7 +93,7 @@ MRB_FUNCTION(inputMouseY)
}
#define DEF_CONST_I(name, value) \
mrb_const_set(mrb, mrb_obj_value(module), mrb_intern(mrb, name), mrb_fixnum_value(value))
mrb_const_set(mrb, mrb_obj_value(module), mrb_intern_lit(mrb, name), mrb_fixnum_value(value))
void
inputBindingInit(mrb_state *mrb)

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@ read_symbol(MarshalContext *ctx)
{
mrb_state *mrb = ctx->mrb;
mrb_sym symbol = mrb_intern(mrb, read_string(ctx));
mrb_sym symbol = mrb_intern_cstr(mrb, read_string(ctx));
ctx->symbols.add(symbol);
return symbol;
@ -412,7 +412,7 @@ mrb_class_from_path(mrb_state *mrb, mrb_value path)
{
while (*p && *p != ':' && *p != '\"') p++;
mrb_sym sym = mrb_intern2(mrb, pbgn, p-pbgn);
mrb_sym sym = mrb_intern(mrb, pbgn, p-pbgn);
klass = mrb_const_get(mrb, klass, sym);
if (p[0] == ':')
@ -465,7 +465,7 @@ read_userdef(MarshalContext *ctx)
mrb_class_from_path(mrb, class_path);
/* Should check here if klass implements '_load()' */
if (!mrb_obj_respond_to(mrb_class(mrb, mrb_obj_value(klass)), mrb_intern_cstr(mrb, "_load")))
if (!mrb_obj_respond_to(mrb, mrb_class(mrb, mrb_obj_value(klass)), mrb_intern_cstr(mrb, "_load")))
throw Exception(Exception::TypeError,
"class %s needs to have method '_load'",
RSTRING_PTR(class_path));
@ -850,8 +850,8 @@ write_value(MarshalContext *ctx, mrb_value value)
case MRB_TT_OBJECT :
ctx->objects.add(value);
if (mrb_obj_respond_to(mrb_obj_ptr(value)->c,
mrb_intern(mrb, "_dump")))
if (mrb_obj_respond_to(mrb, mrb_obj_ptr(value)->c,
mrb_intern_lit(mrb, "_dump")))
{
ctx->writeByte(TYPE_USERDEF);
write_userdef(ctx, value);