* common.mk (encdb.h): see both $(srcdir)/enc and enc.

* enc/make_encdb.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-08-08 07:15:52 +00:00
Родитель 2f37e03736
Коммит b917553e68
3 изменённых файлов: 47 добавлений и 37 удалений

Просмотреть файл

@ -1,4 +1,8 @@
Fri Aug 8 16:09:01 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Aug 8 16:15:50 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (encdb.h): see both $(srcdir)/enc and enc.
* enc/make_encdb.rb: ditto.
* enc/trans/make_transdb.rb: fix for the case no transdirs are given. * enc/trans/make_transdb.rb: fix for the case no transdirs are given.

Просмотреть файл

@ -22,42 +22,48 @@ count = 0
lines = [] lines = []
encodings = [] encodings = []
defs = {} defs = {}
encdir = ARGV[0] encdirs = ARGV.dup
outhdr = ARGV[1] || 'encdb.h' outhdr = encdirs.shift || 'encdb.h'
Dir.open(encdir) {|d| d.grep(/.+\.[ch]\z/)}.sort_by {|e| encdirs << 'enc' if encdirs.empty?
e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten files = {}
}.each do |fn| encdirs.each do |encdir|
open(File.join(encdir,fn)) do |f| Dir.open(encdir) {|d| d.grep(/.+\.[ch]\z/)}.sort_by {|e|
orig = nil e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten
name = nil }.each do |fn|
f.each_line do |line| next if files[fn]
if (/^OnigEncodingDefine/ =~ line)..(/"(.*?)"/ =~ line) files[fn] = true
if $1 open(File.join(encdir,fn)) do |f|
check_duplication(defs, $1, fn, $.) orig = nil
encodings << $1 name = nil
count += 1 f.each_line do |line|
end if (/^OnigEncodingDefine/ =~ line)..(/"(.*?)"/ =~ line)
else if $1
case line check_duplication(defs, $1, fn, $.)
when /^\s*rb_enc_register\(\s*"([^"]+)"/ encodings << $1
count += 1 count += 1
line = nil end
when /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
count += 1
when /^ENC_ALIAS\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
when /^ENC_DUMMY\(\s*"([^"]+)"/
count += 1
else else
next case line
when /^\s*rb_enc_register\(\s*"([^"]+)"/
count += 1
line = nil
when /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
count += 1
when /^ENC_ALIAS\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
when /^ENC_DUMMY\(\s*"([^"]+)"/
count += 1
else
next
end
check_duplication(defs, $1, fn, $.)
lines << line.sub(/;.*/m, "").chomp + ";\n" if line
end end
check_duplication(defs, $1, fn, $.)
lines << line.sub(/;.*/m, "").chomp + ";\n" if line
end end
end end
end end

Просмотреть файл

@ -8,8 +8,8 @@
count = 0 count = 0
converters = {} converters = {}
outhdr = ARGV[0] || 'transdb.h' transdirs = ARGV.dup
transdirs = ARGV[1..-1] outhdr = transdirs.shift || 'transdb.h'
transdirs << 'enc/trans' if transdirs.empty? transdirs << 'enc/trans' if transdirs.empty?
files = {} files = {}
transdirs.each do |transdir| transdirs.each do |transdir|