[#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:26725] Re: TkVariable.new_hash 経由だと trace が発生しない

From: Hidetoshi NAGAI <nagai@...>
Date: 2005-08-03 04:43:57 UTC
List: ruby-dev #26725
永井@知能.九工大です.

From: H.Yamamoto <ocean@m2.ccsnet.ne.jp>
Subject: [ruby-dev:26721] TkVariable.new_hash 経由だと trace が発生しない
Date: Wed, 3 Aug 2005 08:55:04 +0900
Message-ID: <20050803085503.DAD1AA40.ocean@m2.ccsnet.ne.jp>
> いじっているうちに気づいたのですが、TkVariable.new_hash 経由で
> 取得した TkVariable では trace が使用できないようです。これは
> 意図された挙動でしょうか?

意図したものではないです.
次の patch ではいかがでしょう?

Index: ext/tk/lib/tk/variable.rb
===================================================================
RCS file: /var/cvs/src/ruby/ext/tk/lib/tk/variable.rb,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 variable.rb
--- ext/tk/lib/tk/variable.rb	28 Jul 2005 09:15:36 -0000	1.1.2.17
+++ ext/tk/lib/tk/variable.rb	3 Aug 2005 04:42:58 -0000
@@ -41,13 +41,13 @@
   EOL
 
   #def TkVariable.callback(args)
-  def TkVariable.callback(name1, name2, op)
+  def TkVariable.callback(id, name1, name2, op)
     #name1,name2,op = tk_split_list(args)
     #name1,name2,op = tk_split_simplelist(args)
-    if TkVar_CB_TBL[name1]
+    if TkVar_CB_TBL[id]
       #_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
       begin
-        _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
+        _get_eval_string(TkVar_CB_TBL[id].trace_callback(name2, op))
       rescue SystemExit
         exit(0)
       rescue Interrupt
@@ -270,6 +270,9 @@
     Tk_VARIABLE_ID[1].succ!
     TkVar_ID_TBL[@id] = self
 
+    @var  = @id
+    @elem = nil
+
     @def_default = false
     @default_val = nil
 
@@ -805,6 +808,7 @@
   end
 
   def variable
+    # keeps a Tcl's variable name
     TkVarAccess.new(self._value)
   end
   def variable_element(*idxs)
@@ -1264,12 +1268,14 @@
   def trace(opts, cmd = Proc.new)
     @trace_var = [] if @trace_var == nil
     #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
+    opts = opts.to_s
+    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
     @trace_var.unshift([opts,cmd])
     if @trace_opts == nil
       TkVar_CB_TBL[@id] = self
       @trace_opts = opts.dup
-      Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+      Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                             'rb_var ' << @id)
 =begin
       if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
         # TCL_VERSION >= 8.4
@@ -1285,9 +1291,11 @@
       #opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
       opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
       if newopts != @trace_opts
-        Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 
+                               'rb_var ' << @id)
         @trace_opts.replace(newopts)
-        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                               'rb_var ' << @id)
 =begin
         if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
           # TCL_VERSION >= 8.4
@@ -1311,15 +1319,20 @@
   end
 
   def trace_element(elem, opts, cmd = Proc.new)
+    if @elem
+      fail(RuntimeError, 
+           "invalid for a TkVariable which denotes an element of Tcl's array")
+    end
     @trace_elem = {} if @trace_elem == nil
     @trace_elem[elem] = [] if @trace_elem[elem] == nil
-    #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
+    opts = opts.to_s
+    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
     @trace_elem[elem].unshift([opts,cmd])
     if @trace_opts == nil
       TkVar_CB_TBL[@id] = self
       @trace_opts = opts.dup
-      Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+      Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                             'rb_var ' << @id)
 =begin
       if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
         # TCL_VERSION >= 8.4
@@ -1336,9 +1349,11 @@
       # opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
       opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
       if newopts != @trace_opts
-        Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 
+                               'rb_var ' << @id)
         @trace_opts.replace(newopts)
-        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                               'rb_var ' << @id)
 =begin
         if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
           # TCL_VERSION >= 8.4
@@ -1365,7 +1380,12 @@
     return [] unless @trace_var
     @trace_var.dup
   end
-  def trace_vinfo_for_element(elem)
+
+  def _trace_vinfo_for_element(elem)
+    if @elem
+      fail(RuntimeError, 
+           "invalid for a TkVariable which denotes an element of Tcl's array")
+    end
     return [] unless @trace_elem
     return [] unless @trace_elem[elem]
     @trace_elem[elem].dup
@@ -1373,8 +1393,8 @@
 
   def trace_vdelete(opts,cmd)
     return self unless @trace_var.kind_of? Array
-    #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
+    opts = opts.to_s
+    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
     idx = -1
     newopts = ''
     @trace_var.each_with_index{|e,i| 
@@ -1398,10 +1418,11 @@
       }
     }
 
-    #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
-    newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
+    newopts = newopts.to_s
+    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
     if newopts != @trace_opts
-      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 
+                             'rb_var ' << @id)
 =begin
       if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
         # TCL_VERSION >= 8.4
@@ -1415,7 +1436,8 @@
 =end
       @trace_opts.replace(newopts)
       if @trace_opts != ''
-        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                               'rb_var ' << @id)
 =begin
         if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
           # TCL_VERSION >= 8.4
@@ -1434,10 +1456,14 @@
   end
 
   def trace_vdelete_for_element(elem,opts,cmd)
+    if @elem
+      fail(RuntimeError, 
+           "invalid for a TkVariable which denotes an element of Tcl's array")
+    end
     return self unless @trace_elem.kind_of? Hash
     return self unless @trace_elem[elem].kind_of? Array
-    # opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
-    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
+    opts = opts.to_s
+    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
     idx = -1
     @trace_elem[elem].each_with_index{|e,i| 
       if idx < 0 && e[0] == opts && e[1] == cmd
@@ -1463,10 +1489,11 @@
       }
     }
 
-    #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
-    newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
+    newopts = newopts.to_s
+    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
     if newopts != @trace_opts
-      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 
+                             'rb_var ' << @id)
 =begin
       if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
         # TCL_VERSION >= 8.4
@@ -1480,7 +1507,8 @@
 =end
       @trace_opts.replace(newopts)
       if @trace_opts != ''
-        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+        Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 
+                               'rb_var ' << @id)
 =begin
         if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
           # TCL_VERSION >= 8.4
@@ -1519,6 +1547,9 @@
     @id = varname
     TkVar_ID_TBL[@id] = self
 
+    @var  = @id
+    @elem = nil
+
     @def_default = false
     @default_val = nil
 
@@ -1530,7 +1561,16 @@
     var = self
     @element_type = Hash.new{|k,v| var.default_value_type }
 
+    # is an element?
+    if @id =~ /^([^(]+)\((.+)\)$/
+      # is an element --> var == $1, elem == $2
+      @var  = $1
+      @elem = $2
+    end
+
     # teach Tk-ip that @id is global var
+    INTERP._invoke_without_enc('global', @var)
+=begin
     begin
       INTERP._invoke_without_enc('global', @id)
     rescue => e
@@ -1541,6 +1581,7 @@
         fail e
       end
     end
+=end
 
     if val
       if val.kind_of?(Hash)

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

In This Thread