ruby-changes:7721
From: akr <ko1@a...>
Date: Mon, 8 Sep 2008 18:17:06 +0900 (JST)
Subject: [ruby-changes:7721] Ruby:r19242 (trunk): * tool/transcode-tblgen.rb (ArrayCode): less string substitutions.
akr 2008-09-08 18:16:45 +0900 (Mon, 08 Sep 2008) New Revision: 19242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19242 Log: * tool/transcode-tblgen.rb (ArrayCode): less string substitutions. Modified files: trunk/ChangeLog trunk/tool/transcode-tblgen.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19241) +++ ChangeLog (revision 19242) @@ -1,3 +1,7 @@ +Mon Sep 8 18:15:59 2008 Tanaka Akira <akr@f...> + + * tool/transcode-tblgen.rb (ArrayCode): less string substitutions. + Mon Sep 8 18:13:13 2008 Tanaka Akira <akr@f...> * vm.c (rb_mRubyVMFrozenCore): registered for GC. Index: tool/transcode-tblgen.rb =================================================================== --- tool/transcode-tblgen.rb (revision 19241) +++ tool/transcode-tblgen.rb (revision 19242) @@ -157,27 +157,28 @@ class ArrayCode def initialize(type, name) - @code = <<"End" -static const #{type} -#{name}[0] = { -}; -End + @type = type + @name = name + @len = 0; + @content = '' end def length - @code[/\[\d+\]/][1...-1].to_i + @len end def insert_at_last(num, str) newnum = self.length + num - @code.sub!(/^(\};\n\z)/) { - str + $1 - } - @code.sub!(/\[\d+\]/) { "[#{newnum}]" } + @content << str + @len += num end def to_s - @code.dup + <<"End" +static const #{@type} +#{@name}[#{@len}] = { +#{@content}}; +End end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/