ruby-changes:3536
From: ko1@a...
Date: Sun, 13 Jan 2008 23:29:39 +0900 (JST)
Subject: [ruby-changes:3536] naruse - Ruby:r15025 (trunk): * enc/make_encdb.h: sort encoding names by original name.
naruse 2008-01-13 23:29:12 +0900 (Sun, 13 Jan 2008) New Revision: 15025 Modified files: trunk/ChangeLog trunk/enc/euc_jp.c trunk/enc/iso_8859_1.c trunk/enc/iso_8859_10.c trunk/enc/iso_8859_11.c trunk/enc/iso_8859_13.c trunk/enc/iso_8859_14.c trunk/enc/iso_8859_15.c trunk/enc/iso_8859_16.c trunk/enc/iso_8859_2.c trunk/enc/iso_8859_3.c trunk/enc/iso_8859_4.c trunk/enc/iso_8859_5.c trunk/enc/iso_8859_6.c trunk/enc/iso_8859_7.c trunk/enc/iso_8859_8.c trunk/enc/iso_8859_9.c trunk/enc/make_encdb.rb trunk/enc/us_ascii.c trunk/encoding.c Log: * enc/make_encdb.h: sort encoding names by original name. * encoding.c, enc/*.c: define replicas and aliases. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/make_encdb.rb?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_9.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_13.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_14.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_15.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_1.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_2.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_16.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_3.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/euc_jp.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_4.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_5.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_6.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_7.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_10.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/us_ascii.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_8.c?r1=15025&r2=15024&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/iso_8859_11.c?r1=15025&r2=15024&diff_format=u Index: encoding.c =================================================================== --- encoding.c (revision 15024) +++ encoding.c (revision 15025) @@ -1087,10 +1087,13 @@ rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0); rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0); + enc_init_db(); + /* dummy for unsupported, statefull encoding */ rb_define_dummy_encoding("ISO-2022-JP"); - - enc_init_db(); + rb_enc_alias("ISO2022-JP", "ISO-2022-JP"); + rb_define_dummy_encoding("ISO-2022-JP-2"); + rb_enc_alias("ISO2022-JP-2", "ISO-2022-JP-2"); } /* locale insensitive functions */ Index: ChangeLog =================================================================== --- ChangeLog (revision 15024) +++ ChangeLog (revision 15025) @@ -1,3 +1,9 @@ +Sun Jan 13 22:47:28 2008 NARUSE, Yui <naruse@r...> + + * enc/make_encdb.h: sort encoding names by original name. + + * encoding.c, enc/*.c: define replicas and aliases. + Sun Jan 13 20:24:03 2008 NARUSE, Yui <naruse@r...> * encoding.c: add documents. Index: enc/us_ascii.c =================================================================== --- enc/us_ascii.c (revision 15024) +++ enc/us_ascii.c (revision 15025) @@ -28,4 +28,4 @@ }; ENC_ALIAS("ASCII", "US-ASCII"); ENC_ALIAS("ANSI_X3.4-1986", "US-ASCII"); - +ENC_ALIAS("646", "US-ASCII"); \ No newline at end of file Index: enc/euc_jp.c =================================================================== --- enc/euc_jp.c (revision 15024) +++ enc/euc_jp.c (revision 15025) @@ -364,3 +364,6 @@ 0 }; ENC_ALIAS("eucJP", "EUC-JP"); /* UI-OSF Application Platform Profile for Japanese Environment Version 1.1 */ +ENC_REPLICATE("eucJP-ms", "EUC-JP"); /* TOG/JVC CDE/Motif Technical WG */ +ENC_ALIAS("euc-jp-ms", "EUC-JP"); +ENC_REPLICATE("CP51932", "EUC-JP"); /* Windows CodePage 51932 */ Index: enc/iso_8859_1.c =================================================================== --- enc/iso_8859_1.c (revision 15024) +++ enc/iso_8859_1.c (revision 15025) @@ -272,3 +272,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-1", "ISO-8859-1"); +ENC_REPLICATE("Windows-1252", "ISO-8859-1"); +ENC_ALIAS("CP1252", "Windows-1252"); Index: enc/iso_8859_2.c =================================================================== --- enc/iso_8859_2.c (revision 15024) +++ enc/iso_8859_2.c (revision 15025) @@ -237,3 +237,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-2", "ISO-8859-2"); +ENC_REPLICATE("Windowws-1250", "ISO-8859-2"); +ENC_ALIAS("CP1250", "Windows-1250"); Index: enc/iso_8859_3.c =================================================================== --- enc/iso_8859_3.c (revision 15024) +++ enc/iso_8859_3.c (revision 15025) @@ -237,3 +237,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-3", "ISO-8859-3"); Index: enc/iso_8859_4.c =================================================================== --- enc/iso_8859_4.c (revision 15024) +++ enc/iso_8859_4.c (revision 15025) @@ -239,3 +239,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-4", "ISO-8859-4"); +ENC_REPLICATE("Windows-1257", "ISO-8859-4"); +ENC_ALIAS("CP1257", "Windows-1257"); Index: enc/iso_8859_5.c =================================================================== --- enc/iso_8859_5.c (revision 15024) +++ enc/iso_8859_5.c (revision 15025) @@ -227,3 +227,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-5", "ISO-8859-5"); +ENC_REPLICATE("Windows-1251", "ISO-8859-5"); +ENC_ALIAS("CP1251", "Windows-1251"); Index: enc/iso_8859_6.c =================================================================== --- enc/iso_8859_6.c (revision 15024) +++ enc/iso_8859_6.c (revision 15025) @@ -94,3 +94,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-6", "ISO-8859-6"); +ENC_REPLICATE("Windows-1256", "ISO-8859-6"); +ENC_ALIAS("CP1256", "Windows-1256"); Index: enc/iso_8859_7.c =================================================================== --- enc/iso_8859_7.c (revision 15024) +++ enc/iso_8859_7.c (revision 15025) @@ -224,3 +224,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-7", "ISO-8859-7"); +ENC_REPLICATE("Windows-1253", "ISO-8859-7"); +ENC_ALIAS("CP1253", "Windows-1253"); Index: enc/iso_8859_8.c =================================================================== --- enc/iso_8859_8.c (revision 15024) +++ enc/iso_8859_8.c (revision 15025) @@ -94,3 +94,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-8", "ISO-8859-8"); +ENC_REPLICATE("Windows-1255", "ISO-8859-8"); +ENC_ALIAS("CP1255", "Windows-1255"); Index: enc/iso_8859_9.c =================================================================== --- enc/iso_8859_9.c (revision 15024) +++ enc/iso_8859_9.c (revision 15025) @@ -230,3 +230,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-9", "ISO-8859-9"); +ENC_REPLICATE("Windows-1254", "ISO-8859-9"); +ENC_ALIAS("CP1254", "Windows-1254"); Index: enc/iso_8859_10.c =================================================================== --- enc/iso_8859_10.c (revision 15024) +++ enc/iso_8859_10.c (revision 15025) @@ -241,3 +241,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-10", "ISO-8859-10"); Index: enc/iso_8859_11.c =================================================================== --- enc/iso_8859_11.c (revision 15024) +++ enc/iso_8859_11.c (revision 15025) @@ -94,3 +94,6 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-11", "ISO-8859-11"); +ENC_REPLICATE("Windows-874", "ISO-8859-11"); +ENC_ALIAS("CP874", "ISO-8859-11"); Index: enc/make_encdb.rb =================================================================== --- enc/make_encdb.rb (revision 15024) +++ enc/make_encdb.rb (revision 15025) @@ -13,7 +13,7 @@ replicas = {} aliases = {} encdir = ARGV[0] -Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}.each do |fn| +Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}.sort.each do |fn| open(File.join(encdir,fn)) do |f| orig = nil name = nil @@ -26,19 +26,19 @@ encodings << $1 if $1 f.each_line do |line| if /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/o =~ line + encodings << $1 replicas[$1] = $2 elsif /^ENC_ALIAS\(\s*"([^"]+)"\s*,\s*"([^"]+)"/o =~ line + encodings << $1 aliases[$1] = $2 end end end end -p aliases + open('encdb.h', 'wb') do |f| 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('};', '', 'static void', 'enc_init_db(void)', '{') replicas.each_pair {|name, orig| f.puts ' ENC_REPLICATE("%s", "%s");' % [name, orig] Index: enc/iso_8859_13.c =================================================================== --- enc/iso_8859_13.c (revision 15024) +++ enc/iso_8859_13.c (revision 15025) @@ -230,3 +230,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-13", "ISO-8859-13"); Index: enc/iso_8859_14.c =================================================================== --- enc/iso_8859_14.c (revision 15024) +++ enc/iso_8859_14.c (revision 15025) @@ -243,3 +243,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-14", "ISO-8859-14"); Index: enc/iso_8859_15.c =================================================================== --- enc/iso_8859_15.c (revision 15024) +++ enc/iso_8859_15.c (revision 15025) @@ -237,3 +237,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-15", "ISO-8859-15"); Index: enc/iso_8859_16.c =================================================================== --- enc/iso_8859_16.c (revision 15024) +++ enc/iso_8859_16.c (revision 15025) @@ -239,3 +239,4 @@ onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match }; +ENC_ALIAS("ISO8859-16", "ISO-8859-16"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/