From b41a687fe6ba9e2dd898df98018ba59450376603 Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 7 Aug 2008 19:24:47 +0000 Subject: * 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 --- enc/trans/make_transdb.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'enc/trans') 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 -- cgit v1.2.3