MRI-Binding: Add 'System.puts()' for console printing

This commit is contained in:
Jonas Kulla 2013-10-19 15:54:21 +02:00
parent 7236ca0515
commit d5bc71f7ba
1 changed files with 14 additions and 0 deletions

View File

@ -68,6 +68,7 @@ void fileIntBindingInit();
RB_METHOD(mriPrint);
RB_METHOD(mriP);
RB_METHOD(mriDataDirectory);
RB_METHOD(mkxpPuts);
static void mriBindingInit()
{
@ -94,6 +95,7 @@ static void mriBindingInit()
VALUE mod = rb_define_module("System");
_rb_define_module_function(mod, "data_directory", mriDataDirectory);
_rb_define_module_function(mod, "puts", mkxpPuts);
rb_define_global_const("MKXP", Qtrue);
}
@ -104,6 +106,18 @@ showMsg(const QByteArray &msg)
shState->eThread().showMessageBox(msg.constData());
}
RB_METHOD(mkxpPuts)
{
RB_UNUSED_PARAM;
const char *str;
rb_get_args(argc, argv, "z", &str, RB_ARG_END);
qDebug() << str;
return Qnil;
}
static void printP(int argc, VALUE *argv,
const char *convMethod, const char *sep)
{