[#26664] refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

22 messages 2005/08/01
[#26665] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26668] Re: refactoring tcltklib.c (deleted ip check) — Hidetoshi NAGAI <nagai@...> 2005/08/01

永井@知能.九工大です.

[#26678] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26684] Re: refactoring tcltklib.c (deleted ip check) — Hidetoshi NAGAI <nagai@...> 2005/08/01

永井@知能.九工大です.

[#26686] Re: refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/01

山本です。

[#26817] test/socket/test_tcp.rb freeze on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

12 messages 2005/08/18

[#26829] cannot check EOF of pipe on windows — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

19 messages 2005/08/19
[#26830] Re: cannot check EOF of pipe on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/19

山本です。

[#26831] Re: cannot check EOF of pipe on windows — "U.Nakamura" <usa@...> 2005/08/19

こんにちは、なかむら(う)です。

[#26832] Re: cannot check EOF of pipe on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/19

山本です。

[#26836] Re: cannot check EOF of pipe on windows — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/19

なかだです。

[#26872] irb -I/ruby -Iと$LOAD_PATH — akira yamada / やまだあきら <akira@...>

Debianユーザからruby -Iとirb -Iで

17 messages 2005/08/24
[#26873] Re: irb -I/ruby -Iと$LOAD_PATH — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/24

なかだです。

[#26875] Re: irb -I/ruby -Iと$LOAD_PATH — akira yamada / やまだあきら <akira@...> 2005/08/24

nobuyoshi nakada wrote:

[#26885] Re: irb -I/ruby -Iと$LOAD_PATH — keiju@... (石塚圭樹) 2005/08/26

けいじゅ@いしつかです.

[#26897] fail on make install — KIMURA Koichi <kimura.koichi@...>

木村です。

28 messages 2005/08/29
[#26898] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/29

こんにちは、なかむら(う)です。

[#26903] Re: fail on make install — KIMURA Koichi <kbk@...> 2005/08/29

木村です。

[#26922] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/30

木村です。

[#26926] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/31

木村です。

[#26927] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/31

こんにちは、なかむら(う)です。

[#26928] Re: fail on make install — KIMURA Koichi <kimura.koichi@...> 2005/08/31

木村です。

[#26929] Re: fail on make install — "U.Nakamura" <usa@...> 2005/08/31

こんにちは、なかむら(う)です。

[#26930] Re: fail on make install — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/08/31

なかだです。

[#26931] Re: fail on make install — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/08/31

山本です。

[#26933] Re: fail on make install — nobu@... 2005/08/31

なかだです。

[#26938] Re: fail on make install — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/09/01

なかだです。

[#26939] Re: fail on make install — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/01

山本です。

[#26900] multiplying empty string — nobuyoshi nakada <nobuyoshi.nakada@...>

19 messages 2005/08/29
[#26904] Re: multiplying empty string — Yukihiro Matsumoto <matz@...> 2005/08/29

まつもと ゆきひろです

[#26907] Re: multiplying empty string — Tanaka Akira <akr@...17n.org> 2005/08/29

In article <1125327516.070646.12845.nullmailer@x31.priv.netlab.jp>,

[#26909] Re: multiplying empty string — Yukihiro Matsumoto <matz@...> 2005/08/29

まつもと ゆきひろです

[ruby-dev:26749] Re: TkCheckbutton#variable as getter?

From: Hidetoshi NAGAI <nagai@...>
Date: 2005-08-05 06:23:59 UTC
List: ruby-dev #26749
永井@知能.九工大です.

From: H.Yamamoto <ocean@m2.ccsnet.ne.jp>
Subject: [ruby-dev:26748] Re: TkCheckbutton#variable as getter?
Date: Fri, 5 Aug 2005 13:35:19 +0900
Message-ID: <20050805133518.5B06C100.ocean@m2.ccsnet.ne.jp>
> このパッチだと、variable のバインドを解除しようとして c1.variable = nil
> とできないので、None を使うのはどうでしょうか。

そうですね.その方が良さそうです.

>                                                また、c1.variable で返るのは
> TkVariable のほうが使いやすい気がします。

それは確かにそうかもしれません.
ですが,この修正では cget や configinfo などでは変数名のままです.
逆に cget や configinfo がきちんと TkVariable を返すようになれば
この wrap は不要ということになります.

添付の patch ではいかがでしょうか.
とりあえず急ぎで行ったので,'variable' の名前以外に
変数を属性にとるものがあったかを確認していません.
追加が必要なら,__tkvariable_optkeys と __item_tkvariable_optkeys 
とにオプション名を追加する (必要なクラスでの override でも OK) 
ことをせねばなりません.

また,拡張ライブラリなどに変数のリストを属性値に持つような
オプションがあったかどうかは確認できていません.
もしあれば,numlist 用の定義と同様に tkvarlist 用の追加が
必要かと思います.

Index: ext/tk/lib/tk.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk.rb,v
retrieving revision 1.102.2.63
diff -u -r1.102.2.63 tk.rb
--- ext/tk/lib/tk.rb	4 Aug 2005 09:41:32 -0000	1.102.2.63
+++ ext/tk/lib/tk.rb	5 Aug 2005 06:19:20 -0000
@@ -2233,10 +2233,13 @@
       end
 
       def encoding_convertfrom(str, enc=nil)
-        # str must be a Tcl's internal string expression in enc. 
+        # str is an usual enc string or a Tcl's internal string expression
+        # in enc (which is returned from 'encoding_convertto' method). 
         # the return value is a UTF-8 string.
         enc = encoding_system unless enc
-        TkCore::INTERP.__invoke('encoding', 'convertfrom', enc, str)
+        ret = TkCore::INTERP.__invoke('encoding', 'convertfrom', enc, str)
+        ret.instance_variable_set('@encoding', 'utf-8')
+        ret
       end
       alias encoding_convert_from encoding_convertfrom
 
@@ -2245,7 +2248,9 @@
         # The return value is a Tcl's internal string expression in enc. 
         # To get an usual enc string, use Tk.fromUTF8(ret_val, enc).
         enc = encoding_system unless enc
-        TkCore::INTERP.__invoke('encoding', 'convertto', enc, str)
+        ret = TkCore::INTERP.__invoke('encoding', 'convertto', enc, str)
+        ret.instance_variable_set('@encoding', 'binary')
+        ret
       end
       alias encoding_convert_to encoding_convertto
     end
@@ -2710,6 +2715,11 @@
   end
   private :__numlistval_optkeys
 
+  def __tkvariable_optkeys
+    ['variable']
+  end
+  private :__tkvariable_optkeys
+
   def __methodcall_optkeys  # { key=>method, ... }
     {}
   end
@@ -2815,6 +2825,10 @@
         fnt
       end
 
+    when /^(#{__tkvariable_optkeys.join('|')})$/
+      v = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
+      (v.empty?)? nil: TkVarAccess.new(v)
+
     else
       tk_tcl2ruby(tk_call_without_enc(*(__cget_cmd << "-#{slot}")), true)
     end
@@ -2999,6 +3013,28 @@
           when /^(#{__strval_optkeys.join('|')})$/
             # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
             conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+
+          when /^(#{__tkvariable_optkeys.join('|')})$/
+            conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+
+            if ( __configinfo_struct[:default_value] \
+                && conf[__configinfo_struct[:default_value]])
+              v = conf[__configinfo_struct[:default_value]]
+              if v.empty?
+                conf[__configinfo_struct[:default_value]] = nil
+              else
+                conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
+              end
+            end
+            if ( conf[__configinfo_struct[:current_value]] )
+              v = conf[__configinfo_struct[:current_value]]
+              if v.empty?
+                conf[__configinfo_struct[:current_value]] = nil
+              else
+                conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
+              end
+            end
+
           else
             # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
             conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true)
@@ -3100,6 +3136,25 @@
                   list(conf[__configinfo_struct[:current_value]])
               end
 
+            when /^(#{__tkvariable_optkeys.join('|')})$/
+              if ( __configinfo_struct[:default_value] \
+                  && conf[__configinfo_struct[:default_value]] )
+                v = conf[__configinfo_struct[:default_value]]
+                if v.empty?
+                  conf[__configinfo_struct[:default_value]] = nil
+                else
+                  conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
+                end
+              end
+              if ( conf[__configinfo_struct[:current_value]] )
+                v = conf[__configinfo_struct[:current_value]]
+                if v.empty?
+                  conf[__configinfo_struct[:current_value]] = nil
+                else
+                  conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
+                end
+              end
+
             else
               if ( __configinfo_struct[:default_value] \
                   && conf[__configinfo_struct[:default_value]] )
@@ -3269,6 +3324,27 @@
                 list(conf[__configinfo_struct[:current_value]])
             end
 
+          when /^(#{__tkvariable_optkeys.join('|')})$/
+            conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
+
+            if ( __configinfo_struct[:default_value] \
+                && conf[__configinfo_struct[:default_value]] )
+              v = conf[__configinfo_struct[:default_value]]
+              if v.empty?
+                conf[__configinfo_struct[:default_value]] = nil
+              else
+                conf[__configinfo_struct[:default_value]] = TkVarAccess.new(v)
+              end
+            end
+            if ( conf[__configinfo_struct[:current_value]] )
+              v = conf[__configinfo_struct[:current_value]]
+              if v.empty?
+                conf[__configinfo_struct[:current_value]] = nil
+              else
+                conf[__configinfo_struct[:current_value]] = TkVarAccess.new(v)
+              end
+            end
+
           when /^(#{__strval_optkeys.join('|')})$/
             # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
             conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
@@ -3376,6 +3452,25 @@
                   list(conf[__configinfo_struct[:current_value]])
               end
 
+            when /^(#{__tkvariable_optkeys.join('|')})$/
+              if ( __configinfo_struct[:default_value] \
+                  && conf[__configinfo_struct[:default_value]] )
+                v = conf[__configinfo_struct[:default_value]]
+                if v.empty?
+                  conf[__configinfo_struct[:default_value]] = nil
+                else
+                  conf[__configinfo_struct[:default_value]] = TkVarAccess.new
+                end
+              end
+              if ( conf[__configinfo_struct[:current_value]] )
+                v = conf[__configinfo_struct[:current_value]]
+                if v.empty?
+                  conf[__configinfo_struct[:current_value]] = nil
+                else
+                  conf[__configinfo_struct[:current_value]] = TkVarAccess.new
+                end
+              end
+
             else
               if ( __configinfo_struct[:default_value] \
                   && conf[__configinfo_struct[:default_value]] )
Index: ext/tk/lib/tk/itemconfig.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/itemconfig.rb,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 itemconfig.rb
--- ext/tk/lib/tk/itemconfig.rb	25 May 2005 11:09:38 -0000	1.1.2.6
+++ ext/tk/lib/tk/itemconfig.rb	5 Aug 2005 06:19:20 -0000
@@ -40,6 +40,11 @@
   end
   private :__item_numlistval_optkeys
 
+  def __item_tkvariable_optkeys
+    ['variable']
+  end
+  private :__item_tkvariable_optkeys
+
   def __item_methodcall_optkeys(id)  # { key=>method, ... }
     # maybe need to override
     # {'coords'=>'coords'}
@@ -161,6 +166,10 @@
         conf
       end
 
+    when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+      v = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
+      (v.empty?)? nil: TkVarAccess.new(v)
+
     when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
       _fromUTF8(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
 
@@ -357,6 +366,27 @@
             # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
             conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
 
+          when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+            conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+
+            if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+                && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+              v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+              if v.empty?
+                conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+              else
+                conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
+              end
+            end
+            if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+              v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+              if v.empty?
+                conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+              else
+                conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
+              end
+            end
+
           else
             # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
             conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
@@ -458,6 +488,25 @@
                   list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
               end
 
+            when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+              if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+                  && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+                v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+                if v.empty?
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+                else
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
+                end
+              end
+              if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+                v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+                if v.empty?
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+                else
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new
+                end
+              end
+
             else
               if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
                   && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
@@ -630,6 +679,27 @@
             # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
             conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
 
+          when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+            conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
+
+            if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+                && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+              v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+              if v.empty?
+                conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+              else
+                conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
+              end
+            end
+            if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+              v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+              if v.empty?
+                conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+              else
+                conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
+              end
+            end
+
           else
             # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))))
             conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true)
@@ -734,6 +804,25 @@
                   list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
               end
 
+            when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+              if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+                  && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+                v = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
+                if v.empty?
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+                else
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = TkVarAccess.new(v)
+                end
+              end
+              if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+                v = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+                if v.empty?
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+                else
+                  conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = TkVarAccess.new(v)
+                end
+              end
+
             else
               if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
                   && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )

-- 
                                       永井 秀利 (九工大 知能情報)
                                           nagai@ai.kyutech.ac.jp

In This Thread