tk 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/MANUAL_tcltklib.eng +0 -2
  4. data/MANUAL_tcltklib.ja +0 -2
  5. data/README.ActiveTcl +1 -1
  6. data/README.md +53 -1
  7. data/ext/tk/extconf.rb +4 -2
  8. data/ext/tk/old-extconf.rb +0 -1
  9. data/ext/tk/tcltklib.c +47 -149
  10. data/ext/tk/tkutil/extconf.rb +0 -2
  11. data/ext/tk/tkutil/tkutil.c +6 -9
  12. data/lib/multi-tk.rb +99 -320
  13. data/lib/remote-tk.rb +8 -25
  14. data/lib/tk.rb +49 -130
  15. data/lib/tk/autoload.rb +3 -3
  16. data/lib/tk/bgerror.rb +2 -2
  17. data/lib/tk/bindtag.rb +1 -1
  18. data/lib/tk/canvas.rb +7 -15
  19. data/lib/tk/canvastag.rb +11 -19
  20. data/lib/tk/entry.rb +1 -1
  21. data/lib/tk/font.rb +1 -1
  22. data/lib/tk/fontchooser.rb +1 -1
  23. data/lib/tk/grid.rb +4 -4
  24. data/lib/tk/image.rb +1 -1
  25. data/lib/tk/itemconfig.rb +4 -4
  26. data/lib/tk/itemfont.rb +3 -3
  27. data/lib/tk/listbox.rb +1 -1
  28. data/lib/tk/menu.rb +4 -4
  29. data/lib/tk/menuspec.rb +0 -1
  30. data/lib/tk/msgcat.rb +5 -5
  31. data/lib/tk/namespace.rb +14 -34
  32. data/lib/tk/optiondb.rb +3 -74
  33. data/lib/tk/optionobj.rb +1 -1
  34. data/lib/tk/scale.rb +3 -3
  35. data/lib/tk/scrollable.rb +4 -2
  36. data/lib/tk/selection.rb +5 -4
  37. data/lib/tk/text.rb +9 -17
  38. data/lib/tk/textmark.rb +1 -1
  39. data/lib/tk/texttag.rb +7 -15
  40. data/lib/tk/timer.rb +2 -2
  41. data/lib/tk/tk_mac.rb +18 -18
  42. data/lib/tk/validation.rb +6 -37
  43. data/lib/tk/variable.rb +10 -8
  44. data/lib/tk/virtevent.rb +1 -1
  45. data/lib/tk/winfo.rb +1 -1
  46. data/lib/tkextlib/blt/barchart.rb +0 -17
  47. data/lib/tkextlib/blt/bitmap.rb +1 -1
  48. data/lib/tkextlib/blt/component.rb +40 -40
  49. data/lib/tkextlib/blt/dragdrop.rb +6 -6
  50. data/lib/tkextlib/blt/graph.rb +0 -17
  51. data/lib/tkextlib/blt/stripchart.rb +0 -17
  52. data/lib/tkextlib/blt/tabset.rb +16 -31
  53. data/lib/tkextlib/blt/tree.rb +6 -6
  54. data/lib/tkextlib/blt/treeview.rb +14 -14
  55. data/lib/tkextlib/blt/watch.rb +1 -1
  56. data/lib/tkextlib/bwidget/labelentry.rb +6 -14
  57. data/lib/tkextlib/bwidget/listbox.rb +13 -29
  58. data/lib/tkextlib/bwidget/notebook.rb +6 -14
  59. data/lib/tkextlib/bwidget/progressdlg.rb +2 -2
  60. data/lib/tkextlib/bwidget/spinbox.rb +6 -14
  61. data/lib/tkextlib/bwidget/tree.rb +19 -35
  62. data/lib/tkextlib/itcl/incr_tcl.rb +2 -2
  63. data/lib/tkextlib/itk/incr_tk.rb +7 -29
  64. data/lib/tkextlib/iwidgets/calendar.rb +0 -15
  65. data/lib/tkextlib/iwidgets/entryfield.rb +1 -22
  66. data/lib/tkextlib/iwidgets/notebook.rb +2 -2
  67. data/lib/tkextlib/iwidgets/promptdialog.rb +1 -1
  68. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +6 -14
  69. data/lib/tkextlib/iwidgets/spinner.rb +1 -1
  70. data/lib/tkextlib/iwidgets/tabnotebook.rb +2 -2
  71. data/lib/tkextlib/iwidgets/tabset.rb +1 -1
  72. data/lib/tkextlib/pkg_checker.rb +1 -1
  73. data/lib/tkextlib/tcllib/crosshair.rb +2 -2
  74. data/lib/tkextlib/tcllib/ctext.rb +2 -2
  75. data/lib/tkextlib/tcllib/plotchart.rb +5 -5
  76. data/lib/tkextlib/tcllib/tablelist_core.rb +3 -3
  77. data/lib/tkextlib/tcllib/validator.rb +6 -6
  78. data/lib/tkextlib/tile.rb +1 -2
  79. data/lib/tkextlib/tile/style.rb +1 -1
  80. data/lib/tkextlib/tile/treeview.rb +15 -22
  81. data/lib/tkextlib/tkDND/tkdnd.rb +63 -24
  82. data/lib/tkextlib/tkHTML/htmlwidget.rb +1 -1
  83. data/lib/tkextlib/tktable/tktable.rb +2 -2
  84. data/lib/tkextlib/treectrl/tktreectrl.rb +13 -21
  85. data/lib/tkextlib/vu/pie.rb +1 -1
  86. data/sample/binding_sample.rb +2 -2
  87. data/sample/cmd_res_test.rb +1 -1
  88. data/sample/demos-en/widget +21 -21
  89. data/sample/demos-jp/widget +4 -4
  90. data/sample/multi-ip_sample.rb +0 -3
  91. data/sample/multi-ip_sample2.rb +1 -1
  92. data/sample/resource.en +3 -3
  93. data/sample/resource.ja +3 -3
  94. data/sample/tcltklib/sample1.rb +2 -2
  95. data/sample/tkballoonhelp.rb +2 -2
  96. data/sample/tkextlib/tkHTML/ss.rb +0 -6
  97. data/sample/tkmulticolumnlist.rb +2 -2
  98. data/sample/tkmultilistframe.rb +2 -2
  99. data/sample/tkoptdb.rb +14 -16
  100. data/tk.gemspec +7 -8
  101. metadata +13 -15
  102. data/ChangeLog.tkextlib +0 -949
  103. data/old-README.tcltklib.ja +0 -159
  104. data/sample/binstr_usage.rb +0 -46
  105. data/sample/remote-ip_sample2.rb +0 -57
  106. data/sample/safe-tk.rb +0 -132
  107. data/sample/tkoptdb-safeTk.rb +0 -74
  108. data/sample/tktree.rb +0 -104
  109. data/sample/tktree.tcl +0 -305
