1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-01-16 22:09:29 +00:00
parent e84ce31a9e
commit 4d2f38b777
7 changed files with 39 additions and 24 deletions

View file

@ -1,6 +1,21 @@
Mon Jan 17 07:08:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.
Mon Jan 17 00:09:42 2005 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/uri/common.rb (PORT): typo fix. fixed: [ruby-core:04256]
* lib/uri/common.rb (PORT): typo fix. fixed: [ruby-core:04256]
Sat Jan 15 14:57:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>

View file

@ -19,6 +19,7 @@ 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
# define rl_filename_completion_function filename_completion_function
@ -87,7 +88,7 @@ readline_s_set_completion_proc(self, proc)
rb_secure(4);
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);
}
static VALUE
@ -95,7 +96,7 @@ readline_s_get_completion_proc(self)
VALUE self;
{
rb_secure(4);
return rb_iv_get(mReadline, COMPLETION_PROC);
return rb_attr_get(mReadline, completion_proc);
}
static VALUE
@ -104,7 +105,7 @@ readline_s_set_completion_case_fold(self, val)
VALUE val;
{
rb_secure(4);
return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
return rb_ivar_set(mReadline, completion_case_fold, val);
}
static VALUE
@ -112,7 +113,7 @@ readline_s_get_completion_case_fold(self)
VALUE self;
{
rb_secure(4);
return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
return rb_attr_get(mReadline, completion_case_fold);
}
static char **
@ -126,11 +127,11 @@ readline_attempted_completion_function(text, start, end)
int case_fold;
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)
ary = rb_Array(ary);
@ -697,6 +698,9 @@ 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",
readline_readline, -1);

View file

@ -22,7 +22,7 @@ module IRB
_set_last_value(value)
@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}"
end
@ -33,7 +33,7 @@ module IRB
attr_reader :eval_history
def eval_history=(no)
if no
if @eval_history
if (@eval_history ||= nil)
@eval_history_values.size(no)
else
@eval_history_values = History.new(no)

View file

@ -203,6 +203,7 @@ module IRB
def CE.def_extend_command(cmd_name, load_file, *aliases)
Context.module_eval %[
def #{cmd_name}(*opts, &b)
Context.module_eval {remove_method(:#{cmd_name})}
require "#{load_file}"
send :#{cmd_name}, *opts, &b
end

View file

@ -97,7 +97,7 @@ module IRB
}
}
@CONF[:PROMPT_MODE] = :DEFAULT
@CONF[:PROMPT_MODE] = (STDIN.tty? ? :DEFAULT : :NULL)
@CONF[:AUTO_INDENT] = false
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
@ -123,11 +123,11 @@ module IRB
@CONF[:MATH_MODE] = true
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(.)/
$KCODE = $1

View file

@ -10,7 +10,6 @@
#
#
autoload :Tempfile, "tempfile"
autoload :Kconv, "kconv"
module IRB
@ -126,15 +125,12 @@ module IRB
end
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

View file

@ -116,7 +116,6 @@ class SLex
def create_subnode(chrs, preproc = nil, postproc = nil)
if chrs.empty?
if @postproc
p node
SLex.fail ErrNodeAlreadyExists
else
print "Warn: change abstract node to real node\n" if SLex.debug?