summaryrefslogtreecommitdiff
path: root/ext/tk/lib
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-29 15:44:25 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-29 15:44:25 +0000
commitb72256f91c7ad0be9d6d33b22b0781f181163380 (patch)
tree931db106145f512cff609091a0caf115d29a8c9a /ext/tk/lib
parent2fd4dec977ec87e418b18da6586b51513d6e81e7 (diff)
* 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
Diffstat (limited to 'ext/tk/lib')
-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
3 files changed, 24 insertions, 26 deletions
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index 4abbcad85e6..f2d0653c69a 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 4af891995e0..0119ba5ef77 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 bc7a6c9a2ec..f7074655eda 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