data/lib/remote-tk.rb CHANGED
@@ -13,8 +13,8 @@ class MultiTkIp; end
13
13
  class RemoteTkIp < MultiTkIp; end
14
14
 
15
15
  class MultiTkIp
16
- @@IP_TABLE = TkUtil.untrust({}) unless defined?(@@IP_TABLE)
17
- @@TK_TABLE_LIST = TkUtil.untrust([]) unless defined?(@@TK_TABLE_LIST)
16
+ @@IP_TABLE = {} unless defined?(@@IP_TABLE)
17
+ @@TK_TABLE_LIST = [] unless defined?(@@TK_TABLE_LIST)
18
18
  def self._IP_TABLE; @@IP_TABLE; end
19
19
  def self._TK_TABLE_LIST; @@TK_TABLE_LIST; end
20
20
 
@@ -87,39 +87,25 @@ class RemoteTkIp
87
87
  @slave_ip_tbl = {}
88
88
  @slave_ip_top = {}
89
89
 
90
- @force_default_encoding ||= TkUtil.untrust([false])
91
- @encoding ||= TkUtil.untrust([nil])
90
+ @force_default_encoding ||= [false]
91
+ @encoding ||= [nil]
92
92
  def @encoding.to_s; self.join(nil); end
93
93
 
94
- TkUtil.untrust(@tk_windows) unless @tk_windows.tainted?
95
- TkUtil.untrust(@tk_table_list) unless @tk_table_list.tainted?
96
- TkUtil.untrust(@slave_ip_tbl) unless @slave_ip_tbl.tainted?
97
- TkUtil.untrust(@slave_ip_top) unless @slave_ip_top.tainted?
98
-
99
94
  @system = Object.new
