summaryrefslogtreecommitdiff
path: root/enc/trans
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-13 09:05:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-13 09:05:29 +0000
commite668e36b49b38d6d422c6e9d4b3eddd374bcbb15 (patch)
treea50eeca907825118f10b1948c534ce30b1535faa /enc/trans
parent4cb8d3316afc452993d8e6d26e2818f412b400a2 (diff)
* 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
Diffstat (limited to 'enc/trans')
-rw-r--r--enc/trans/make_transdb.rb61
1 files changed, 0 insertions, 61 deletions
diff --git a/enc/trans/make_transdb.rb b/enc/trans/make_transdb.rb
deleted file mode 100644
index 4f11abd35a..0000000000
--- a/enc/trans/make_transdb.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# static const rb_transcoder
-# rb_from_US_ASCII = {
-# "US-ASCII", "UTF-8", &from_US_ASCII, 1, 0,
-# NULL, NULL,
-# };
-#
-
-count = 0
-converters = {}
-transdirs = ARGV.dup
-outhdr = transdirs.shift || 'transdb.h'
-transdirs << 'enc/trans' if transdirs.empty?
-
-transdirs = transdirs.sort_by {|td|
- -td.length
-}.inject([]) {|tds, td|
- next tds unless File.directory?(td)
- tds << td if tds.all? {|td2| !File.identical?(td2, td) }
- tds
-}
-
-files = {}
-names_t = []
-converter_list = []
-transdirs.each do |transdir|
- names = Dir.entries(transdir)
- names_t += names.map {|n| /(?!\A)\.trans\z/ =~ n ? $` : nil }.compact
- names_c = names.map {|n| /(?!\A)\.c\z/ =~ n ? $` : nil }.compact
- (names_t & names_c).map {|n|
- "#{n}.c"
- }.sort_by {|e|
- e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten
- }.each do |fn|
- next if files[fn]
- files[fn] = true
- path = File.join(transdir,fn)
- open(path) 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 at %s:%d' %
- [path, $., from_to, *converters[from_to].values_at(3, 4)]
- else
- converters[from_to] = [$1, $2, fn[0..-3], path, $.]
- converter_list << from_to
- end
- end
- end
- end
- 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