ruby-changes:6864
From: akr <ko1@a...>
Date: Wed, 6 Aug 2008 07:47:57 +0900 (JST)
Subject: [ruby-changes:6864] Ruby:r18382 (trunk): * tool/transcode-tblgen.rb: show generating tables in verbose mode.
akr 2008-08-06 07:47:44 +0900 (Wed, 06 Aug 2008) New Revision: 18382 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18382 Log: * tool/transcode-tblgen.rb: show generating tables in verbose mode. (transcode_generate_node): call ActionMap#generate_node with showing table name. * enc/trans/utf_16_32.erb.c: use transcode_generate_node. Modified files: trunk/ChangeLog trunk/enc/trans/utf_16_32.erb.c trunk/tool/transcode-tblgen.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 18381) +++ ChangeLog (revision 18382) @@ -1,3 +1,11 @@ +Wed Aug 6 07:45:26 2008 Tanaka Akira <akr@f...> + + * tool/transcode-tblgen.rb: show generating tables in verbose mode. + (transcode_generate_node): call ActionMap#generate_node with showing + table name. + + * enc/trans/utf_16_32.erb.c: use transcode_generate_node. + Wed Aug 6 06:55:20 2008 Nobuyoshi Nakada <nobu@r...> * thread.c (thread_start_func_2): propagates fatal error and system Index: enc/trans/utf_16_32.erb.c =================================================================== --- enc/trans/utf_16_32.erb.c (revision 18381) +++ enc/trans/utf_16_32.erb.c (revision 18382) @@ -186,7 +186,7 @@ map["{dc-df}{00-ff}"] = :invalid map["{d8-db}{00-ff}{00-db,e0-ff}{00-ff}"] = :invalid code = '' - ActionMap.parse(map).generate_node(code, "from_UTF_16BE", []) + transcode_generate_node(ActionMap.parse(map), code, "from_UTF_16BE", []) code %> @@ -214,7 +214,7 @@ map["f4{90-bf}"] = :invalid code = '' am = ActionMap.parse(map) - am.generate_node(code, "to_UTF_16BE", [0x00..0xff, 0x80..0xbf, 0x80..0xbf, 0x80..0xbf]) + transcode_generate_node(am, code, "to_UTF_16BE", [0x00..0xff, 0x80..0xbf, 0x80..0xbf, 0x80..0xbf]) code %> @@ -231,7 +231,7 @@ map["{00-ff}{dc-df}"] = :invalid map["{00-ff}{d8-db}{00-ff}{00-db,e0-ff}"] = :invalid code = '' - ActionMap.parse(map).generate_node(code, "from_UTF_16LE", []) + transcode_generate_node(ActionMap.parse(map), code, "from_UTF_16LE", []) code %> @@ -256,7 +256,7 @@ #map["{01-ff}"] = :invalid map["{01-ff}{00-ff}{00-ff}{00-ff}"] = :invalid code = '' - ActionMap.parse(map).generate_node(code, "from_UTF_32BE", []) + transcode_generate_node(ActionMap.parse(map), code, "from_UTF_32BE", []) code %> @@ -280,7 +280,7 @@ map["{00-ff}{00-ff}{11-ff}00"] = :invalid map["{00-ff}{d8-df}0000"] = :invalid code = '' - ActionMap.parse(map).generate_node(code, "from_UTF_32LE", []) + transcode_generate_node(ActionMap.parse(map), code, "from_UTF_32LE", []) code %> Index: tool/transcode-tblgen.rb =================================================================== --- tool/transcode-tblgen.rb (revision 18381) +++ tool/transcode-tblgen.rb (revision 18382) @@ -380,6 +380,7 @@ TRANSCODERS = [] def transcode_tblgen(from, to, map) + STDERR.puts "converter for #{from} to #{to}" if VERBOSE_MODE id_from = from.tr('^0-9A-Za-z', '_') id_to = to.tr('^0-9A-Za-z', '_') if from == "UTF-8" @@ -405,6 +406,11 @@ tree_code + "\n" + transcoder_code end +def transcode_generate_node(am, code, name_hint=nil, ranges=[]) + STDERR.puts "converter for #{name_hint}" if VERBOSE_MODE + am.generate_node(code, name_hint, ranges) +end + def transcode_register_code code = '' TRANSCODERS.each {|transcoder_name| @@ -499,6 +505,8 @@ op.def_option("--output=FILE", "specify output file") {|arg| output_filename = arg } op.parse! +VERBOSE_MODE = verbose_mode + arg = ARGV.shift dir = File.dirname(arg) $:.unshift dir unless $:.include? dir @@ -523,14 +531,14 @@ if old_signature == chk_signature now = Time.now File.utime(now, now, output_filename) - STDERR.puts "#{output_filename} is already up-to-date." if verbose_mode + STDERR.puts "already up-to-date: #{output_filename}" if VERBOSE_MODE exit end end -if verbose_mode +if VERBOSE_MODE if output_filename - STDERR.print "generate #{output_filename} ..." + STDERR.puts "generating #{output_filename} ..." end end @@ -559,7 +567,7 @@ new_filename = output_filename + ".new" File.open(new_filename, "w") {|f| f << result } File.rename(new_filename, output_filename) - STDERR.puts " done." if verbose_mode + STDERR.puts "done." if VERBOSE_MODE else print result end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/