* ext/tk/lib/tkextlib/tktable/tktable.rb: fix bug on arguments for Proc object.

* ext/tk/sample/scrollframe.rb: forgot a Module definition.

* ext/tk/extconf.rb: check unsupported version of tclConfig.sh/tkConfig.sh. It is because current Ruby/Tk doesn't support Tcl/Tk8.6.

* ext/tk/extconf.rb: change search step of Tcl/Tk libraries.

* ext/tk/lib/tk/namespace.rb: instance_exec() cannot accept a script string.

* ext/tk/lib/tk/msgcat.rb: bug fix on treating encodings. Now, ext/tk/sample/tkmsgcat-load_rb*.rb will work.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2013-11-29 15:44:25 +00:00
Родитель 2fd4dec977
Коммит b72256f91c
5 изменённых файлов: 59 добавлений и 33 удалений

Просмотреть файл

@ -11,9 +11,17 @@ 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 ?
##############################################################
@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -13,6 +13,8 @@
#
require 'tk'
module Tk::RbWidget; end
class Tk::RbWidget::ScrollFrame < TkFrame
include TkComposite