mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enc/make_encdb.h: sort encoding names by original name.
* encoding.c, enc/*.c: define replicas and aliases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
62c596cb36
commit
21671b558c
20 changed files with 52 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Jan 13 22:47:28 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* encoding.c: add documents.
|
||||
|
|
|
@ -364,3 +364,6 @@ OnigEncodingDefine(euc_jp, EUC_JP) = {
|
|||
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 */
|
||||
|
|
|
@ -272,3 +272,6 @@ OnigEncodingDefine(iso_8859_1, ISO_8859_1) = {
|
|||
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");
|
||||
|
|
|
@ -241,3 +241,4 @@ OnigEncodingDefine(iso_8859_10, ISO_8859_10) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-10", "ISO-8859-10");
|
||||
|
|
|
@ -94,3 +94,6 @@ OnigEncodingDefine(iso_8859_11, ISO_8859_11) = {
|
|||
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");
|
||||
|
|
|
@ -230,3 +230,4 @@ OnigEncodingDefine(iso_8859_13, ISO_8859_13) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-13", "ISO-8859-13");
|
||||
|
|
|
@ -243,3 +243,4 @@ OnigEncodingDefine(iso_8859_14, ISO_8859_14) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-14", "ISO-8859-14");
|
||||
|
|
|
@ -237,3 +237,4 @@ OnigEncodingDefine(iso_8859_15, ISO_8859_15) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-15", "ISO-8859-15");
|
||||
|
|
|
@ -239,3 +239,4 @@ OnigEncodingDefine(iso_8859_16, ISO_8859_16) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-16", "ISO-8859-16");
|
||||
|
|
|
@ -237,3 +237,6 @@ OnigEncodingDefine(iso_8859_2, ISO_8859_2) = {
|
|||
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");
|
||||
|
|
|
@ -237,3 +237,4 @@ OnigEncodingDefine(iso_8859_3, ISO_8859_3) = {
|
|||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
||||
ENC_ALIAS("ISO8859-3", "ISO-8859-3");
|
||||
|
|
|
@ -239,3 +239,6 @@ OnigEncodingDefine(iso_8859_4, ISO_8859_4) = {
|
|||
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");
|
||||
|
|
|
@ -227,3 +227,6 @@ OnigEncodingDefine(iso_8859_5, ISO_8859_5) = {
|
|||
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");
|
||||
|
|
|
@ -94,3 +94,6 @@ OnigEncodingDefine(iso_8859_6, ISO_8859_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");
|
||||
|
|
|
@ -224,3 +224,6 @@ OnigEncodingDefine(iso_8859_7, ISO_8859_7) = {
|
|||
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");
|
||||
|
|
|
@ -94,3 +94,6 @@ OnigEncodingDefine(iso_8859_8, ISO_8859_8) = {
|
|||
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");
|
||||
|
|
|
@ -230,3 +230,6 @@ OnigEncodingDefine(iso_8859_9, ISO_8859_9) = {
|
|||
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");
|
||||
|
|
|
@ -13,7 +13,7 @@ encodings = []
|
|||
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 @@ Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}.each do |fn|
|
|||
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]
|
||||
|
|
|
@ -28,4 +28,4 @@ OnigEncodingDefine(us_ascii, US_ASCII) = {
|
|||
};
|
||||
ENC_ALIAS("ASCII", "US-ASCII");
|
||||
ENC_ALIAS("ANSI_X3.4-1986", "US-ASCII");
|
||||
|
||||
ENC_ALIAS("646", "US-ASCII");
|
|
@ -1087,10 +1087,13 @@ Init_Encoding(void)
|
|||
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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue