diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2000-09-26 00:05:52 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2000-09-26 00:05:52 +0000 |
| commit | 0b95971d92a07bdc4719f41fbbb23cfc8decb2f7 (patch) | |
| tree | bcea861005746afbc240e24884a73ebd4d51792e | |
| parent | a2aa7df3d6bf73cda977ee050a503a7f7a78a82d (diff) | |
| download | glibc-0b95971d92a07bdc4719f41fbbb23cfc8decb2f7.tar.xz glibc-0b95971d92a07bdc4719f41fbbb23cfc8decb2f7.zip | |
Update.
2000-09-23 Bruno Haible <haible@clisp.cons.org>
* iconvdata/gbk.c (USE_PRIVATE_AREA): Define to 0.
(__gbk_to_ucs): Conditionalize private area mappings.
(__gbk_from_ucs4_tab9): Likewise.
(BODY for TO_LOOP): Likewise.
* iconvdata/testdata/GBK: Don't use characters not yet in Unicode.
* iconvdata/testdata/GBK..UTF-8: Likewise.
* iconvdata/tst-tables.sh: Enable GBK test.
2000-09-23 Bruno Haible <haible@clisp.cons.org>
* iconvdata/gbk.c (__gbk_to_ucs): Swap U+2014 and U+2015.
(__gbk_from_ucs4_tab4): Swap entries for U+2014 and U+2015.
(BODY for FROM_LOOP): Reject input > 0xFEA0, avoids out-of-bounds
array access.
* iconvdata/gbgbk.c (BODY for FROM_LOOP): Map 0xA844 to 0xA1AA.
* iconvdata/testdata/GBK..UTF8: Swap U+2014 and U+2015.
2000-09-23 Bruno Haible <haible@clisp.cons.org>
* iconvdata/johab.c (final_to_ucs): Fix typos.
(jamo_from_ucs_table): Likewise.
(BODY for FROM_LOOP): Map 0x5c to U+20A9. Reject ranges
0xD9E6..0xD9FE and 0xDEF2..0xDEFE.
(BODY for TO_LOOP): Map U+20A9 to 0x5c. Don't produce values in
the range 0xD9E6..0xD9FE.
* iconvdata/tst-tables.sh: Enable JOHAB testing.
| -rw-r--r-- | ChangeLog | 29 | ||||
| -rw-r--r-- | iconvdata/gbk.c | 33 | ||||
| -rw-r--r-- | iconvdata/testdata/GBK | 18 | ||||
| -rw-r--r-- | iconvdata/testdata/GBK..UTF8 | 18 | ||||
| -rwxr-xr-x | iconvdata/tst-tables.sh | 2 | ||||
| -rw-r--r-- | localedata/ChangeLog | 22 | ||||
| -rw-r--r-- | localedata/Makefile | 3 | ||||
| -rw-r--r-- | localedata/dump-ctype.c | 163 | ||||
| -rw-r--r-- | localedata/gen-unicode-ctype.c | 792 | ||||
| -rw-r--r-- | localedata/locales/i18n | 1425 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_iswctype.c | 12 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_iswgraph.c | 4 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_iswprint.c | 4 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_iswpunct.c | 4 | ||||
| -rw-r--r-- | localedata/tests-mbwc/dat_wcswidth.c | 4 | ||||
| -rw-r--r-- | localedata/tst-ctype-de_DE.ISO-8859-1.in | 8 |
16 files changed, 2016 insertions, 525 deletions
@@ -1,3 +1,32 @@ +2000-09-23 Bruno Haible <haible@clisp.cons.org> + + * iconvdata/gbk.c (USE_PRIVATE_AREA): Define to 0. + (__gbk_to_ucs): Conditionalize private area mappings. + (__gbk_from_ucs4_tab9): Likewise. + (BODY for TO_LOOP): Likewise. + * iconvdata/testdata/GBK: Don't use characters not yet in Unicode. + * iconvdata/testdata/GBK..UTF-8: Likewise. + * iconvdata/tst-tables.sh: Enable GBK test. + +2000-09-23 Bruno Haible <haible@clisp.cons.org> + + * iconvdata/gbk.c (__gbk_to_ucs): Swap U+2014 and U+2015. + (__gbk_from_ucs4_tab4): Swap entries for U+2014 and U+2015. + (BODY for FROM_LOOP): Reject input > 0xFEA0, avoids out-of-bounds + array access. + * iconvdata/gbgbk.c (BODY for FROM_LOOP): Map 0xA844 to 0xA1AA. + * iconvdata/testdata/GBK..UTF8: Swap U+2014 and U+2015. + +2000-09-23 Bruno Haible <haible@clisp.cons.org> + + * iconvdata/johab.c (final_to_ucs): Fix typos. + (jamo_from_ucs_table): Likewise. + (BODY for FROM_LOOP): Map 0x5c to U+20A9. Reject ranges + 0xD9E6..0xD9FE and 0xDEF2..0xDEFE. + (BODY for TO_LOOP): Map U+20A9 to 0x5c. Don't produce values in + the range 0xD9E6..0xD9FE. + * iconvdata/tst-tables.sh: Enable JOHAB testing. + 2000-09-25 Ulrich Drepper <drepper@redhat.com> * iconv/gconv_conf.c (__gconv_get_path): Fix problem with relative diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c index f9a53ff2df..b07f39294a 100644 --- a/iconvdata/gbk.c +++ b/iconvdata/gbk.c @@ -26,6 +26,12 @@ #include <wchar.h> #include <assert.h> +/* Unicode 3.0.1 does not contain all the characters in GBK. Define + USE_PRIVATE_AREA to 1 in order to use mappings from/to the Unicode + Private Use area. Until we see other systems using the same mappings, + it is disabled. */ +#define USE_PRIVATE_AREA 0 + /* The conversion table to UCS4 has almost no holes. It can be generated with: perl tab.pl < gbk.txt @@ -1739,7 +1745,13 @@ static const uint16_t __gbk_to_ucs[] = [0x1db0] = 0x00f2, [0x1db1] = 0x016b, [0x1db2] = 0x00fa, [0x1db3] = 0x01d4, [0x1db4] = 0x00f9, [0x1db5] = 0x01d6, [0x1db6] = 0x01d8, [0x1db7] = 0x01da, [0x1db8] = 0x01dc, [0x1db9] = 0x00fc, [0x1dba] = 0x00ea, [0x1dbb] = 0x0251, - [0x1dbc] = 0xe7c7, [0x1dbd] = 0x0144, [0x1dbe] = 0x0148, [0x1dbf] = 0xe7c8, +#if USE_PRIVATE_AREA + [0x1dbc] = 0xe7c7, +#endif + [0x1dbd] = 0x0144, [0x1dbe] = 0x0148, +#if USE_PRIVATE_AREA + [0x1dbf] = 0xe7c8, +#endif [0x1dc0] = 0x0261, [0x1dc5] = 0x3105, [0x1dc6] = 0x3106, [0x1dc7] = 0x3107, [0x1dc8] = 0x3108, [0x1dc9] = 0x3109, [0x1dca] = 0x310a, [0x1dcb] = 0x310b, [0x1dcc] = 0x310c, [0x1dcd] = 0x310d, [0x1dce] = 0x310e, [0x1dcf] = 0x310f, @@ -1766,10 +1778,14 @@ static const uint16_t __gbk_to_ucs[] = [0x1e3b] = 0xfe5e, [0x1e3c] = 0xfe5f, [0x1e3d] = 0xfe60, [0x1e3e] = 0xfe61, [0x1e40] = 0xfe62, [0x1e41] = 0xfe63, [0x1e42] = 0xfe64, [0x1e43] = 0xfe65, [0x1e44] = 0xfe66, [0x1e45] = 0xfe68, [0x1e46] = 0xfe69, [0x1e47] = 0xfe6a, - [0x1e48] = 0xfe6b, [0x1e49] = 0xe7e7, [0x1e4a] = 0xe7e8, [0x1e4b] = 0xe7e9, + [0x1e48] = 0xfe6b, +#if USE_PRIVATE_AREA + [0x1e49] = 0xe7e7, [0x1e4a] = 0xe7e8, [0x1e4b] = 0xe7e9, [0x1e4c] = 0xe7ea, [0x1e4d] = 0xe7eb, [0x1e4e] = 0xe7ec, [0x1e4f] = 0xe7ed, [0x1e50] = 0xe7ee, [0x1e51] = 0xe7ef, [0x1e52] = 0xe7f0, [0x1e53] = 0xe7f1, - [0x1e54] = 0xe7f2, [0x1e55] = 0xe7f3, [0x1e56] = 0x3007, [0x1e64] = 0x2500, + [0x1e54] = 0xe7f2, [0x1e55] = 0xe7f3, +#endif + [0x1e56] = 0x3007, [0x1e64] = 0x2500, [0x1e65] = 0x2501, [0x1e66] = 0x2502, [0x1e67] = 0x2503, [0x1e68] = 0x2504, [0x1e69] = 0x2505, [0x1e6a] = 0x2506, [0x1e6b] = 0x2507, [0x1e6c] = 0x2508, [0x1e6d] = 0x2509, [0x1e6e] = 0x250a, [0x1e6f] = 0x250b, [0x1e70] = 0x250c, @@ -5499,7 +5515,9 @@ static const uint16_t __gbk_to_ucs[] = [0x5dc2] = 0xfa0e, [0x5dc3] = 0xfa0f, [0x5dc4] = 0xfa11, [0x5dc5] = 0xfa13, [0x5dc6] = 0xfa14, [0x5dc7] = 0xfa18, [0x5dc8] = 0xfa1f, [0x5dc9] = 0xfa20, [0x5dca] = 0xfa21, [0x5dcb] = 0xfa23, [0x5dcc] = 0xfa24, [0x5dcd] = 0xfa27, - [0x5dce] = 0xfa28, [0x5dcf] = 0xfa29, [0x5dd0] = 0xe815, [0x5dd1] = 0xe816, + [0x5dce] = 0xfa28, [0x5dcf] = 0xfa29, +#if USE_PRIVATE_AREA + [0x5dd0] = 0xe815, [0x5dd1] = 0xe816, [0x5dd2] = 0xe817, [0x5dd3] = 0xe818, [0x5dd4] = 0xe819, [0x5dd5] = 0xe81a, [0x5dd6] = 0xe81b, [0x5dd7] = 0xe81c, [0x5dd8] = 0xe81d, [0x5dd9] = 0xe81e, [0x5dda] = 0xe81f, [0x5ddb] = 0xe820, [0x5ddc] = 0xe821, [0x5ddd] = 0xe822, @@ -5520,6 +5538,9 @@ static const uint16_t __gbk_to_ucs[] = [0x5e17] = 0xe85b, [0x5e18] = 0xe85c, [0x5e19] = 0xe85d, [0x5e1a] = 0xe85e, [0x5e1b] = 0xe85f, [0x5e1c] = 0xe860, [0x5e1d] = 0xe861, [0x5e1e] = 0xe862, [0x5e1f] = 0xe863, [0x5e20] = 0xe864, +#else + [0x5e20] = 0x0000, +#endif }; /* The table can be created using @@ -12936,6 +12957,7 @@ static const char __gbk_from_ucs4_tab8[][2] = */ static const char __gbk_from_ucs4_tab9[][2] = { +#if USE_PRIVATE_AREA [0x0000] = "\xa8\xbc", [0x0001] = "\xa8\xbf", [0x0020] = "\xa9\x89", [0x0021] = "\xa9\x8a", [0x0022] = "\xa9\x8b", [0x0023] = "\xa9\x8c", [0x0024] = "\xa9\x8d", [0x0025] = "\xa9\x8e", [0x0026] = "\xa9\x8f", @@ -12968,6 +12990,7 @@ static const char __gbk_from_ucs4_tab9[][2] = [0x0096] = "\xfe\x99", [0x0097] = "\xfe\x9a", [0x0098] = "\xfe\x9b", [0x0099] = "\xfe\x9c", [0x009a] = "\xfe\x9d", [0x009b] = "\xfe\x9e", [0x009c] = "\xfe\x9f", [0x009d] = "\xfe\xa0", +#endif }; /* The table can be created using @@ -13418,7 +13441,7 @@ static const char __gbk_from_ucs4_tab12[][2] = cp = __gbk_from_ucs4_tab8[ch - 0x4e00]; \ break; \ case 0xe7c7 ... 0xe864: \ - cp = __gbk_from_ucs4_tab9[ch - 0xe7c7]; \ + cp = USE_PRIVATE_AREA ? __gbk_from_ucs4_tab9[ch - 0xe7c7] : "\0\0"; \ break; \ case 0xf92c: \ cp = "\xfd\x9c"; \ diff --git a/iconvdata/testdata/GBK b/iconvdata/testdata/GBK index 31f35414c8..615c47c376 100644 --- a/iconvdata/testdata/GBK +++ b/iconvdata/testdata/GBK @@ -438,7 +438,7 @@ ¨€ ¨� ¨‚ ¨ƒ ¨„ ¨… ¨† ¨‡ ¨ˆ ¨‰ ¨Š ¨‹ ¨Œ ¨� ¨Ž ¨� ¨� ¨‘ ¨’ ¨“ ¨” ¨• ¨¡ ¨¢ ¨£ ¨¤ ¨¥ ¨¦ ¨§ ¨¨ ¨© ¨ª ¨« ¨¬ ¨ ¨® ¨¯ - ¨° ¨± ¨² ¨³ ¨´ ¨µ ¨¶ ¨· ¨¸ ¨¹ ¨º ¨» ¨¼ ¨½ ¨¾ ¨¿ + ¨° ¨± ¨² ¨³ ¨´ ¨µ ¨¶ ¨· ¨¸ ¨¹ ¨º ¨» A8BC ¨½ ¨¾ A8BF ¨À ¨Å ¨Æ ¨Ç ¨È ¨É ¨Ê ¨Ë ¨Ì ¨Í ¨Î ¨Ï ¨Ð ¨Ñ ¨Ò ¨Ó ¨Ô ¨Õ ¨Ö ¨× ¨Ø ¨Ù ¨Ú ¨Û ¨Ü ¨Ý ¨Þ ¨ß ¨à ¨á ¨â ¨ã ¨ä ¨å ¨æ ¨ç ¨è ¨é @@ -446,8 +446,8 @@ ©P ©Q ©R ©S ©T ©U ©V ©W ©Y ©Z ©\ ©` ©a ©b ©c ©d ©e ©f ©g ©h ©i ©j ©k ©l ©m ©n ©o ©p ©q ©r ©s ©t ©u ©v ©w ©x ©y ©z ©{ ©| ©} ©~ - ©€ ©� ©‚ ©ƒ ©„ ©… ©† ©‡ ©ˆ ©‰ ©Š ©‹ ©Œ ©� ©Ž ©� - ©� ©‘ ©’ ©“ ©” ©• ©– + ©€ ©� ©‚ ©ƒ ©„ ©… ©† ©‡ ©ˆ A989 A98A A98B A98C A98D A98E A98F + A990 A991 A992 A993 A994 A995 ©– ©¤ ©¥ ©¦ ©§ ©¨ ©© ©ª ©« ©¬ © ©® ©¯ ©° ©± ©² ©³ ©´ ©µ ©¶ ©· ©¸ ©¹ ©º ©» ©¼ ©½ ©¾ ©¿ ©À ©Á ©Â ©Ã ©Ä ©Å ©Æ ©Ç ©È ©É ©Ê ©Ë ©Ì ©Í ©Î ©Ï @@ -1402,9 +1402,9 @@ ý� ý‘ ý’ ý“ ý” ý• ý– ý— ý˜ ý™ ýš ý› ýœ ý� ýž ýŸ ý þ@ þA þB þC þD þE þF þG þH þI þJ þK þL þM þN þO - þP þQ þR þS þT þU þV þW þX þY þZ þ[ þ\ þ] þ^ þ_ - þ` þa þb þc þd þe þf þg þh þi þj þk þl þm þn þo - þp þq þr þs þt þu þv þw þx þy þz þ{ þ| þ} þ~ - þ€ þ� þ‚ þƒ þ„ þ… þ† þ‡ þˆ þ‰ þŠ þ‹ þŒ þ� þŽ þ� - þ� þ‘ þ’ þ“ þ” þ• þ– þ— þ˜ þ™ þš þ› þœ þ� þž þŸ - þ + FE50 FE51 FE52 FE53 FE54 FE55 FE56 FE57 FE58 FE59 FE5A FE5B FE5C FE5D FE5E FE5F + FE60 FE61 FE62 FE63 FE64 FE65 FE66 FE67 FE68 FE69 FE6A FE6B FE6C FE6D FE6E FE6F + FE70 FE71 FE72 FE73 FE74 FE75 FE76 FE77 FE78 FE79 FE7A FE7B FE7C FE7D FE7E + FE80 FE81 FE82 FE83 FE84 FE85 FE86 FE87 FE88 FE89 FE8A FE8B FE8C FE8D FE8E FE8F + FE90 FE91 FE92 FE93 FE94 FE95 FE96 FE97 FE98 FE99 FE9A FE9B FE9C FE9D FE9E FE9F + FEA0 diff --git a/iconvdata/testdata/GBK..UTF8 b/iconvdata/testdata/GBK..UTF8 index cadf7239a6..6d8ce8c9a6 100644 --- a/iconvdata/testdata/GBK..UTF8 +++ b/iconvdata/testdata/GBK..UTF8 @@ -438,7 +438,7 @@ â–ˆ â–‰ â–Š â–‹ â–Œ â–� â–Ž â–� â–“ â–” â–• â–¼ â–½ â—¢ â—£ â—¤ â—¥ ☉ ⊕ 〒 ã€� 〞 Ä� á ÇŽ à ē é Ä› è Ä« à Ç� ì Å� ó Ç’ - ò Å« ú Ç” ù Ç– ǘ Çš Çœ ü ê É‘  Å„ ň  + ò Å« ú Ç” ù Ç– ǘ Çš Çœ ü ê É‘ A8BC Å„ ň A8BF É¡ ã„… ㄆ ㄇ ㄈ ㄉ ㄊ ã„‹ ㄌ ã„� ㄎ ã„� ã„� ã„‘ ã„’ ã„“ ã„” ã„• ã„– ã„— ㄘ ã„™ ㄚ ã„› ㄜ ã„� ㄞ ㄟ ã„ ã„¡ ã„¢ ã„£ ㄤ ã„¥ ㄦ ã„§ ㄨ ã„© @@ -446,8 +446,8 @@ ã�„ ã�Ž ã�‘ ã�’ ã�• ︰ ï¿¢ ¦ â„¡ ㈱ â€� ー ã‚› ゜ ヽ ヾ 〆 ã‚� ゞ ﹉ ﹊ ﹋ ﹌ ï¹� ﹎ ï¹� ï¹� ﹑ ï¹’ ï¹” ﹕ ï¹– ï¹— ï¹™ ﹚ ï¹› ﹜ ï¹� ﹞ ﹟ ï¹ ï¹¡ - ï¹¢ ï¹£ ﹤ ï¹¥ ﹦ ﹨ ﹩ ﹪ ﹫       îŸ -       〇 + ï¹¢ ï¹£ ﹤ ï¹¥ ﹦ ﹨ ﹩ ﹪ ﹫ A989 A98A A98B A98C A98D A98E A98F + A990 A991 A992 A993 A994 A995 〇 ─ â”� │ ┃ ┄ â”… ┆ ┇ ┈ ┉ ┊ ┋ ┌ â”� ┎ â”� â”� ┑ â”’ ┓ â”” ┕ â”– â”— ┘ â”™ ┚ â”› ├ â”� ┞ ┟ ┠┡ ┢ ┣ ┤ ┥ ┦ â”§ ┨ ┩ ┪ ┫ @@ -1402,9 +1402,9 @@ 龕 é¾– é¾— 龘 龜 é¾� 龞 龡 é¾¢ é¾£ 龤 é¾¥ 郎 凉 秊 ï§§ ï§± 兀 ï¨� 﨎 ï¨� 﨑 﨓 﨔 礼 﨟 ï¨ ï¨¡ 﨣 﨤 﨧 﨨 﨩 - î • î – î — î ˜ î ™ î š î › î œ î � î ž î Ÿ î î ¡ î ¢ î £ î ¤ - î ¥ î ¦ î § î ¨ î © î ª î « î ¬ î î ® î ¯ î ° î ± î ² î ³ î ´ - î µ î ¶ î · î ¸ î ¹ î º î » î ¼ î ½ î ¾ î ¿ î¡€ î¡� î¡‚  - î¡„ î¡…      î¡‹  î¡�  î¡� î¡� î¡‘ î¡’ î¡“ - î¡” î¡• î¡– î¡—  î¡™  î¡›  î¡�   î¡ î¡¡ î¡¢ î¡£ -  + FE50 FE51 FE52 FE53 FE54 FE55 FE56 FE57 FE58 FE59 FE5A FE5B FE5C FE5D FE5E FE5F + FE60 FE61 FE62 FE63 FE64 FE65 FE66 FE67 FE68 FE69 FE6A FE6B FE6C FE6D FE6E FE6F + FE70 FE71 FE72 FE73 FE74 FE75 FE76 FE77 FE78 FE79 FE7A FE7B FE7C FE7D FE7E + FE80 FE81 FE82 FE83 FE84 FE85 FE86 FE87 FE88 FE89 FE8A FE8B FE8C FE8D FE8E FE8F + FE90 FE91 FE92 FE93 FE94 FE95 FE96 FE97 FE98 FE99 FE9A FE9B FE9C FE9D FE9E FE9F + FEA0 diff --git a/iconvdata/tst-tables.sh b/iconvdata/tst-tables.sh index e743239a76..bc57e1b83b 100755 --- a/iconvdata/tst-tables.sh +++ b/iconvdata/tst-tables.sh @@ -191,7 +191,7 @@ cat <<EOF | BIG5HKSCS EUC-JP EUC-CN GB2312 - #GBK Converter uses private area characters + GBK EUC-TW GB18030 # diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 7e95c5001f..1ba7cc0926 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,25 @@ +2000-09-24 Bruno Haible <haible@clisp.cons.org> + + * gen-unicode-ctype.c: New file. + * dump-ctype.c: New file. + * Makefile (distribute): Add them. + * locales/i18n: Update LC_CTYPE part to Unicode 3.0, using + gen-unicode-ctype.c. + (blank): Add U+1680. + (cntrl): Add U+2028, U+2029. + (space): Add U+1680, U+2028, U+2029. + (digit): Add Myanmar, Ethiopic, Khmer, Mongolian, fullwidth digits. + (alnum, alpha, print, graph, punct): Lots of additions. + (lower, upper, tolower, toupper, combining, combining_level3): Update. + (totitle): New map. + * tst-ctype-de_DE.ISO-8859-1.in: Mark U00B5 as lower; the Unicode 3.0 + towupper functions maps it to U039C. Mark U00A0 as graph, print, punct. + * tests-mbwc/dat_iswctype.c: Mark U00A0 as graph, print, punct. + * tests-mbwc/dat_iswgraph.c: Mark U00A0 as graph. + * tests-mbwc/dat_iswprint.c: Mark U00A0 as print. + * tests-mbwc/dat_iswpunct.c: Mark U00A0 as punct. + * tests-mbwc/dat_wcswidth.c: U00A0 is now print. + 2000-09-23 Bruno Haible <haible@clisp.cons.org> * charmaps/GBK: Add commented mappings for GBK characters not yet in diff --git a/localedata/Makefile b/localedata/Makefile index f86584ab26..25ee02d828 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -72,7 +72,8 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog \ $(wildcard tests-mbwc/*.[ch]) \ $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests)) \ gen-locale.sh show-ucs-data.c tst-langinfo.sh \ - tst-wctype.sh tst-wctype.input + tst-wctype.sh tst-wctype.input gen-unicode-ctype.c \ + dump-ctype.c # Get $(inst_i18ndir) defined. include ../Makeconfig diff --git a/localedata/dump-ctype.c b/localedata/dump-ctype.c new file mode 100644 index 0000000000..9514ca7654 --- /dev/null +++ b/localedata/dump-ctype.c @@ -0,0 +1,163 @@ +/* Dump the character classes and character maps of a locale to a bunch + of individual files which can be processed with diff, sed etc. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible <haible@clisp.cons.org>, 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU UTF-8 Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Usage example: + $ dump-ctype de_DE.UTF-8 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <wctype.h> +#include <locale.h> +#include <sys/stat.h> +#include <unistd.h> +#include <errno.h> + +static const char *program_name = "dump-ctype"; +static const char *locale; + +static const char *class_names[] = + { + "alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower", + "print", "punct", "space", "upper", "xdigit" + }; + +static const char *map_names[] = + { + "tolower", "toupper", "totitle" + }; + +static void dump_class (const char *class_name) +{ + wctype_t class; + FILE *f; + unsigned int ch; + + class = wctype (class_name); + if (class == (wctype_t) 0) + { + fprintf (stderr, "%s %s: noexistent class %s\n", program_name, + locale, class_name); + return; + } + + f = fopen (class_name, "w"); + if (f == NULL) + { + fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name, + locale, locale, class_name); + exit (1); + } + + for (ch = 0; ch < 0x10000; ch++) + if (iswctype (ch, class)) + fprintf (f, "0x%04X\n", ch); + + if (ferror (f) || fclose (f)) + { + fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name, + locale, locale, class_name); + exit (1); + } +} + +static void dump_map (const char *map_name) +{ + wctrans_t map; + FILE *f; + unsigned int ch; + + map = wctrans (map_name); + if (map == (wctrans_t) 0) + { + fprintf (stderr, "%s %s: noexistent map %s\n", program_name, + locale, map_name); + return; + } + + f = fopen (map_name, "w"); + if (f == NULL) + { + fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name, + locale, locale, map_name); + exit (1); + } + + for (ch = 0; ch < 0x10000; ch++) + if (towctrans (ch, map) != ch) + fprintf (f, "0x%04X\t0x%04X\n", ch, towctrans (ch, map)); + + if (ferror (f) || fclose (f)) + { + fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name, + locale, locale, map_name); + exit (1); + } +} + +int main (int argc, char *argv[]) +{ + size_t i; + + if (argc != 2) + { + fprintf (stderr, "Usage: dump-ctype locale\n"); + exit (1); + } + locale = argv[1]; + + if (setlocale (LC_ALL, locale) == NULL) + { + fprintf (stderr, "%s: setlocale cannot switch to locale %s\n", + program_name, locale); + exit (1); + } + + if (mkdir (locale, 0777) < 0) + { + char buf[100]; + int save_errno = errno; + + sprintf (buf, "%s: cannot create directory %s", program_name, locale); + errno = save_errno; + perror (buf); + exit (1); + } + + if (chdir (locale) < 0) + { + char buf[100]; + int save_errno = errno; + + sprintf (buf, "%s: cannot chdir to %s", program_name, locale); + errno = save_errno; + perror (buf); + exit (1); + } + + for (i = 0; i < sizeof (class_names) / sizeof (class_names[0]); i++) + dump_class (class_names[i]); + + for (i = 0; i < sizeof (map_names) / sizeof (map_names[0]); i++) + dump_map (map_names[i]); + + return 0; +} diff --git a/localedata/gen-unicode-ctype.c b/localedata/gen-unicode-ctype.c new file mode 100644 index 0000000000..b45e70351a --- /dev/null +++ b/localedata/gen-unicode-ctype.c @@ -0,0 +1,792 @@ +/* Generate a Unicode conforming LC_CTYPE category from a UnicodeData file. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible <haible@clisp.cons.org>, 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU UTF-8 Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Usage example: + $ gen-unicode /usr/local/share/Unidata/UnicodeData.txt \ + /usr/local/share/Unidata/PropList.txt \ + 3.0 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <time.h> + +/* This structure represents one line in the UnicodeData.txt file. */ +struct unicode_attribute +{ + const char *name; /* Character name */ + const char *category; /* General category */ + const char *combining; /* Canonical combining classes */ + const char *bidi; /* Bidirectional category */ + const char *decomposition; /* Character decomposition mapping */ + const char *decdigit; /* Decimal digit value */ + const char *digit; /* Digit value */ + const char *numeric; /* Numeric value */ + int mirrored; /* mirrored */ + const char *oldname; /* Old Unicode 1.0 name */ + const char *comment; /* Comment */ + unsigned int upper; /* Uppercase mapping */ + unsigned int lower; /* Lowercase mapping */ + unsigned int title; /* Titlecase mapping */ +}; + +/* Missing fields are represented with "" for strings, and NONE for + characters. */ +#define NONE (~(unsigned int)0) + +/* The entire contents of the UnicodeData.txt file. */ +struct unicode_attribute unicode_attributes [0x10000]; + +/* Stores in unicode_attributes[i] the values from the given fields. */ +static void +fill_attribute (unsigned int i, + const char *field1, const char *field2, + const char *field3, const char *field4, + const char *field5, const char *field6, + const char *field7, const char *field8, + const char *field9, const char *field10, + const char *field11, const char *field12, + const char *field13, const char *field14) +{ + struct unicode_attribute * uni; + |
