[ruby-dev:25488] Re: some problems on ext/tk/sample/**/*.rb
From:
Hidetoshi NAGAI <nagai@...>
Date:
2005-01-22 05:18:59 UTC
List:
ruby-dev #25488
永井@知能.九工大です.
From: H.Yamamoto <ocean@m2.ccsnet.ne.jp>
Subject: [ruby-dev:25479] some problems on ext/tk/sample/**/*.rb
Date: Sat, 15 Jan 2005 23:47:08 +0900
Message-ID: <20050115234704.AEE3A920.ocean@m2.ccsnet.ne.jp>
> ext/tk/sample 以下のサンプルプログラムを実行していて、
> 幾つか動かないものがありました。直し方がわかるものは
> パッチもつけました。
少々手間取ってしまいましたが,次のようなパッチではいかがでしょうか?
Index: tcltklib/extconf.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tcltklib/extconf.rb,v
retrieving revision 1.15.2.8
diff -u -r1.15.2.8 extconf.rb
--- tcltklib/extconf.rb 23 Dec 2004 04:16:43 -0000 1.15.2.8
+++ tcltklib/extconf.rb 22 Jan 2005 05:15:08 -0000
@@ -166,6 +166,15 @@
# tcl-thread is unknown
if try_run(<<EOF)
#include <tcl.h>
+int main() {
+ Tcl_Interp *ip;
+ ip = Tcl_CreateInterp();
+ exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1);
+}
+EOF
+ tcl_enable_thread = true
+ elsif try_run(<<EOF)
+#include <tcl.h>
static Tcl_ThreadDataKey dataKey;
int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); }
EOF
@@ -230,11 +239,11 @@
**
*****************************************************************************
')
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
return false
else
# ruby -> disable && tcl -> disable
- $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1'
+ $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0'
return true
end
end
Index: tcltklib/tcltklib.c
===================================================================
RCS file: /var/cvs/src/ruby/ext/tcltklib/tcltklib.c,v
retrieving revision 1.49.2.24
diff -u -r1.49.2.24 tcltklib.c
--- tcltklib/tcltklib.c 27 Dec 2004 11:03:58 -0000 1.49.2.24
+++ tcltklib/tcltklib.c 22 Jan 2005 05:15:09 -0000
@@ -4,7 +4,7 @@
* Oct. 24, 1997 Y. Matsumoto
*/
-#define TCLTKLIB_RELEASE_DATE "2004-12-27"
+#define TCLTKLIB_RELEASE_DATE "2005-01-22"
#include "ruby.h"
#include "rubysig.h"
@@ -74,8 +74,8 @@
static char *finalize_hook_name = "INTERP_FINALIZE_HOOK";
/* to cancel remained after-scripts when deleting IP */
-#define REMAINED_AFTER_IDS_VAR "__ruby_tcltklib_remained_after_script_list__"
-#define CANCEL_REMAINED_AFTER_IDS "foreach id $__ruby_tcltklib_remained_after_script_list__ {after cancel $id}"
+#define CANCEL_AFTER_SCRIPTS "__ruby_tcltklib_cancel_after_scripts__"
+#define DEF_CANCEL_AFTER_SCRIPTS_PROC "proc __ruby_tcltklib_cancel_after_scripts__ {} {foreach id [after info] {after cancel $id}}"
/* for callback break & continue */
static VALUE eTkCallbackReturn;
@@ -3261,10 +3261,13 @@
if (!Tcl_InterpDeleted(ip)) {
Tcl_Preserve(ip);
- while((main_win = Tk_MainWindow(ip)) != (Tk_Window)NULL) {
+
+ while ( (main_win = Tk_MainWindow(ip)) != (Tk_Window)NULL
+ && !(((Tk_FakeWin*)main_win)->flags & TK_ALREADY_DEAD) ) {
DUMP1("wait main_win is destroyed");
Tk_DestroyWindow(main_win);
}
+
Tcl_Release(ip);
}
return Qnil;
@@ -3277,9 +3280,15 @@
{
Tcl_Interp *slave;
Tcl_Obj *slave_list, *elem;
+ Tcl_CmdInfo info;
char *slave_name;
int i, len;
+ if (Tcl_InterpDeleted(ip)) {
+ DUMP2("call delete_slaves() for deleted ip(%lx)", ip);
+ return;
+ }
+
DUMP2("delete slaves of ip(%lx)", ip);
Tcl_Preserve(ip);
@@ -3317,13 +3326,17 @@
Tcl_Preserve(slave);
if (!Tcl_InterpDeleted(slave)) {
- if (Tcl_Eval(slave, "after info") == TCL_OK
- && Tcl_SetVar(slave,
- REMAINED_AFTER_IDS_VAR,
- Tcl_GetStringResult(slave),
- TCL_GLOBAL_ONLY) != (char *)NULL) {
- DUMP1("cancel after scripts");
- Tcl_Eval(slave, CANCEL_REMAINED_AFTER_IDS);
+ if (Tcl_Eval(slave, DEF_CANCEL_AFTER_SCRIPTS_PROC) == TCL_OK) {
+ if (Tcl_GetCommandInfo(slave, CANCEL_AFTER_SCRIPTS, &info)) {
+ DUMP2("call cancel after scripts proc '%s'",
+ CANCEL_AFTER_SCRIPTS);
+ Tcl_Eval(slave, CANCEL_AFTER_SCRIPTS);
+ }
+ }
+
+ if (Tcl_GetCommandInfo(slave, finalize_hook_name, &info)) {
+ DUMP2("call finalize hook proc '%s'", finalize_hook_name);
+ Tcl_Eval(slave, finalize_hook_name);
}
}
@@ -3368,13 +3381,12 @@
Tcl_ResetResult(ptr->ip);
- if (Tcl_Eval(ptr->ip, "after info") == TCL_OK
- && Tcl_SetVar(ptr->ip,
- REMAINED_AFTER_IDS_VAR,
- Tcl_GetStringResult(ptr->ip),
- TCL_GLOBAL_ONLY) != (char *)NULL) {
- DUMP1("cancel after scripts");
- Tcl_Eval(ptr->ip, CANCEL_REMAINED_AFTER_IDS);
+ if (Tcl_Eval(ptr->ip, DEF_CANCEL_AFTER_SCRIPTS_PROC) == TCL_OK) {
+ if (Tcl_GetCommandInfo(ptr->ip, CANCEL_AFTER_SCRIPTS, &info)) {
+ DUMP2("call cancel after scripts proc '%s'",
+ CANCEL_AFTER_SCRIPTS);
+ Tcl_Eval(ptr->ip, CANCEL_AFTER_SCRIPTS);
+ }
}
if (Tcl_GetCommandInfo(ptr->ip, finalize_hook_name, &info)) {
@@ -3382,7 +3394,7 @@
Tcl_Eval(ptr->ip, finalize_hook_name);
}
- del_root(ptr->ip);
+ /* del_root(ptr->ip); */
DUMP1("delete interp");
while(!Tcl_InterpDeleted(ptr->ip)) {
@@ -3843,18 +3855,23 @@
ip_delete(self)
VALUE self;
{
+ Tcl_CmdInfo info;
struct tcltkip *ptr = get_ip(self);
/* Tcl_Preserve(ptr->ip); */
rbtk_preserve_ip(ptr);
- if (Tcl_Eval(ptr->ip, "after info") == TCL_OK
- && Tcl_SetVar(ptr->ip,
- REMAINED_AFTER_IDS_VAR,
- Tcl_GetStringResult(ptr->ip),
- TCL_GLOBAL_ONLY) != (char *)NULL) {
- DUMP1("cancel after scripts");
- Tcl_Eval(ptr->ip, CANCEL_REMAINED_AFTER_IDS);
+ if (Tcl_Eval(ptr->ip, DEF_CANCEL_AFTER_SCRIPTS_PROC) == TCL_OK) {
+ if (Tcl_GetCommandInfo(ptr->ip, CANCEL_AFTER_SCRIPTS, &info)) {
+ DUMP2("call cancel after scripts proc '%s'",
+ CANCEL_AFTER_SCRIPTS);
+ Tcl_Eval(ptr->ip, CANCEL_AFTER_SCRIPTS);
+ }
+ }
+
+ if (Tcl_GetCommandInfo(ptr->ip, finalize_hook_name, &info)) {
+ DUMP2("call finalize hook proc '%s'", finalize_hook_name);
+ Tcl_Eval(ptr->ip, finalize_hook_name);
}
del_root(ptr->ip);
@@ -3922,7 +3939,11 @@
# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0
s = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &len);
- return(rb_tainted_str_new(s, len));
+ if (s == (char*)NULL) {
+ return rb_tainted_str_new2("");
+ } else {
+ return(rb_tainted_str_new(s, len));
+ }
# else /* TCL_VERSION >= 8.1 */
volatile VALUE strval;
@@ -3937,12 +3958,20 @@
if (Tcl_GetCharLength(retobj) != Tcl_UniCharLen(Tcl_GetUnicode(retobj))) {
/* possibly binary string */
s = Tcl_GetByteArrayFromObj(retobj, &len);
- strval = rb_tainted_str_new(s, len);
+ if (s == (char*)NULL) {
+ strval = rb_tainted_str_new2("");
+ } else {
+ strval = rb_tainted_str_new(s, len);
+ }
rb_ivar_set(strval, ID_at_enc, rb_str_new2("binary"));
} else {
/* possibly text string */
s = Tcl_GetStringFromObj(retobj, &len);
- strval = rb_tainted_str_new(s, len);
+ if (s == (char*)NULL) {
+ strval = rb_tainted_str_new2("");
+ } else {
+ strval = rb_tainted_str_new(s, len);
+ }
}
rb_thread_critical = thr_crit_bup;
Index: tk/tkutil.c
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/tkutil.c,v
retrieving revision 1.4.2.14
diff -u -r1.4.2.14 tkutil.c
--- tk/tkutil.c 23 Dec 2004 04:16:43 -0000 1.4.2.14
+++ tk/tkutil.c 22 Jan 2005 05:15:09 -0000
@@ -8,7 +8,7 @@
************************************************/
-#define TKUTIL_RELEASE_DATE "2004-12-23"
+#define TKUTIL_RELEASE_DATE "2005-01-22"
#include "ruby.h"
#include "rubysig.h"
@@ -824,6 +824,8 @@
value = rb_funcall(value, ID_downcase, 0);
+ if (RSTRING(value)->ptr == (char*)NULL) return Qnil;
+
if (RSTRING(value)->ptr[0] == '\0'
|| strcmp(RSTRING(value)->ptr, "0") == 0
|| strcmp(RSTRING(value)->ptr, "no") == 0
@@ -880,6 +882,8 @@
{
rb_check_type(value, T_STRING);
+ if (RSTRING(value)->ptr == (char*)NULL) return INT2FIX(0);
+
return rb_rescue2(tkstr_to_int, value,
tkstr_rescue_float, value,
rb_eArgError, 0);
@@ -916,6 +920,8 @@
{
rb_check_type(value, T_STRING);
+ if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
+
return tkstr_to_str(value);
}
@@ -925,6 +931,8 @@
VALUE value;
{
rb_check_type(value, T_STRING);
+
+ if (RSTRING(value)->ptr == (char*)NULL) return rb_tainted_str_new2("");
return rb_rescue2(tkstr_to_number, value,
tkstr_to_str, value,
Index: tk/lib/multi-tk.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/multi-tk.rb,v
retrieving revision 1.17.2.19
diff -u -r1.17.2.19 multi-tk.rb
--- tk/lib/multi-tk.rb 27 Dec 2004 11:04:00 -0000 1.17.2.19
+++ tk/lib/multi-tk.rb 22 Jan 2005 05:15:09 -0000
@@ -2217,7 +2217,7 @@
def set_bgerror_handler(cmd = Proc.new, slave = nil, &b)
unless TkComm._callback_entry?(cmd)
- unless slave
+ if !slave && b
slave = cmd
cmd = Proc.new(&b)
end
Index: tk/lib/tk.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk.rb,v
retrieving revision 1.102.2.33
diff -u -r1.102.2.33 tk.rb
--- tk/lib/tk.rb 27 Dec 2004 11:03:59 -0000 1.102.2.33
+++ tk/lib/tk.rb 22 Jan 2005 05:15:10 -0000
@@ -913,7 +913,7 @@
#end
def bind(tagOrClass, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -928,7 +928,7 @@
#end
def bind_append(tagOrClass, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -952,7 +952,7 @@
#end
def bind_all(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -967,7 +967,7 @@
#end
def bind_append_all(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -2131,7 +2131,7 @@
#end
def bind(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -2144,7 +2144,7 @@
#end
def bind_append(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -3940,7 +3940,7 @@
#Tk.freeze
module Tk
- RELEASE_DATE = '2004-12-27'.freeze
+ RELEASE_DATE = '2005-01-22'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
Index: tk/lib/tk/bindtag.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/bindtag.rb,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 bindtag.rb
--- tk/lib/tk/bindtag.rb 16 Dec 2004 07:12:44 -0000 1.1.2.3
+++ tk/lib/tk/bindtag.rb 22 Jan 2005 05:15:10 -0000
@@ -23,6 +23,7 @@
@id = name
BTagID_TBL[@id] = self
bind(*args, &b) if args != []
+ self
}
end
Index: tk/lib/tk/canvas.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/canvas.rb,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 canvas.rb
--- tk/lib/tk/canvas.rb 16 Dec 2004 07:12:44 -0000 1.1.2.10
+++ tk/lib/tk/canvas.rb 22 Jan 2005 05:15:10 -0000
@@ -100,7 +100,7 @@
#end
def itembind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -115,7 +115,7 @@
#end
def itembind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tk/canvastag.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/canvastag.rb,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 canvastag.rb
--- tk/lib/tk/canvastag.rb 16 Dec 2004 07:12:44 -0000 1.1.2.9
+++ tk/lib/tk/canvastag.rb 22 Jan 2005 05:15:10 -0000
@@ -27,7 +27,7 @@
#end
def bind(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -42,7 +42,7 @@
#end
def bind_append(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tk/menu.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/menu.rb,v
retrieving revision 1.1.2.11
diff -u -r1.1.2.11 menu.rb
--- tk/lib/tk/menu.rb 8 Dec 2004 18:13:37 -0000 1.1.2.11
+++ tk/lib/tk/menu.rb 22 Jan 2005 05:15:10 -0000
@@ -438,6 +438,7 @@
parent = nil
if args[0].kind_of?(TkWindow) || args[0] == nil
+ keys.delete('parent') # ignore
parent = args.shift
else
parent = keys.delete('parent')
@@ -445,6 +446,7 @@
@variable = nil
if args[0].kind_of?(TkVariable) || args[0] == nil
+ keys.delete('variable') # ignore
@variable = args.shift
else
@variable = keys.delete('variable')
Index: tk/lib/tk/text.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/text.rb,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 text.rb
--- tk/lib/tk/text.rb 20 Dec 2004 05:10:33 -0000 1.1.2.17
+++ tk/lib/tk/text.rb 22 Jan 2005 05:15:10 -0000
@@ -589,7 +589,7 @@
#end
def tag_bind(tag, seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -604,7 +604,7 @@
#end
def tag_bind_append(tag, seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tk/texttag.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/texttag.rb,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 texttag.rb
--- tk/lib/tk/texttag.rb 17 Dec 2004 07:31:22 -0000 1.1.2.9
+++ tk/lib/tk/texttag.rb 22 Jan 2005 05:15:10 -0000
@@ -173,7 +173,7 @@
#end
def bind(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -188,7 +188,7 @@
#end
def bind_append(seq, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/blt/component.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/blt/component.rb,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 component.rb
--- tk/lib/tkextlib/blt/component.rb 23 Dec 2004 16:22:37 -0000 1.1.2.1
+++ tk/lib/tkextlib/blt/component.rb 22 Jan 2005 05:15:11 -0000
@@ -899,7 +899,7 @@
end
def _component_bind(target, tag, context, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -908,7 +908,7 @@
self
end
def _component_bind_append(target, tag, context, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/blt/tabset.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/blt/tabset.rb,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 tabset.rb
--- tk/lib/tkextlib/blt/tabset.rb 23 Dec 2004 16:22:37 -0000 1.1.2.1
+++ tk/lib/tkextlib/blt/tabset.rb 22 Jan 2005 05:15:11 -0000
@@ -78,7 +78,7 @@
#end
def bind(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -92,7 +92,7 @@
#end
def bind_append(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -243,7 +243,7 @@
#end
def tabbind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -257,7 +257,7 @@
#end
def tabbind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/blt/treeview.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/blt/treeview.rb,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 treeview.rb
--- tk/lib/tkextlib/blt/treeview.rb 23 Dec 2004 16:22:37 -0000 1.1.2.1
+++ tk/lib/tkextlib/blt/treeview.rb 22 Jan 2005 05:15:11 -0000
@@ -292,7 +292,7 @@
end
def tag_bind(tag, seq, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -301,7 +301,7 @@
self
end
def tag_bind_append(tag, seq, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -323,7 +323,7 @@
end
def button_bind(tag, seq, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -332,7 +332,7 @@
self
end
def button_bind_append(tag, seq, *args)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/bwidget/labelentry.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/bwidget/labelentry.rb,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 labelentry.rb
--- tk/lib/tkextlib/bwidget/labelentry.rb 16 Dec 2004 07:12:45 -0000 1.1.2.3
+++ tk/lib/tkextlib/bwidget/labelentry.rb 22 Jan 2005 05:15:11 -0000
@@ -29,7 +29,7 @@
#end
def entrybind(context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -44,7 +44,7 @@
#end
def entrybind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/bwidget/listbox.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/bwidget/listbox.rb,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 listbox.rb
--- tk/lib/tkextlib/bwidget/listbox.rb 16 Dec 2004 07:12:45 -0000 1.1.2.5
+++ tk/lib/tkextlib/bwidget/listbox.rb 22 Jan 2005 05:15:11 -0000
@@ -50,7 +50,7 @@
#end
def imagebind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -66,7 +66,7 @@
#end
def imagebind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -91,7 +91,7 @@
#end
def textbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -107,7 +107,7 @@
#end
def textbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/bwidget/notebook.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/bwidget/notebook.rb,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 notebook.rb
--- tk/lib/tkextlib/bwidget/notebook.rb 16 Dec 2004 07:12:45 -0000 1.1.2.5
+++ tk/lib/tkextlib/bwidget/notebook.rb 22 Jan 2005 05:15:11 -0000
@@ -47,7 +47,7 @@
#end
def tabbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -63,7 +63,7 @@
#end
def tabbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/bwidget/spinbox.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/bwidget/spinbox.rb,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 spinbox.rb
--- tk/lib/tkextlib/bwidget/spinbox.rb 16 Dec 2004 07:12:45 -0000 1.1.2.3
+++ tk/lib/tkextlib/bwidget/spinbox.rb 22 Jan 2005 05:15:11 -0000
@@ -28,7 +28,7 @@
#end
def entrybind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -43,7 +43,7 @@
#end
def entrybind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/bwidget/tree.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/bwidget/tree.rb,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 tree.rb
--- tk/lib/tkextlib/bwidget/tree.rb 16 Dec 2004 07:12:45 -0000 1.1.2.5
+++ tk/lib/tkextlib/bwidget/tree.rb 22 Jan 2005 05:15:11 -0000
@@ -47,7 +47,7 @@
#end
def imagebind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -63,7 +63,7 @@
#end
def imagebind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -88,7 +88,7 @@
#end
def textbind(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -104,7 +104,7 @@
#end
def textbind_append(context, *args)
#if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/itk/incr_tk.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/itk/incr_tk.rb,v
retrieving revision 1.1.2.7
diff -u -r1.1.2.7 incr_tk.rb
--- tk/lib/tkextlib/itk/incr_tk.rb 16 Dec 2004 07:12:45 -0000 1.1.2.7
+++ tk/lib/tkextlib/itk/incr_tk.rb 22 Jan 2005 05:15:11 -0000
@@ -351,7 +351,7 @@
end
end
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -380,7 +380,7 @@
end
end
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 scrolledcanvas.rb
--- tk/lib/tkextlib/iwidgets/scrolledcanvas.rb 16 Dec 2004 07:12:46 -0000 1.1.2.5
+++ tk/lib/tkextlib/iwidgets/scrolledcanvas.rb 22 Jan 2005 05:15:11 -0000
@@ -103,7 +103,7 @@
#end
def itembind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -118,7 +118,7 @@
#end
def itembind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/tkDND/tkdnd.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/tkDND/tkdnd.rb,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 tkdnd.rb
--- tk/lib/tkextlib/tkDND/tkdnd.rb 16 Dec 2004 07:12:46 -0000 1.1.2.5
+++ tk/lib/tkextlib/tkDND/tkdnd.rb 22 Jan 2005 05:15:11 -0000
@@ -89,7 +89,7 @@
#end
def dnd_bindtarget(type, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -129,7 +129,7 @@
#end
def dnd_bindsource(type, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/lib/tkextlib/treectrl/tktreectrl.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 tktreectrl.rb
--- tk/lib/tkextlib/treectrl/tktreectrl.rb 16 Dec 2004 07:12:47 -0000 1.1.2.8
+++ tk/lib/tkextlib/treectrl/tktreectrl.rb 22 Jan 2005 05:15:11 -0000
@@ -749,7 +749,7 @@
#end
def notify_bind(obj, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
@@ -764,7 +764,7 @@
#end
def notify_bind_append(obj, event, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
- if TkComm._callback_entry?(args[0])
+ if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
Index: tk/sample/tkextlib/tkHTML/ss.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/sample/tkextlib/tkHTML/ss.rb,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 ss.rb
--- tk/sample/tkextlib/tkHTML/ss.rb 11 Oct 2004 04:51:20 -0000 1.1.2.2
+++ tk/sample/tkextlib/tkHTML/ss.rb 22 Jan 2005 05:15:11 -0000
@@ -159,6 +159,8 @@
#
#
last_dir = Dir.pwd
+load_file = nil
+
sel_load = proc{
filetypes = [
['Html Files', ['.html', '.htm']],
--
永井 秀利 (九工大 知能情報)
nagai@ai.kyutech.ac.jp