なかだです。

irbを-dつきで実行したところ、いくつか警告が出ました。

Exception `LoadError' at /usr/lib/ruby/1.9/tmpdir.rb:12 - No such file to load -- Win32API
removing /tmp/_usr_lib_ruby_1_9_irb_lc_error_rb28469.0...done
/usr/lib/ruby/1.9/irb/ext/history.rb:34: warning: method redefined; discarding old eval_history=
/usr/lib/ruby/1.9/irb/ext/history.rb:36: warning: instance variable @eval_history not initialized

また、タブを打ったときもreadlineから警告が出ます。

/usr/lib/ruby/1.9/irb/input-method.rb:134: warning: instance variable completion_proc not initialized


* ext/readline/readline.c: suppress warnings.

* lib/irb/extend-command.rb (IRB::ContextExtender.def_extend_command):
  ditto.

* lib/irb/ext/history.rb (IRB::Context::set_last_value): ditto.

* lib/irb/ext/history.rb (IRB::Context::eval_history): ditto.

* lib/irb/locale.rb (IRB::Locale::real_load): ditto.

* lib/irb/slex.rb (SLex::Node::create_subnode): remove garbage.


Index: ext/readline/readline.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/readline/readline.c,v retrieving revision 1.19 diff -U2 -p -r1.19 readline.c --- ext/readline/readline.c 19 Nov 2004 01:38:38 -0000 1.19 +++ ext/readline/readline.c 16 Jan 2005 05:55:24 -0000 @@ -20,4 +20,5 @@ static VALUE mReadline; #define COMPLETION_PROC "completion_proc" #define COMPLETION_CASE_FOLD "completion_case_fold" +static ID completion_proc, completion_case_fold; #ifndef READLINE_42_OR_LATER @@ -88,5 +89,5 @@ readline_s_set_completion_proc(self, pro if (!rb_respond_to(proc, rb_intern("call"))) rb_raise(rb_eArgError, "argument must respond to `call'"); - return rb_iv_set(mReadline, COMPLETION_PROC, proc); + return rb_ivar_set(mReadline, completion_proc, proc); } @@ -96,5 +97,5 @@ readline_s_get_completion_proc(self) { rb_secure(4); - return rb_iv_get(mReadline, COMPLETION_PROC); + return rb_attr_get(mReadline, completion_proc); } @@ -105,5 +106,5 @@ readline_s_set_completion_case_fold(self { rb_secure(4); - return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val); + return rb_ivar_set(mReadline, completion_case_fold, val); } @@ -113,5 +114,5 @@ readline_s_get_completion_case_fold(self { rb_secure(4); - return rb_iv_get(mReadline, COMPLETION_CASE_FOLD); + return rb_attr_get(mReadline, completion_case_fold); } @@ -127,9 +128,9 @@ readline_attempted_completion_function(t int i, matches; - proc = rb_iv_get(mReadline, COMPLETION_PROC); + proc = rb_attr_get(mReadline, completion_proc); if (NIL_P(proc)) return NULL; rl_attempted_completion_over = 1; - case_fold = RTEST(rb_iv_get(mReadline, COMPLETION_CASE_FOLD)); + case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold)); ary = rb_funcall(proc, rb_intern("call"), 1, rb_tainted_str_new2(text)); if (TYPE(ary) != T_ARRAY) @@ -698,4 +699,7 @@ Init_readline() using_history(); + completion_proc = rb_intern(COMPLETION_PROC); + completion_case_fold = rb_intern(COMPLETION_CASE_FOLD); + mReadline = rb_define_module("Readline"); rb_define_module_function(mReadline, "readline", Index: lib/irb/extend-command.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/extend-command.rb,v retrieving revision 1.5 diff -U2 -p -r1.5 extend-command.rb --- lib/irb/extend-command.rb 6 Feb 2004 00:15:16 -0000 1.5 +++ lib/irb/extend-command.rb 16 Jan 2005 05:29:05 -0000 @@ -204,4 +204,5 @@ module IRB Context.module_eval %[ def #{cmd_name}(*opts, &b) + Context.module_eval {remove_method(:#{cmd_name})} require "#{load_file}" send :#{cmd_name}, *opts, &b Index: lib/irb/init.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/init.rb,v retrieving revision 1.8 diff -U2 -p -r1.8 init.rb --- lib/irb/init.rb 20 Feb 2004 10:03:40 -0000 1.8 +++ lib/irb/init.rb 16 Jan 2005 05:46:55 -0000 @@ -98,5 +98,5 @@ module IRB } - @CONF[:PROMPT_MODE] = :DEFAULT + @CONF[:PROMPT_MODE] = (STDIN.tty? ? :DEFAULT : :NULL) @CONF[:AUTO_INDENT] = false @@ -124,9 +124,9 @@ module IRB when "-d" $DEBUG = true - when "-r" - opt = ARGV.shift + when /^-r(.+)?/ + opt = $1 || ARGV.shift @CONF[:LOAD_MODULES].push opt if opt - when "-I" - opt = ARGV.shift + when /^-I(.+)?/ + opt = $1 || ARGV.shift $LOAD_PATH.push opt if opt when /^-K(.)/ Index: lib/irb/locale.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/locale.rb,v retrieving revision 1.6 diff -U2 -p -r1.6 locale.rb --- lib/irb/locale.rb 24 Jul 2003 05:18:47 -0000 1.6 +++ lib/irb/locale.rb 16 Jan 2005 05:40:04 -0000 @@ -11,5 +11,4 @@ # -autoload :Tempfile, "tempfile" autoload :Kconv, "kconv" @@ -127,13 +126,10 @@ module IRB def real_load(path, priv) - tmp_base = path.tr("./:", "___") - lc_file = Tempfile.new(tmp_base) - File.foreach(path) do |line| - line = self.String(line) - lc_file.print(line) + src = self.String(File.read(path)) + if priv + eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)}) + else + eval(src, TOPLEVEL_BINDING, path) end - lc_file.close - toplevel_load lc_file.path, priv - lc_file.close(true) end private :real_load Index: lib/irb/slex.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/slex.rb,v retrieving revision 1.7 diff -U2 -p -r1.7 slex.rb --- lib/irb/slex.rb 28 Mar 2004 14:10:39 -0000 1.7 +++ lib/irb/slex.rb 16 Jan 2005 05:30:56 -0000 @@ -117,5 +117,4 @@ class SLex if chrs.empty? if @postproc - p node SLex.fail ErrNodeAlreadyExists else Index: lib/irb/ext/history.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/irb/ext/history.rb,v retrieving revision 1.1 diff -U2 -p -r1.1 history.rb --- lib/irb/ext/history.rb 9 Jul 2002 11:17:17 -0000 1.1 +++ lib/irb/ext/history.rb 16 Jan 2005 05:26:25 -0000 @@ -23,5 +23,5 @@ module IRB @workspace.evaluate self, "_ = IRB.CurrentContext.last_value" - if @eval_history #and !@eval_history_values.equal?(llv) + if (@eval_history ||= nil) #and !@eval_history_values.equal?(llv) @eval_history_values.push @line_no, @last_value @workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}" @@ -34,5 +34,5 @@ module IRB def eval_history=(no) if no - if @eval_history + if (@eval_history ||= nil) @eval_history_values.size(no) else
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