diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-27 19:35:06 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-27 19:35:06 +0000 |
commit | b388591ab76c81eb2c7b4a5d66a840235f1365df (patch) | |
tree | d45ad5c93760b70162054cfc085ba34a86d698be /ext/tk/lib/tkafter.rb | |
parent | e4ffaf6ea862785cef27ec5bd1083d2622ff0121 (diff) | |
download | ruby-b388591ab76c81eb2c7b4a5d66a840235f1365df.tar.gz |
multi-tk.rb : (new) library to support multiple Tk interpreters (high level)
tcltklib.c : add some methods to support multiple interpreters (low level)
MANUAL.euc : modify descriptions
tcltklib/sample/safeTk.rb : (new) sample : how to use safeTk interpreter
tk/sample/safe-tk.rb : (new) sample : how to use multi-tk.rb
tk.rb, tkafter.rb : bug fix and add feature to supprt multi-tk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkafter.rb')
-rw-r--r-- | ext/tk/lib/tkafter.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb index 2ff60fe1e9..b24d6c72d3 100644 --- a/ext/tk/lib/tkafter.rb +++ b/ext/tk/lib/tkafter.rb @@ -12,10 +12,15 @@ class TkTimer TkCommandNames = ['after'.freeze].freeze Tk_CBID = ['a'.freeze, '00000'] - Tk_CBTBL = TkCore::INTERP.create_table + Tk_CBTBL = {} - TkCore::INTERP.add_tk_procs('rb_after', 'id', - "ruby [format \"#{self.name}.callback %%Q!%s!\" $id]") + TkCore::INTERP.add_tk_procs('rb_after', 'id', <<-'EOL') + if {[set st [catch {ruby [format "TkTimer.callback %%Q!%s!" $id]} ret]] != 0} { + return -code $st $ret + } { + return $ret + } + EOL ############################### @@ -24,9 +29,14 @@ class TkTimer def self.callback(obj_id) @after_id = nil ex_obj = Tk_CBTBL[obj_id] - return nil if ex_obj == nil; # canceled + return "" if ex_obj == nil; # canceled #_get_eval_string(ex_obj.do_callback) - ex_obj.cb_call + begin + ex_obj.cb_call + rescue Exception + Tk_CBTBL[obj_id] = nil + "" + end end def self.info @@ -43,7 +53,7 @@ class TkTimer @in_callback = true begin @return_value = @current_proc.call(self) - rescue StandardError, NameError + rescue Exception if @cancel_on_exception cancel return nil |