mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3af2559d17
commit
e90dd02529
3 changed files with 25 additions and 9 deletions
|
@ -1,3 +1,11 @@
|
|||
Wed Aug 6 07:45:26 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* thread.c (thread_start_func_2): propagates fatal error and system
|
||||
|
|
|
@ -186,7 +186,7 @@ fun_so_to_utf_32le(const unsigned char* s, unsigned char* o)
|
|||
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 @@ rb_from_UTF_16BE = {
|
|||
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 @@ rb_to_UTF_16BE = {
|
|||
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 @@ rb_to_UTF_16LE = {
|
|||
#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 @@ rb_to_UTF_32BE = {
|
|||
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
|
||||
%>
|
||||
|
||||
|
|
|
@ -380,6 +380,7 @@ end
|
|||
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 @@ End
|
|||
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("--force", "force table generation") { force_mode = true }
|
|||
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 !force_mode && output_filename && File.readable?(output_filename)
|
|||
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 @@ if output_filename
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue