diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-07 19:24:47 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-07 19:24:47 +0000 |
commit | b41a687fe6ba9e2dd898df98018ba59450376603 (patch) | |
tree | 7ba03172aef9e4f2bd3e3f91c3cf866d3702c36f /enc | |
parent | c6d05a63c689dd162c92dc73188a8ba041fef6bc (diff) |
* common.mk: see both $(srcdir)/enc/trans and enc/trans.
* enc/trans/make_transdb.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rw-r--r-- | enc/trans/make_transdb.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/enc/trans/make_transdb.rb b/enc/trans/make_transdb.rb index 649a6f21a3..ab48c4c940 100644 --- a/enc/trans/make_transdb.rb +++ b/enc/trans/make_transdb.rb @@ -8,22 +8,24 @@ count = 0 converters = {} -transdir = ARGV[0] -outhdr = ARGV[1] || 'transdb.h' -Dir.open(transdir) {|d| d.grep(/.+\.[ch]\z/).reject {|n| /\.erb\.c\z/ =~ n }}.sort_by {|e| - e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten -}.each do |fn| - open(File.join(transdir,fn)) do |f| - f.each_line do |line| - if (/^static const rb_transcoder/ =~ line)..(/"(.*?)"\s*,\s*"(.*?)"/ =~ line) - if $1 && $2 - from_to = "%s to %s" % [$1, $2] - if converters[from_to] - raise ArgumentError, '%s:%d: transcode "%s" is already registered (%s:%d)' % - [fn, $., from_to, *converters[from_to].values_at(2, 3)] - else - converters[from_to] = [$1, $2, fn[0..-3], $.] - end +outhdr = ARGV[0] || 'transdb.h' +transdirs = ARGV[1..-1] || 'enc/trans' +transdirs.each do |transdir| + Dir.open(transdir) {|d| d.grep(/.+\.[ch]\z/).reject {|n| /\.erb\.c\z/ =~ n }}.sort_by {|e| + e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten + }.each do |fn| + open(File.join(transdir,fn)) do |f| + f.each_line do |line| + if (/^static const rb_transcoder/ =~ line)..(/"(.*?)"\s*,\s*"(.*?)"/ =~ line) + if $1 && $2 + from_to = "%s to %s" % [$1, $2] + if converters[from_to] + raise ArgumentError, '%s:%d: transcode "%s" is already registered (%s:%d)' % + [fn, $., from_to, *converters[from_to].values_at(2, 3)] + else + converters[from_to] = [$1, $2, fn[0..-3], $.] + end + end end end end |