1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* template/{encdb,transdb}.h.tmpl: moved enc/make_encdb.rb and

enc/trans/make_transdb.rb using tool/generic_erb.rb.

* common.mk (encdb.h, transdb.h): generates from avobe template.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-01-13 09:05:29 +00:00
parent 4cb8d3316a
commit e668e36b49
3 changed files with 18 additions and 20 deletions

View file

@ -647,13 +647,11 @@ insns: $(INSNS)
node_name.inc: {$(VPATH)}node.h node_name.inc: {$(VPATH)}node.h
encdb.h: $(PREP) encdb.h: $(PREP) $(srcdir)/tool/generic_erb.rb $(srcdir)/template/encdb.h.tmpl
$(MINIRUBY) $(srcdir)/enc/make_encdb.rb $@.new $(srcdir)/enc enc $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/encdb.h.tmpl $(srcdir)/enc enc
$(IFCHANGE) "$@" "$@.new"
transdb.h: $(PREP) srcs-enc transdb.h: $(PREP) srcs-enc $(srcdir)/tool/generic_erb.rb $(srcdir)/template/transdb.h.tmpl
$(MINIRUBY) $(srcdir)/enc/trans/make_transdb.rb $@.new $(srcdir)/enc/trans enc/trans $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/transdb.h.tmpl $(srcdir)/enc/trans enc/trans
$(IFCHANGE) "$@" "$@.new"
# {$(VPATH)}id.h: {$(VPATH)}parse.h $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl # {$(VPATH)}id.h: {$(VPATH)}parse.h $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl
# $(BASERUBY) $(srcdir)/tool/generic_erb.rb --if-change --output=$@ \ # $(BASERUBY) $(srcdir)/tool/generic_erb.rb --if-change --output=$@ \

View file

@ -1,3 +1,4 @@
<%
# #
# OnigEncodingDefine(foo, Foo) = { # OnigEncodingDefine(foo, Foo) = {
# .. # ..
@ -23,7 +24,6 @@ lines = []
encodings = [] encodings = []
defs = {} defs = {}
encdirs = ARGV.dup encdirs = ARGV.dup
outhdr = encdirs.shift || 'encdb.h'
encdirs << 'enc' if encdirs.empty? encdirs << 'enc' if encdirs.empty?
files = {} files = {}
encdirs.each do |encdir| encdirs.each do |encdir|
@ -63,15 +63,17 @@ encdirs.each do |encdir|
next next
end end
check_duplication(defs, $1, fn, $.) check_duplication(defs, $1, fn, $.)
lines << line.sub(/;.*/m, "").chomp + ";\n" if line lines << line.sub(/;.*/m, "").chomp + ";" if line
end end
end end
end end
end end
end end
encodings.each do |e|
%>ENC_DEFINE("<%=e%>");
% end
% lines.each do |line|
<%=line%>
% end
result = encodings.map {|e| %[ENC_DEFINE("#{e}");\n]}.join + lines.join + #define ENCODING_COUNT <%=count%>
"\n#define ENCODING_COUNT #{count}\n"
open(outhdr, 'wb') do |f|
f.print result
end

View file

@ -1,3 +1,4 @@
<%
# #
# static const rb_transcoder # static const rb_transcoder
# rb_from_US_ASCII = { # rb_from_US_ASCII = {
@ -9,7 +10,6 @@
count = 0 count = 0
converters = {} converters = {}
transdirs = ARGV.dup transdirs = ARGV.dup
outhdr = transdirs.shift || 'transdb.h'
transdirs << 'enc/trans' if transdirs.empty? transdirs << 'enc/trans' if transdirs.empty?
transdirs = transdirs.sort_by {|td| transdirs = transdirs.sort_by {|td|
@ -53,9 +53,7 @@ transdirs.each do |transdir|
end end
end end
end end
result = converter_list.map do |from_to| converter_list.each do |from_to|
%[rb_declare_transcoder("%s", "%s", "%s");\n] % converters[from_to] from, to, fn = *converters[from_to]
end.join("") %>rb_declare_transcoder("<%=from%>", "<%=to%>", "<%=fn%>");
open(outhdr, 'wb') do |f| % end
f.print result
end