зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
c6d05a63c6
Коммит
b41a687fe6
|
@ -1,3 +1,9 @@
|
|||
Fri Aug 8 04:20:14 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* common.mk: see both $(srcdir)/enc/trans and enc/trans.
|
||||
|
||||
* enc/trans/make_transdb.rb: ditto.
|
||||
|
||||
Fri Aug 8 00:05:02 2008 TAKAO Kouji <kouji@takao7.net>
|
||||
|
||||
* ext/.document: added readline/readline.c.
|
||||
|
|
|
@ -684,7 +684,7 @@ encdb.h: $(PREP)
|
|||
$(IFCHANGE) "$@" "$@.new"
|
||||
|
||||
transdb.h: $(PREP) transcodes
|
||||
$(MINIRUBY) $(srcdir)/enc/trans/make_transdb.rb $(srcdir)/enc/trans $@.new
|
||||
$(MINIRUBY) $(srcdir)/enc/trans/make_transdb.rb $@.new $(srcdir)/enc/trans enc/trans
|
||||
$(IFCHANGE) "$@" "$@.new"
|
||||
|
||||
miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.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
|
||||
|
|
Загрузка…
Ссылка в новой задаче