Browse files

* 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
  • Loading branch information...
1 parent 4cb8d33 commit e668e36b49b38d6d422c6e9d4b3eddd374bcbb15 @nobu nobu committed Jan 13, 2009
Showing with 18 additions and 20 deletions.
  1. +4 −6 common.mk
  2. +9 −7 enc/make_encdb.rb → template/encdb.h.tmpl
  3. +5 −7 enc/trans/make_transdb.rb → template/transdb.h.tmpl
View
10 common.mk
@@ -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
16 enc/make_encdb.rb → template/encdb.h.tmpl
@@ -1,3 +1,4 @@
+<%
#
# OnigEncodingDefine(foo, Foo) = {
# ..
@@ -23,7 +24,6 @@ def check_duplication(defs, name, fn, line)
encodings = []
defs = {}
encdirs = ARGV.dup
-outhdr = encdirs.shift || 'encdb.h'
encdirs << 'enc' if encdirs.empty?
files = {}
encdirs.each do |encdir|
@@ -63,15 +63,17 @@ def check_duplication(defs, name, fn, line)
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
12 enc/trans/make_transdb.rb → template/transdb.h.tmpl
@@ -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 @@
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

0 comments on commit e668e36

Please sign in to comment.