diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 09:41:57 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 09:41:57 +0000 |
commit | c9ec81289744231cb3ca9aa2c2bda3de6a668442 (patch) | |
tree | 17c15edd3de13818905acc92bae66ca8e1c91ace /ext/tk/stubs.c | |
parent | b08e8d937f0b4f4289dd204e9c08b8a45e469baf (diff) | |
download | ruby-c9ec81289744231cb3ca9aa2c2bda3de6a668442.tar.gz |
* ext/tk/tcltklib.c: cannot compile for Tcl7.6/Tk4.2.
* ext/tk/tcltklib.c: add nativethread consistency check.
* ext/tk/stubs.c: ditto.
* ext/tk/lib/tk.rb: forgot to define TclTkIp.encoding and encoding=
when Tcl is 7.6 or 8.0.
* ext/tk/lib/tk/wm.rb: support to make some methods as options of
root or toplevel widget. [ruby-talk:150336]
* ext/tk/lib/tk/root.rb: ditto.
* ext/tk/lib/tk/toplevel.rb: ditto.
* ext/tk/lib/tkextlib/SUPPRT_STATUS: update RELEASE_DATE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/stubs.c')
-rw-r--r-- | ext/tk/stubs.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c index e8b05355a9..050333cf63 100644 --- a/ext/tk/stubs.c +++ b/ext/tk/stubs.c @@ -24,6 +24,37 @@ _macinit() /*------------------------------*/ +static int nativethread_checked = 0; + +static void +_nativethread_consistency_check(ip) + Tcl_Interp *ip; +{ + if (nativethread_checked || ip == (Tcl_Interp *)NULL) { + return; + } + + if (Tcl_Eval(ip, "set ::tcl_platform(threaded)") == TCL_OK) { +#ifdef HAVE_NATIVETHREAD + /* consistent */ +#else + rb_warn("Inconsistency. Loaded Tcl/Tk libraries are enabled nativethread-support. But `tcltklib' is not. The inconsistency causes SEGV or other troubles frequently."); +#endif + } else { +#ifdef HAVE_NATIVETHREAD + rb_warning("Inconsistency.`tcltklib' is enabled nativethread-support. But loaded Tcl/Tk libraries are not. (Probably, the inconsistency doesn't cause any troubles.)"); +#else + /* consistent */ +#endif + } + + Tcl_ResetResult(ip); + + nativethread_checked = 1; +} + +/*------------------------------*/ + #if defined USE_TCL_STUBS && defined USE_TK_STUBS #if defined _WIN32 || defined __CYGWIN__ @@ -158,14 +189,25 @@ Tcl_Interp * ruby_tcl_create_ip_and_stubs_init(st) int *st; { + Tcl_Interp *tcl_ip; + if (st) *st = 0; if (tcl_stubs_init_p()) { - return Tcl_CreateInterp(); + tcl_ip = Tcl_CreateInterp(); + + if (!tcl_ip) { + if (st) *st = FAIL_CreateInterp; + return (Tcl_Interp*)NULL; + } + + _nativethread_consistency_check(tcl_ip); + + return tcl_ip; + } else { Tcl_Interp *(*p_Tcl_CreateInterp)(); Tcl_Interp *(*p_Tcl_DeleteInterp)(); - Tcl_Interp *tcl_ip; if (!tcl_dll) { int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr); @@ -195,6 +237,8 @@ ruby_tcl_create_ip_and_stubs_init(st) return (Tcl_Interp*)NULL; } + _nativethread_consistency_check(tcl_ip); + if (!Tcl_InitStubs(tcl_ip, "8.1", 0)) { if (st) *st = FAIL_Tcl_InitStubs; (*p_Tcl_DeleteInterp)(tcl_ip); @@ -401,6 +445,9 @@ ruby_tcl_create_ip_and_stubs_init(st) if (st) *st = FAIL_CreateInterp; return (Tcl_Interp*)NULL; } + + _nativethread_consistency_check(tcl_ip); + return tcl_ip; } |