From: nobu.nokada@... Date: 2002-08-13T07:23:19+09:00 Subject: Re: [ToDo] Ruby module, Warn(ing) interface Hi, At Tue, 13 Aug 2002 00:55:35 +0900, Michal Rokos wrote: > +static VALUE > +ruby_warn(dummy, str) > + VALUE dummy, str; > +{ > + rb_warn("%s", StringValuePtr(str)); > + return Qnil; > +} I guess it's better to be printf-like as C version. static VALUE ruby_warn(argc, argv) int argc; VALUE *argv; { VALUE str, s = rb_str_buf_new(strlen(ruby_sourcefile) + 12 + 14); sprintf(RSTRING(s)->ptr, "%s:%d: warning: ", ruby_sourcefile, ruby_sourceline); RSTRING(s)->len = strlen(RSTRING(s)->ptr); str = rb_f_sprintf(argc, argv); rb_str_update(str, 0, 0, s); rb_gc_force_recycle(s); rb_str_cat(str, "\n", 1); rb_io_write(rb_stderr, str); rb_gc_force_recycle(str); return Qnil; } rb_define_module_function(rb_mRuby, "warn", ruby_warn, -1); And RUBY_VERSION.equal?(Ruby::VERSION) shouldn't be true, and so on? -- Nobu Nakada