[#26664] refactoring tcltklib.c (deleted ip check) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
山本です。
山本です。
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
[#26711] --with-static-linked-extするとrequireできないライブラリがある — IWATSUKI Hiroyuki <don@...>
岩月と申します。
なかだです。
[#26721] TkVariable.new_hash 経由だと trace が発生しない — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
[#26723] Fixnum演算メソッド中のcoerceの削減 — Tadashi Saito <shiba@...2.accsnet.ne.jp>
斎藤と申します。
[#26743] zsuper in a method with optional arg — "NAKAMURA, Hiroshi" <nakahiro@...>
-----BEGIN PGP SIGNED MESSAGE-----
まつもと ゆきひろです
-----BEGIN PGP SIGNED MESSAGE-----
[#26745] TkCheckbutton#variable as getter? — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
永井@知能.九工大です.
山本です。
永井@知能.九工大です.
[#26753] some questions about tcltklib.c — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
永井@知能.九工大です.
山本です。
[#26764] multi-thread and logger — Nobuhiro IMAI <nov@...>
いまいです。
[#26791] Failure: test_block_passing(TestIterator) — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
まつもと ゆきひろです
[#26800] reducing PUSH_TAG in rescue, and useless exceptions — nobu@...
なかだです。
[#26808] test/nkf/test_kconv.rb — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
[#26817] test/socket/test_tcp.rb freeze on windows — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
こんにちは、なかむら(う)です。
山本です。
山本です。
こんにちは、なかむら(う)です。
山本です。
こんにちは、なかむら(う)です。
山本です。返信が遅れてすみません。
[#26829] cannot check EOF of pipe on windows — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
山本です。
こんにちは、なかむら(う)です。
山本です。
なかだです。
山本です。
こんにちは、なかむら(う)です。
なかだです。
こんにちは、なかむら(う)です。
なかだです。
こんにちは、なかむら(う)です。
山本です。
[#26840] [BUG] oniguruma + utf-8 — "NAKAMURA, Hiroshi" <nakahiro@...>
-----BEGIN PGP SIGNED MESSAGE-----
[#26851] ripper for 1.8 — Tanaka Akira <akr@...17n.org>
ruby-1.8 で動かす gonzui で、ruby code の解析をしたいという要望があっ
[#26872] irb -I/ruby -Iと$LOAD_PATH — akira yamada / やまだあきら <akira@...>
Debianユーザからruby -Iとirb -Iで
なかだです。
nobuyoshi nakada wrote:
けいじゅ@いしつかです.
けいじゅ@いしつかです.
なかだです。
けいじゅ@いしつかです.
まつもと ゆきひろです
けいじゅ@いしつかです.
[#26883] top level include on load(filename, true) — Shugo Maeda <shugo@...>
前田です。
[#26897] fail on make install — KIMURA Koichi <kimura.koichi@...>
木村です。
こんにちは、なかむら(う)です。
木村です。
木村です。
木村です。
こんにちは、なかむら(う)です。
木村です。
こんにちは、なかむら(う)です。
なかだです。
山本です。
なかだです。
なかだです。
山本です。
こんにちは、なかむら(う)です。
なかだです。
まつもと ゆきひろです
山本です。
なかだです。
[#26900] multiplying empty string — nobuyoshi nakada <nobuyoshi.nakada@...>
まつもと ゆきひろです
In article <1125327516.070646.12845.nullmailer@x31.priv.netlab.jp>,
まつもと ゆきひろです
In article <1125356798.802509.8788.nullmailer@x31.priv.netlab.jp>,
まつもと ゆきひろです
In article <1125369966.174424.13781.nullmailer@x31.priv.netlab.jp>,
[ruby-dev:26725] Re: TkVariable.new_hash 経由だと trace が発生しない
永井@知能.九工大です.
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