100
95
 
101
96
  @threadgroup = ThreadGroup.new
102
97
 
103
- @safe_level = [$SAFE]
98
+ @safe_level = [0]
104
99
 
105
100
  @wait_on_mainloop = [true, 0]
106
101
 
107
102
  @cmd_queue = Queue.new
108
103
 
109
- =begin
110
- @cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog()
111
-
112
- @threadgroup.add @cmd_receiver
113
- @threadgroup.add @receiver_watchdog
114
-
115
- @threadgroup.enclose
116
- =end
117
104
  @@DEFAULT_MASTER.assign_receiver_and_watchdog(self)
118
105
 
119
106
  @@IP_TABLE[@threadgroup] = self
120
107
  @@TK_TABLE_LIST.size.times{
121
- (tbl = {}).tainted? || TkUtil.untrust(tbl)
122
- @tk_table_list << tbl
108
+ @tk_table_list << {}
123
109
  }
124
110
 
125
111
  @ret_val = TkVariable.new
@@ -198,9 +184,6 @@ class RemoteTkIp
198
184
  raise SecurityError, "no permission to manipulate" unless self.manipulable?
199
185
 
200
186
  p ['_appsend', [@remote, @displayof], enc_mode, async, cmds] if $DEBUG
201
- if $SAFE >= 1 && cmds.find{|obj| obj.tainted?}
202
- fail SecurityError, "cannot send tainted commands at level #{$SAFE}"
203
- end
204
187
 
205
188
  cmds = @interp._merge_tklist(*TkUtil::_conv_args([], enc_mode, *cmds))
206
189
  if @displayof
@@ -287,7 +270,7 @@ class RemoteTkIp
287
270
  false
288
271
  end
289
272
 
290
- def allow_ruby_exit= (mode)
273
+ def allow_ruby_exit=(mode)
291
274
  fail RuntimeError, 'cannot change mode of the remote interpreter'
292
275
  end
293
276
 
@@ -376,7 +359,7 @@ class RemoteTkIp
376
359
  end
377
360
 
378
361
  def _thread_vwait(var_name)
379
- _appsend(false, 'thread_vwait', varname)
362
+ _appsend(false, 'thread_vwait', var_name)
380
363
  end
381
364
 
382
365
  def _thread_tkwait(mode, target)
data/lib/tk.rb CHANGED
@@ -31,8 +31,8 @@ class TclTkIp
31
31
  def initialize(*args)
32
32
  __initialize__(*args)
33
33
 
34
- @force_default_encoding ||= TkUtil.untrust([false])
35
- @encoding ||= TkUtil.untrust([nil])
34
+ @force_default_encoding ||= [false]
35
+ @encoding ||= [nil]
36
36
  def @encoding.to_s; self.join(nil); end
37
37
  end
38
38
  end
@@ -42,8 +42,8 @@ module TkComm
42
42
  include TkUtil
43
43
  extend TkUtil
44
44
 
45
- WidgetClassNames = TkUtil.untrust({})
46
- TkExtlibAutoloadModule = TkUtil.untrust([])
45
+ WidgetClassNames = {}
46
+ TkExtlibAutoloadModule = []
47
47
 
48
48
  # None = Object.new ### --> definition is moved to TkUtil module
49
49
  # def None.to_s
@@ -54,8 +54,8 @@ module TkComm
54
54
  #Tk_CMDTBL = {}
55
55
  #Tk_WINDOWS = {}
56
56
  Tk_IDs = [
57
- TkUtil.untrust("00000"), # [0]-cmdid
58
- TkUtil.untrust("00000") # [1]-winid
57
+ "00000", # [0]-cmdid
58
+ "00000" # [1]-winid
59
59
  ]
