From: nagai@... Date: 2002-01-28T01:27:18+09:00 Subject: [ruby-dev:15776] Bug? and Ruby/Tk patch 永井@知能.九工大です. 1.7.2 ですが, ---------------------------------------- [nagai@jyunyou nagai]$ irb irb(main):001:0> require 'tk' true irb(main):002:0> root = TkRoot.new # irb(main):003:0> TkGrid.rowconfigure(root, 0, 'weight'=>1, 'minsize'=>0) "" irb(main):004:0> TkGrid.rowconfigure (root, 0, 'weight'=>1, 'minsize'=>0) (irb):4: [BUG] Segmentation fault ruby 1.7.2 (2002-01-25) [i586-linux] Aborted (core dumped) [nagai@jyunyou nagai]$ ---------------------------------------- などとなってしまいました. メソッド名と括弧が隣接していると OK なのですが, 空白を挟んでしまうと落ちます. 今は原因究明までは手が回らないので, 報告だけでごめんなさい. これに加えて Ruby/Tk のパッチです. cvs アカウントはいただいているのですが, まだ自信をもって commit できるようにはマスターできてないので, 今回分はパッチ当てをお願いできないでしょうか? 1.6 系, 1.7 系の両方での適用をお願いします. 修正点は, ・デバッグ用出力の消し忘れの削除 ・TkVariable のトレース部での恥ずかしいバグの修正 ・日本語パッチ版Tcl/Tk使用時に,直接フォント指定に失敗するバグの修正 ・TkTextMark#next と previous の仕様改善 です. diff -urN lib.orig/tk.rb lib/tk.rb --- lib.orig/tk.rb Mon Nov 19 14:02:17 2001 +++ lib/tk.rb Mon Jan 28 00:27:48 2002 @@ -93,7 +93,6 @@ brace -= 1 if c == ?} break if brace == 0 } - p str[0,i] if str[0, i] == ' ' list.push ' ' else @@ -1318,7 +1317,7 @@ opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('') idx = -1 newopts = '' - @trace_var.each_with_index{|i,e| + @trace_var.each_with_index{|e,i| if idx < 0 && e[0] == opts && e[1] == cmd idx = i next @@ -1352,7 +1351,7 @@ return unless @trace_elem[elem].kind_of? Array opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('') idx = -1 - @trace_elem[elem].each_with_index{|i,e| + @trace_elem[elem].each_with_index{|e,i| if idx < 0 && e[0] == opts && e[1] == cmd idx = i next diff -urN lib.orig/tkfont.rb lib/tkfont.rb --- lib.orig/tkfont.rb Mon Nov 19 14:02:17 2001 +++ lib/tkfont.rb Mon Jan 28 00:23:34 2002 @@ -173,8 +173,8 @@ TkFont.new(nil, nil).call_font_configure(path, *(args + [{}])) else begin - compound = Hash[*list(tk_call('font', 'configure', - fnt))].collect{|key,value| + compound = Hash[*tk_split_simplelist(tk_call('font', 'configure', + fnt))].collect{|key,value| [key[1..-1], value] }.assoc('compound')[1] rescue diff -urN lib.orig/tktext.rb lib/tktext.rb --- lib.orig/tktext.rb Wed Sep 5 15:54:57 2001 +++ lib/tktext.rb Mon Jan 28 01:10:20 2002 @@ -813,12 +813,20 @@ tk_call @t.path, 'mark', 'gravity', @id, direction end - def next(index) - @t.tagid2obj(tk_call(@t.path, 'mark', 'next', index)) + def next(index = nil) + if index + @t.tagid2obj(tk_call(@t.path, 'mark', 'next', index)) + else + @t.tagid2obj(tk_call(@t.path, 'mark', 'next', @id)) + end end - def previous(index) - @t.tagid2obj(tk_call(@t.path, 'mark', 'previous', index)) + def previous(index = nil) + if index + @t.tagid2obj(tk_call(@t.path, 'mark', 'previous', index)) + else + @t.tagid2obj(tk_call(@t.path, 'mark', 'previous', @id)) + end end end -- 永井 秀利 (九工大 知能情報) nagai@ai.kyutech.ac.jp