|
|
|
@ -543,6 +543,18 @@ static VALUE rb_dfprint_str(VALUE self, VALUE s)
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VALUE rb_dfprint_color(VALUE self, VALUE c, VALUE s)
|
|
|
|
|
{
|
|
|
|
|
if (r_console) {
|
|
|
|
|
color_value old_col = r_console->color();
|
|
|
|
|
r_console->color(color_value(rb_num2ulong(c)));
|
|
|
|
|
r_console->print("%s", rb_string_value_ptr(&s));
|
|
|
|
|
r_console->color(old_col);
|
|
|
|
|
} else
|
|
|
|
|
console_proxy->print("%s", rb_string_value_ptr(&s));
|
|
|
|
|
return Qnil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static VALUE rb_dfprint_err(VALUE self, VALUE s)
|
|
|
|
|
{
|
|
|
|
|
printerr("%s", rb_string_value_ptr(&s));
|
|
|
|
@ -1072,6 +1084,7 @@ static void ruby_bind_dfhack(void) {
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "get_vtable_ptr", RUBY_METHOD_FUNC(rb_dfget_vtable_ptr), 1);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "dfhack_run", RUBY_METHOD_FUNC(rb_dfhack_run), 1);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_str", RUBY_METHOD_FUNC(rb_dfprint_str), 1);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_color", RUBY_METHOD_FUNC(rb_dfprint_color), 2);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "print_err", RUBY_METHOD_FUNC(rb_dfprint_err), 1);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "malloc", RUBY_METHOD_FUNC(rb_dfmalloc), 1);
|
|
|
|
|
rb_define_singleton_method(rb_cDFHack, "free", RUBY_METHOD_FUNC(rb_dffree), 1);
|
|
|
|
|