60
60
  Tk_IDs.instance_eval{
61
61
  @mutex = Mutex.new
@@ -76,7 +76,7 @@ module TkComm
76
76
  Tk_WINDOWS.freeze
77
77
 
78
78
  self.instance_eval{
79
- @cmdtbl = TkUtil.untrust([])
79
+ @cmdtbl = []
80
80
  }
81
81
 
82
82
  unless const_defined?(:GET_CONFIGINFO_AS_ARRAY)
@@ -818,7 +818,7 @@ end
818
818
 
819
819
  def _curr_cmd_id
820
820
  #id = format("c%.4d", Tk_IDs[0])
821
- id = "c" + TkCore::INTERP._ip_id_ + TkComm::Tk_IDs[0]
821
+ "c" + TkCore::INTERP._ip_id_ + TkComm::Tk_IDs[0]
822
822
  end
823
823
  def _next_cmd_id
824
824
  TkComm::Tk_IDs.mutex.synchronize{
@@ -848,7 +848,6 @@ end
848
848
  TkCore::INTERP.tk_cmd_tbl[id] = TkCore::INTERP.get_cb_entry(cmd)
849
849
  end
850
850
  @cmdtbl = [] unless defined? @cmdtbl
851
- TkUtil.untrust(@cmdtbl) unless @cmdtbl.tainted?
852
851
  @cmdtbl.push id
853
852
 
854
853
  if local_cmdtbl && local_cmdtbl.kind_of?(Array)
@@ -1070,31 +1069,23 @@ module TkComm
1070
1069
  :_bind_append_for_event_class, :_bind_remove_for_event_class,
1071
1070
  :_bindinfo_for_event_class
1072
1071
 
1073
- #def bind(tagOrClass, context, cmd=Proc.new, *args)
1074
- # _bind(["bind", tagOrClass], context, cmd, *args)
1075
- # tagOrClass
1076
- #end
1077
- def bind(tagOrClass, context, *args)
1072
+ def bind(tagOrClass, context, *args, &block)
1078
1073
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1079
- if TkComm._callback_entry?(args[0]) || !block_given?
1074
+ if TkComm._callback_entry?(args[0]) || !block
1080
1075
  cmd = args.shift
1081
1076
  else
1082
- cmd = Proc.new
1077
+ cmd = block
1083
1078
  end
1084
1079
  _bind(["bind", tagOrClass], context, cmd, *args)
1085
1080
  tagOrClass
1086
1081
  end
1087
1082
 
1088
- #def bind_append(tagOrClass, context, cmd=Proc.new, *args)
1089
- # _bind_append(["bind", tagOrClass], context, cmd, *args)
1090
- # tagOrClass
1091
- #end
1092
- def bind_append(tagOrClass, context, *args)
1083
+ def bind_append(tagOrClass, context, *args, &block)
1093
1084
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1094
- if TkComm._callback_entry?(args[0]) || !block_given?
1085
+ if TkComm._callback_entry?(args[0]) || !block
1095
1086
  cmd = args.shift
1096
1087
  else
1097
- cmd = Proc.new
1088
+ cmd = block
1098
1089
  end
1099
1090
  _bind_append(["bind", tagOrClass], context, cmd, *args)
1100
1091
  tagOrClass
@@ -1109,31 +1100,23 @@ module TkComm
1109
1100
  _bindinfo(['bind', tagOrClass], context)
1110
1101
  end
1111
1102
 
1112
- #def bind_all(context, cmd=Proc.new, *args)
1113
- # _bind(['bind', 'all'], context, cmd, *args)
1114
- # TkBindTag::ALL
1115
- #end
1116
- def bind_all(context, *args)
1103
+ def bind_all(context, *args, &block)
1117
1104
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1118
- if TkComm._callback_entry?(args[0]) || !block_given?
1105
+ if TkComm._callback_entry?(args[0]) || !block
1119
1106
  cmd = args.shift
1120
1107
  else
1121
- cmd = Proc.new
1108
+ cmd = block
1122
1109
  end
1123
1110
  _bind(['bind', 'all'], context, cmd, *args)
1124
1111
  TkBindTag::ALL
1125
1112
  end
1126
1113
 
1127
- #def bind_append_all(context, cmd=Proc.new, *args)
1128
- # _bind_append(['bind', 'all'], context, cmd, *args)
1129
- # TkBindTag::ALL
1130
- #end
1131
- def bind_append_all(context, *args)
1114
+ def bind_append_all(context, *args, &block)
1132
1115
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
1133
- if TkComm._callback_entry?(args[0]) || !block_given?
1116
+ if TkComm._callback_entry?(args[0]) || !block
1134
1117
  cmd = args.shift
1135
1118
  else
1136
- cmd = Proc.new
1119
+ cmd = block
1137
1120
  end
1138
1121
  _bind_append(['bind', 'all'], context, cmd, *args)
1139
1122
  TkBindTag::ALL
@@ -1227,7 +1210,7 @@ module TkCore
1227
1210
  =end
1228
1211
  end
1229
1212
  else
1230
- RUN_EVENTLOOP_ON_MAIN_THREAD = false
1213
+ RUN_EVENTLOOP_ON_MAIN_THREAD = true
1231
1214
  end
1232
1215
 
1233
1216
  else # Ruby 1.8.x
@@ -1363,11 +1346,10 @@ EOS
1363
1346
  end
1364
1347
 
1365
1348
  INTERP.instance_eval{
1366
- # @tk_cmd_tbl = TkUtil.untrust({})
1367
1349
  @tk_cmd_tbl =
1368
- TkUtil.untrust(Hash.new{|hash, key|
1350
+ Hash.new{|hash, key|
1369
1351
  fail IndexError, "unknown command ID '#{key}'"
1370
- })
1352
+ }
1371
1353
  def @tk_cmd_tbl.[]=(idx,val)
1372
1354
  if self.has_key?(idx) && Thread.current.group != ThreadGroup::Default
1373
1355
  fail SecurityError,"cannot change the entried command"
@@ -1375,15 +1357,15 @@ EOS
1375
1357
  super(idx,val)
1376
1358
  end
1377
1359
 
1378
- @tk_windows = TkUtil.untrust({})
1360
+ @tk_windows = {}
1379
1361
 
1380
- @tk_table_list = TkUtil.untrust([])
1362
+ @tk_table_list = []
1381
1363
 
1382
- @init_ip_env = TkUtil.untrust([]) # table of Procs
1383
- @add_tk_procs = TkUtil.untrust([]) # table of [name, args, body]
1364
+ @init_ip_env = [] # table of Procs
1365
+ @add_tk_procs = [] # table of [name, args, body]
1384
1366
 
1385
- @force_default_encoding ||= TkUtil.untrust([false])
1386
- @encoding ||= TkUtil.untrust([nil])
1367
+ @force_default_encoding ||= [false]
1368
+ @encoding ||= [nil]
1387
1369
  def @encoding.to_s; self.join(nil); end
1388
1370
 
1389
1371
  @cb_entry_class = Class.new(TkCallbackEntry){
@@ -1437,15 +1419,7 @@ EOS
1437
1419
  end
1438
1420
  def INTERP.create_table
1439
1421
  id = @tk_table_list.size
1440
- (tbl = {}).tainted? || TkUtil.untrust(tbl)
1441
- @tk_table_list << tbl
1442
- # obj = Object.new
1443
- # obj.instance_eval <<-EOD
1444
- # def self.method_missing(m, *args)
1445
- # TkCore::INTERP.tk_object_table(#{id}).send(m, *args)
1446
- # end
1447
- # EOD
1448
- # return obj
1422
+ @tk_table_list << {}
1449
1423
  Tk_OBJECT_TABLE.new(id)
1450
1424
  end
1451
1425
 
@@ -1456,7 +1430,8 @@ EOS
1456
1430
  TkUtil._get_eval_string(TkUtil.eval_cmd(cmd, *args))
1457
1431
  end
1458
1432
 
1459
- def INTERP.init_ip_env(script = Proc.new)
1433
+ def INTERP.init_ip_env(script = (use_block = true), &block)
1434
+ script = block if use_block
1460
1435
  @init_ip_env << script
1461
1436
  script.call(self)
1462
1437
  end
@@ -1684,57 +1659,21 @@ EOS
1684
1659
  bool(tk_call('auto_load', tk_cmd))
1685
1660
  end
1686
1661
 
1687
- def after(ms, cmd=Proc.new)
1662
+ def after(ms, cmd=nil, &block)
1663
+ cmd ||= block
1688
1664
  cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
1689
1665
  after_id = tk_call_without_enc("after",ms,cmdid)
1690
1666
  after_id.instance_variable_set('@cmdid', cmdid)
1691
1667
  after_id
1692
1668
  end
1693
- =begin
1694
- def after(ms, cmd=Proc.new)
1695
- crit_bup = Thread.critical
1696
- Thread.critical = true
1697
-
1698
- myid = _curr_cmd_id
1699
- cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(myid); ret})
1700
-
1701
- Thread.critical = crit_bup
1702
-
1703
- tk_call_without_enc("after",ms,cmdid) # return id
1704
- # return
1705
- # if false #defined? Thread
1706
- # Thread.start do
1707
- # ms = Float(ms)/1000
1708
- # ms = 10 if ms == 0
1709
- # sleep ms/1000
1710
- # cmd.call
1711
- # end
1712
- # else
1713
- # cmdid = install_cmd(cmd)
1714
- # tk_call("after",ms,cmdid)
1715
- # end
1716
- end
1717
- =end
1718
1669
 
1719
- def after_idle(cmd=Proc.new)
1670
+ def after_idle(cmd=nil, &block)
1671
+ cmd ||= block
1720
1672
  cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(cmdid); ret})
1721
1673
  after_id = tk_call_without_enc('after','idle',cmdid)
1722
1674
  after_id.instance_variable_set('@cmdid', cmdid)
1723
1675
  after_id
1724
1676
  end
1725
- =begin
1726
- def after_idle(cmd=Proc.new)
1727
- crit_bup = Thread.critical
1728
- Thread.critical = true
1729
-
1730
- myid = _curr_cmd_id
1731
- cmdid = install_cmd(proc{ret = cmd.call;uninstall_cmd(myid); ret})
1732
-
1733
- Thread.critical = crit_bup
1734
-
1735
- tk_call_without_enc('after','idle',cmdid)
1736
- end
1737
- =end
1738
1677
 
1739
1678
  def after_cancel(afterId)
1740
1679
  tk_call_without_enc('after','cancel',afterId)
@@ -1786,9 +1725,6 @@ EOS
1786
1725
  end
1787
1726
 
1788
1727
  def appsend(interp, async, *args)
1789
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
1790
- fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
1791
- end
1792
1728
  if async != true && async != false && async != nil
1793
1729
  args.unshift(async)
1794
1730
  async = false
@@ -1801,9 +1737,6 @@ EOS
1801
1737
  end
1802
1738
 
1803
1739
  def rb_appsend(interp, async, *args)
1804
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
1805
- fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
1806
- end
1807
1740
  if async != true && async != false && async != nil
1808
1741
  args.unshift(async)
1809
1742
  async = false
@@ -1817,9 +1750,6 @@ EOS
1817
1750
  end
1818
1751
 
1819
1752
  def appsend_displayof(interp, win, async, *args)
1820
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
1821
- fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}"
1822
- end
1823
1753
  win = '.' if win == nil
1824
1754
  if async != true && async != false && async != nil
1825
1755
  args.unshift(async)
@@ -1833,9 +1763,6 @@ EOS
1833
1763
  end
1834
1764
 
1835
1765
  def rb_appsend_displayof(interp, win, async, *args)
1836
- if $SAFE >= 1 && args.find{|obj| obj.tainted?}
1837
- fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}"
1838
- end
1839
1766
  win = '.' if win == nil
1840
1767
  if async != true && async != false && async != nil
1841
1768
  args.unshift(async)
@@ -2085,7 +2012,6 @@ EOS
2085
2012
  puts 'invoke args => ' + args.inspect if $DEBUG
2086
2013
  ### print "=> ", args.join(" ").inspect, "\n" if $DEBUG
2087
2014
  begin
2088
- # res = TkUtil.untrust(INTERP._invoke(*args))
2089
2015
  # res = INTERP._invoke(enc_mode, *args)
2090
2016
  res = _ip_invoke_core(enc_mode, *args)
2091
2017
  # >>>>> _invoke returns a TAINTED string <<<<<
