summaryrefslogtreecommitdiff
path: root/enc/make_encdb.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 09:41:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-13 09:41:50 +0000
commitbb8ddbe8471d4d1a66b79956b7697f947fb0a61d (patch)
tree31174f6d592d63136fcc1ba21950aa28c645d0ed /enc/make_encdb.rb
parente26e05c4abf76d751bd17704b55ab550a9fe024e (diff)
* encoding.c (Init_Encoding): moved initialization from encdb.h.
* enc/make_encdb.rb (enc_name_list): constified. * enc/make_encdb.rb (enc_init_db): moved some functions to encoding.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/make_encdb.rb')
-rwxr-xr-xenc/make_encdb.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/enc/make_encdb.rb b/enc/make_encdb.rb
index 32dacbc740..fe596769dc 100755
--- a/enc/make_encdb.rb
+++ b/enc/make_encdb.rb
@@ -35,26 +35,16 @@ Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}.each do |fn|
end
p aliases
open('encdb.h', 'wb') do |f|
- f.puts 'static const char *enc_name_list[] = {'
+ f.puts 'static const char *const 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_")
-};
-#define enc_name_list_size (sizeof(enc_name_list)/sizeof(enc_name_list[0]))
-
-static void enc_init_db(void)
-{
- if (!enc_table.replica_name) {
- enc_table.replica_name = st_init_strcasetable();
- }
- if (!enc_table.alias_name) {
- enc_table.alias_name = st_init_strcasetable();
- }
-_TEXT_
+ f.puts('};', '', 'static void', 'enc_init_db(void)', '{')
replicas.each_pair {|name, orig|
- f.puts' st_insert(enc_table.replica_name, (st_data_t)"%s", (st_data_t)"%s");' % [name, orig]}
+ f.puts ' ENC_REPLICATE("%s", "%s");' % [name, orig]
+ }
aliases.each_pair {|name, orig|
- f.puts' st_insert(enc_table.alias_name, (st_data_t)"%s", (st_data_t)"%s");' % [name, orig]}
+ f.puts ' ENC_ALIAS("%s", "%s");' % [name, orig]
+ }
f.puts '}'
end