summaryrefslogtreecommitdiffstats
path: root/ext/tk
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-03 04:55:07 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-03 04:55:07 +0000
commitf8b41c131b4ebe3f92ffb4c46cb66bbee211cc77 (patch)
tree9834a0d57193a270ab207169f79faeb8b7f1cc8a /ext/tk
parent1c63280fcb458971136577d2aea1556555c07619 (diff)
downloadruby-f8b41c131b4ebe3f92ffb4c46cb66bbee211cc77.tar.gz
ruby-f8b41c131b4ebe3f92ffb4c46cb66bbee211cc77.tar.xz
ruby-f8b41c131b4ebe3f92ffb4c46cb66bbee211cc77.zip
* 'format'==>'Kernel.format' (avoid override trouble)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/lib/tk.rb71
-rw-r--r--ext/tk/lib/tkafter.rb12
-rw-r--r--ext/tk/lib/tkcanvas.rb12
-rw-r--r--ext/tk/lib/tkdialog.rb20
-rw-r--r--ext/tk/lib/tktext.rb12
5 files changed, 64 insertions, 63 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 590574672..69c214175 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -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,8 +1550,8 @@ module Tk
def self.tk_escape(str)
s = '"' + str.gsub(/[\[\]$"]/, '\\\\\&') + '"'
- TkCore::INTERP.__eval(format('global %s; set %s %s',
- @@enc_buf, @@enc_buf, s))
+ TkCore::INTERP.__eval(Kernel.format('global %s; set %s %s',
+ @@enc_buf, @@enc_buf, s))
end
def self.new(str, enc = Tk.encoding_system)
@@ -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,25 +1933,25 @@ 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',
- @id, @id, @id, 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',
- @id, @id, @id, s))
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
+ @id, @id, @id, s))
else
fail
end
@@ -1960,13 +1960,13 @@ class TkVariable
end
def [](index)
- INTERP._eval(format('global %s; set %s(%s)',
- @id, @id, _get_eval_string(index)))
+ 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,
- _get_eval_string(index), _get_eval_string(val)))
+ INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
+ _get_eval_string(index), _get_eval_string(val)))
end
def numeric
@@ -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)',
- @id, @id, tk_tcl2ruby(elem)))
+ 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
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb
index 728f7f70d..53e78b880 100644
--- a/ext/tk/lib/tkafter.rb
+++ b/ext/tk/lib/tkafter.rb
@@ -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
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb
index 687f52165..58177584a 100644
--- a/ext/tk/lib/tkcanvas.rb
+++ b/ext/tk/lib/tkcanvas.rb
@@ -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
diff --git a/ext/tk/lib/tkdialog.rb b/ext/tk/lib/tkdialog.rb
index 8ac598c60..d5c13dca1 100644
--- a/ext/tk/lib/tkdialog.rb
+++ b/ext/tk/lib/tkdialog.rb
@@ -18,8 +18,8 @@ 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; ",
- @path, i, hash_kv(c).join(' '))
+ @config << Kernel.format("%s.button%s configure %s; ",
+ @path, i, hash_kv(c).join(' '))
}
case configs
when Proc
@@ -114,23 +114,23 @@ class TkDialog2 < TkWindow
}
if @message_config.kind_of? Hash
- @config << format("%s.msg configure %s;",
- @path, hash_kv(@message_config).join(' '))
+ @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;",
- @path, hash_kv(@msgframe_config).join(' '))
+ @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;",
- @path, hash_kv(@btnframe_config).join(' '))
+ @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;",
- @path, hash_kv(@bitmap_config).join(' '))
+ @config << Kernel.format("%s.bitmap configure %s;",
+ @path, hash_kv(@bitmap_config).join(' '))
end
_set_button_config(@button_configs) if @button_configs
diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb
index 8ab57d806..d7cb055a4 100644
--- a/ext/tk/lib/tktext.rb
+++ b/ext/tk/lib/tktext.rb
@@ -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'