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
encdb.h: $(PREP)
$(MINIRUBY) $(srcdir)/enc/make_encdb.rb $@.new $(srcdir)/enc enc
$(IFCHANGE) "$@" "$@.new"
encdb.h: $(PREP) $(srcdir)/tool/generic_erb.rb $(srcdir)/template/encdb.h.tmpl
$(MINIRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/encdb.h.tmpl $(srcdir)/enc enc
transdb.h: $(PREP) srcs-enc
$(MINIRUBY) $(srcdir)/enc/trans/make_transdb.rb $@.new $(srcdir)/enc/trans enc/trans
$(IFCHANGE) "$@" "$@.new"
transdb.h: $(PREP) srcs-enc $(srcdir)/tool/generic_erb.rb $(srcdir)/template/transdb.h.tmpl
$(MINIRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/transdb.h.tmpl $(srcdir)/enc/trans enc/trans
# {$(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=$@ \

View file

@ -1,3 +1,4 @@
<%
#
# OnigEncodingDefine(foo, Foo) = {
# ..
@ -23,7 +24,6 @@ lines = []
encodings = []
defs = {}
encdirs = ARGV.dup
outhdr = encdirs.shift || 'encdb.h'
encdirs << 'enc' if encdirs.empty?
files = {}
encdirs.each do |encdir|
@ -63,15 +63,17 @@ encdirs.each do |encdir|
next
end
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
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 +
"\n#define ENCODING_COUNT #{count}\n"
open(outhdr, 'wb') do |f|
f.print result
end
#define ENCODING_COUNT <%=count%>

View file

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