tk 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/MANUAL_tcltklib.eng +0 -2
- data/MANUAL_tcltklib.ja +0 -2
- data/README.ActiveTcl +1 -1
- data/README.md +43 -0
- data/ext/tk/extconf.rb +4 -2
- data/ext/tk/old-extconf.rb +0 -1
- data/ext/tk/tcltklib.c +46 -148
- data/ext/tk/tkutil/extconf.rb +0 -2
- data/ext/tk/tkutil/tkutil.c +6 -9
- data/lib/multi-tk.rb +95 -315
- data/lib/remote-tk.rb +6 -23
- data/lib/tk.rb +41 -122
- data/lib/tk/bgerror.rb +2 -2
- data/lib/tk/bindtag.rb +1 -1
- data/lib/tk/canvas.rb +6 -14
- data/lib/tk/canvastag.rb +8 -16
- data/lib/tk/font.rb +1 -1
- data/lib/tk/fontchooser.rb +1 -1
- data/lib/tk/image.rb +1 -1
- data/lib/tk/menu.rb +4 -4
- data/lib/tk/msgcat.rb +5 -5
- data/lib/tk/namespace.rb +12 -32
- data/lib/tk/optiondb.rb +3 -73
- data/lib/tk/scale.rb +2 -2
- data/lib/tk/scrollable.rb +4 -2
- data/lib/tk/selection.rb +5 -4
- data/lib/tk/text.rb +8 -16
- data/lib/tk/textmark.rb +1 -1
- data/lib/tk/texttag.rb +7 -15
- data/lib/tk/timer.rb +2 -2
- data/lib/tk/tk_mac.rb +18 -18
- data/lib/tk/validation.rb +4 -35
- data/lib/tk/variable.rb +7 -5
- data/lib/tk/virtevent.rb +1 -1
- data/lib/tkextlib/blt/barchart.rb +0 -17
- data/lib/tkextlib/blt/bitmap.rb +1 -1
- data/lib/tkextlib/blt/component.rb +34 -34
- data/lib/tkextlib/blt/dragdrop.rb +6 -6
- data/lib/tkextlib/blt/graph.rb +0 -17
- data/lib/tkextlib/blt/stripchart.rb +0 -17
- data/lib/tkextlib/blt/tabset.rb +16 -31
- data/lib/tkextlib/blt/tree.rb +5 -5
- data/lib/tkextlib/blt/treeview.rb +14 -14
- data/lib/tkextlib/blt/watch.rb +1 -1
- data/lib/tkextlib/bwidget/labelentry.rb +6 -14
- data/lib/tkextlib/bwidget/listbox.rb +13 -29
- data/lib/tkextlib/bwidget/notebook.rb +6 -14
- data/lib/tkextlib/bwidget/spinbox.rb +6 -14
- data/lib/tkextlib/bwidget/tree.rb +19 -35
- data/lib/tkextlib/itcl/incr_tcl.rb +2 -2
- data/lib/tkextlib/itk/incr_tk.rb +7 -29
- data/lib/tkextlib/iwidgets/calendar.rb +0 -15
- data/lib/tkextlib/iwidgets/entryfield.rb +0 -21
- data/lib/tkextlib/iwidgets/notebook.rb +2 -2
- data/lib/tkextlib/iwidgets/scrolledcanvas.rb +6 -14
- data/lib/tkextlib/iwidgets/tabnotebook.rb +2 -2
- data/lib/tkextlib/tcllib/ctext.rb +2 -2
- data/lib/tkextlib/tcllib/plotchart.rb +5 -5
- data/lib/tkextlib/tcllib/validator.rb +6 -6
- data/lib/tkextlib/tile.rb +1 -1
- data/lib/tkextlib/tile/style.rb +1 -1
- data/lib/tkextlib/tile/treeview.rb +13 -20
- data/lib/tkextlib/tkDND/tkdnd.rb +6 -22
- data/lib/tkextlib/tkHTML/htmlwidget.rb +1 -1
- data/lib/tkextlib/tktable/tktable.rb +1 -1
- data/lib/tkextlib/treectrl/tktreectrl.rb +12 -20
- data/lib/tkextlib/vu/pie.rb +1 -1
- data/sample/binding_sample.rb +2 -2
- data/sample/cmd_res_test.rb +1 -1
- data/sample/demos-en/widget +21 -21
- data/sample/demos-jp/widget +4 -4
- data/sample/multi-ip_sample.rb +0 -3
- data/sample/multi-ip_sample2.rb +1 -1
- data/sample/resource.en +3 -3
- data/sample/resource.ja +3 -3
- data/sample/tcltklib/sample1.rb +2 -2
- data/sample/tkballoonhelp.rb +2 -2
- data/sample/tkextlib/tkHTML/ss.rb +0 -6
- data/sample/tkmulticolumnlist.rb +2 -2
- data/sample/tkmultilistframe.rb +2 -2
- data/sample/tkoptdb.rb +14 -16
- data/tk.gemspec +4 -4
- metadata +6 -13
- data/ChangeLog.tkextlib +0 -949
- data/old-README.tcltklib.ja +0 -159
- data/sample/binstr_usage.rb +0 -46
- data/sample/remote-ip_sample2.rb +0 -57
- data/sample/safe-tk.rb +0 -132
- data/sample/tkoptdb-safeTk.rb +0 -74
- data/sample/tktree.rb +0 -104
- data/sample/tktree.tcl +0 -305
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de793924acb0bcb31d9cf7810b29ee8b955498771677127d14a8f84a0be28447
|
4
|
+
data.tar.gz: 624bf1e5f517b16c2147b43b840189f711f91c585edda293ba55585dde6d2901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496b71be86f3fad9951713a33c51cc2df0362914717adc915977d93b6197c5770938c82013cb84e97a1893e4489c549159ddbd96e2f1d42362d881ec50c6970e
|
7
|
+
data.tar.gz: 39d4d96c72e0484684f0048f01fd7df53ce8ad20158c9a14d82de0d93c1732f9eab52e83003d4d4084743bde9898c91044b909e82eebf0b098329a666cc1a111
|
data/.gitignore
CHANGED
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 <
|
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.
|
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
|
1814
|
-
rb_proc_new
|
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|
|
data/ext/tk/old-extconf.rb
CHANGED
@@ -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
|
};
|
@@ -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 =
|
3620
|
+
s = rb_str_new(str, len);
|
3624
3621
|
#else /* TCL_MAJOR_VERSION < 8 */
|
3625
3622
|
str = argv[i];
|
3626
|
-
s =
|
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
|
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
|
-
|
7010
|
-
|
7011
|
-
|
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
|
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
|
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
|
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
|
-
|
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 =
|
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 =
|
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
|
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 =
|
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
|
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
|
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
|
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
|
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
|
-
|
9003
|
-
|
9004
|
-
|
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
|
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
|
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
|
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 =
|
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
|
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
|
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
|
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 =
|
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
|
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
|
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
|
-
|
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);
|