[前][次][番号順一覧][スレッド一覧]

ruby-changes:32257

From: usa <ko1@a...>
Date: Sun, 22 Dec 2013 13:53:47 +0900 (JST)
Subject: [ruby-changes:32257] usa:r44336 (ruby_1_9_3): merge revision(s) 43923, 43925: [Backport #9182]

usa	2013-12-22 13:53:40 +0900 (Sun, 22 Dec 2013)

  New Revision: 44336

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44336

  Log:
    merge revision(s) 43923,43925: [Backport #9182]
    
    * 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.

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ext/tk/extconf.rb
    branches/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb
    branches/ruby_1_9_3/ext/tk/lib/tk/namespace.rb
    branches/ruby_1_9_3/ext/tk/lib/tkextlib/tktable/tktable.rb
    branches/ruby_1_9_3/ext/tk/sample/scrollframe.rb
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ext/tk/sample/scrollframe.rb
===================================================================
--- ruby_1_9_3/ext/tk/sample/scrollframe.rb	(revision 44335)
+++ ruby_1_9_3/ext/tk/sample/scrollframe.rb	(revision 44336)
@@ -13,6 +13,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/sample/scrollframe.rb#L13
 #
 require 'tk'
 
+module Tk::RbWidget; end
+
 class Tk::RbWidget::ScrollFrame < TkFrame
   include TkComposite
 
Index: ruby_1_9_3/ext/tk/lib/tkextlib/tktable/tktable.rb
===================================================================
--- ruby_1_9_3/ext/tk/lib/tkextlib/tktable/tktable.rb	(revision 44335)
+++ ruby_1_9_3/ext/tk/lib/tkextlib/tktable/tktable.rb	(revision 44336)
@@ -70,7 +70,7 @@ module Tk::TkTable::ConfigMethod https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tkextlib/tktable/tktable.rb#L70
   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
 
Index: ruby_1_9_3/ext/tk/lib/tk/msgcat.rb
===================================================================
--- ruby_1_9_3/ext/tk/lib/tk/msgcat.rb	(revision 44335)
+++ ruby_1_9_3/ext/tk/lib/tk/msgcat.rb	(revision 44336)
@@ -125,6 +125,8 @@ class TkMsgCatalog < TkObject https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L125
 
     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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L201
       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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L221
       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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L239
   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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L263
     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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/msgcat.rb#L283
       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
 
Index: ruby_1_9_3/ext/tk/lib/tk/namespace.rb
===================================================================
--- ruby_1_9_3/ext/tk/lib/tk/namespace.rb	(revision 44335)
+++ ruby_1_9_3/ext/tk/lib/tk/namespace.rb	(revision 44336)
@@ -325,12 +325,7 @@ class TkNamespace < TkObject https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/lib/tk/namespace.rb#L325
   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
Index: ruby_1_9_3/ext/tk/extconf.rb
===================================================================
--- ruby_1_9_3/ext/tk/extconf.rb	(revision 44335)
+++ ruby_1_9_3/ext/tk/extconf.rb	(revision 44336)
@@ -11,10 +11,18 @@ TkLib_Config['search_versions'] = https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L11
   # %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 https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L551
 
 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? || /nextstep|openstep|rhapsody/ =~ RUBY_PLATFORM
 
-  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?
@@ -737,6 +745,7 @@ def search_tclConfig(*paths) # libdir li https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L745
   end
 
   conf = nil
+  progress_flag = false
 
   config_dir.uniq!
   config_dir.map{|dir|
@@ -747,7 +756,7 @@ def search_tclConfig(*paths) # libdir li https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L756
       dir.strip.chomp('/')
     end
   }.each{|dir|
-    print(".") # progress
+    print("."); progress_flag = true # progress
     # print("check #{dir} ==>");
     if dir.kind_of? Array
       tcldir, tkdir = dir
@@ -786,10 +795,36 @@ def search_tclConfig(*paths) # libdir li https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L795
 
       # 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
+        if tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
+          print("\n") if progress_flag
+          puts "Ignore \"#{tclpath}\" (unmatch with configured version)."
+          progress_flag = false
+          next
+        end
+        if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tclconf['TCL_MAJOR_VERSION']}.#{tclconf['TCL_MINOR_VERSION']}"}
+          print("\n") if progress_flag
+          puts "Ignore \"#{tclpath}\" (unsupported version of Tcl/Tk)."
+          progress_flag = false
+          next
+        end
+      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
+        if tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
+          print("\n") if progress_flag
+          puts "Ignore \"#{tkpath}\" (unmatch with configured version)."
+          progress_flag = false
+          next
+        end
+        if TkLib_Config['unsupported_versions'].find{|ver| ver == "#{tkconf['TK_MAJOR_VERSION']}.#{tkconf['TK_MINOR_VERSION']}"}
+          print("\n") if progress_flag
+          puts "Ignore \"#{tkpath}\" (unsupported version of Tcl/Tk)."
+          progress_flag = false
+          next
+        end
+      end
 
       # nativethread check
       if !TkLib_Config["ruby_with_thread"]
@@ -1292,6 +1327,10 @@ end https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L1327
 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 +1343,10 @@ def find_tcltk_library(tcllib, tklib, st https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/tk/extconf.rb#L1343
   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
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44335)
+++ ruby_1_9_3/version.h	(revision 44336)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 485
+#define RUBY_PATCHLEVEL 486
 
 #define RUBY_RELEASE_DATE "2013-12-22"
 #define RUBY_RELEASE_YEAR 2013

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r43923,43925


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]