MRI-Binding: Add 'System.puts()' for console printing
This commit is contained in:
		
							parent
							
								
									7236ca0515
								
							
						
					
					
						commit
						d5bc71f7ba
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -68,6 +68,7 @@ void fileIntBindingInit();
 | 
				
			||||||
RB_METHOD(mriPrint);
 | 
					RB_METHOD(mriPrint);
 | 
				
			||||||
RB_METHOD(mriP);
 | 
					RB_METHOD(mriP);
 | 
				
			||||||
RB_METHOD(mriDataDirectory);
 | 
					RB_METHOD(mriDataDirectory);
 | 
				
			||||||
 | 
					RB_METHOD(mkxpPuts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void mriBindingInit()
 | 
					static void mriBindingInit()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,7 @@ static void mriBindingInit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	VALUE mod = rb_define_module("System");
 | 
						VALUE mod = rb_define_module("System");
 | 
				
			||||||
	_rb_define_module_function(mod, "data_directory", mriDataDirectory);
 | 
						_rb_define_module_function(mod, "data_directory", mriDataDirectory);
 | 
				
			||||||
 | 
						_rb_define_module_function(mod, "puts", mkxpPuts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rb_define_global_const("MKXP", Qtrue);
 | 
						rb_define_global_const("MKXP", Qtrue);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -104,6 +106,18 @@ showMsg(const QByteArray &msg)
 | 
				
			||||||
	shState->eThread().showMessageBox(msg.constData());
 | 
						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,
 | 
					static void printP(int argc, VALUE *argv,
 | 
				
			||||||
                   const char *convMethod, const char *sep)
 | 
					                   const char *convMethod, const char *sep)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue