tk 0.1.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c8897622f3700514a9e7ad8043b4379dbd43da20
4
- data.tar.gz: 05fd0ff84cac88b0b41e46bc0e14125dd5571c35
2
+ SHA256:
3
+ metadata.gz: e1347bf6638e8e5c8ad7de473d26b0c8b3d2f4b8a2c195696c24c19d652cb426
4
+ data.tar.gz: c52bc29bd1d742bc707c7d53f82c564355c32c43dd64e19a2b4df8ed63b9bbab
5
5
  SHA512:
6
- metadata.gz: 78b5de22c78d924fbe1cbcda6a97310e24f6ce2d16914a1ec66331827199aefefeb72406f14c7063e98bdf6f1f7c28283bba2d52aa150ed56b73d320e8daf077
7
- data.tar.gz: c982efd3c7b674e2c71a4c9815bbef3cd78d9b342ee9bd2a3968d1b1885d54c053716b778eab3e28f813f5717f841f1f7b3cc2335b8259e7812a4ca5e81fdc09
6
+ metadata.gz: 47633e9b2b38bbde90c157d6fec882ea7747180de3ac28bbec7d0d8671ec709cf9a0cdff5335186e192b3fdf72c7f4b6de68479b8307d6ea426ba47e3de35482
7
+ data.tar.gz: 7fb2f1dea579e612ea57eddd8136f855c68b4845d550559c136ca5e92e8c4af1fe437544721763b71f50df5d60e0c19de7ea01f4eb602e7cf177862cc94d0381
data/.gitignore CHANGED
@@ -7,4 +7,6 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /lib/*.so
11
+ /*.gem
10
12
  *.bundle
data/MANUAL_tcltklib.eng CHANGED
@@ -171,8 +171,6 @@ module TclTklib
171
171
  : a target event.
172
172
  : If set DONT_WAIT flag and no event for processing, returns
173
173
  : false immediately.
174
- : If $SAFE >= 1 and the flag is tainted,
175
- : force to set DONT_WAIT flag.
176
174
 
177
175
  set_eventloop_tick(timer_tick)
178
176
  : Define the interval of thread-switching with an integer
data/MANUAL_tcltklib.ja CHANGED
@@ -272,8 +272,6 @@ require "tcltklib" すると, 以下のモジュール, クラスが利用可能
272
272
  : 象となっている種類のイベントが発生するまで待ち続ける.
273
273
  : DONT_WAIT を指定していた場合,処理対象イベントがなくても
274
274
  : すぐに終了し false を返す.
275
- : $SAFE >= 1 かつ flag が汚染されているならば
276
- : flag には DONT_WAIT が強制的に付けられる.
277
275
 
278
276
  set_eventloop_tick(timer_tick)
279
277
  : イベントループと同時に別スレッドが稼働している場合に,時
data/README.ActiveTcl CHANGED
@@ -1,6 +1,6 @@
1
1
  ActiveTcl is ActiveState's quality-assured distribution of Tcl.
2
2
 
3
- # see <http://www.activestate.com/Products/ActiveTcl/>
3
+ # see <https://www.activestate.com/products/tcl/tcl-tk-modules/>
4
4
  # <http://www.tcl.tk/>
5
5
 
6
6
  First of all, please try to configure without any options.
data/README.md CHANGED
@@ -18,6 +18,49 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install tk
20
20
 
21
+ ## Documentation
22
+
23
+ ### Read this first
24
+
25
+ If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
26
+ which is working correctly. When you have some troubles on compiling,
27
+ please read [README.tcltklib] and [README.ActiveTcl].
28
+
29
+ Even if there is a tcltklib.so on your Ruby library directory, it will not
30
+ work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
31
+ You must also check that your Tcl/Tk is installed properly.
32
+
33
+ --------------------------------------------
34
+
35
+ Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく動いていな
36
+ ければなりません.コンパイル時に何か問題が生じた場合は,[README.tcltklib]
37
+ や [README.ActiveTcl] を見てください.
38
+
39
+ たとえ Ruby のライブラリディレクトリに tcltklib.so が存在していたとして
40
+ も,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) がなければ機能しま
41
+ せん.Tcl/Tk が正しくインストールされているかもチェックしてください.
42
+
43
+ <tt>==========================================================
44
+ Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)</tt>
45
+
46
+ ### Manual
47
+
48
+ - [Manual tcltklib, in English](MANUAL_tcltklib.eng)
49
+ - [Manual tcltklib, in Japanese](MANUAL_tcltklib.ja)
50
+
51
+ ### Other documents
52
+
53
+ [README.tcltklib] for compilation instructions.
54
+
55
+ [README.fork] is a note on forking.
56
+
57
+ [README.macosx-aqua] is about MacOS X Aqua usage.
58
+
59
+ [README.tcltklib]: README.tcltklib
60
+ [README.ActiveTcl]: README.ActiveTcl
61
+ [README.fork]: README.fork
62
+ [README.macosx-aqua]: README.macosx-aqua
63
+
21
64
  ## Development
22
65
 
23
66
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -26,7 +69,16 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
26
69
 
27
70
  ## Contributing
28
71
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/tk.
72
+ Your contributions are welcome on GitHub at https://github.com/ruby/tk.
73
+
74
+ Unfortunately we have no resource to handle issue reports.
75
+
76
+ Therefore please open pull request with either:
77
+
78
+ - a bug report with a correction patch or
79
+ - (at least) a reproducible code snippet for an issue in form of a test/spec.
80
+
81
+ Thank you in advance!
30
82
 
31
83
  ## License
32
84
 
data/ext/tk/extconf.rb CHANGED
@@ -5,6 +5,8 @@
5
5
  ##############################################################
6
6
  require 'mkmf'
7
7
 
8
+ $CFLAGS << " -DNO_TAINT" if RUBY_VERSION >= '2.7'
9
+
8
10
  TkLib_Config = {}
9
11
  TkLib_Config['search_versions'] =
10
12
  # %w[8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6 4.2]
@@ -1810,8 +1812,8 @@ end
1810
1812
  # check header file
1811
1813
  print("check functions.")
1812
1814
 
1813
- %w"ruby_native_thread_p rb_errinfo rb_safe_level rb_hash_lookup
1814
- rb_proc_new rb_obj_untrust rb_obj_taint rb_set_safe_level_force
1815
+ %w"ruby_native_thread_p rb_errinfo rb_hash_lookup
1816
+ rb_proc_new
1815
1817
  rb_sourcefile rb_thread_alive_p rb_thread_check_trap_pending
1816
1818
  ruby_enc_find_basename
1817
1819
  ".each do |func|
@@ -8,7 +8,6 @@ is_win32 = (/mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM)
8
8
 
9
9
  have_func("ruby_native_thread_p", "ruby.h")
10
10
  have_func("rb_errinfo", "ruby.h")
11
- have_func("rb_safe_level", "ruby.h")
12
11
  have_struct_member("struct RArray", "ptr", "ruby.h")
13
12
  have_struct_member("struct RArray", "len", "ruby.h")
14
13
 
data/ext/tk/tcltklib.c CHANGED
@@ -46,11 +46,15 @@ int rb_thread_check_trap_pending(void);
46
46
  #define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
47
47
  #endif
48
48
 
49
+ #ifdef NO_TAINT
50
+ #define RbTk_OBJ_UNTRUST(x) do {} while (0)
51
+ #else
49
52
  #ifdef OBJ_UNTRUST
50
53
  #define RbTk_OBJ_UNTRUST(x) do {OBJ_TAINT(x); OBJ_UNTRUST(x);} while (0)
51
54
  #else
52
55
  #define RbTk_OBJ_UNTRUST(x) OBJ_TAINT(x)
53
56
  #endif
57
+ #endif
54
58
  #define RbTk_ALLOC_N(type, n) (type *)ckalloc((int)(sizeof(type) * (n)))
55
59
 
56
60
  #if defined(HAVE_RB_PROC_NEW) && !defined(RUBY_VM)
@@ -97,9 +101,6 @@ extern VALUE rb_proc_new _((VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg]
97
101
  #else
98
102
  VALUE rb_errinfo(void);
99
103
  #endif
100
- #ifndef HAVE_RB_SAFE_LEVEL
101
- #define rb_safe_level() (ruby_safe_level+0)
102
- #endif
103
104
  #ifndef HAVE_RB_SOURCEFILE
104
105
  #define rb_sourcefile() (ruby_sourcefile+0)
105
106
  #endif
@@ -255,7 +256,6 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
255
256
  static VALUE ip_invoke _((int, VALUE*, VALUE));
256
257
  static VALUE ip_invoke_with_position _((int, VALUE*, VALUE, Tcl_QueuePosition));
257
258
  static VALUE tk_funcall _((VALUE(), int, VALUE*, VALUE));
258
- static VALUE callq_safelevel_handler _((VALUE, VALUE));
259
259
 
260
260
  /* Tcl's object type */
261
261
  #if TCL_MAJOR_VERSION >= 8
@@ -420,7 +420,6 @@ struct invoke_queue {
420
420
  #endif
421
421
  VALUE interp;
422
422
  int *done;
423
- int safe_level;
424
423
  VALUE result;
425
424
  VALUE thread;
426
425
  };
@@ -431,7 +430,6 @@ struct eval_queue {
431
430
  int len;
432
431
  VALUE interp;
433
432
  int *done;
434
- int safe_level;
435
433
  VALUE result;
436
434
  VALUE thread;
437
435
  };
@@ -443,7 +441,6 @@ struct call_queue {
443
441
  VALUE *argv;
444
442
  VALUE interp;
445
443
  int *done;
446
- int safe_level;
447
444
  VALUE result;
448
445
  VALUE thread;
449
446
  };
@@ -2441,7 +2438,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
2441
2438
  if (NIL_P(rb_errinfo())) {
2442
2439
  rb_exc_raise(rb_exc_new2(rb_eFatal, "FATAL"));
2443
2440
  } else {
2444
- rb_exc_raise(rb_errinfo());
2441
+ rb_jump_tag(TAG_FATAL);
2445
2442
  }
2446
2443
  }
2447
2444
  }
@@ -3620,10 +3617,10 @@ ip_ruby_cmd(clientData, interp, argc, argv)
3620
3617
  VALUE s;
3621
3618
  #if TCL_MAJOR_VERSION >= 8
3622
3619
  str = Tcl_GetStringFromObj(argv[i], &len);
3623
- s = rb_tainted_str_new(str, len);
3620
+ s = rb_str_new(str, len);
3624
3621
  #else /* TCL_MAJOR_VERSION < 8 */
3625
3622
  str = argv[i];
3626
- s = rb_tainted_str_new2(str);
3623
+ s = rb_str_new2(str);
3627
3624
  #endif
3628
3625
  DUMP2("arg:%s",str);
3629
3626
  rb_ary_push(args, s);
@@ -6254,19 +6251,25 @@ ip_init(argc, argv, self)
6254
6251
  st = ruby_tcl_stubs_init();
6255
6252
  /* from Tcl_AppInit() */
6256
6253
  if (with_tk) {
6254
+ const char *error;
6257
6255
  DUMP1("Tk_Init");
6258
6256
  st = ruby_tk_stubs_init(ptr->ip);
6257
+ if (st != TCLTK_STUBS_OK) {
6258
+ error = Tcl_GetStringResult(ptr->ip);
6259
+ ip_finalize(ptr->ip);
6260
+ Tcl_DeleteInterp(ptr->ip);
6261
+ Tcl_Release(ptr->ip);
6262
+ ptr->ip = (Tcl_Interp*)NULL;
6263
+ }
6259
6264
  switch(st) {
6260
6265
  case TCLTK_STUBS_OK:
6261
6266
  break;
6262
6267
  case NO_Tk_Init:
6263
6268
  rb_raise(rb_eLoadError, "tcltklib: can't find Tk_Init()");
6264
6269
  case FAIL_Tk_Init:
6265
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_Init(). %s",
6266
- Tcl_GetStringResult(ptr->ip));
6270
+ rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_Init(). %s", error);
6267
6271
  case FAIL_Tk_InitStubs:
6268
- rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_InitStubs(). %s",
6269
- Tcl_GetStringResult(ptr->ip));
6272
+ rb_raise(rb_eRuntimeError, "tcltklib: fail to Tk_InitStubs(). %s", error);
6270
6273
  default:
6271
6274
  rb_raise(rb_eRuntimeError, "tcltklib: unknown error(%d) on ruby_tk_stubs_init", st);
6272
6275
  }
@@ -6946,24 +6949,10 @@ ip_get_result_string_obj(interp)
6946
6949
  Tcl_DecrRefCount(retObj);
6947
6950
  return strval;
6948
6951
  #else
6949
- return rb_tainted_str_new2(interp->result);
6952
+ return rb_str_new2(interp->result);
6950
6953
  #endif
6951
6954
  }
6952
6955
 
6953
- /* call Tcl/Tk functions on the eventloop thread */
6954
- static VALUE
6955
- callq_safelevel_handler(arg, callq)
6956
- VALUE arg;
6957
- VALUE callq;
6958
- {
6959
- struct call_queue *q;
6960
-
6961
- Data_Get_Struct(callq, struct call_queue, q);
6962
- DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
6963
- rb_set_safe_level(q->safe_level);
6964
- return((q->func)(q->interp, q->argc, q->argv));
6965
- }
6966
-
6967
6956
  static int call_queue_handler _((Tcl_Event *, int));
6968
6957
  static int
6969
6958
  call_queue_handler(evPtr, flags)
@@ -7006,19 +6995,9 @@ call_queue_handler(evPtr, flags)
7006
6995
  /* incr internal handler mark */
7007
6996
  rbtk_internal_eventloop_handler++;
7008
6997
 
7009
- /* check safe-level */
7010
- if (rb_safe_level() != q->safe_level) {
7011
- /* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */
7012
- q_dat = Data_Wrap_Struct(0,call_queue_mark,-1,q);
7013
- ret = rb_funcall(rb_proc_new(callq_safelevel_handler, q_dat),
7014
- ID_call, 0);
7015
- rb_gc_force_recycle(q_dat);
7016
- q_dat = (VALUE)NULL;
7017
- } else {
7018
- DUMP2("call function (for caller thread:%"PRIxVALUE")", thread);
7019
- DUMP2("call function (current thread:%"PRIxVALUE")", rb_thread_current());
7020
- ret = (q->func)(q->interp, q->argc, q->argv);
7021
- }
6998
+ DUMP2("call function (for caller thread:%"PRIxVALUE")", thread);
6999
+ DUMP2("call function (current thread:%"PRIxVALUE")", rb_thread_current());
7000
+ ret = (q->func)(q->interp, q->argc, q->argv);
7022
7001
 
7023
7002
  /* set result */
7024
7003
  RARRAY_ASET(q->result, 0, ret);
@@ -7155,7 +7134,6 @@ tk_funcall(func, argc, argv, obj)
7155
7134
  callq->interp = ip_obj;
7156
7135
  callq->result = result;
7157
7136
  callq->thread = current;
7158
- callq->safe_level = rb_safe_level();
7159
7137
  callq->ev.proc = call_queue_handler;
7160
7138
 
7161
7139
  /* add the handler to Tcl event queue */
@@ -7303,7 +7281,7 @@ ip_eval_real(self, cmd_str, cmd_len)
7303
7281
  Tcl_DecrRefCount(cmd);
7304
7282
  rb_thread_critical = thr_crit_bup;
7305
7283
  ptr->return_value = TCL_OK;
7306
- return rb_tainted_str_new2("");
7284
+ return rb_str_new2("");
7307
7285
  } else {
7308
7286
  int status;
7309
7287
  struct call_eval_info inf;
@@ -7379,7 +7357,7 @@ ip_eval_real(self, cmd_str, cmd_len)
7379
7357
  Tcl_ResetResult(ptr->ip);
7380
7358
  rbtk_release_ip(ptr);
7381
7359
  rb_thread_critical = thr_crit_bup;
7382
- return rb_tainted_str_new2("");
7360
+ return rb_str_new2("");
7383
7361
  }
7384
7362
  }
7385
7363
 
@@ -7395,7 +7373,7 @@ ip_eval_real(self, cmd_str, cmd_len)
7395
7373
  /* ip is deleted? */
7396
7374
  if (deleted_ip(ptr)) {
7397
7375
  ptr->return_value = TCL_OK;
7398
- return rb_tainted_str_new2("");
7376
+ return rb_str_new2("");
7399
7377
  } else {
7400
7378
  /* Tcl_Preserve(ptr->ip); */
7401
7379
  rbtk_preserve_ip(ptr);
@@ -7438,19 +7416,6 @@ ip_eval_real(self, cmd_str, cmd_len)
7438
7416
  #endif
7439
7417
  }
7440
7418
 
7441
- static VALUE
7442
- evq_safelevel_handler(arg, evq)
7443
- VALUE arg;
7444
- VALUE evq;
7445
- {
7446
- struct eval_queue *q;
7447
-
7448
- Data_Get_Struct(evq, struct eval_queue, q);
7449
- DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
7450
- rb_set_safe_level(q->safe_level);
7451
- return ip_eval_real(q->interp, q->str, q->len);
7452
- }
7453
-
7454
7419
  int eval_queue_handler _((Tcl_Event *, int));
7455
7420
  int
7456
7421
  eval_queue_handler(evPtr, flags)
@@ -7493,24 +7458,7 @@ eval_queue_handler(evPtr, flags)
7493
7458
  /* incr internal handler mark */
7494
7459
  rbtk_internal_eventloop_handler++;
7495
7460
 
7496
- /* check safe-level */
7497
- if (rb_safe_level() != q->safe_level) {
7498
- #ifdef HAVE_NATIVETHREAD
7499
- #ifndef RUBY_USE_NATIVE_THREAD
7500
- if (!ruby_native_thread_p()) {
7501
- rb_bug("cross-thread violation on eval_queue_handler()");
7502
- }
7503
- #endif
7504
- #endif
7505
- /* q_dat = Data_Wrap_Struct(rb_cData,0,-1,q); */
7506
- q_dat = Data_Wrap_Struct(0,eval_queue_mark,-1,q);
7507
- ret = rb_funcall(rb_proc_new(evq_safelevel_handler, q_dat),
7508
- ID_call, 0);
7509
- rb_gc_force_recycle(q_dat);
7510
- q_dat = (VALUE)NULL;
7511
- } else {
7512
- ret = ip_eval_real(q->interp, q->str, q->len);
7513
- }
7461
+ ret = ip_eval_real(q->interp, q->str, q->len);
7514
7462
 
7515
7463
  /* set result */
7516
7464
  RARRAY_ASET(q->result, 0, ret);
@@ -7640,7 +7588,6 @@ ip_eval(self, str)
7640
7588
  evq->interp = ip_obj;
7641
7589
  evq->result = result;
7642
7590
  evq->thread = current;
7643
- evq->safe_level = rb_safe_level();
7644
7591
  evq->ev.proc = eval_queue_handler;
7645
7592
 
7646
7593
  position = TCL_QUEUE_TAIL;
@@ -7912,7 +7859,6 @@ lib_toUTF8_core(ip_obj, src, encodename)
7912
7859
  # endif
7913
7860
  Tcl_Encoding encoding;
7914
7861
  Tcl_DString dstr;
7915
- int taint_flag = OBJ_TAINTED(str);
7916
7862
  struct tcltkip *ptr;
7917
7863
  char *buf;
7918
7864
  int thr_crit_bup;
@@ -8033,13 +7979,12 @@ lib_toUTF8_core(ip_obj, src, encodename)
8033
7979
  /* Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr); */
8034
7980
  Tcl_ExternalToUtfDString(encoding, buf, RSTRING_LENINT(str), &dstr);
8035
7981
 
8036
- /* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
7982
+ /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
8037
7983
  /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
8038
7984
  str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr));
8039
7985
  #ifdef HAVE_RUBY_ENCODING_H
8040
7986
  rb_enc_associate_index(str, ENCODING_INDEX_UTF8);
8041
7987
  #endif
8042
- if (taint_flag) RbTk_OBJ_UNTRUST(str);
8043
7988
  rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8);
8044
7989
 
8045
7990
  /*
@@ -8098,7 +8043,6 @@ lib_fromUTF8_core(ip_obj, src, encodename)
8098
8043
  Tcl_Interp *interp;
8099
8044
  Tcl_Encoding encoding;
8100
8045
  Tcl_DString dstr;
8101
- int taint_flag = OBJ_TAINTED(str);
8102
8046
  char *buf;
8103
8047
  int thr_crit_bup;
8104
8048
  #endif
@@ -8182,7 +8126,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
8182
8126
  tclstr = Tcl_NewStringObj(RSTRING_PTR(str), RSTRING_LENINT(str));
8183
8127
  Tcl_IncrRefCount(tclstr);
8184
8128
  s = (char*)Tcl_GetByteArrayFromObj(tclstr, &len);
8185
- str = rb_tainted_str_new(s, len);
8129
+ str = rb_str_new(s, len);
8186
8130
  s = (char*)NULL;
8187
8131
  Tcl_DecrRefCount(tclstr);
8188
8132
  #ifdef HAVE_RUBY_ENCODING_H
@@ -8211,7 +8155,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
8211
8155
 
8212
8156
  if (RSTRING_LEN(str) == 0) {
8213
8157
  rb_thread_critical = thr_crit_bup;
8214
- return rb_tainted_str_new2("");
8158
+ return rb_str_new2("");
8215
8159
  }
8216
8160
 
8217
8161
  buf = ALLOC_N(char, RSTRING_LEN(str)+1);
@@ -8224,7 +8168,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
8224
8168
  /* Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr); */
8225
8169
  Tcl_UtfToExternalDString(encoding,buf,RSTRING_LENINT(str),&dstr);
8226
8170
 
8227
- /* str = rb_tainted_str_new2(Tcl_DStringValue(&dstr)); */
8171
+ /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
8228
8172
  /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
8229
8173
  str = rb_str_new(Tcl_DStringValue(&dstr), Tcl_DStringLength(&dstr));
8230
8174
  #ifdef HAVE_RUBY_ENCODING_H
@@ -8241,7 +8185,6 @@ lib_fromUTF8_core(ip_obj, src, encodename)
8241
8185
  }
8242
8186
  #endif
8243
8187
 
8244
- if (taint_flag) RbTk_OBJ_UNTRUST(str);
8245
8188
  rb_ivar_set(str, ID_at_enc, encodename);
8246
8189
 
8247
8190
  /*
@@ -8297,7 +8240,6 @@ lib_UTF_backslash_core(self, str, all_bs)
8297
8240
  #ifdef TCL_UTF_MAX
8298
8241
  char *src_buf, *dst_buf, *ptr;
8299
8242
  int read_len = 0, dst_len = 0;
8300
- int taint_flag = OBJ_TAINTED(str);
8301
8243
  int thr_crit_bup;
8302
8244
 
8303
8245
  tcl_stubs_check();
@@ -8335,7 +8277,6 @@ lib_UTF_backslash_core(self, str, all_bs)
8335
8277
  }
8336
8278
 
8337
8279
  str = rb_str_new(dst_buf, dst_len);
8338
- if (taint_flag) RbTk_OBJ_UNTRUST(str);
8339
8280
  #ifdef HAVE_RUBY_ENCODING_H
8340
8281
  rb_enc_associate_index(str, ENCODING_INDEX_UTF8);
8341
8282
  #endif
@@ -8571,7 +8512,7 @@ ip_invoke_core(interp, argc, argv)
8571
8512
 
8572
8513
  /* ip is deleted? */
8573
8514
  if (deleted_ip(ptr)) {
8574
- return rb_tainted_str_new2("");
8515
+ return rb_str_new2("");
8575
8516
  }
8576
8517
 
8577
8518
  /* Tcl_Preserve(ptr->ip); */
@@ -8606,7 +8547,7 @@ ip_invoke_core(interp, argc, argv)
8606
8547
  Tcl_ResetResult(ptr->ip);
8607
8548
  /* Tcl_Release(ptr->ip); */
8608
8549
  rbtk_release_ip(ptr);
8609
- return rb_tainted_str_new2("");
8550
+ return rb_str_new2("");
8610
8551
  }
8611
8552
  } else {
8612
8553
  #if TCL_MAJOR_VERSION >= 8
@@ -8801,7 +8742,7 @@ ip_invoke_core(interp, argc, argv)
8801
8742
  rb_warn("%s (ignore)", Tcl_GetStringResult(ptr->ip));
8802
8743
  }
8803
8744
  Tcl_ResetResult(ptr->ip);
8804
- return rb_tainted_str_new2("");
8745
+ return rb_str_new2("");
8805
8746
  }
8806
8747
  }
8807
8748
 
@@ -8928,7 +8869,7 @@ ip_invoke_real(argc, argv, interp)
8928
8869
 
8929
8870
  /* ip is deleted? */
8930
8871
  if (deleted_ip(ptr)) {
8931
- return rb_tainted_str_new2("");
8872
+ return rb_str_new2("");
8932
8873
  }
8933
8874
 
8934
8875
  /* allocate memory for arguments */
@@ -8944,19 +8885,6 @@ ip_invoke_real(argc, argv, interp)
8944
8885
  return v;
8945
8886
  }
8946
8887
 
8947
- VALUE
8948
- ivq_safelevel_handler(arg, ivq)
8949
- VALUE arg;
8950
- VALUE ivq;
8951
- {
8952
- struct invoke_queue *q;
8953
-
8954
- Data_Get_Struct(ivq, struct invoke_queue, q);
8955
- DUMP2("(safe-level handler) $SAFE = %d", q->safe_level);
8956
- rb_set_safe_level(q->safe_level);
8957
- return ip_invoke_core(q->interp, q->argc, q->argv);
8958
- }
8959
-
8960
8888
  int invoke_queue_handler _((Tcl_Event *, int));
8961
8889
  int
8962
8890
  invoke_queue_handler(evPtr, flags)
@@ -8999,19 +8927,9 @@ invoke_queue_handler(evPtr, flags)
8999
8927
  /* incr internal handler mark */
9000
8928
  rbtk_internal_eventloop_handler++;
9001
8929
 
9002
- /* check safe-level */
9003
- if (rb_safe_level() != q->safe_level) {
9004
- /* q_dat = Data_Wrap_Struct(rb_cData,0,0,q); */
9005
- q_dat = Data_Wrap_Struct(0,invoke_queue_mark,-1,q);
9006
- ret = rb_funcall(rb_proc_new(ivq_safelevel_handler, q_dat),
9007
- ID_call, 0);
9008
- rb_gc_force_recycle(q_dat);
9009
- q_dat = (VALUE)NULL;
9010
- } else {
9011
- DUMP2("call invoke_real (for caller thread:%"PRIxVALUE")", thread);
9012
- DUMP2("call invoke_real (current thread:%"PRIxVALUE")", rb_thread_current());
9013
- ret = ip_invoke_core(q->interp, q->argc, q->argv);
9014
- }
8930
+ DUMP2("call invoke_real (for caller thread:%"PRIxVALUE")", thread);
8931
+ DUMP2("call invoke_real (current thread:%"PRIxVALUE")", rb_thread_current());
8932
+ ret = ip_invoke_core(q->interp, q->argc, q->argv);
9015
8933
 
9016
8934
  /* set result */
9017
8935
  RARRAY_ASET(q->result, 0, ret);
@@ -9141,7 +9059,6 @@ ip_invoke_with_position(argc, argv, obj, position)
9141
9059
  ivq->interp = ip_obj;
9142
9060
  ivq->result = result;
9143
9061
  ivq->thread = current;
9144
- ivq->safe_level = rb_safe_level();
9145
9062
  ivq->ev.proc = invoke_queue_handler;
9146
9063
 
9147
9064
  /* add the handler to Tcl event queue */
@@ -9239,7 +9156,7 @@ ip_retval(self)
9239
9156
 
9240
9157
  /* ip is deleted? */
9241
9158
  if (deleted_ip(ptr)) {
9242
- return rb_tainted_str_new2("");
9159
+ return rb_str_new2("");
9243
9160
  }
9244
9161
 
9245
9162
  return (INT2FIX(ptr->return_value));
@@ -9296,7 +9213,7 @@ ip_get_variable2_core(interp, argc, argv)
9296
9213
  /* ip is deleted? */
9297
9214
  if (deleted_ip(ptr)) {
9298
9215
  rb_thread_critical = thr_crit_bup;
9299
- return rb_tainted_str_new2("");
9216
+ return rb_str_new2("");
9300
9217
  } else {
9301
9218
  /* Tcl_Preserve(ptr->ip); */
9302
9219
  rbtk_preserve_ip(ptr);
@@ -9334,7 +9251,7 @@ ip_get_variable2_core(interp, argc, argv)
9334
9251
 
9335
9252
  /* ip is deleted? */
9336
9253
  if (deleted_ip(ptr)) {
9337
- return rb_tainted_str_new2("");
9254
+ return rb_str_new2("");
9338
9255
  } else {
9339
9256
  /* Tcl_Preserve(ptr->ip); */
9340
9257
  rbtk_preserve_ip(ptr);
@@ -9352,7 +9269,7 @@ ip_get_variable2_core(interp, argc, argv)
9352
9269
  return exc;
9353
9270
  }
9354
9271
 
9355
- strval = rb_tainted_str_new2(ret);
9272
+ strval = rb_str_new2(ret);
9356
9273
  /* Tcl_Release(ptr->ip); */
9357
9274
  rbtk_release_ip(ptr);
9358
9275
  rb_thread_critical = thr_crit_bup;
@@ -9382,7 +9299,7 @@ ip_get_variable2(self, varname, index, flag)
9382
9299
  retval = tk_funcall(ip_get_variable2_core, 3, argv, self);
9383
9300
 
9384
9301
  if (NIL_P(retval)) {
9385
- return rb_tainted_str_new2("");
9302
+ return rb_str_new2("");
9386
9303
  } else {
9387
9304
  return retval;
9388
9305
  }
@@ -9433,7 +9350,7 @@ ip_set_variable2_core(interp, argc, argv)
9433
9350
  if (deleted_ip(ptr)) {
9434
9351
  Tcl_DecrRefCount(valobj);
9435
9352
  rb_thread_critical = thr_crit_bup;
9436
- return rb_tainted_str_new2("");
9353
+ return rb_str_new2("");
9437
9354
  } else {
9438
9355
  /* Tcl_Preserve(ptr->ip); */
9439
9356
  rbtk_preserve_ip(ptr);
@@ -9474,7 +9391,7 @@ ip_set_variable2_core(interp, argc, argv)
9474
9391
 
9475
9392
  /* ip is deleted? */
9476
9393
  if (deleted_ip(ptr)) {
9477
- return rb_tainted_str_new2("");
9394
+ return rb_str_new2("");
9478
9395
  } else {
9479
9396
  /* Tcl_Preserve(ptr->ip); */
9480
9397
  rbtk_preserve_ip(ptr);
@@ -9487,7 +9404,7 @@ ip_set_variable2_core(interp, argc, argv)
9487
9404
  return rb_exc_new2(rb_eRuntimeError, ptr->ip->result);
9488
9405
  }
9489
9406
 
9490
- strval = rb_tainted_str_new2(ret);
9407
+ strval = rb_str_new2(ret);
9491
9408
 
9492
9409
  /* Tcl_Release(ptr->ip); */
9493
9410
  rbtk_release_ip(ptr);
@@ -9521,7 +9438,7 @@ ip_set_variable2(self, varname, index, value, flag)
9521
9438
  retval = tk_funcall(ip_set_variable2_core, 4, argv, self);
9522
9439
 
9523
9440
  if (NIL_P(retval)) {
9524
- return rb_tainted_str_new2("");
9441
+ return rb_str_new2("");
9525
9442
  } else {
9526
9443
  return retval;
9527
9444
  }
@@ -9596,7 +9513,7 @@ ip_unset_variable2(self, varname, index, flag)
9596
9513
  retval = tk_funcall(ip_unset_variable2_core, 3, argv, self);
9597
9514
 
9598
9515
  if (NIL_P(retval)) {
9599
- return rb_tainted_str_new2("");
9516
+ return rb_str_new2("");
9600
9517
  } else {
9601
9518
  return retval;
9602
9519
  }
@@ -9680,7 +9597,6 @@ lib_split_tklist_core(ip_obj, list_str)
9680
9597
  Tcl_Interp *interp;
9681
9598
  volatile VALUE ary, elem;
9682
9599
  int idx;
9683
- int taint_flag = OBJ_TAINTED(list_str);
9684
9600
  #ifdef HAVE_RUBY_ENCODING_H
9685
9601
  int list_enc_idx;
9686
9602
  volatile VALUE list_ivar_enc;
@@ -9735,13 +9651,11 @@ lib_split_tklist_core(ip_obj, list_str)
9735
9651
  rb_thread_critical = Qtrue;
9736
9652
 
9737
9653
  ary = rb_ary_new2(objc);
9738
- if (taint_flag) RbTk_OBJ_UNTRUST(ary);
9739
9654
 
9740
9655
  old_gc = rb_gc_disable();
9741
9656
 
9742
9657
  for(idx = 0; idx < objc; idx++) {
9743
9658
  elem = get_str_from_obj(objv[idx]);
9744
- if (taint_flag) RbTk_OBJ_UNTRUST(elem);
9745
9659
 
9746
9660
  #ifdef HAVE_RUBY_ENCODING_H
9747
9661
  if (rb_enc_get_index(elem) == ENCODING_INDEX_BINARY) {
@@ -9783,16 +9697,11 @@ lib_split_tklist_core(ip_obj, list_str)
9783
9697
  }
9784
9698
 
9785
9699
  ary = rb_ary_new2(argc);
9786
- if (taint_flag) RbTk_OBJ_UNTRUST(ary);
9787
9700
 
9788
9701
  old_gc = rb_gc_disable();
9789
9702
 
9790
9703
  for(idx = 0; idx < argc; idx++) {
9791
- if (taint_flag) {
9792
- elem = rb_tainted_str_new2(argv[idx]);
9793
- } else {
9794
- elem = rb_str_new2(argv[idx]);
9795
- }
9704
+ elem = rb_str_new2(argv[idx]);
9796
9705
  /* rb_ivar_set(elem, ID_at_enc, rb_str_new2("binary")); */
9797
9706
  /* RARRAY(ary)->ptr[idx] = elem; */
9798
9707
  rb_ary_push(ary, elem)
@@ -9833,7 +9742,6 @@ lib_merge_tklist(argc, argv, obj)
9833
9742
  int *flagPtr;
9834
9743
  char *dst, *result;
9835
9744
  volatile VALUE str;
9836
- int taint_flag = 0;
9837
9745
  int thr_crit_bup;
9838
9746
  VALUE old_gc;
9839
9747
 
@@ -9855,7 +9763,6 @@ lib_merge_tklist(argc, argv, obj)
9855
9763
  /* pass 1 */
9856
9764
  len = 1;
9857
9765
  for(num = 0; num < argc; num++) {
9858
- if (OBJ_TAINTED(argv[num])) taint_flag = 1;
9859
9766
  dst = StringValueCStr(argv[num]);
9860
9767
  #if TCL_MAJOR_VERSION >= 8
9861
9768
  len += Tcl_ScanCountedElement(dst, RSTRING_LENINT(argv[num]),
@@ -9903,7 +9810,6 @@ lib_merge_tklist(argc, argv, obj)
9903
9810
 
9904
9811
  /* create object */
9905
9812
  str = rb_str_new(result, dst - result - 1);
9906
- if (taint_flag) RbTk_OBJ_UNTRUST(str);
9907
9813
  #if 0 /* use Tcl_EventuallyFree */
9908
9814
  Tcl_EventuallyFree((ClientData)result, TCL_DYNAMIC); /* XXXXXXXX */
9909
9815
  #else
@@ -9928,7 +9834,6 @@ lib_conv_listelement(self, src)
9928
9834
  {
9929
9835
  int len, scan_flag;
9930
9836
  volatile VALUE dst;
9931
- int taint_flag = OBJ_TAINTED(src);
9932
9837
  int thr_crit_bup;
9933
9838
 
9934
9839
  tcl_stubs_check();
@@ -9951,7 +9856,6 @@ lib_conv_listelement(self, src)
9951
9856
  #endif
9952
9857
 
9953
9858
  rb_str_resize(dst, len);
9954
- if (taint_flag) RbTk_OBJ_UNTRUST(dst);
9955
9859
 
9956
9860
  rb_thread_critical = thr_crit_bup;
9957
9861
 
@@ -10417,12 +10321,6 @@ create_encoding_table_core(arg, interp)
10417
10321
  Tcl_Obj **objv;
10418
10322
  Tcl_Obj *enc_list;
10419
10323
 
10420
- #ifdef HAVE_RB_SET_SAFE_LEVEL_FORCE
10421
- rb_set_safe_level_force(0);
10422
- #else
10423
- rb_set_safe_level(0);
10424
- #endif
10425
-
10426
10324
  /* set 'binary' encoding */
10427
10325
  encobj = rb_enc_from_encoding(rb_enc_from_index(ENCODING_INDEX_BINARY));
10428
10326
  rb_hash_aset(table, ENCODING_NAME_BINARY, encobj);