From d5bc71f7ba831ed25bee4febbd4092d8428160fc Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 19 Oct 2013 15:54:21 +0200 Subject: [PATCH] MRI-Binding: Add 'System.puts()' for console printing --- binding-mri/binding-mri.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 9dc9331..5767b43 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -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) {