summaryrefslogtreecommitdiff
path: root/enc
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-12 16:55:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-12 16:55:33 +0000
commite699dda5042b65e9e4c8ce29fa6575e3684b9100 (patch)
treea5adf00e581e45aa630dd5297ab4aed3d31e4caf /enc
parentb866ecbc42f5cb4d2f6138a9038d0443dc9f6cc6 (diff)
* enc/make_encdb.rb: should work on Ruby 1.8. [ruby-dev:33069]
* common.mk (encdb.h): pass enc dir from outside to make_encdb.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rwxr-xr-xenc/make_encdb.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/enc/make_encdb.rb b/enc/make_encdb.rb
index 2cd7699944..b8b430190f 100755
--- a/enc/make_encdb.rb
+++ b/enc/make_encdb.rb
@@ -1,5 +1,3 @@
-#! ./miniruby
-
#
# OnigEncodingDefine(foo, Foo) = {
# ..
@@ -11,13 +9,12 @@
# ENC_ALIAS("CP932", "Windows-31J")
#
-require 'mkmf'
-
encodings = []
replicas = {}
aliases = {}
-Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)}.each do |fn|
- open(File.join($srcdir,fn)) do |f|
+encdir = ARGV[0]
+Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}.each do |fn|
+ open(File.join(encdir,fn)) do |f|
orig = nil
name = nil
f.each_line do |line|
@@ -36,14 +33,16 @@ Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)}.each do |fn|
end
end
end
+p aliases
open('encdb.h', 'wb') do |f|
f.puts 'static const char *enc_name_list[] = {'
encodings.each {|name| f.puts' "%s",' % name}
replicas.each_key {|name| f.puts' "%s",' % name}
+ aliases.each_key {|name| f.puts' "%s",' % name}
f.puts(<<"_TEXT_")
NULL
};
-static const int enc_name_list_size = #{encodings.length + replicas.length};
+static const int enc_name_list_size = #{encodings.length + replicas.length + aliases.length};
static const int enc_aliases_size = #{aliases.length};
static st_table *enc_table_replica_name;
static st_table *enc_table_alias_name;