summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/tk/extconf.rb40
-rw-r--r--ext/tk/lib/tk/msgcat.rb41
-rw-r--r--ext/tk/lib/tk/namespace.rb7
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb2
-rw-r--r--ext/tk/sample/scrollframe.rb2
5 files changed, 59 insertions, 33 deletions
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index 1a44eccb31..0ef4104fc3 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -11,10 +11,18 @@ TkLib_Config['search_versions'] =
# %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
%w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported.
+TkLib_Config['unsupported_versions'] =
+ %w[8.8 8.7 8.6] # At present, Tcl/Tk8.6 is not supported.
+
TkLib_Config['major_nums'] = '87'
##############################################################
+
+TkLib_Config['enable-shared'] = enable_config("shared")
+
+
+##############################################################
# use old extconf.rb ?
##############################################################
if with_config('tk-old-extconf')
@@ -543,13 +551,13 @@ end
def get_ext_list()
exts = [CONFIG['DLEXT']]
- exts.concat %w(dll lib) if is_win32?
+ exts.concat %w(dll) if is_win32?
exts.concat %w(bundle dylib) if is_macosx?
- if enable_config("shared") == false
- [CONFIG['LIBEXT'], "a"].concat exts
- else
- exts.concat [CONFIG['LIBEXT'], "a"]
+ if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false
+ exts.unshift "lib" if is_win32?
+ exts.unshift "a"
+ exts.unshift CONFIG['LIBEXT']
end
if is_win32?
@@ -786,10 +794,20 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
# parse tclConfig.sh/tkConfig.sh
tclconf = (tclpath)? parse_tclConfig(tclpath): nil
- next if tclconf && tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
+ if tclconf
+ next if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
+ next if TkLib_Config['unsupported_versions'].find{|ver|
+ ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"
+ }
+ end
tkconf = (tkpath)? parse_tclConfig(tkpath): nil
- next if tkconf && tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
+ if tkconf
+ next if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
+ next if TkLib_Config['unsupported_versions'].find{|ver|
+ ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"
+ }
+ end
# nativethread check
if !TkLib_Config["ruby_with_thread"]
@@ -1292,6 +1310,10 @@ end
def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
tcl_opt_paths, tk_opt_paths)
st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
+ if !st && TkLib_Config['enable-shared'] == nil
+ TkLib_Config['enable-shared'] = false
+ st,path,lib,libs,*inc = find_tcl(tcllib, stubs, tclversion, *tcl_opt_paths)
+ end
unless st
puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
return false
@@ -1304,6 +1326,10 @@ def find_tcltk_library(tcllib, tklib, stubs, tclversion, tkversion,
end
st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
+ if !st && TkLib_Config['enable-shared'] == nil
+ TkLib_Config['enable-shared'] = false
+ st,path,lib,libs,*inc = find_tk(tklib, stubs, tkversion, *tk_opt_paths)
+ end
unless st
puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.")
return false
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index 4abbcad85e..f2d0653c69 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -125,6 +125,8 @@ class TkMsgCatalog < TkObject
when 2 # src and trans, or, trans_list and enc
if args[0].kind_of?(Array)
+ # trans_list
+ self.set_translation_list(loc, *args)
else
#self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
self.set_translation(loc, *args)
@@ -199,7 +201,11 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + self::MSGCAT_EXT)
if File.readable?(file)
count += 1
- eval(open(file){|f| f.read})
+ if TkCore::WITH_ENCODING
+ eval(IO.read(file, :encoding=>"ASCII-8BIT"))
+ else
+ eval(IO.read(file))
+ end
end
}
count
@@ -215,7 +221,11 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + @msgcat_ext)
if File.readable?(file)
count += 1
- @namespace.eval(open(file){|f| f.read})
+ if TkCore::WITH_ENCODING
+ @namespace.eval(IO.read(file, :encoding=>"ASCII-8BIT"))
+ else
+ @namespace.eval(IO.read(file))
+ end
end
}
count
@@ -229,30 +239,21 @@ class TkMsgCatalog < TkObject
def self.set_translation(locale, src_str, trans_str=None, enc='utf-8')
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
- Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str))
+ Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}"))
else
- Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true)))
+ Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}"))
end
end
def set_translation(locale, src_str, trans_str=None, enc='utf-8')
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
Tk.UTF8_String(@namespace.eval{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str)
+ ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}")
})
else
Tk.UTF8_String(@namespace.eval{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true))})
+ ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}")
+ })
end
end
@@ -262,12 +263,13 @@ class TkMsgCatalog < TkObject
trans_list.each{|src, trans|
if trans && trans != None
list << _get_eval_string(src, true)
- list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
+ list << Tk.UTF8_String(_toUTF8(trans, enc))
else
list << _get_eval_string(src, true) << ''
end
}
- number(tk_call_without_enc('::msgcat::mcmset', locale, list))
+ #number(tk_call_without_enc('::msgcat::mcmset', locale, list))
+ number(ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}"))
end
def set_translation_list(locale, trans_list, enc='utf-8')
# trans_list ::= [ [src, trans], [src, trans], ... ]
@@ -281,7 +283,8 @@ class TkMsgCatalog < TkObject
end
}
number(@namespace.eval{
- tk_call_without_enc('::msgcat::mcmset', locale, list)
+ #tk_call_without_enc('::msgcat::mcmset', locale, list)
+ ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}")
})
end
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 4af891995e..0119ba5ef7 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -325,12 +325,7 @@ class TkNamespace < TkObject
def code(script = Proc.new)
if script.kind_of?(String)
cmd = proc{|*args|
- if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!!
- obj = ScopeArgs.new(@fullname,*args)
- ret = obj.instance_exec(obj, script)
- else
- ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
- end
+ ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
id = ret.object_id
TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
id
diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb
index bc7a6c9a2e..f7074655ed 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -70,7 +70,7 @@ module Tk::TkTable::ConfigMethod
private :__item_strval_optkeys
def __item_val2ruby_optkeys(id) # { key=>method, ... }
- super(id).update('window'=>proc{|v| window(v)})
+ super(id).update('window'=>proc{|k,v| window(v)})
end
private :__item_val2ruby_optkeys
diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb
index e340e1da3c..e9d8af7ebf 100644
--- a/ext/tk/sample/scrollframe.rb
+++ b/ext/tk/sample/scrollframe.rb
@@ -13,6 +13,8 @@
#
require 'tk'
+module Tk::RbWidget; end
+
class Tk::RbWidget::ScrollFrame < TkFrame
include TkComposite