summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-29 15:54:32 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-29 15:54:32 +0000
commitc73eb341d289621235f1d91b962d6f45692e1158 (patch)
tree03f94411c11d556ddf463d4b4cb27a16fcbba3a1 /ext/tk/lib
parent2589e9f012c08e9aec7202686c9e888099aa6ab5 (diff)
downloadruby-c73eb341d289621235f1d91b962d6f45692e1158.tar.gz
ruby-c73eb341d289621235f1d91b962d6f45692e1158.tar.xz
ruby-c73eb341d289621235f1d91b962d6f45692e1158.zip
* ext/tcltklib/tcltklib.c (ip_init): bug fix
* ext/tk/tkutil.c (get_eval_string_core): accept a Regexp object * ext/tk/lib/multi-tk.rb: fix bug on 'exit' operation * ext/tk/lib/tk/text.rb: 'tksearch' accepts a Regexp object as a matting pattern argument git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r--ext/tk/lib/multi-tk.rb52
-rw-r--r--ext/tk/lib/tk/text.rb34
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS2
3 files changed, 79 insertions, 9 deletions
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index 5299eee06..061123b79 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -125,7 +125,10 @@ class MultiTkIp
if wait == 0
# no wait
- thread.raise exception
+ Thread.pass
+ if thread.stop?
+ thread.raise exception
+ end
return thread
end
@@ -294,7 +297,8 @@ class MultiTkIp
obj.delete unless obj.deleted?
}
=end
- exit
+ #exit(e.status)
+ fail e
end
# break
@@ -1325,14 +1329,19 @@ class MultiTkIp
rescue MultiTkIp_OK => ret
# return value
return ret.value
- rescue SystemExit
+ rescue SystemExit => e
# exit IP
warn("Warning: " + $! + " on " + self.inspect) if $DEBUG
begin
self._eval_without_enc('exit')
rescue Exception
end
- self.delete
+ if !safe? && allow_ruby_exit?
+ self.delete
+ fail e
+ else
+ self.delete
+ end
rescue Exception => e
if $DEBUG
warn("Warning: " + e.class.inspect +
@@ -1542,10 +1551,18 @@ class << MultiTkIp
__getip.deleted?
end
- def exit(st = 0)
+ def abort(msg = nil)
+ __getip.abort(msg)
+ end
+
+ def exit(st = true)
__getip.exit(st)
end
+ def exit!(st = false)
+ __getip.exit!(st)
+ end
+
def restart(app_name = nil, keys = {})
init_ip_internal
@@ -1852,7 +1869,21 @@ class MultiTkIp
@interp.deleted?
end
- def exit(st = 0)
+ def abort(msg = nil)
+ if master?
+ if msg
+ Kernel.abort(msg)
+ else
+ Kernel.abort
+ end
+ else
+ # ignore msg
+ delete
+ 1
+ end
+ end
+
+ def exit(st = true)
if master?
Kernel.exit(st)
else
@@ -1861,6 +1892,15 @@ class MultiTkIp
end
end
+ def exit!(st = false)
+ if master? && !safe? && allow_ruby_exit?
+ Kernel.exit!(st)
+ else
+ delete
+ st
+ end
+ end
+
def restart(app_name = nil, keys = {})
_init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index c05e3f03a..123f49af0 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -971,12 +971,25 @@ class TkText<TkTextWin
# call 'search' subcommand of text widget
# args ::= [<array_of_opts>] <pattern> <start_index> [<stop_index>]
# If <pattern> is regexp, then it must be a regular expression of Tcl
+ nocase = false
if args[0].kind_of?(Array)
- opts = args.shift.collect{|opt| '-' + opt.to_s }
+ opts = args.shift.collect{|opt|
+ s_opt = opt.to_s
+ nocase = true if s_opt == 'nocase'
+ '-' + s_opt
+ }
else
opts = []
end
+ if args[0].kind_of?(Regexp)
+ regexp = args.shift
+ if !nocase && (regexp.options & Regexp::IGNORECASE) != 0
+ opts << '-nocase'
+ end
+ args.unshift(regexp.source)
+ end
+
opts << '--'
ret = tk_send('search', *(opts + args))
@@ -991,13 +1004,28 @@ class TkText<TkTextWin
# call 'search' subcommand of text widget
# args ::= [<array_of_opts>] <var> <pattern> <start_index> [<stop_index>]
# If <pattern> is regexp, then it must be a regular expression of Tcl
+ nocase = false
if args[0].kind_of?(Array)
- opts = args.shift.collect{|opt| '-' + opt.to_s }
+ opts = args.shift.collect{|opt|
+ s_opt = opt.to_s
+ nocase = true if s_opt == 'nocase'
+ '-' + s_opt
+ }
else
opts = []
end
- opts << '-count' << args.shift << '--'
+ opts << '-count' << args.shift
+
+ if args[0].kind_of?(Regexp)
+ regexp = args.shift
+ if !nocase && (regexp.options & Regexp::IGNORECASE) != 0
+ opts << '-nocase'
+ end
+ args.unshift(regexp.source)
+ end
+
+ opts << '--'
ret = tk_send('search', *(opts + args))
if ret == ""
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index cd2130d0b..a13e2751e 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -104,8 +104,10 @@ Tkgeomap http://tkgeomap.sourceforge.net/index.html
===< not determined to supprt or not >========================================
BLT http://sourceforge.net/projects/blt
+ * see tcltk-ext library on RAA (http://raa.ruby-lang.org/)
Tix http://tixlibrary.sourceforge.net/
+ * see tcltk-ext library on RAA (http://raa.ruby-lang.org/)
TkZinc http://www.tkzinc.org/