mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 'format'==>'Kernel.format' (avoid override trouble)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3bab670fc
commit
a7c382223c
6 changed files with 76 additions and 63 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Wed Dec 3 13:49:07 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb: 'format'==>'Kernel.format' (avoid override trouble)
|
||||
|
||||
* ext/tk/lib/tkafter.rb: ditto.
|
||||
|
||||
* ext/tk/lib/tkcanvas.rb: ditto.
|
||||
|
||||
* ext/tk/lib/tkdialog.rb: ditto.
|
||||
|
||||
* ext/tk/lib/tktext.rb: ditto.
|
||||
|
||||
Wed Dec 3 13:28:13 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* Makefile.in (lex.c): try gperf first, and copy from the source
|
||||
|
|
|
@ -229,7 +229,8 @@ module TkComm
|
|||
when /^-?\d+\.?\d*(e[-+]?\d+)?$/
|
||||
val.to_f
|
||||
else
|
||||
fail ArgumentError, format('invalid value for Number:"%s"', val.to_s)
|
||||
fail(ArgumentError,
|
||||
Kernel.format('invalid value for Number:"%s"', val.to_s))
|
||||
end
|
||||
end
|
||||
def string(val)
|
||||
|
@ -334,7 +335,7 @@ module TkComm
|
|||
@cmdtbl = [] unless defined? @cmdtbl
|
||||
@cmdtbl.taint unless @cmdtbl.tainted?
|
||||
@cmdtbl.push id
|
||||
return format("rb_out %s", id);
|
||||
return Kernel.format("rb_out %s", id);
|
||||
end
|
||||
def uninstall_cmd(id)
|
||||
id = $1 if /rb_out (c\d+)/ =~ id
|
||||
|
@ -354,9 +355,9 @@ module TkComm
|
|||
if name[0] == ?.
|
||||
@path = name.dup
|
||||
elsif !ppath or ppath == "."
|
||||
@path = format(".%s", name);
|
||||
@path = Kernel.format(".%s", name);
|
||||
else
|
||||
@path = format("%s.%s", ppath, name)
|
||||
@path = Kernel.format("%s.%s", ppath, name)
|
||||
end
|
||||
#Tk_WINDOWS[@path] = self
|
||||
TkCore::INTERP.tk_windows[@path] = self
|
||||
|
@ -1549,7 +1550,7 @@ module Tk
|
|||
|
||||
def self.tk_escape(str)
|
||||
s = '"' + str.gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
TkCore::INTERP.__eval(format('global %s; set %s %s',
|
||||
TkCore::INTERP.__eval(Kernel.format('global %s; set %s %s',
|
||||
@@enc_buf, @@enc_buf, s))
|
||||
end
|
||||
|
||||
|
@ -1782,7 +1783,7 @@ class TkBindTag
|
|||
end
|
||||
|
||||
def inspect
|
||||
format "#<TkBindTag: %s>", @id
|
||||
Kernel.format "#<TkBindTag: %s>", @id
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1808,7 +1809,7 @@ class TkDatabaseClass<TkBindTag
|
|||
end
|
||||
|
||||
def inspect
|
||||
format "#<TkDatabaseClass: %s>", @id
|
||||
Kernel.format "#<TkDatabaseClass: %s>", @id
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1871,10 +1872,10 @@ class TkVariable
|
|||
if val.kind_of?(Hash)
|
||||
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||
.gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||
INTERP._eval(Kernel.format('global %s; array set %s %s', @id, @id, s))
|
||||
else
|
||||
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||
INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1918,14 +1919,13 @@ class TkVariable
|
|||
|
||||
def value
|
||||
begin
|
||||
INTERP._eval(format('global %s; set %s', @id, @id))
|
||||
INTERP._eval(Kernel.format('global %s; set %s', @id, @id))
|
||||
rescue
|
||||
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
||||
if INTERP._eval(Kernel.format('global %s; array exists %s',
|
||||
@id, @id)) != "1"
|
||||
fail
|
||||
else
|
||||
Hash[*tk_split_simplelist(INTERP.
|
||||
_eval(format('global %s; array get %s',
|
||||
@id, @id)))]
|
||||
Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1933,24 +1933,24 @@ class TkVariable
|
|||
def value=(val)
|
||||
begin
|
||||
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||
INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
|
||||
rescue
|
||||
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
||||
if INTERP._eval(Kernel.format('global %s; array exists %s',
|
||||
@id, @id)) != "1"
|
||||
fail
|
||||
else
|
||||
if val == []
|
||||
INTERP._eval(format('global %s; unset %s; set %s(0) 0; unset %s(0)',
|
||||
@id, @id, @id, @id))
|
||||
INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
|
||||
elsif val.kind_of?(Array)
|
||||
a = []
|
||||
val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
|
||||
s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
||||
INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
|
||||
@id, @id, @id, s))
|
||||
elsif val.kind_of?(Hash)
|
||||
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||
.gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
||||
INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
|
||||
@id, @id, @id, s))
|
||||
else
|
||||
fail
|
||||
|
@ -1960,12 +1960,12 @@ class TkVariable
|
|||
end
|
||||
|
||||
def [](index)
|
||||
INTERP._eval(format('global %s; set %s(%s)',
|
||||
INTERP._eval(Kernel.format('global %s; set %s(%s)',
|
||||
@id, @id, _get_eval_string(index)))
|
||||
end
|
||||
|
||||
def []=(index,val)
|
||||
INTERP._eval(format('global %s; set %s(%s) %s', @id, @id,
|
||||
INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
|
||||
_get_eval_string(index), _get_eval_string(val)))
|
||||
end
|
||||
|
||||
|
@ -2016,7 +2016,7 @@ class TkVariable
|
|||
end
|
||||
|
||||
def inspect
|
||||
format "#<TkVariable: %s>", @id
|
||||
Kernel.format "#<TkVariable: %s>", @id
|
||||
end
|
||||
|
||||
def coerce(other)
|
||||
|
@ -2151,10 +2151,10 @@ class TkVariable
|
|||
|
||||
def unset(elem=nil)
|
||||
if elem
|
||||
INTERP._eval(format('global %s; unset %s(%s)',
|
||||
INTERP._eval(Kernel.format('global %s; unset %s(%s)',
|
||||
@id, @id, tk_tcl2ruby(elem)))
|
||||
else
|
||||
INTERP._eval(format('global %s; unset %s', @id, @id))
|
||||
INTERP._eval(Kernel.format('global %s; unset %s', @id, @id))
|
||||
end
|
||||
end
|
||||
alias remove unset
|
||||
|
@ -2302,7 +2302,7 @@ class TkVarAccess<TkVariable
|
|||
TkVar_ID_TBL[@id] = self
|
||||
if val
|
||||
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
|
||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||
INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3919,8 +3919,9 @@ class TkObject<TkKernel
|
|||
|
||||
def tk_trace_variable(v)
|
||||
unless v.kind_of?(TkVariable)
|
||||
fail ArgumentError,
|
||||
format("type error (%s); must be TkVariable object", v.class)
|
||||
fail(ArgumentError,
|
||||
Kernel.format("type error (%s); must be TkVariable object",
|
||||
v.class))
|
||||
end
|
||||
v
|
||||
end
|
||||
|
@ -5547,7 +5548,7 @@ module TkSystemMenu
|
|||
unless parent.kind_of? TkMenu
|
||||
fail ArgumentError, "parent must be a TkMenu object"
|
||||
end
|
||||
@path = format("%s.%s", parent.path, self.class::SYSMENU_NAME)
|
||||
@path = Kernel.format("%s.%s", parent.path, self.class::SYSMENU_NAME)
|
||||
#TkComm::Tk_WINDOWS[@path] = self
|
||||
TkCore::INTERP.tk_windows[@path] = self
|
||||
if self.method(:create_self).arity == 0
|
||||
|
|
|
@ -193,7 +193,7 @@ class TkTimer
|
|||
def set_procs(interval, loop_exec, *procs)
|
||||
if !interval == 'idle' \
|
||||
&& !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
|
||||
fail format("%s need to be Integer or Proc", interval.inspect)
|
||||
fail Kernel.format("%s need to be Integer or Proc", interval.inspect)
|
||||
end
|
||||
@sleep_time = interval
|
||||
|
||||
|
@ -216,7 +216,7 @@ class TkTimer
|
|||
@loop_exec = 1
|
||||
else
|
||||
if not loop_exec.kind_of?(Integer)
|
||||
fail format("%s need to be Integer", loop_exec.inspect)
|
||||
fail Kernel.format("%s need to be Integer", loop_exec.inspect)
|
||||
end
|
||||
@loop_exec = loop_exec
|
||||
end
|
||||
|
@ -263,7 +263,7 @@ class TkTimer
|
|||
|
||||
def set_start_proc(sleep, init_proc, *init_args)
|
||||
if !sleep == 'idle' && !sleep.kind_of?(Integer)
|
||||
fail format("%s need to be Integer", sleep.inspect)
|
||||
fail Kernel.format("%s need to be Integer", sleep.inspect)
|
||||
end
|
||||
@init_sleep = sleep
|
||||
@init_proc = init_proc
|
||||
|
@ -282,7 +282,7 @@ class TkTimer
|
|||
if argc > 0
|
||||
sleep = init_args.shift
|
||||
if !sleep == 'idle' && !sleep.kind_of?(Integer)
|
||||
fail format("%s need to be Integer", sleep.inspect)
|
||||
fail Kernel.format("%s need to be Integer", sleep.inspect)
|
||||
end
|
||||
@init_sleep = sleep
|
||||
end
|
||||
|
@ -293,7 +293,7 @@ class TkTimer
|
|||
@running = true
|
||||
if @init_proc
|
||||
if not @init_proc.kind_of? Proc
|
||||
fail format("%s need to be Proc", @init_proc.inspect)
|
||||
fail Kernel.format("%s need to be Proc", @init_proc.inspect)
|
||||
end
|
||||
@current_proc = @init_proc
|
||||
set_callback(@init_sleep, @init_args)
|
||||
|
@ -346,7 +346,7 @@ class TkTimer
|
|||
fail RuntimeError, "no procedure to continue" unless cmd
|
||||
if wait
|
||||
if not wait.kind_of? Integer
|
||||
fail RuntimeError, format("%s need to be Integer", wait.inspect)
|
||||
fail RuntimeError, Kernel.format("%s need to be Integer", wait.inspect)
|
||||
end
|
||||
sleep = wait
|
||||
end
|
||||
|
|
|
@ -569,7 +569,7 @@ class TkcTag<TkObject
|
|||
|
||||
def initialize(parent, mode=nil, *args)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
|
@ -647,7 +647,7 @@ class TkcTagString<TkcTag
|
|||
|
||||
def initialize(parent, name, mode=nil, *args)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
|
@ -664,7 +664,7 @@ TkcNamedTag = TkcTagString
|
|||
class TkcTagAll<TkcTag
|
||||
def initialize(parent)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
|
@ -677,7 +677,7 @@ end
|
|||
class TkcTagCurrent<TkcTag
|
||||
def initialize(parent)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
|
@ -691,7 +691,7 @@ class TkcGroup<TkcTag
|
|||
Tk_cGroup_ID = ['tkcg'.freeze, '00000'.taint].freeze
|
||||
def create_self(parent, *args)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@c = parent
|
||||
@cpath = parent.path
|
||||
|
@ -737,7 +737,7 @@ class TkcItem<TkObject
|
|||
|
||||
def initialize(parent, *args)
|
||||
if not parent.kind_of?(TkCanvas)
|
||||
fail format("%s need to be TkCanvas", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkCanvas", parent.inspect)
|
||||
end
|
||||
@parent = @c = parent
|
||||
@path = parent.path
|
||||
|
|
|
@ -18,7 +18,7 @@ class TkDialog2 < TkWindow
|
|||
"to the dialog button#{i}. It was removed.\n")
|
||||
end
|
||||
c.delete('command'); c.delete(:command)
|
||||
@config << format("%s.button%s configure %s; ",
|
||||
@config << Kernel.format("%s.button%s configure %s; ",
|
||||
@path, i, hash_kv(c).join(' '))
|
||||
}
|
||||
case configs
|
||||
|
@ -114,22 +114,22 @@ class TkDialog2 < TkWindow
|
|||
}
|
||||
|
||||
if @message_config.kind_of? Hash
|
||||
@config << format("%s.msg configure %s;",
|
||||
@config << Kernel.format("%s.msg configure %s;",
|
||||
@path, hash_kv(@message_config).join(' '))
|
||||
end
|
||||
|
||||
if @msgframe_config.kind_of? Hash
|
||||
@config << format("%s.top configure %s;",
|
||||
@config << Kernel.format("%s.top configure %s;",
|
||||
@path, hash_kv(@msgframe_config).join(' '))
|
||||
end
|
||||
|
||||
if @btnframe_config.kind_of? Hash
|
||||
@config << format("%s.bot configure %s;",
|
||||
@config << Kernel.format("%s.bot configure %s;",
|
||||
@path, hash_kv(@btnframe_config).join(' '))
|
||||
end
|
||||
|
||||
if @bitmap_config.kind_of? Hash
|
||||
@config << format("%s.bitmap configure %s;",
|
||||
@config << Kernel.format("%s.bitmap configure %s;",
|
||||
@path, hash_kv(@bitmap_config).join(' '))
|
||||
end
|
||||
|
||||
|
|
|
@ -834,7 +834,7 @@ class TkTextTag<TkObject
|
|||
|
||||
def initialize(parent, *args)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@parent = @t = parent
|
||||
@tpath = parent.path
|
||||
|
@ -1006,7 +1006,7 @@ class TkTextNamedTag<TkTextTag
|
|||
|
||||
def initialize(parent, name, *args)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@parent = @t = parent
|
||||
@tpath = parent.path
|
||||
|
@ -1050,7 +1050,7 @@ class TkTextMark<TkObject
|
|||
|
||||
def initialize(parent, index)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@parent = @t = parent
|
||||
@tpath = parent.path
|
||||
|
@ -1122,7 +1122,7 @@ class TkTextNamedMark<TkTextMark
|
|||
|
||||
def initialize(parent, name, index=nil)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@parent = @t = parent
|
||||
@tpath = parent.path
|
||||
|
@ -1156,7 +1156,7 @@ end
|
|||
class TkTextWindow<TkObject
|
||||
def initialize(parent, index, keys)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@t = parent
|
||||
if index == 'end'
|
||||
|
@ -1245,7 +1245,7 @@ end
|
|||
class TkTextImage<TkObject
|
||||
def initialize(parent, index, keys)
|
||||
if not parent.kind_of?(TkText)
|
||||
fail format("%s need to be TkText", parent.inspect)
|
||||
fail Kernel.format("%s need to be TkText", parent.inspect)
|
||||
end
|
||||
@t = parent
|
||||
if index == 'end'
|
||||
|
|
Loading…
Reference in a new issue