summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-09 14:15:24 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-09 14:15:24 +0000
commit849892636f88dcc25deb90ca738c1c61494df944 (patch)
treec71d54e68ac35b56d4d3d393c5aa974a12620911 /ext
parent99a6e8a3edaddb1fa065cb601584429bb6dedbe5 (diff)
* ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
* ext/tk/tcltklib.c: avoid error on a shared object. * ext/tk/extconf.rb: support --with-tcltkversion * ext/tk/README.tcltklib: add document about --with-tcltkversion * ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget, ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb, ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb: bug fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/tk/README.tcltklib6
-rw-r--r--ext/tk/extconf.rb140
-rw-r--r--ext/tk/lib/multi-tk.rb33
-rw-r--r--ext/tk/lib/tk.rb14
-rw-r--r--ext/tk/sample/demos-en/bind.rb2
-rw-r--r--ext/tk/sample/demos-en/style.rb2
-rw-r--r--ext/tk/sample/demos-en/widget21
-rw-r--r--ext/tk/sample/demos-jp/bind.rb2
-rw-r--r--ext/tk/sample/demos-jp/style.rb2
-rw-r--r--ext/tk/sample/demos-jp/widget43
-rw-r--r--ext/tk/tcltklib.c35
11 files changed, 221 insertions, 79 deletions
diff --git a/ext/tk/README.tcltklib b/ext/tk/README.tcltklib
index b94d778104..8c6dd5178f 100644
--- a/ext/tk/README.tcltklib
+++ b/ext/tk/README.tcltklib
@@ -5,10 +5,14 @@ Tcl/Tk libraries or header files are installed but are not found, you can
give the information by arguments of the 'configure' script. Please give
some or all of the following options.
+ --with-tcltkversion=<version>
+ force version of Tcl/Tk libaray
+ (e.g. libtcl8.4g.so ==> --with-tcltkversion=8.4g)
+
--with-tcllib=<libname> (e.g. libtcl8.4.so ==> --with-tcllib=tcl8.4)
--with-tklib=<libname> (e.g. libtk8.4.so ==> --with-tklib=tk8.4)
- --enable-tcltk_stubs (if you force to enable stubs)
+ --enable-tcltk-stubs (if you force to enable stubs)
--with-tcl-dir=<path>
equal to "--with-tcl-include=<path>/include --with-tcl-lib=<path>/lib"
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index 4311aecce0..4807ea7b40 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -48,15 +48,60 @@ tk_ldir2 = with_config("tk-lib")
tcl_ldir2 = with_config("tcl-lib")
x11_ldir2 = with_config("X11-lib")
+tk_ldir_list = [tk_ldir2, tk_ldir]
+tcl_ldir_list = [tcl_ldir2, tcl_ldir]
+
tklib = with_config("tklib")
tcllib = with_config("tcllib")
stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
+tcltk_version = with_config("tcltkversion")
+
use_X = with_config("X11", (! is_win32))
-def find_tcl(tcllib, stubs, *opt_paths)
+def check_tcltk_version(version)
+ return [nil, nil] unless version
+
+ version = version.strip
+
+ tclver = version.dup
+ tkver = version.dup
+
+ major = dot = minor = dot = plvl = ext = nil
+
+ if version =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/
+ major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6
+ dot = ! minor_dot.empty?
+ if plvl_dot.empty? && ! plvl.empty?
+ minor << plvl
+ end
+ elsif version =~ /^(\d)(\.?)(\d?)(.*)$/
+ major = $1; minor_dot = $2; minor = $3; ext = $4
+ dot = ! minor_dot.empty?
+ else # unknown -> believe user
+ return [tclver, tkver]
+ end
+
+ # check Tcl7.6 / Tk4.2 ?
+ if major == "7" # Tcl7.6 ( not support Tclversion < 7.6 )
+ # Tk4.2
+ tkver = "4" + ((dot)? ".": "") + ((minor.empty)? "": "2") + ext
+ elsif major == "4" # Tk4.2 ( not support Tkversion < 4.2 )
+ # Tcl7.6
+ tclver = "7" + ((dot)? ".": "") + ((minor.empty)? "": "6") + ext
+ end
+
+ [tclver, tkver]
+end
+
+def find_tcl(tcllib, stubs, version, *opt_paths)
default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- paths = opt_paths.compact.concat(default_paths)
+ default_paths << "/Tcl/lib" # default for ActiveTcl
+
+ if (paths = opt_paths.compact).empty?
+ paths = default_paths
+ end
+
if stubs
func = "Tcl_InitStubs"
lib = "tclstub"
@@ -64,25 +109,42 @@ def find_tcl(tcllib, stubs, *opt_paths)
func = "Tcl_FindExecutable"
lib = "tcl"
end
+
+ if version && ! version.empty?
+ versions = [version]
+ else
+ versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6]
+ end
+
if tcllib
- find_library(tcllib, func, *paths)
+ st = find_library(tcllib, func, *paths)
else
- %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("#{lib}#{ver}g", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
- find_library("tcl#{ver}", func, *paths) or
- find_library("tcl#{ver.delete('.')}", func, *paths) or
- find_library("tcl#{ver}g", func, *paths) or
- find_library("tcl#{ver.delete('.')}g", func, *paths)
- } || find_library(lib, func, *paths)
+ st = versions.find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("#{lib}#{ver}g", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
+ find_library("tcl#{ver}", func, *paths) or
+ find_library("tcl#{ver.delete('.')}", func, *paths) or
+ find_library("tcl#{ver}g", func, *paths) or
+ find_library("tcl#{ver.delete('.')}g", func, *paths)
+ } || (!version && find_library(lib, func, *paths))
+ end
+
+ unless st
+ puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.")
end
+ st
end
-def find_tk(tklib, stubs, *opt_paths)
+def find_tk(tklib, stubs, version, *opt_paths)
default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
- paths = opt_paths.compact.concat(default_paths)
+ default_paths << "/Tcl/lib" # default for ActiveTcl
+
+ if (paths = opt_paths.compact).empty?
+ paths = default_paths
+ end
+
if stubs
func = "Tk_InitStubs"
lib = "tkstub"
@@ -90,27 +152,43 @@ def find_tk(tklib, stubs, *opt_paths)
func = "Tk_Init"
lib = "tk"
end
+
+ if version && ! version.empty?
+ versions = [version]
+ else
+ versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2]
+ end
+
if tklib
- find_library(tklib, func, *paths)
+ st = find_library(tklib, func, *paths)
else
- %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2].find { |ver|
- find_library("#{lib}#{ver}", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}", func, *paths) or
- find_library("#{lib}#{ver}g", func, *paths) or
- find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
- find_library("tk#{ver}", func, *paths) or
- find_library("tk#{ver.delete('.')}", func, *paths) or
- find_library("tk#{ver}g", func, *paths) or
- find_library("tk#{ver.delete('.')}g", func, *paths)
- } || find_library(lib, func, *paths)
+ st = versions.find { |ver|
+ find_library("#{lib}#{ver}", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}", func, *paths) or
+ find_library("#{lib}#{ver}g", func, *paths) or
+ find_library("#{lib}#{ver.delete('.')}g", func, *paths) or
+ find_library("tk#{ver}", func, *paths) or
+ find_library("tk#{ver.delete('.')}", func, *paths) or
+ find_library("tk#{ver}g", func, *paths) or
+ find_library("tk#{ver.delete('.')}g", func, *paths)
+ } || (!version && find_library(lib, func, *paths))
end
+
+ unless st
+ puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.")
+ end
+ st
end
def find_X11(*opt_paths)
default_paths =
[ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib" ]
paths = opt_paths.compact.concat(default_paths)
- find_library("X11", "XOpenDisplay", *paths)
+ st = find_library("X11", "XOpenDisplay", *paths)
+ unless st
+ puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.")
+ end
+ st
end
def pthread_check()
@@ -291,11 +369,13 @@ EOF
end
end
-if have_header("tcl.h") && have_header("tk.h") &&
+tclver, tkver = check_tcltk_version(tcltk_version)
+
+if have_header("tcl.h") && have_header("tk.h") &&
( tcltk_framework ||
( ( !use_X || find_X11(x11_ldir2, x11_ldir) ) &&
- find_tcl(tcllib, stubs, tcl_ldir2, tcl_ldir) &&
- find_tk(tklib, stubs, tk_ldir2, tk_ldir) ) )
+ find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) &&
+ find_tk(tklib, stubs, tkver, *tk_ldir_list) ) )
$CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
$CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index fd9a863888..b3b9e69539 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -3339,28 +3339,29 @@ end
# remove methods for security
-class MultiTkIp
- INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
- INTERP_MUTEX = INTERP_THREAD[:mutex]
- INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
-
- # undef_method :instance_eval
- undef_method :instance_variable_get
- undef_method :instance_variable_set
-end
-
-module TkCore
- if MultiTkIp::WITH_RUBY_VM &&
- ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+if MultiTkIp::WITH_RUBY_VM &&
+ ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
+ class MultiTkIp
+ INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
+ INTERP_MUTEX = INTERP_THREAD[:mutex]
+ INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
+ end
+ module TkCore
INTERP_THREAD = MultiTkIp::INTERP_THREAD
INTERP_MUTEX = MultiTkIp::INTERP_MUTEX
INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK
end
+ class MultiTkIp
+ remove_const(:INTERP_THREAD)
+ remove_const(:INTERP_MUTEX)
+ remove_const(:INTERP_ROOT_CHECK)
+ end
end
+
class MultiTkIp
- remove_const(:INTERP_THREAD)
- remove_const(:INTERP_MUTEX)
- remove_const(:INTERP_ROOT_CHECK)
+ # undef_method :instance_eval
+ undef_method :instance_variable_get
+ undef_method :instance_variable_set
end
# end of MultiTkIp definition
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 0d00ecf207..81df3cbf43 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -775,7 +775,7 @@ end
private :_curr_cmd_id, :_next_cmd_id
module_function :_curr_cmd_id, :_next_cmd_id
- def install_cmd(cmd)
+ def TkComm.install_cmd(cmd)
return '' if cmd == ''
begin
ns = TkCore::INTERP._invoke_without_enc('namespace', 'current')
@@ -801,14 +801,20 @@ end
'rb_out' << TkCore::INTERP._ip_id_ << ' ' << id
end
end
- def uninstall_cmd(id)
+ def TkComm.uninstall_cmd(id)
#id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
id = $4 if id =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
#Tk_CMDTBL.delete(id)
TkCore::INTERP.tk_cmd_tbl.delete(id)
end
# private :install_cmd, :uninstall_cmd
- module_function :install_cmd, :uninstall_cmd
+ # module_function :install_cmd, :uninstall_cmd
+ def install_cmd(cmd)
+ TkComm.install_cmd(cmd)
+ end
+ def uninstall_cmd(id)
+ TkComm.uninstall_cmd(id)
+ end
=begin
def install_win(ppath,name=nil)
@@ -5317,7 +5323,7 @@ TkWidget = TkWindow
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-03-29'.freeze
+ RELEASE_DATE = '2008-04-02'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb
index 5d6ec84edb..d4e6717483 100644
--- a/ext/tk/sample/demos-en/bind.rb
+++ b/ext/tk/sample/demos-en/bind.rb
@@ -122,4 +122,4 @@ txt = TkText.new($bind_demo){|t|
}
txt.width 60
-txt.width 24
+txt.height 24
diff --git a/ext/tk/sample/demos-en/style.rb b/ext/tk/sample/demos-en/style.rb
index 8606893c9b..06952f41b8 100644
--- a/ext/tk/sample/demos-en/style.rb
+++ b/ext/tk/sample/demos-en/style.rb
@@ -64,7 +64,7 @@ TkText.new($style_demo){|t|
style_tag_bold = TkTextTag.new(t, 'font'=>[family, 12, :bold, :italic])
style_tag_big = TkTextTag.new(t, 'font'=>[family, 14, :bold])
style_tag_verybig = TkTextTag.new(t, 'font'=>['Helvetica', 24, :bold])
- style_tag_small = TkTextTag.new(t, 'font'=>['Times 8 bold'])
+ style_tag_small = TkTextTag.new(t, 'font'=>'Times 8 bold')
end
###
# case($tk_version)
diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget
index 391d8532b6..4456f8ab5b 100644
--- a/ext/tk/sample/demos-en/widget
+++ b/ext/tk/sample/demos-en/widget
@@ -257,7 +257,10 @@ the demonstration. Once the demonstration window appears, you can \
click the "See Code" button to see the Ruby/Tk code that created the \
demonstration. If you wish, you can edit the code and click the \
"Rerun Demo" button in the code window to reinvoke the demonstration \
-with the modified code.
+with the modified code. \
+Don't worry about breaking the source code. \
+Your modifications are not reflected on the original file. \
+Please try many kind of changes.
Some demo scripts require the recent version of Tk library \
(e.g. Tk8.4 or later) \
@@ -266,6 +269,20 @@ required by the demo script, the demo doesn't work. \
In such a case, please re-compile tcltklib with the later Tk library \
which supports the required functions.
+If your Tk supports Ttk (Tile) extension (included or installed), \
+please try the demo of Ttk extension (sample/tkextlib/tile/demo.rb) too.
+( Probably, Ttk extension \
+#{
+begin
+ require 'tkextlib/tile'
+ "is already installed on your environment"
+rescue
+ "is not installed on your environment yet"
+end
+}\
+. )
+Ttk extension is a standard feature of Tk8.5 or later.
+
EOT
@@ -914,7 +931,7 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk widget demonstration Ver.1.6.3-en\n\n" +
+ 'message'=>"Ruby/Tk widget demonstration Ver.1.6.4-en\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
"( Copyright:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " +
diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb
index 3b6f6242c2..8985463b15 100644
--- a/ext/tk/sample/demos-jp/bind.rb
+++ b/ext/tk/sample/demos-jp/bind.rb
@@ -120,4 +120,4 @@ txt = TkText.new($bind_demo){|t|
}
txt.width 60
-txt.width 24
+txt.height 24
diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb
index c8c7850156..7a8497f1b2 100644
--- a/ext/tk/sample/demos-jp/style.rb
+++ b/ext/tk/sample/demos-jp/style.rb
@@ -65,7 +65,7 @@ txt = TkText.new($style_demo){|t|
style_tag_bold = TkTextTag.new(t, 'font'=>[family, 12, :bold, :italic])
style_tag_big = TkTextTag.new(t, 'font'=>[family, 14, :bold])
style_tag_verybig = TkTextTag.new(t, 'font'=>['Helvetica', 24, :bold])
- style_tag_small = TkTextTag.new(t, 'font'=>['Times 8 bold'])
+ style_tag_small = TkTextTag.new(t, 'font'=>'Times 8 bold')
end
###
# case($tk_version)
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index 3eea4c7887..a7e4bf3ca7 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -46,15 +46,15 @@ when /^4.*/
# $msg_kanji_font=TkFont.new('Helvetica 16', 'Gothic 16 bold')
when /^8.*/
- $font = TkFont.new('Helvetica 12')
- $kanji_font = TkFont.new('Helvetica 12', 'Mincho 12')
+ $font = TkFont.new('Helvetica -12')
+ $kanji_font = TkFont.new('Helvetica -12', 'Mincho -12')
TkOption.add('*kanjiFont', knjfont, 'startupFile')
- $msg_kanji_font=TkFont.new('Helvetica 18 bold', 'Gothic 18 bold')
+ $msg_kanji_font=TkFont.new('Helvetica 16 bold', 'Gothic 16 bold')
else
$font = TkFont.new('Helvetica 14', nil)
knjfont = '-*--16-*-jisx0208.1983-0'
- $kanji_font = TkFont.new('Helvetic 14', knj)
+ $kanji_font = TkFont.new('Helvetic 14', knjfont)
TkOption.add('*kanjiFont', knjfont, 'startupFile')
$msg_kanji_font=TkFont.new('Helvetica 14',
'-*--24-*-jisx0208.1983-0')
@@ -276,14 +276,31 @@ txt.insert('end', <<"EOT")
るために、"コード参照"ボタンをクリックすることができます。あなたが\
望むなら、そのコードを修正することができます。修正したコードでデモ\
ンストレーションを再実行するためには、コードが書かれたウィンドウに\
-ある"デモ再実行" ボタンをクリックしてください。
-
-一部のデモでは,比較的最近のバージョンの Tk でなければサポートして\
-いない機能を使って実装しています(例えば Tk8.4 以上など).そのため,\
-そうした機能を持たない Tk ライブラリを使っている場合には,そうした\
-デモは正しく動きません.そのような機能が必要であれば,それをサポート\
-している Tk ライブラリを使うように,tcltklib をコンパイルしなおして\
-ください.
+ある"デモ再実行" ボタンをクリックしてください。\
+コードを修正してもオリジナルのファイルが書き換えられることは\
+ありませんから、心配せずに色々な変更を試してみてください。
+
+一部のデモでは、比較的最近のバージョンの Tk でなければサポートして\
+いない機能を使って実装しています(例えば Tk8.4 以上など)。そのため、\
+そうした機能を持たない Tk ライブラリを使っている場合には、そうした\
+デモは正しく動きません。そのような機能が必要であれば、それをサポート\
+している Tk ライブラリを使うように tcltklib をコンパイルしなおして\
+ください。
+
+もしあなたの Tk が (最初から含むかインストールしたかにより) \
+Ttk (Tile) 拡張を利用できる状態であるなら、\
+Ttk 拡張のデモ (sample/tkextlib/tile/demo.rb) もぜひ試してみてください。
+( 多分,現在のあなたの環境には Ttk 拡張は\
+#{
+begin
+ require 'tkextlib/tile'
+ "すでに導入されています"
+rescue
+ "まだインストールされていません"
+end
+}\
+。)
+Ttk 拡張は、Tk8.5 以上では標準の機能として組み込まれています。
EOT
@@ -948,7 +965,7 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.6.3-jp\n\n" +
+ 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.6.4-jp\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
"( Copyright:: " +
"(c) 1996-1997 Sun Microsystems, Inc. / " +
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 51e2b65198..e9aeb7d2fc 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -4,7 +4,7 @@
* Oct. 24, 1997 Y. Matsumoto
*/
-#define TCLTKLIB_RELEASE_DATE "2008-03-29"
+#define TCLTKLIB_RELEASE_DATE "2008-04-02"
#include "ruby.h"
@@ -2585,10 +2585,12 @@ ip_set_exc_message(interp, exc)
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
} else if (TYPE(enc) == T_STRING) {
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc));
} else {
enc = rb_funcall(enc, ID_to_s, 0, 0);
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc));
}
/* to avoid a garbled error message dialog */
@@ -7105,7 +7107,9 @@ lib_toUTF8_core(ip_obj, src, encodename)
encoding = (Tcl_Encoding)NULL;
} else {
StringValue(enc);
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL,
+ RSTRING_PTR(enc));
if (encoding == (Tcl_Encoding)NULL) {
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
}
@@ -7121,7 +7125,9 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_thread_critical = thr_crit_bup;
return str;
}
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL,
+ RSTRING_PTR(enc));
if (encoding == (Tcl_Encoding)NULL) {
rb_warning("string has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
}
@@ -7139,7 +7145,8 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_thread_critical = thr_crit_bup;
return str;
}
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(encodename));
if (encoding == (Tcl_Encoding)NULL) {
/*
rb_warning("unknown encoding name '%s'",
@@ -7174,9 +7181,11 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8);
if (taint_flag) OBJ_TAINT(str);
+ /*
if (encoding != (Tcl_Encoding)NULL) {
Tcl_FreeEncoding(encoding);
}
+ */
Tcl_DStringFree(&dstr);
free(buf);
@@ -7284,7 +7293,9 @@ lib_fromUTF8_core(ip_obj, src, encodename)
encoding = (Tcl_Encoding)NULL;
} else {
StringValue(enc);
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL,
+ RSTRING_PTR(enc));
if (encoding == (Tcl_Encoding)NULL) {
rb_warning("Tk-interp has unknown encoding information (@encoding:'%s')", RSTRING_PTR(enc));
} else {
@@ -7314,7 +7325,8 @@ lib_fromUTF8_core(ip_obj, src, encodename)
return str;
}
- encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename));
+ /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(encodename)); */
+ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(encodename));
if (encoding == (Tcl_Encoding)NULL) {
/*
rb_warning("unknown encoding name '%s'",
@@ -7363,9 +7375,11 @@ lib_fromUTF8_core(ip_obj, src, encodename)
if (taint_flag) OBJ_TAINT(str);
+ /*
if (encoding != (Tcl_Encoding)NULL) {
Tcl_FreeEncoding(encoding);
}
+ */
Tcl_DStringFree(&dstr);
free(buf);
@@ -9110,7 +9124,7 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode)
StringValue(name);
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1)
- if (Tcl_GetEncoding(ptr->ip, RSTRING_PTR(name)) == (Tcl_Encoding) NULL) {
+ if (Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(name)) == (Tcl_Encoding)NULL) {
if (RTEST(error_mode)) {
rb_raise(rb_eArgError, "invalid Tk encoding name '%s'",
RSTRING_PTR(name));
@@ -10052,6 +10066,9 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
+ /* Tcl stub check */
+ tcl_stubs_check();
+
Tcl_ObjType_ByteArray = Tcl_GetObjType(Tcl_ObjTypeName_ByteArray);
Tcl_ObjType_String = Tcl_GetObjType(Tcl_ObjTypeName_String);