@@ -2093,7 +2019,6 @@ EOS
2093
2019
  # err = $!
2094
2020
  begin
2095
2021
  args.unshift "unknown"
2096
- #res = TkUtil.untrust(INTERP._invoke(*args))
2097
2022
  #res = INTERP._invoke(enc_mode, *args)
2098
2023
  res = _ip_invoke_core(enc_mode, *args)
2099
2024
  # >>>>> _invoke returns a TAINTED string <<<<<
@@ -3383,28 +3308,22 @@ end
3383
3308
 
3384
3309
 
3385
3310
  module TkBindCore
3386
- #def bind(context, cmd=Proc.new, *args)
3387
- # Tk.bind(self, context, cmd, *args)
3388
- #end
3389
- def bind(context, *args)
3311
+ def bind(context, *args, &block)
3390
3312
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
3391
- if TkComm._callback_entry?(args[0]) || !block_given?
3313
+ if TkComm._callback_entry?(args[0]) || !block
3392
3314
  cmd = args.shift
3393
3315
  else
3394
- cmd = Proc.new
3316
+ cmd = block
3395
3317
  end
3396
3318
  Tk.bind(self, context, cmd, *args)
3397
3319
  end
3398
3320
 
3399
- #def bind_append(context, cmd=Proc.new, *args)
3400
- # Tk.bind_append(self, context, cmd, *args)
3401
- #end
3402
- def bind_append(context, *args)
3321
+ def bind_append(context, *args, &block)
3403
3322
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
3404
- if TkComm._callback_entry?(args[0]) || !block_given?
3323
+ if TkComm._callback_entry?(args[0]) || !block
3405
3324
  cmd = args.shift
3406
3325
  else
3407
- cmd = Proc.new
3326
+ cmd = block
3408
3327
  end
3409
3328
  Tk.bind_append(self, context, cmd, *args)
3410
3329
  end
@@ -3568,7 +3487,7 @@ module TkTreatFont
3568
3487
  else
3569
3488
  begin
3570
3489
  tk_call(*(__config_cmd << "-#{optkey}" << ltn))
3571
- rescue => e
3490
+ rescue
3572
3491
  # ignore
3573
3492
  end
3574
3493
  end
@@ -3628,7 +3547,7 @@ module TkTreatFont
3628
3547
  else
3629
3548
  begin
3630
3549
  tk_call(*(__config_cmd << "-#{optkey}" << knj))
3631
- rescue => e
3550
+ rescue
3632
3551
  # ignore
3633
3552
  end
3634
3553
  end
@@ -3885,7 +3804,7 @@ module TkConfigMethod
3885
3804
  fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
3886
3805
  end
3887
3806
 
3888
- alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
3807
+ _, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
3889
3808
  if real_name
3890
3809
  slot = real_name.to_s
3891
3810
  end
@@ -4029,7 +3948,7 @@ module TkConfigMethod
4029
3948
  fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
4030
3949
  end
4031
3950
 
4032
- alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
3951
+ _, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
4033
3952
  if real_name
4034
3953
  slot = real_name.to_s
4035
3954
  end
@@ -4132,7 +4051,7 @@ module TkConfigMethod
4132
4051
  if slot
4133
4052
  slot = slot.to_s
4134
4053
 
4135
- alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
4054
+ _, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
4136
4055
  if real_name
4137
4056
  slot = real_name.to_s
4138
4057
  end
@@ -4512,7 +4431,7 @@ module TkConfigMethod
4512
4431
  if slot
4513
4432
  slot = slot.to_s
4514
4433
 
4515
- alias_name, real_name = __optkey_aliases.find{|k,var| k.to_s == slot}
4434
+ _, real_name = __optkey_aliases.find{|k,var| k.to_s == slot}
4516
4435
  if real_name
4517
4436
  slot = real_name.to_s
4518
4437
  end
@@ -5592,7 +5511,7 @@ class TkWindow<TkObject
5592
5511
  if cmd
5593
5512
  configure_cmd('command', cmd)
5594
5513
  elsif b
5595
- configure_cmd('command', Proc.new(&b))
5514
+ configure_cmd('command', b)
5596
5515
  else
5597
5516
  cget('command')
5598
5517
  end