summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/variable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk/variable.rb')
-rw-r--r--ext/tk/lib/tk/variable.rb386
1 files changed, 193 insertions, 193 deletions
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 97d18e4a50..d5882fd649 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -19,24 +19,24 @@ class TkVariable
Tk_VARIABLE_ID = ["v".freeze, "00000".taint].freeze
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
- # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
+ # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
set idx [string first "\n\n" $ret]
if {$idx > 0} {
- global errorInfo
- set tcl_backtrace $errorInfo
- set errorInfo [string range $ret [expr $idx + 2] \
+ global errorInfo
+ set tcl_backtrace $errorInfo
+ set errorInfo [string range $ret [expr $idx + 2] \
[string length $ret]]
append errorInfo "\n" $tcl_backtrace
- bgerror [string range $ret 0 [expr $idx - 1]]
+ bgerror [string range $ret 0 [expr $idx - 1]]
} else {
bgerror $ret
}
return ""
#return -code $st $ret
} else {
- return $ret
+ return $ret
}
EOL
@@ -47,40 +47,40 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
if TkVar_CB_TBL[name1]
#_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
begin
- _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
rescue SystemExit
- exit(0)
+ exit(0)
rescue Interrupt
- exit!(1)
+ exit!(1)
rescue Exception => e
- begin
- msg = _toUTF8(e.class.inspect) + ': ' +
- _toUTF8(e.message) + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- _toUTF8(e.backtrace.join("\n")) +
- "\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
- rescue Exception
- msg = e.class.inspect + ': ' + e.message + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- e.backtrace.join("\n") +
- "\n---< backtrace of Tk side >-------"
- end
- fail(e, msg)
+ begin
+ msg = _toUTF8(e.class.inspect) + ': ' +
+ _toUTF8(e.message) + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ _toUTF8(e.backtrace.join("\n")) +
+ "\n---< backtrace of Tk side >-------"
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ rescue Exception
+ msg = e.class.inspect + ': ' + e.message + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ e.backtrace.join("\n") +
+ "\n---< backtrace of Tk side >-------"
+ end
+ fail(e, msg)
end
=begin
begin
- raise 'check backtrace'
+ raise 'check backtrace'
rescue
- # ignore backtrace before 'callback'
- pos = -($!.backtrace.size)
+ # ignore backtrace before 'callback'
+ pos = -($!.backtrace.size)
end
begin
- _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
rescue
- trace = $!.backtrace
- raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
- "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
+ trace = $!.backtrace
+ raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
+ "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
end
=end
else
@@ -159,7 +159,7 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
=begin
if val == []
# INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
- # @id, @id, @id))
+ # @id, @id, @id))
elsif val.kind_of?(Array)
a = []
# val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
@@ -202,15 +202,15 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
on_thread &= (Thread.list.size != 1)
if on_thread
if check_root
- INTERP._thread_tkwait('variable', @id)
+ INTERP._thread_tkwait('variable', @id)
else
- INTERP._thread_vwait(@id)
+ INTERP._thread_vwait(@id)
end
else
if check_root
- INTERP._invoke_without_enc('tkwait', 'variable', @id)
+ INTERP._invoke_without_enc('tkwait', 'variable', @id)
else
- INTERP._invoke_without_enc('vwait', @id)
+ INTERP._invoke_without_enc('vwait', @id)
end
end
end
@@ -299,21 +299,21 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
if val.kind_of?(Hash)
self.clear
val.each{|k, v|
- #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
- # _toUTF8(_get_eval_string(v)))
- INTERP._set_global_var2(@id, _get_eval_string(k, true),
- _get_eval_string(v, true))
+ #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
+ # _toUTF8(_get_eval_string(v)))
+ INTERP._set_global_var2(@id, _get_eval_string(k, true),
+ _get_eval_string(v, true))
}
self.value
elsif val.kind_of?(Array)
INTERP._set_global_var(@id, '')
val.each{|v|
- #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
- INTERP._set_variable(@id, _get_eval_string(v, true),
- TclTkLib::VarAccessFlag::GLOBAL_ONLY |
- TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
- TclTkLib::VarAccessFlag::APPEND_VALUE |
- TclTkLib::VarAccessFlag::LIST_ELEMENT)
+ #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
+ INTERP._set_variable(@id, _get_eval_string(v, true),
+ TclTkLib::VarAccessFlag::GLOBAL_ONLY |
+ TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
+ TclTkLib::VarAccessFlag::APPEND_VALUE |
+ TclTkLib::VarAccessFlag::LIST_ELEMENT)
}
self.value
else
@@ -329,11 +329,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
rescue => e
case @def_default
when :proc
- @default_val.call(self, *idxs)
+ @default_val.call(self, *idxs)
when :val
- @default_val
+ @default_val
else
- fail e
+ fail e
end
end
#_fromUTF8(INTERP._get_global_var2(@id, index))
@@ -346,9 +346,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
index = args.collect{|idx| _get_eval_string(idx, true)}.join(',')
_fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true)))
#_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)),
- # _toUTF8(_get_eval_string(val))))
+ # _toUTF8(_get_eval_string(val))))
#_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true),
- # _get_eval_string(val, true)))
+ # _get_eval_string(val, true)))
end
def unset(elem=nil)
@@ -372,13 +372,13 @@ else
#INTERP._invoke_without_enc('set', @id)
rescue
if INTERP._eval(Kernel.format('global %s; array exists %s',
- @id, @id)) != "1"
+ @id, @id)) != "1"
#if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
#if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
- fail
+ fail
else
- Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
- #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
+ Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
+ #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
end
end
end
@@ -392,43 +392,43 @@ else
#_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s)))
rescue
if INTERP._eval(Kernel.format('global %s; array exists %s',
- @id, @id)) != "1"
+ @id, @id)) != "1"
#if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
#if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
- fail
+ fail
else
- if val == []
- INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
- #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)',
- # @id, @id, @id))
- #INTERP._invoke_without_enc('unset', @id)
- #INTERP._invoke_without_enc('set', @id+'(0)', 0)
- #INTERP._invoke_without_enc('unset', @id+'(0)')
- elsif val.kind_of?(Array)
- a = []
- val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
- #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
- s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
- INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
- @id, @id, @id, s))
- #INTERP._eval(Kernel.format('unset %s; array set %s %s',
- # @id, @id, s))
- #INTERP._invoke_without_enc('unset', @id)
- #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
- elsif val.kind_of?(Hash)
- #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
- # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
- s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
- .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
- INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
- @id, @id, @id, s))
- #INTERP._eval(Kernel.format('unset %s; array set %s %s',
- # @id, @id, s))
- #INTERP._invoke_without_enc('unset', @id)
- #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
- else
- fail
- end
+ if val == []
+ INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
+ #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)',
+ # @id, @id, @id))
+ #INTERP._invoke_without_enc('unset', @id)
+ #INTERP._invoke_without_enc('set', @id+'(0)', 0)
+ #INTERP._invoke_without_enc('unset', @id+'(0)')
+ elsif val.kind_of?(Array)
+ a = []
+ val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
+ #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
+ @id, @id, @id, s))
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ elsif val.kind_of?(Hash)
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
+ @id, @id, @id, s))
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ else
+ fail
+ end
end
end
end
@@ -440,11 +440,11 @@ else
rescue => e
case @def_default
when :proc
- @default_val.call(self, *idxs)
+ @default_val.call(self, *idxs)
when :val
- @default_val
+ @default_val
else
- fail e
+ fail e
end
end
#INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index))
@@ -462,9 +462,9 @@ else
#INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
# _get_eval_string(index), _get_eval_string(val)))
#INTERP._eval(Kernel.format('set %s(%s) %s', @id,
- # _get_eval_string(index), _get_eval_string(val)))
+ # _get_eval_string(index), _get_eval_string(val)))
#INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' +
- # _get_eval_string(val))
+ # _get_eval_string(val))
end
def unset(elem=nil)
@@ -514,9 +514,9 @@ end
else
case val.to_s.downcase
when 'false', '0', 'no', 'off'
- self.value = '0'
+ self.value = '0'
else
- self.value = '1'
+ self.value = '1'
end
end
end
@@ -602,9 +602,9 @@ end
self.value + other
else
begin
- number(self.value) + other
+ number(self.value) + other
rescue
- self.value + other.to_s
+ self.value + other.to_s
end
end
end
@@ -670,17 +670,17 @@ end
def <=>(other)
if other.kind_of?(TkVariable)
begin
- val = other.numeric
- other = val
+ val = other.numeric
+ other = val
rescue
- other = other.value
+ other = other.value
end
end
if other.kind_of?(Numeric)
begin
- return self.numeric <=> other
+ return self.numeric <=> other
rescue
- return self.value <=> other.to_s
+ return self.value <=> other.to_s
end
else
return self.value <=> other
@@ -697,7 +697,7 @@ end
end
if elem.kind_of?(String) && elem != ''
if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array)
- @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
+ @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
end
end
end
@@ -713,12 +713,12 @@ end
Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
end
=end
else
@@ -726,25 +726,25 @@ end
#opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -763,13 +763,13 @@ end
Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
end
=end
else
@@ -777,25 +777,25 @@ end
# opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -820,8 +820,8 @@ end
newopts = ''
@trace_var.each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
+ idx = i
+ next
end
# e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
@@ -834,8 +834,8 @@ end
@trace_elem.each{|elem|
@trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
}
}
@@ -845,28 +845,28 @@ end
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -882,8 +882,8 @@ end
idx = -1
@trace_elem[elem].each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
+ idx = i
+ next
end
}
if idx >= 0
@@ -899,8 +899,8 @@ end
}
@trace_elem.each{|elem|
@trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
}
}
@@ -910,28 +910,28 @@ end
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id,
- @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id,
+ @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -966,9 +966,9 @@ class TkVarAccess<TkVariable
if val
if val.kind_of?(Hash)
- # assoc-array variable
- self[''] = 0
- self.clear
+ # assoc-array variable
+ self[''] = 0
+ self.clear
end
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"