diff --git a/ChangeLog b/ChangeLog index 185ce4dac2..d41bc245c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2002-09-22 Bruno Haible + + * iconv/iconv_prog.c (main): Provide an error message that identifies + the wrong encoding. + +2002-09-22 Bruno Haible + + * iconvdata/tscii.c: New file. + * iconvdata/testdata/TSCII: New file. + * iconvdata/testdata/TSCII..UTF8: New file. + * iconvdata/TSCII.precomposed: New file. + * iconvdata/TSCII.irreversible: New file. + * iconvdata/gconv-modules (TSCII): New module. + * iconvdata/Makefile (modules): Add TSCII. + (distribute): Add tscii.c. + * iconvdata/tst-table-from.c (try, utf8_decode, main): Double output + buffer size. + * iconvdata/tst-tables.sh: Add TSCII. + * iconvdata/TESTS: Add TSCII. + +2002-09-22 Bruno Haible + + Revert 2002-04-18 patch. + * iconvdata/euc-jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for + FROM_DIRECTION): Make the FROM direction stateful again. + * iconvdata/shift_jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for + FROM_DIRECTION): Likewise. + 2002-09-22 Bruno Haible * iconvdata/tst-e2big.c: New file. diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index a67c6ebad1..dd1b9689b6 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -216,10 +217,47 @@ main (int argc, char *argv[]) if (cd == (iconv_t) -1) { if (errno == EINVAL) - error (EXIT_FAILURE, 0, - _("conversion from `%s' to `%s' not supported"), - from_code[0] ? from_code : nl_langinfo (CODESET), - orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET)); + { + /* Try to be nice with the user and tell her which of the + two encoding names is wrong. This is possible because + all supported encodings can be converted from/to Unicode, + in other words, because the graph of encodings is + connected. */ + bool from_wrong = + (iconv_open ("UTF-8", from_code) == (iconv_t) -1 + && errno == EINVAL); + bool to_wrong = + (iconv_open (to_code, "UTF-8") == (iconv_t) -1 + && errno == EINVAL); + const char *from_pretty = + (from_code[0] ? from_code : nl_langinfo (CODESET)); + const char *to_pretty = + (orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET)); + + if (from_wrong) + { + if (to_wrong) + error (EXIT_FAILURE, 0, + _("\ +conversions from `%s' and to `%s' are not supported"), + from_pretty, to_pretty); + else + error (EXIT_FAILURE, 0, + _("conversion from `%s' is not supported"), + from_pretty); + } + else + { + if (to_wrong) + error (EXIT_FAILURE, 0, + _("conversion to `%s' is not supported"), + to_pretty); + else + error (EXIT_FAILURE, 0, + _("conversion from `%s' to `%s' is not supported"), + from_pretty, to_pretty); + } + } else error (EXIT_FAILURE, errno, _("failed to start conversion processing")); diff --git a/iconvdata/Makefile b/iconvdata/Makefile index 49cf62c35f..10a307f456 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile @@ -51,7 +51,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ GB18030 ISO-2022-CN-EXT VISCII GBBIG5 CP10007 KOI8-T \ GEORGIAN-PS GEORGIAN-ACADEMY ISO-IR-209 MAC-SAMI ARMSCII-8 \ TCVN5712-1 libJISX0213 EUC-JISX0213 SHIFT_JISX0213 \ - ISO-2022-JP-3 + ISO-2022-JP-3 TSCII modules.so := $(addsuffix .so, $(modules)) @@ -166,7 +166,7 @@ distribute := gconv-modules extra-module.mk gap.awk gaptab.awk \ mac-sami.c ibm1160.c ibm1160.h ibm1161.c ibm1161.h \ ibm1163.c ibm1163.h ibm1164.c ibm1164.h jisx0213.c jisx0213.h \ euc-jisx0213.c shift_jisx0213.c iso-2022-jp-3.c \ - tcvn5712-1.c armscii-8.c + tcvn5712-1.c armscii-8.c tscii.c # We build the transformation modules only when we build shared libs. ifeq (yes,$(build-shared)) diff --git a/iconvdata/TESTS b/iconvdata/TESTS index 8d6df22432..57e86ac37e 100644 --- a/iconvdata/TESTS +++ b/iconvdata/TESTS @@ -118,3 +118,4 @@ TCVN-5712 TCVN-5712 Y UTF8 EUC-JISX0213 EUC-JISX0213 Y UTF8 SHIFT_JISX0213 SHIFT_JISX0213 Y UTF8 ISO-2022-JP-3 ISO-2022-JP-3 N UTF8 +TSCII TSCII Y UTF8 diff --git a/iconvdata/TSCII.irreversible b/iconvdata/TSCII.irreversible new file mode 100644 index 0000000000..fe9dd3a167 --- /dev/null +++ b/iconvdata/TSCII.irreversible @@ -0,0 +1 @@ +0xAD 0x0B87 diff --git a/iconvdata/TSCII.precomposed b/iconvdata/TSCII.precomposed new file mode 100644 index 0000000000..033e93dedd --- /dev/null +++ b/iconvdata/TSCII.precomposed @@ -0,0 +1,66 @@ +0x82 0x0BB8 0x0BCD 0x0BB0 0x0BC0 +0x87 0x0B95 0x0BCD 0x0BB7 +0x88 0x0B9C 0x0BCD +0x89 0x0BB7 0x0BCD +0x8A 0x0BB8 0x0BCD +0x8B 0x0BB9 0x0BCD +0x8C 0x0B95 0x0BCD 0x0BB7 0x0BCD +0x99 0x0B99 0x0BC1 +0x9A 0x0B9E 0x0BC1 +0x9B 0x0B99 0x0BC2 +0x9C 0x0B9E 0x0BC2 +0xA6A1 0x0BCA +0xA7A1 0x0BCB +0xA7AA 0x0BCC +0xCA 0x0B9F 0x0BBF +0xCB 0x0B9F 0x0BC0 +0xCC 0x0B95 0x0BC1 +0xCD 0x0B9A 0x0BC1 +0xCE 0x0B9F 0x0BC1 +0xCF 0x0BA3 0x0BC1 +0xD0 0x0BA4 0x0BC1 +0xD1 0x0BA8 0x0BC1 +0xD2 0x0BAA 0x0BC1 +0xD3 0x0BAE 0x0BC1 +0xD4 0x0BAF 0x0BC1 +0xD5 0x0BB0 0x0BC1 +0xD6 0x0BB2 0x0BC1 +0xD7 0x0BB5 0x0BC1 +0xD8 0x0BB4 0x0BC1 +0xD9 0x0BB3 0x0BC1 +0xDA 0x0BB1 0x0BC1 +0xDB 0x0BA9 0x0BC1 +0xDC 0x0B95 0x0BC2 +0xDD 0x0B9A 0x0BC2 +0xDE 0x0B9F 0x0BC2 +0xDF 0x0BA3 0x0BC2 +0xE0 0x0BA4 0x0BC2 +0xE1 0x0BA8 0x0BC2 +0xE2 0x0BAA 0x0BC2 +0xE3 0x0BAE 0x0BC2 +0xE4 0x0BAF 0x0BC2 +0xE5 0x0BB0 0x0BC2 +0xE6 0x0BB2 0x0BC2 +0xE7 0x0BB5 0x0BC2 +0xE8 0x0BB4 0x0BC2 +0xE9 0x0BB3 0x0BC2 +0xEA 0x0BB1 0x0BC2 +0xEB 0x0BA9 0x0BC2 +0xEC 0x0B95 0x0BCD +0xED 0x0B99 0x0BCD +0xEE 0x0B9A 0x0BCD +0xEF 0x0B9E 0x0BCD +0xF0 0x0B9F 0x0BCD +0xF1 0x0BA3 0x0BCD +0xF2 0x0BA4 0x0BCD +0xF3 0x0BA8 0x0BCD +0xF4 0x0BAA 0x0BCD +0xF5 0x0BAE 0x0BCD +0xF6 0x0BAF 0x0BCD +0xF7 0x0BB0 0x0BCD +0xF8 0x0BB2 0x0BCD +0xF9 0x0BB5 0x0BCD +0xFA 0x0BB4 0x0BCD +0xFB 0x0BB3 0x0BCD +0xFC 0x0BB1 0x0BCD +0xFD 0x0BA9 0x0BCD diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c index 8a41756a35..733cbc15ee 100644 --- a/iconvdata/euc-jisx0213.c +++ b/iconvdata/euc-jisx0213.c @@ -67,7 +67,9 @@ *statep = saved_state -/* During UCS-4 to EUC-JISX0213 conversion, the COUNT element of the state +/* During EUC-JISX0213 to UCS-4 conversion, the COUNT element of the state + contains the last UCS-4 character, shifted by 3 bits. + During UCS-4 to EUC-JISX0213 conversion, the COUNT element of the state contains the last two bytes to be output, shifted by 3 bits. */ /* Since this is a stateful encoding we have to provide code which resets @@ -77,8 +79,17 @@ if (data->__statep->__count != 0) \ { \ if (FROM_DIRECTION) \ - /* We don't use shift states in the FROM_DIRECTION. */ \ - data->__statep->__count = 0; \ + { \ + if (__builtin_expect (outbuf + 4 <= outend, 1)) \ + { \ + /* Write out the last character. */ \ + *((uint32_t *) outbuf)++ = data->__statep->__count >> 3; \ + data->__statep->__count = 0; \ + } \ + else \ + /* We don't have enough room in the output buffer. */ \ + status = __GCONV_FULL_OUTPUT; \ + } \ else \ { \ if (__builtin_expect (outbuf + 2 <= outend, 1)) \ @@ -104,104 +115,114 @@ #define LOOPFCT FROM_LOOP #define BODY \ { \ - uint32_t ch = *inptr; \ + uint32_t ch; \ \ - if (ch < 0x80) \ - /* Plain ASCII character. */ \ - ++inptr; \ - else if ((ch >= 0xa1 && ch <= 0xfe) || ch == 0x8e || ch == 0x8f) \ + /* Determine whether there is a buffered character pending. */ \ + ch = *statep >> 3; \ + if (__builtin_expect (ch == 0, 1)) \ { \ - /* Two or three byte character. */ \ - uint32_t ch2; \ + /* No - so look at the next input byte. */ \ + ch = *inptr; \ \ - if (__builtin_expect (inptr + 1 >= inend, 0)) \ + if (ch < 0x80) \ + /* Plain ASCII character. */ \ + ++inptr; \ + else if ((ch >= 0xa1 && ch <= 0xfe) || ch == 0x8e || ch == 0x8f) \ { \ - /* The second byte is not available. */ \ - result = __GCONV_INCOMPLETE_INPUT; \ - break; \ - } \ + /* Two or three byte character. */ \ + uint32_t ch2; \ \ - ch2 = inptr[1]; \ - \ - /* The second byte must be >= 0xa1 and <= 0xfe. */ \ - if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \ - { \ - /* This is an illegal character. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ - } \ - \ - if (ch == 0x8e) \ - { \ - /* Half-width katakana. */ \ - if (__builtin_expect (ch2 > 0xdf, 0)) \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ - \ - ch = ch2 + 0xfec0; \ - inptr += 2; \ - } \ - else \ - { \ - const unsigned char *endp; \ - \ - if (ch == 0x8f) \ + if (__builtin_expect (inptr + 1 >= inend, 0)) \ { \ - /* JISX 0213 plane 2. */ \ - uint32_t ch3; \ + /* The second byte is not available. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ \ - if (__builtin_expect (inptr + 2 >= inend, 0)) \ - { \ - /* The third byte is not available. */ \ - result = __GCONV_INCOMPLETE_INPUT; \ - break; \ - } \ + ch2 = inptr[1]; \ \ - ch3 = inptr[2]; \ - endp = inptr + 3; \ + /* The second byte must be >= 0xa1 and <= 0xfe. */ \ + if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \ + { \ + /* This is an illegal character. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ \ - ch = jisx0213_to_ucs4 (0x200 - 0x80 + ch2, ch3 ^ 0x80); \ + if (ch == 0x8e) \ + { \ + /* Half-width katakana. */ \ + if (__builtin_expect (ch2 > 0xdf, 0)) \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + \ + ch = ch2 + 0xfec0; \ + inptr += 2; \ } \ else \ { \ - /* JISX 0213 plane 1. */ \ - endp = inptr + 2; \ + const unsigned char *endp; \ \ - ch = jisx0213_to_ucs4 (0x100 - 0x80 + ch, ch2 ^ 0x80); \ - } \ - \ - if (ch == 0) \ - /* This is an illegal character. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ - \ - if (ch < 0x80) \ - { \ - /* It's a combining character. */ \ - uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \ - uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \ - \ - /* See whether we have room for two characters. */ \ - if (outptr + 8 <= outend) \ + if (ch == 0x8f) \ { \ - inptr = endp; \ - put32 (outptr, u1); \ - outptr += 4; \ - put32 (outptr, u2); \ - outptr += 4; \ - continue; \ + /* JISX 0213 plane 2. */ \ + uint32_t ch3; \ + \ + if (__builtin_expect (inptr + 2 >= inend, 0)) \ + { \ + /* The third byte is not available. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + \ + ch3 = inptr[2]; \ + endp = inptr + 3; \ + \ + ch = jisx0213_to_ucs4 (0x200 - 0x80 + ch2, ch3 ^ 0x80); \ } \ else \ { \ + /* JISX 0213 plane 1. */ \ + endp = inptr + 2; \ + \ + ch = jisx0213_to_ucs4 (0x100 - 0x80 + ch, ch2 ^ 0x80); \ + } \ + \ + if (ch == 0) \ + /* This is an illegal character. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + \ + inptr = endp; \ + \ + if (ch < 0x80) \ + { \ + /* It's a combining character. */ \ + uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \ + uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \ + \ + put32 (outptr, u1); \ + outptr += 4; \ + \ + /* See whether we have room for two characters. */ \ + if (outptr + 4 <= outend) \ + { \ + put32 (outptr, u2); \ + outptr += 4; \ + continue; \ + } \ + \ + /* Otherwise store only the first character now, and \ + put the second one into the queue. */ \ + *statep = u2 << 3; \ + /* Tell the caller why we terminate the loop. */ \ result = __GCONV_FULL_OUTPUT; \ break; \ } \ } \ - \ - inptr = endp; \ } \ - } \ - else \ - { \ - /* This is illegal. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + else \ + { \ + /* This is illegal. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ } \ \ put32 (outptr, ch); \ diff --git a/iconvdata/gconv-modules b/iconvdata/gconv-modules index b35135352c..c5fc10e5d0 100644 --- a/iconvdata/gconv-modules +++ b/iconvdata/gconv-modules @@ -1523,3 +1523,7 @@ module INTERNAL EUC-JISX0213// EUC-JISX0213 1 # from to module cost module Shift_JISX0213// INTERNAL SHIFT_JISX0213 1 module INTERNAL Shift_JISX0213// SHIFT_JISX0213 1 + +# from to module cost +module TSCII// INTERNAL TSCII 1 +module INTERNAL TSCII// TSCII 1 diff --git a/iconvdata/shift_jisx0213.c b/iconvdata/shift_jisx0213.c index d48d67ef0f..119e0017b9 100644 --- a/iconvdata/shift_jisx0213.c +++ b/iconvdata/shift_jisx0213.c @@ -67,7 +67,9 @@ *statep = saved_state -/* During UCS-4 to Shift_JISX0213 conversion, the COUNT element of the state +/* During Shift_JISX0213 to UCS-4 conversion, the COUNT element of the state + contains the last UCS-4 character, shifted by 3 bits. + During UCS-4 to Shift_JISX0213 conversion, the COUNT element of the state contains the last two bytes to be output, shifted by 3 bits. */ /* Since this is a stateful encoding we have to provide code which resets @@ -77,8 +79,17 @@ if (data->__statep->__count != 0) \ { \ if (FROM_DIRECTION) \ - /* We don't use shift states in the FROM_DIRECTION. */ \ - data->__statep->__count = 0; \ + { \ + if (__builtin_expect (outbuf + 4 <= outend, 1)) \ + { \ + /* Write out the last character. */ \ + *((uint32_t *) outbuf)++ = data->__statep->__count >> 3; \ + data->__statep->__count = 0; \ + } \ + else \ + /* We don't have enough room in the output buffer. */ \ + status = __GCONV_FULL_OUTPUT; \ + } \ else \ { \ if (__builtin_expect (outbuf + 2 <= outend, 1)) \ @@ -104,106 +115,116 @@ #define LOOPFCT FROM_LOOP #define BODY \ { \ - uint32_t ch = *inptr; \ + uint32_t ch; \ \ - if (ch < 0x80) \ + /* Determine whether there is a buffered character pending. */ \ + ch = *statep >> 3; \ + if (__builtin_expect (ch == 0, 1)) \ { \ - /* Plain ISO646-JP character. */ \ - if (__builtin_expect (ch == 0x5c, 0)) \ - ch = 0xa5; \ - else if (__builtin_expect (ch == 0x7e, 0)) \ - ch = 0x203e; \ - ++inptr; \ - } \ - else if (ch >= 0xa1 && ch <= 0xdf) \ - { \ - /* Half-width katakana. */ \ - ch += 0xfec0; \ - ++inptr; \ - } \ - else if ((ch >= 0x81 && ch <= 0x9f) || (ch >= 0xe0 && ch <= 0xfc)) \ - { \ - /* Two byte character. */ \ - uint32_t ch2; \ - \ - if (__builtin_expect (inptr + 1 >= inend, 0)) \ - { \ - /* The second byte is not available. */ \ - result = __GCONV_INCOMPLETE_INPUT; \ - break; \ - } \ - \ - ch2 = inptr[1]; \ - \ - /* The second byte must be in the range 0x{40..7E,80..FC}. */ \ - if (__builtin_expect (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc, 0)) \ - { \ - /* This is an illegal character. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ - } \ - \ - /* Convert to row and column. */ \ - if (ch < 0xe0) \ - ch -= 0x81; \ - else \ - ch -= 0xc1; \ - if (ch2 < 0x80) \ - ch2 -= 0x40; \ - else \ - ch2 -= 0x41; \ - /* Now 0 <= ch <= 0x3b, 0 <= ch2 <= 0xbb. */ \ - ch = 2 * ch; \ - if (ch2 >= 0x5e) \ - ch2 -= 0x5e, ch++; \ - ch2 += 0x21; \ - if (ch >= 0x5e) \ - { \ - /* Handling of JISX 0213 plane 2 rows. */ \ - if (ch >= 0x67) \ - ch += 230; \ - else if (ch >= 0x63 || ch == 0x5f) \ - ch += 168; \ - else \ - ch += 162; \ - } \ - \ - ch = jisx0213_to_ucs4 (0x121 + ch, ch2); \ - \ - if (ch == 0) \ - { \ - /* This is an illegal character. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ - } \ + /* No - so look at the next input byte. */ \ + ch = *inptr; \ \ if (ch < 0x80) \ { \ - /* It's a combining character. */ \ - uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \ - uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \ + /* Plain ISO646-JP character. */ \ + if (__builtin_expect (ch == 0x5c, 0)) \ + ch = 0xa5; \ + else if (__builtin_expect (ch == 0x7e, 0)) \ + ch = 0x203e; \ + ++inptr; \ + } \ + else if (ch >= 0xa1 && ch <= 0xdf) \ + { \ + /* Half-width katakana. */ \ + ch += 0xfec0; \ + ++inptr; \ + } \ + else if ((ch >= 0x81 && ch <= 0x9f) || (ch >= 0xe0 && ch <= 0xfc)) \ + { \ + /* Two byte character. */ \ + uint32_t ch2; \ \ - /* See whether we have room for two characters. */ \ - if (outptr + 8 <= outend) \ + if (__builtin_expect (inptr + 1 >= inend, 0)) \ { \ - inptr += 2; \ + /* The second byte is not available. */ \ + result = __GCONV_INCOMPLETE_INPUT; \ + break; \ + } \ + \ + ch2 = inptr[1]; \ + \ + /* The second byte must be in the range 0x{40..7E,80..FC}. */ \ + if (__builtin_expect (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc, 0))\ + { \ + /* This is an illegal character. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ + \ + /* Convert to row and column. */ \ + if (ch < 0xe0) \ + ch -= 0x81; \ + else \ + ch -= 0xc1; \ + if (ch2 < 0x80) \ + ch2 -= 0x40; \ + else \ + ch2 -= 0x41; \ + /* Now 0 <= ch <= 0x3b, 0 <= ch2 <= 0xbb. */ \ + ch = 2 * ch; \ + if (ch2 >= 0x5e) \ + ch2 -= 0x5e, ch++; \ + ch2 += 0x21; \ + if (ch >= 0x5e) \ + { \ + /* Handling of JISX 0213 plane 2 rows. */ \ + if (ch >= 0x67) \ + ch += 230; \ + else if (ch >= 0x63 || ch == 0x5f) \ + ch += 168; \ + else \ + ch += 162; \ + } \ + \ + ch = jisx0213_to_ucs4 (0x121 + ch, ch2); \ + \ + if (ch == 0) \ + { \ + /* This is an illegal character. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ + \ + inptr += 2; \ + \ + if (ch < 0x80) \ + { \ + /* It's a combining character. */ \ + uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \ + uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \ + \ put32 (outptr, u1); \ outptr += 4; \ - put32 (outptr, u2); \ - outptr += 4; \ - continue; \ - } \ - else \ - { \ + \ + /* See whether we have room for two characters. */ \ + if (outptr + 4 <= outend) \ + { \ + put32 (outptr, u2); \ + outptr += 4; \ + continue; \ + } \ + \ + /* Otherwise store only the first character now, and \ + put the second one into the queue. */ \ + *statep = u2 << 3; \ + /* Tell the caller why we terminate the loop. */ \ result = __GCONV_FULL_OUTPUT; \ break; \ } \ } \ - \ - inptr += 2; \ - } \ - else \ - { \ - /* This is illegal. */ \ - STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + else \ + { \ + /* This is illegal. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ } \ \ put32 (outptr, ch); \ diff --git a/iconvdata/testdata/TSCII b/iconvdata/testdata/TSCII new file mode 100644 index 0000000000..51691e1626 --- /dev/null +++ b/iconvdata/testdata/TSCII @@ -0,0 +1,27 @@ +« ¬ þ ® ¯ ° ± ² ´ µ ¶ · + +¸ ¸¡ ¸¢ ¸£ Ì Ü ¦¸ §¸ ¨¸ ¦¸¡ §¸¡ ¦¸ª +¹ ¹¡ ¹¢ ¹£ ™ › ¦¹ §¹ ¨¹ ¦¹¡ ¦¹¡ ¦¹ª +º º¡ º¢ º£ Í Ý ¦º §º ¨º ¦º¡ §º¡ ¦ºª +» »¡ »¢ »£ š œ ¦» §» ¨» ¦»¡ §»¡ ¦»ª +¼ ¼¡ Ê Ë Î Þ ¦¼ §¼ ¨¼ ¦¼¡ §¼¡ ¦¼ª +½ ½¡ ½¢ ½£ Ï ß ¦½ §½ ¨½ ¦½¡ §½¡ ¦½ª +¾ ¾¡ ¾¢ ¾£ Ð à ¦¾ §¾ ¨¾ ¦¾¡ §¾¡ ¦¾ª +¿ ¿¡ ¿¢ ¿£ Ñ á ¦¿ §¿ ¨¿ ¦¿¡ §¿¡ ¦¿ª +À À¡ À¢ À£ Ò â ¦À §À ¨À ¦À¡ §À¡ ¦Àª +Á Á¡ Á¢ Á£ Ó ã ¦Á §Á ¨Á ¦Á¡ §Á¡ ¦Áª + ¡ ¢ £ Ô ä ¦Â §Â ¨Â ¦Â¡ §Â¡ ¦Âª +à á â ã Õ å ¦Ã §Ã ¨Ã ¦Ã¡ §Ã¡ ¦Ãª +Ä Ä¡ Ä¢ Ä£ Ö æ ¦Ä §Ä ¨Ä ¦Ä¡ §Ä¡ ¦Äª +Å Å¡ Å¢ Å£ × ç ¦Å §Å ¨Å ¦Å¡ §Å¡ ¦Åª +Æ Æ¡ Æ¢ Æ£ Ø è ¦Æ §Æ ¨Æ ¦Æ¡ §Æ¡ ¦Æª +È È¡ È¢ È£ Ú ê ¦È §È ¨È ¦È¡ §È¡ ¦Èª +É É¡ É¢ É£ Û ë ¦É §É ¨É ¦É¡ §É¡ ¦Éª + +‚ + +ƒ ƒ¡ ƒ¢ ƒ£ ƒ¤ ƒ¥ ¦ƒ §ƒ ¨ƒ ¦ƒ¡ §ƒ¡ ¦ƒª +„ „¡ „¢ „£ „¤ „¥ ¦„ §„ ¨„ ¦„¡ §„¡ ¦„ª +… …¡ …¢ …£ Š¤ Š¥ ¦… §… ¨… ¦…¡ §…¡ ¦…ª +† †¡ †¢ †£ ‹¤ ‹¥ ¦† §† ¨† ¦†¡ §†¡ ¦†ª +‡ ‡¡ ‡¢ ‡£ ‡¥ ‡¥ ¦‡ §‡ ¨‡ ¦‡¡ §‡¡ ¦‡ª diff --git a/iconvdata/testdata/TSCII..UTF8 b/iconvdata/testdata/TSCII..UTF8 new file mode 100644 index 0000000000..28f15aeb80 --- /dev/null +++ b/iconvdata/testdata/TSCII..UTF8 @@ -0,0 +1,27 @@ +à®… ஆ இ ஈ உ ஊ எ à® à®’ ஓ à®” ஃ + +க கா கி கீ க௠கூ கெ கே கை கொ கோ கௌ +à®™ ஙா ஙி ஙீ ங௠ஙூ ஙெ ஙே ஙை ஙொ ஙொ ஙௌ +ச சா சி சீ ச௠சூ செ சே சை சொ சோ சௌ +ஞ ஞா ஞி ஞீ ஞ௠ஞூ ஞெ ஞே ஞை ஞொ ஞோ ஞௌ +ட டா டி டீ ட௠டூ டெ டே டை டொ டோ டௌ +ண ணா ணி ணீ ண௠ணூ ணெ ணே ணை ணொ ணோ ணௌ +த தா தி தீ த௠தூ தெ தே தை தொ தோ தௌ +ந நா நி நீ ந௠நூ நெ நே நை நொ நோ நௌ +ப பா பி பீ ப௠பூ பெ பே பை பொ போ பௌ +à®® மா மி மீ ம௠மூ மெ மே மை மொ மோ மௌ +ய யா யி யீ ய௠யூ யெ யே யை யொ யோ யௌ +à®° ரா ரி ரீ ர௠ரூ ரெ ரே ரை ரொ ரோ ரௌ +ல லா லி லீ ல௠லூ லெ லே லை லொ லோ லௌ +வ வா வி வீ வ௠வூ வெ வே வை வொ வோ வௌ +à®´ ழா ழி ழீ ழ௠ழூ ழெ ழே ழை ழொ ழோ ழௌ +à®± றா றி றீ ற௠றூ றெ றே றை றொ றோ றௌ +ன னா னி னீ ன௠னூ னெ னே னை னொ னோ னௌ + +ஸà¯à®°à¯€ + +ஜ ஜா ஜி ஜீ ஜ௠ஜூ ெஜ ேஜ ைஜ ெஜா ேஜா ெஜௗ +à®· ஷா ஷி ஷீ ஷ௠ஷூ ெஷ ேஷ ைஷ ெஷா ேஷா ெஷௗ +ஸ ஸா ஸி ஸீ ஸ௠ஸூ ெஸ ேஸ ைஸ ெஸா ேஸா ெஸௗ +ஹ ஹா ஹி ஹீ ஹ௠ஹூ ெஹ ேஹ ைஹ ெஹா ேஹா ெஹௗ +கà¯à®· கà¯à®·à®¾ கà¯à®·à®¿ கà¯à®·à¯€ கà¯à®·à¯‚ கà¯à®·à¯‚ ெகà¯à®· ேகà¯à®· ைகà¯à®· ெகà¯à®·à®¾ ேகà¯à®·à®¾ ெகà¯à®·à¯— diff --git a/iconvdata/tscii.c b/iconvdata/tscii.c new file mode 100644 index 0000000000..66e4062a3f --- /dev/null +++ b/iconvdata/tscii.c @@ -0,0 +1,851 @@ +/* Conversion from and to TSCII. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible , 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* TSCII is an 8-bit encoding consisting of: + 0x00..0x7F: ASCII + 0x80..0x90, 0x95..0x9F, 0xAB..0xFE: + Tamil letters and glyphs + 0xA1..0xA5, 0xAA: Tamil combining letters (after the base character) + 0xA6..0xA8: Tamil combining letters (before the base character) + 0x91..0x94: Punctuation + 0xA9: Symbols +*/ + +/* Definitions used in the body of the `gconv' function. */ +#define CHARSET_NAME "TSCII//" +#define FROM_LOOP from_tscii +#define TO_LOOP to_tscii +#define DEFINE_INIT 1 +#define DEFINE_FINI 1 +#define FROM_LOOP_MIN_NEEDED_FROM 1 +#define FROM_LOOP_MAX_NEEDED_FROM 2 +#define FROM_LOOP_MIN_NEEDED_TO 4 +#define FROM_LOOP_MAX_NEEDED_TO 16 +#define TO_LOOP_MIN_NEEDED_FROM 4 +#define TO_LOOP_MAX_NEEDED_FROM 4 +#define TO_LOOP_MIN_NEEDED_TO 1 +#define TO_LOOP_MAX_NEEDED_TO 3 +#define PREPARE_LOOP \ + int saved_state; \ + int *statep = &data->__statep->__count; +#define EXTRA_LOOP_ARGS , statep + + +/* Since we might have to reset input pointer we must be able to save + and restore the state. */ +#define SAVE_RESET_STATE(Save) \ + if (Save) \ + saved_state = *statep; \ + else \ + *statep = saved_state + + +/* During TSCII to UCS-4 conversion, the COUNT element of the state contains + the last UCS-4 character to be output, shifted by 8 bits, and an encoded + representation of additional UCS-4 characters to be output (if any), + shifted by 4 bits. This character can be: + 0x0000 Nothing pending. + 0x0BCD Pending VIRAMA sign. If bit 3 is set, it may be + omitted if followed by a vowel sign U or UU. + 0x0BC6, 0x0BC7, 0x0BC8 Pending vowel sign. Bit 3 is set after the + consonant was seen. + Other Bit 3 always cleared. */ + +/* During UCS-4 to TSCII conversion, the COUNT element of the state contains + the last byte (or sometimes the last two bytes) to be output, shifted by + 3 bits. This can be: + 0x00 Nothing pending. + 0xB8..0xC9, 0x83..0x86 A consonant. + 0xEC, 0x8A A consonant with VIRAMA sign (final or joining). + 0x87, 0xC38A Two consonants combined through a VIRAMA sign. */ + +/* Since this is a stateful encoding we have to provide code which resets + the output state to the initial state. This has to be done during the + flushing. */ +#define EMIT_SHIFT_TO_INIT \ + if (data->__statep->__count != 0) \ + { \ + if (FROM_DIRECTION) \ + { \ + do \ + { \ + if (__builtin_expect (outbuf + 4 > outend, 0)) \ + { \ + /* We don't have enough room in the output buffer. */ \ + status = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + /* Write out the pending character. */ \ + *((uint32_t *) outbuf)++ = data->__statep->__count >> 8; \ + /* Retrieve the successor state. */ \ + data->__statep->__count = \ + tscii_next_state[(data->__statep->__count >> 4) & 0x0f]; \ + } \ + while (data->__statep->__count != 0); \ + } \ + else \ + { \ + uint32_t last = data->__statep->__count >> 3; \ + if (__builtin_expect (last >> 8, 0)) \ + { \ + /* Write out the last character, two bytes. */ \ + if (__builtin_expect (outbuf + 2 <= outend, 1)) \ + { \ + *outbuf++ = last & 0xff; \ + *outbuf++ = (last >> 8) & 0xff; \ + data->__statep->__count = 0; \ + } \ + else \ + /* We don't have enough room in the output buffer. */ \ + status = __GCONV_FULL_OUTPUT; \ + } \ + else \ + { \ + /* Write out the last character, a single byte. */ \ + if (__builtin_expect (outbuf < outend, 1)) \ + { \ + *outbuf++ = last & 0xff; \ + data->__statep->__count = 0; \ + } \ + else \ + /* We don't have enough room in the output buffer. */ \ + status = __GCONV_FULL_OUTPUT; \ + } \ + } \ + } + + +/* First define the conversion function from TSCII to UCS-4. */ + +static const uint16_t tscii_to_ucs4[128][2] = + { + { 0x0BE6, 0 }, + { 0x0BE7, 0 }, + { 0, 0 }, /* 0x82 - maps to */ + { 0x0B9C, 0 }, + { 0x0BB7, 0 }, + { 0x0BB8, 0 }, + { 0x0BB9, 0 }, + { 0, 0 }, /* 0x87 - maps to */ + { 0x0B9C, 0x0BCD }, + { 0x0BB7, 0x0BCD }, + { 0, 0 }, /* 0x8a - maps to and buffers */ + { 0, 0 }, /* 0x8b - maps to and buffers */ + { 0, 0 }, /* 0x8c - maps to */ + { 0x0BE8, 0 }, + { 0x0BE9, 0 }, + { 0x0BEA, 0 }, + { 0x0BEB, 0 }, + { 0x2018, 0 }, + { 0x2019, 0 }, + { 0x201C, 0 }, + { 0x201D, 0 }, + { 0x0BEC, 0 }, + { 0x0BED, 0 }, + { 0x0BEE, 0 }, + { 0x0BEF, 0 }, + { 0x0B99, 0x0BC1 }, + { 0x0B9E, 0x0BC1 }, + { 0x0B99, 0x0BC2 }, + { 0x0B9E, 0x0BC2 }, + { 0x0BF0, 0 }, + { 0x0BF1, 0 }, + { 0x0BF2, 0 }, + { 0, 0 }, /* 0xa0 - unmapped */ + { 0x0BBE, 0 }, + { 0x0BBF, 0 }, + { 0x0BC0, 0 }, + { 0x0BC1, 0 }, + { 0x0BC2, 0 }, + { 0, 0 }, /* 0xa6 - buffers */ + { 0, 0 }, /* 0xa7 - buffers */ + { 0, 0 }, /* 0xa8 - buffers */ + { 0x00A9, 0 }, + { 0x0BD7, 0 }, + { 0x0B85, 0 }, + { 0x0B86, 0 }, + { 0x0B87, 0 }, + { 0x0B88, 0 }, + { 0x0B89, 0 }, + { 0x0B8A, 0 }, + { 0x0B8E, 0 }, + { 0x0B8F, 0 }, + { 0x0B90, 0 }, + { 0x0B92, 0 }, + { 0x0B93, 0 }, + { 0x0B94, 0 }, + { 0x0B83, 0 }, + { 0x0B95, 0 }, + { 0x0B99, 0 }, + { 0x0B9A, 0 }, + { 0x0B9E, 0 }, + { 0x0B9F, 0 }, + { 0x0BA3, 0 }, + { 0x0BA4, 0 }, + { 0x0BA8, 0 }, + { 0x0BAA, 0 }, + { 0x0BAE, 0 }, + { 0x0BAF, 0 }, + { 0x0BB0, 0 }, + { 0x0BB2, 0 }, + { 0x0BB5, 0 }, + { 0x0BB4, 0 }, + { 0x0BB3, 0 }, + { 0x0BB1, 0 }, + { 0x0BA9, 0 }, + { 0x0B9F, 0x0BBF }, + { 0x0B9F, 0x0BC0 }, + { 0x0B95, 0x0BC1 }, + { 0x0B9A, 0x0BC1 }, + { 0x0B9F, 0x0BC1 }, + { 0x0BA3, 0x0BC1 }, + { 0x0BA4, 0x0BC1 }, + { 0x0BA8, 0x0BC1 }, + { 0x0BAA, 0x0BC1 }, + { 0x0BAE, 0x0BC1 }, + { 0x0BAF, 0x0BC1 }, + { 0x0BB0, 0x0BC1 }, + { 0x0BB2, 0x0BC1 }, + { 0x0BB5, 0x0BC1 }, + { 0x0BB4, 0x0BC1 }, + { 0x0BB3, 0x0BC1 }, + { 0x0BB1, 0x0BC1 }, + { 0x0BA9, 0x0BC1 }, + { 0x0B95, 0x0BC2 }, + { 0x0B9A, 0x0BC2 }, + { 0x0B9F, 0x0BC2 }, + { 0x0BA3, 0x0BC2 }, + { 0x0BA4, 0x0BC2 }, + { 0x0BA8, 0x0BC2 }, + { 0x0BAA, 0x0BC2 }, + { 0x0BAE, 0x0BC2 }, + { 0x0BAF, 0x0BC2 }, + { 0x0BB0, 0x0BC2 }, + { 0x0BB2, 0x0BC2 }, + { 0x0BB5, 0x0BC2 }, + { 0x0BB4, 0x0BC2 }, + { 0x0BB3, 0x0BC2 }, + { 0x0BB1, 0x0BC2 }, + { 0x0BA9, 0x0BC2 }, + { 0x0B95, 0x0BCD }, + { 0x0B99, 0x0BCD }, + { 0x0B9A, 0x0BCD }, + { 0x0B9E, 0x0BCD }, + { 0x0B9F, 0x0BCD }, + { 0x0BA3, 0x0BCD }, + { 0x0BA4, 0x0BCD }, + { 0x0BA8, 0x0BCD }, + { 0x0BAA, 0x0BCD }, + { 0x0BAE, 0x0BCD }, + { 0x0BAF, 0x0BCD }, + { 0x0BB0, 0x0BCD }, + { 0x0BB2, 0x0BCD }, + { 0x0BB5, 0x0BCD }, + { 0x0BB4, 0x0BCD }, + { 0x0BB3, 0x0BCD }, + { 0x0BB1, 0x0BCD }, + { 0x0BA9, 0x0BCD }, + { 0x0B87, 0 }, + { 0, 0 } /* 0xff - unmapped */ + }; + +static const uint32_t tscii_next_state[6] = + { + /* 0 means no more pending Unicode characters. */ + 0, + /* 1 means . */ + (0x0BB7 << 8), + /* 2 means . */ + (0x0BC0 << 8), + /* 3 means . */ + (0x0BCD << 8), + /* 4 means . */ + (0x0BB0 << 8) + (2 << 4), + /* 5 means . */ + (0x0BB7 << 8) + (3 << 4) + }; + +#define MIN_NEEDED_INPUT FROM_LOOP_MIN_NEEDED_FROM +#define MAX_NEEDED_INPUT FROM_LOOP_MAX_NEEDED_FROM +#define MIN_NEEDED_OUTPUT FROM_LOOP_MIN_NEEDED_TO +#define MAX_NEEDED_OUTPUT FROM_LOOP_MAX_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + uint32_t ch = *inptr; \ + \ + if ((*statep >> 8) != 0) \ + { \ + /* Attempt to combine the last character with this one. */ \ + uint32_t last = *statep >> 8; \ + \ + if (last == 0x0BCD && (*statep & (1 << 3))) \ + { \ + if (ch == 0xa4 || ch == 0xa5) \ + { \ + ch += 0xb1d; \ + /* Now ch = 0x0BC1 or ch = 0x0BC2. */ \ + put32 (outptr, ch); \ + outptr += 4; \ + *statep = 0; \ + inptr++; \ + continue; \ + } \ + } \ + else if (last >= 0x0BC6 && last <= 0x0BC8) \ + { \ + if ((last == 0x0BC6 && ch == 0xa1) \ + || (last == 0x0BC7 && (ch == 0xa1 || ch == 0xaa))) \ + { \ + ch = last + 4 + (ch != 0xa1); \ + /* Now ch = 0x0BCA or ch = 0x0BCB or ch = 0x0BCC. */ \ + put32 (outptr, ch); \ + outptr += 4; \ + *statep = 0; \ + inptr++; \ + continue; \ + } \ + if ((ch >= 0xb8 && ch <= 0xc9) && (*statep & (1 << 3)) == 0) \ + { \ + ch = tscii_to_ucs4[ch - 0x80][0]; \ + put32 (outptr, ch); \ + outptr += 4; \ + *statep |= 1 << 3; \ + inptr++; \ + continue; \ + } \ + } \ + \ + do \ + { \ + /* Output the buffered character. */ \ + put32 (outptr, last); \ + outptr += 4; \ + /* Retrieve the successor state. */ \ + *statep = tscii_next_state[(*statep >> 4) & 0x0f]; \ + } \ + while (*statep != 0 && __builtin_expect (outptr + 4 <= outend, 1)); \ + \ + if (*statep != 0) \ + { \ + /* We don't have enough room in the output buffer. \ + Tell the caller why we terminate the loop. */ \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + \ + continue; \ + } \ + \ + if (ch < 0x80) \ + { \ + /* Plain ASCII character. */ \ + put32 (outptr, ch); \ + outptr += 4; \ + } \ + else \ + { \ + /* Tamil character. */ \ + uint32_t u1 = tscii_to_ucs4[ch - 0x80][0]; \ + \ + if (u1 != 0) \ + { \ + uint32_t u2 = tscii_to_ucs4[ch - 0x80][1]; \ + \ + inptr++; \ + \ + put32 (outptr, u1); \ + outptr += 4; \ + \ + if (u2 != 0) \ + { \ + /* See whether we have room for two characters. Otherwise \ + store only the first character now, and put the second \ + one into the queue. */ \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = u2 << 8; \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, u2); \ + outptr += 4; \ + } \ + continue; \ + } \ + /* Special handling of a few Tamil characters. */ \ + else if (ch == 0xa6 || ch == 0xa7 || ch == 0xa8) \ + { \ + ch += 0x0b20; \ + /* Now ch = 0x0BC6 or ch = 0x0BC7 or ch = 0x0BC8. */ \ + *statep = ch << 8; \ + inptr++; \ + continue; \ + } \ + else if (ch == 0x8a || ch == 0x8b) \ + { \ + ch += 0x0b2e; \ + /* Now ch = 0x0BB8 or ch = 0x0BB9. */ \ + put32 (outptr, ch); \ + outptr += 4; \ + *statep = (0x0BCD << 8) + (1 << 3); \ + inptr++; \ + continue; \ + } \ + else if (ch == 0x82) \ + { \ + /* Output , if we have room for \ + four characters. */ \ + inptr++; \ + put32 (outptr, 0x0BB8); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BCD << 8) + (4 << 4); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BCD); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BB0 << 8) + (2 << 4); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BB0); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BC0 << 8); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BC0); \ + outptr += 4; \ + continue; \ + } \ + else if (ch == 0x87) \ + { \ + /* Output , if we have room for \ + three characters. */ \ + inptr++; \ + put32 (outptr, 0x0B95); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BCD << 8) + (1 << 4); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BCD); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BB7 << 8); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BB7); \ + outptr += 4; \ + continue; \ + } \ + else if (ch == 0x8c) \ + { \ + /* Output , if we have room for \ + four characters. */ \ + inptr++; \ + put32 (outptr, 0x0B95); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BCD << 8) + (5 << 4); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BCD); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BB7 << 8) + (3 << 4); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BB7); \ + outptr += 4; \ + if (__builtin_expect (outptr + 4 > outend, 0)) \ + { \ + *statep = (0x0BCD << 8); \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + put32 (outptr, 0x0BCD); \ + outptr += 4; \ + continue; \ + } \ + else \ + { \ + /* This is illegal. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ + } \ + \ + /* Now that we wrote the output increment the input pointer. */ \ + inptr++; \ + } +#define LOOP_NEED_FLAGS +#define EXTRA_LOOP_DECLS , int *statep +#include + + +/* Next, define the other direction, from UCS-4 to TSCII. */ + +static const uint8_t ucs4_to_tscii[128] = + { + 0, 0, 0, 0xb7, 0, 0xab, 0xac, 0xfe, /* 0x0B80..0x0B87 */ + 0xae, 0xaf, 0xb0, 0, 0, 0, 0xb1, 0xb2, /* 0x0B88..0x0B8F */ + 0xb3, 0, 0xb4, 0xb5, 0xb6, 0xb8, 0, 0, /* 0x0B90..0x0B97 */ + 0, 0xb9, 0xba, 0, 0x83, 0, 0xbb, 0xbc, /* 0x0B98..0x0B9F */ + 0, 0, 0, 0xbd, 0xbe, 0, 0, 0, /* 0x0BA0..0x0BA7 */ + 0xbf, 0xc9, 0xc0, 0, 0, 0, 0xc1, 0xc2, /* 0x0BA8..0x0BAF */ + 0xc3, 0xc8, 0xc4, 0xc7, 0xc6, 0xc5, 0, 0x84, /* 0x0BB0..0x0BB7 */ + 0x85, 0x86, 0, 0, 0, 0, 0xa1, 0xa2, /* 0x0BB8..0x0BBF */ + 0xa3, 0xa4, 0xa5, 0, 0, 0, 0xa6, 0xa7, /* 0x0BC0..0x0BC7 */ + 0xa8, 0, 0, 0, 0, 0, 0, 0, /* 0x0BC8..0x0BCF */ + 0, 0, 0, 0, 0, 0, 0, 0xaa, /* 0x0BD0..0x0BD7 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0BD8..0x0BDF */ + 0, 0, 0, 0, 0, 0, 0x80, 0x81, /* 0x0BE0..0x0BE7 */ + 0x8d, 0x8e, 0x8f, 0x90, 0x95, 0x96, 0x97, 0x98, /* 0x0BE8..0x0BEF */ + 0x9d, 0x9e, 0x9f, 0, 0, 0, 0, 0, /* 0x0BF0..0x0BF7 */ + 0, 0, 0, 0, 0, 0, 0, 0 /* 0x0BF8..0x0BFF */ + }; + +static const uint8_t consonant_with_u[18] = + { + 0xcc, 0x99, 0xcd, 0x9a, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb + }; + +static const uint8_t consonant_with_uu[18] = + { + 0xdc, 0x9b, 0xdd, 0x9c, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb + }; + +static const uint8_t consonant_with_virama[18] = + { + 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, + 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd + }; + +#define MIN_NEEDED_INPUT TO_LOOP_MIN_NEEDED_FROM +#define MAX_NEEDED_INPUT TO_LOOP_MAX_NEEDED_FROM +#define MIN_NEEDED_OUTPUT TO_LOOP_MIN_NEEDED_TO +#define MAX_NEEDED_OUTPUT TO_LOOP_MAX_NEEDED_TO +#define LOOPFCT TO_LOOP +#define BODY \ + { \ + uint32_t ch = get32 (inptr); \ + \ + if ((*statep >> 3) != 0) \ + { \ + /* Attempt to combine the last character with this one. */ \ + uint32_t last = *statep >> 3; \ + \ + if (last >= 0xb8 && last <= 0xc9) \ + { \ + if (ch == 0x0BC1) \ + { \ + *outptr++ = consonant_with_u[last - 0xb8]; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + if (ch == 0x0BC2) \ + { \ + *outptr++ = consonant_with_uu[last - 0xb8]; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + if (ch == 0x0BC6) \ + { \ + if (__builtin_expect (outptr + 2 <= outend, 1)) \ + { \ + *outptr++ = 0xa6; \ + *outptr++ = last; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BC7) \ + { \ + if (__builtin_expect (outptr + 2 <= outend, 1)) \ + { \ + *outptr++ = 0xa7; \ + *outptr++ = last; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BC8) \ + { \ + if (__builtin_expect (outptr + 2 <= outend, 1)) \ + { \ + *outptr++ = 0xa8; \ + *outptr++ = last; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BCA) \ + { \ + if (__builtin_expect (outptr + 3 <= outend, 1)) \ + { \ + *outptr++ = 0xa6; \ + *outptr++ = last; \ + *outptr++ = 0xa1; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BCB) \ + { \ + if (__builtin_expect (outptr + 3 <= outend, 1)) \ + { \ + *outptr++ = 0xa7; \ + *outptr++ = last; \ + *outptr++ = 0xa1; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BCC) \ + { \ + if (__builtin_expect (outptr + 3 <= outend, 1)) \ + { \ + *outptr++ = 0xa7; \ + *outptr++ = last; \ + *outptr++ = 0xaa; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + if (ch == 0x0BCD) \ + { \ + if (last != 0xb8) \ + { \ + *outptr++ = consonant_with_virama[last - 0xb8]; \ + *statep = 0; \ + } \ + else \ + *statep = 0xec << 3; \ + inptr += 4; \ + continue; \ + } \ + if (last == 0xbc && (ch == 0x0BBF || ch == 0x0BC0)) \ + { \ + *outptr++ = ch - 0x0af5; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + } \ + else if (last >= 0x83 && last <= 0x86) \ + { \ + if (last >= 0x85 && (ch == 0x0BC1 || ch == 0x0BC2)) \ + { \ + *outptr++ = last + 5; \ + *statep = 0; \ + continue; \ + } \ + if (ch == 0x0BCD) \ + { \ + if (last != 0x85) \ + { \ + *outptr++ = last + 5; \ + *statep = 0; \ + } \ + else \ + *statep = 0x8a << 3; \ + inptr += 4; \ + continue; \ + } \ + } \ + else if (last == 0xec) \ + { \ + if (ch == 0x0BB7) \ + { \ + *statep = 0x87 << 3; \ + inptr += 4; \ + continue; \ + } \ + } \ + else if (last == 0x8a) \ + { \ + if (ch == 0x0BB0) \ + { \ + *statep = 0xc38a << 3; \ + inptr += 4; \ + continue; \ + } \ + } \ + else if (last == 0x87) \ + { \ + if (ch == 0x0BCD) \ + { \ + *outptr++ = 0x8c; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + } \ + else \ + { \ + assert (last == 0xc38a); \ + if (ch == 0x0BC0) \ + { \ + *outptr++ = 0x82; \ + *statep = 0; \ + inptr += 4; \ + continue; \ + } \ + } \ + \ + /* Output the buffered character. */ \ + if (__builtin_expect (last >> 8, 0)) \ + { \ + if (__builtin_expect (outptr + 2 <= outend, 1)) \ + { \ + *outptr++ = last & 0xff; \ + *outptr++ = (last >> 8) & 0xff; \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + else \ + *outptr++ = last & 0xff; \ + *statep = 0; \ + continue; \ + } \ + \ + if (ch < 0x80) \ + /* Plain ASCII character. */ \ + *outptr++ = ch; \ + else if (ch >= 0x0B80 && ch <= 0x0BFF) \ + { \ + /* Tamil character. */ \ + uint8_t t = ucs4_to_tscii[ch - 0x0B80]; \ + \ + if (t != 0) \ + { \ + if ((t >= 0xb8 && t <= 0xc9) || (t >= 0x83 && t <= 0x86)) \ + *statep = (uint32_t) t << 3; \ + else \ + *outptr++ = t; \ + } \ + else if (ch >= 0x0BCA && ch <= 0x0BCC) \ + { \ + /* See whether we have room for two bytes. */ \ + if (__builtin_expect (outptr + 2 <= outend, 1)) \ + { \ + *outptr++ = (ch == 0x0BCA ? 0xa6 : 0xa7); \ + *outptr++ = (ch != 0x0BCC ? 0xa1 : 0xaa); \ + } \ + else \ + { \ + result = __GCONV_FULL_OUTPUT; \ + break; \ + } \ + } \ + else \ + { \ + /* Illegal character. */ \ + STANDARD_TO_LOOP_ERR_HANDLER (4); \ + } \ + } \ + else if (ch == 0x00A9) \ + *outptr++ = ch; \ + else if (ch == 0x2018 || ch == 0x2019) \ + *outptr++ = ch - 0x1f87; \ + else if (ch == 0x201C || ch == 0x201D) \ + *outptr++ = ch - 0x1f89; \ + else \ + { \ + UNICODE_TAG_HANDLER (ch, 4); \ + \ + /* Illegal character. */ \ + STANDARD_TO_LOOP_ERR_HANDLER (4); \ + } \ + \ + /* Now that we wrote the output increment the input pointer. */ \ + inptr += 4; \ + } +#define LOOP_NEED_FLAGS +#define EXTRA_LOOP_DECLS , int *statep +#include + + +/* Now define the toplevel functions. */ +#include diff --git a/iconvdata/tst-table-from.c b/iconvdata/tst-table-from.c index 084de5fe2b..34ea79362d 100644 --- a/iconvdata/tst-table-from.c +++ b/iconvdata/tst-table-from.c @@ -57,7 +57,7 @@ hexbuf (unsigned char buf[], unsigned int buflen) return msg; } -/* Attempts to convert a byte buffer BUF (BUFLEN bytes) to OUT (6 bytes) +/* Attempts to convert a byte buffer BUF (BUFLEN bytes) to OUT (12 bytes) using the conversion descriptor CD. Returns the number of written bytes, or 0 if ambiguous, or -1 if invalid. */ static int @@ -66,7 +66,7 @@ try (iconv_t cd, unsigned char buf[], unsigned int buflen, unsigned char *out) const char *inbuf = (const char *) buf; size_t inbytesleft = buflen; char *outbuf = (char *) out; - size_t outbytesleft = 6; + size_t outbytesleft = 12; size_t result; iconv (cd, NULL, NULL, NULL, NULL); @@ -100,10 +100,10 @@ try (iconv_t cd, unsigned char buf[], unsigned int buflen, unsigned char *out) fprintf (stderr, "%s: inbytes = %ld, outbytes = %ld\n", hexbuf (buf, buflen), (long) (buflen - inbytesleft), - (long) (6 - outbytesleft)); + (long) (12 - outbytesleft)); exit (1); } - return 6 - outbytesleft; + return 12 - outbytesleft; } } @@ -111,7 +111,7 @@ try (iconv_t cd, unsigned char buf[], unsigned int buflen, unsigned char *out) static const char * utf8_decode (const unsigned char *out, unsigned int outlen) { - static char hexbuf[42]; + static char hexbuf[84]; char *p = hexbuf; while (outlen > 0) @@ -203,7 +203,7 @@ main (int argc, char *argv[]) search_depth = (strcmp (charset, "UTF-8") == 0 ? 3 : 4); { - unsigned char out[6]; + unsigned char out[12]; unsigned char buf[4]; unsigned int i0, i1, i2, i3; int result; diff --git a/iconvdata/tst-tables.sh b/iconvdata/tst-tables.sh index c1aaac55e4..e5bb7f0afb 100755 --- a/iconvdata/tst-tables.sh +++ b/iconvdata/tst-tables.sh @@ -202,6 +202,7 @@ cat < + + * charmaps/TSCII: New file. + 2002-09-20 Roland McGrath * gen-locale.sh (generate_locale): Clean up overly baroque sh syntax. diff --git a/localedata/charmaps/TSCII b/localedata/charmaps/TSCII new file mode 100644 index 0000000000..9646f326cb --- /dev/null +++ b/localedata/charmaps/TSCII @@ -0,0 +1,388 @@ + TSCII + % + / + 1 + 1 +% based on TSCII version 1.7 + +CHARMAP + /x00 NULL + /x01 START OF HEADING + /x02 START OF TEXT + /x03 END OF TEXT + /x04 END OF TRANSMISSION + /x05 ENQUIRY + /x06 ACKNOWLEDGE + /x07 BELL + /x08 BACKSPACE + /x09 HORIZONTAL TABULATION + /x0a LINE FEED + /x0b VERTICAL TABULATION + /x0c FORM FEED + /x0d CARRIAGE RETURN + /x0e SHIFT OUT + /x0f SHIFT IN + /x10 DATA LINK ESCAPE + /x11 DEVICE CONTROL ONE + /x12 DEVICE CONTROL TWO + /x13 DEVICE CONTROL THREE + /x14 DEVICE CONTROL FOUR + /x15 NEGATIVE ACKNOWLEDGE + /x16 SYNCHRONOUS IDLE + /x17 END OF TRANSMISSION BLOCK + /x18 CANCEL + /x19 END OF MEDIUM + /x1a SUBSTITUTE + /x1b ESCAPE + /x1c FILE SEPARATOR + /x1d GROUP SEPARATOR + /x1e RECORD SEPARATOR + /x1f UNIT SEPARATOR + /x20 SPACE + /x21 EXCLAMATION MARK + /x22 QUOTATION MARK + /x23 NUMBER SIGN + /x24 DOLLAR SIGN + /x25 PERCENT SIGN + /x26 AMPERSAND + /x27 APOSTROPHE + /x28 LEFT PARENTHESIS + /x29 RIGHT PARENTHESIS + /x2a ASTERISK + /x2b PLUS SIGN + /x2c COMMA + /x2d HYPHEN-MINUS + /x2e FULL STOP + /x2f SOLIDUS + /x30 DIGIT ZERO + /x31 DIGIT ONE + /x32 DIGIT TWO + /x33 DIGIT THREE + /x34 DIGIT FOUR + /x35 DIGIT FIVE + /x36 DIGIT SIX + /x37 DIGIT SEVEN + /x38 DIGIT EIGHT + /x39 DIGIT NINE + /x3a COLON + /x3b SEMICOLON + /x3c LESS-THAN SIGN + /x3d EQUALS SIGN + /x3e GREATER-THAN SIGN + /x3f QUESTION MARK + /x40 COMMERCIAL AT + /x41 LATIN CAPITAL LETTER A + /x42 LATIN CAPITAL LETTER B + /x43 LATIN CAPITAL LETTER C + /x44 LATIN CAPITAL LETTER D + /x45 LATIN CAPITAL LETTER E + /x46 LATIN CAPITAL LETTER F + /x47 LATIN CAPITAL LETTER G + /x48 LATIN CAPITAL LETTER H + /x49 LATIN CAPITAL LETTER I + /x4a LATIN CAPITAL LETTER J + /x4b LATIN CAPITAL LETTER K + /x4c LATIN CAPITAL LETTER L + /x4d LATIN CAPITAL LETTER M + /x4e LATIN CAPITAL LETTER N + /x4f LATIN CAPITAL LETTER O + /x50 LATIN CAPITAL LETTER P + /x51 LATIN CAPITAL LETTER Q + /x52 LATIN CAPITAL LETTER R + /x53 LATIN CAPITAL LETTER S + /x54 LATIN CAPITAL LETTER T + /x55 LATIN CAPITAL LETTER U + /x56 LATIN CAPITAL LETTER V + /x57 LATIN CAPITAL LETTER W + /x58 LATIN CAPITAL LETTER X + /x59 LATIN CAPITAL LETTER Y + /x5a LATIN CAPITAL LETTER Z + /x5b LEFT SQUARE BRACKET + /x5c REVERSE SOLIDUS + /x5d RIGHT SQUARE BRACKET + /x5e CIRCUMFLEX ACCENT + /x5f LOW LINE + /x60 GRAVE ACCENT + /x61 LATIN SMALL LETTER A + /x62 LATIN SMALL LETTER B + /x63 LATIN SMALL LETTER C + /x64 LATIN SMALL LETTER D + /x65 LATIN SMALL LETTER E + /x66 LATIN SMALL LETTER F + /x67 LATIN SMALL LETTER G + /x68 LATIN SMALL LETTER H + /x69 LATIN SMALL LETTER I + /x6a LATIN SMALL LETTER J + /x6b LATIN SMALL LETTER K + /x6c LATIN SMALL LETTER L + /x6d LATIN SMALL LETTER M + /x6e LATIN SMALL LETTER N + /x6f LATIN SMALL LETTER O + /x70 LATIN SMALL LETTER P + /x71 LATIN SMALL LETTER Q + /x72 LATIN SMALL LETTER R + /x73 LATIN SMALL LETTER S + /x74 LATIN SMALL LETTER T + /x75 LATIN SMALL LETTER U + /x76 LATIN SMALL LETTER V + /x77 LATIN SMALL LETTER W + /x78 LATIN SMALL LETTER X + /x79 LATIN SMALL LETTER Y + /x7a LATIN SMALL LETTER Z + /x7b LEFT CURLY BRACKET + /x7c VERTICAL LINE + /x7d RIGHT CURLY BRACKET + /x7e TILDE + /x7f DELETE + /x80 TAMIL DIGIT ZERO (currently unassigned) + /x81 TAMIL DIGIT ONE + /x82 TAMIL GLYPH SRI + /x83 TAMIL LETTER JA + /x83/xa4 TAMIL GLYPH JU + /x83/xa5 TAMIL GLYPH JUU + /x84 TAMIL LETTER SSA + /x84/xa4 TAMIL GLYPH SSU + /x84/xa5 TAMIL GLYPH SSUU + /x85 TAMIL LETTER SA + /x86 TAMIL LETTER HA + /x87 TAMIL GLYPH KSHA + /x88 TAMIL GLYPH J + /x89 TAMIL GLYPH SS + /x8a TAMIL GLYPH S + /x8a/xa4 TAMIL GLYPH SU + /x8a/xa5 TAMIL GLYPH SUU + /x8b TAMIL GLYPH H + /x8b/xa4 TAMIL GLYPH HU + /x8b/xa5 TAMIL GLYPH HUU + /x8c TAMIL GLYPH KSH + /x8d TAMIL DIGIT TWO + /x8e TAMIL DIGIT THREE + /x8f TAMIL DIGIT FOUR + /x90 TAMIL DIGIT FIVE + /x91 LEFT SINGLE QUOTATION MARK + /x92 RIGHT SINGLE QUOTATION MARK + /x93 LEFT DOUBLE QUOTATION MARK + /x94 RIGHT DOUBLE QUOTATION MARK + /x95 TAMIL DIGIT SIX + /x96 TAMIL DIGIT SEVEN + /x97 TAMIL DIGIT EIGHT + /x98 TAMIL DIGIT NINE + /x99 TAMIL GLYPH NGU + /x9a TAMIL GLYPH NYU + /x9b TAMIL GLYPH NGUU + /x9c TAMIL GLYPH NYUU + /x9d TAMIL NUMBER TEN + /x9e TAMIL NUMBER ONE HUNDRED + /x9f TAMIL NUMBER ONE THOUSAND + /xa1 TAMIL VOWEL SIGN AA + /xa2 TAMIL VOWEL SIGN I + /xa3 TAMIL VOWEL SIGN II + /xa4 TAMIL VOWEL SIGN U + /xa5 TAMIL VOWEL SIGN UU + /xa6 TAMIL VOWEL SIGN E + /xa6/xa1 TAMIL VOWEL SIGN O + /xa6/xb8 TAMIL GLYPH KE + /xa6/xb8/xa1 TAMIL GLYPH KAI + /xa6/xb9 TAMIL GLYPH NGE + /xa6/xb9/xa1 TAMIL GLYPH NGAI + /xa6/xba TAMIL GLYPH CE + /xa6/xba/xa1 TAMIL GLYPH CAI + /xa6/xbb TAMIL GLYPH NYE + /xa6/xbb/xa1 TAMIL GLYPH NYAI + /xa6/xbc TAMIL GLYPH TTE + /xa6/xbc/xa1 TAMIL GLYPH TTAI + /xa6/xbd TAMIL GLYPH NNE + /xa6/xbd/xa1 TAMIL GLYPH NNAI + /xa6/xbe TAMIL GLYPH TE + /xa6/xbe/xa1 TAMIL GLYPH TAI + /xa6/xbf TAMIL GLYPH NE + /xa6/xbf/xa1 TAMIL GLYPH NAI + /xa6/xc0 TAMIL GLYPH PE + /xa6/xc0/xa1 TAMIL GLYPH PAI + /xa6/xc1 TAMIL GLYPH ME + /xa6/xc1/xa1 TAMIL GLYPH MAI + /xa6/xc2 TAMIL GLYPH YE + /xa6/xc2/xa1 TAMIL GLYPH YAI + /xa6/xc3 TAMIL GLYPH RE + /xa6/xc3/xa1 TAMIL GLYPH RAI + /xa6/xc4 TAMIL GLYPH LE + /xa6/xc4/xa1 TAMIL GLYPH LAI + /xa6/xc5 TAMIL GLYPH VE + /xa6/xc5/xa1 TAMIL GLYPH VAI + /xa6/xc6 TAMIL GLYPH LLLE + /xa6/xc6/xa1 TAMIL GLYPH LLLAI + /xa6/xc7 TAMIL GLYPH LLE + /xa6/xc7/xa1 TAMIL GLYPH LLAI + /xa6/xc8 TAMIL GLYPH RRE + /xa6/xc8/xa1 TAMIL GLYPH RRAI + /xa6/xc9 TAMIL GLYPH NNNE + /xa6/xc9/xa1 TAMIL GLYPH NNNAI + /xa7 TAMIL VOWEL SIGN EE + /xa7/xa1 TAMIL VOWEL SIGN OO + /xa7/xaa TAMIL VOWEL SIGN AU + /xa7/xb8 TAMIL GLYPH KEE + /xa7/xb8/xa1 TAMIL GLYPH KOO + /xa7/xb8/xaa TAMIL GLYPH KAU + /xa7/xb9 TAMIL GLYPH NGEE + /xa7/xb9/xa1 TAMIL GLYPH NGOO + /xa7/xb9/xaa TAMIL GLYPH NGAU + /xa7/xba TAMIL GLYPH CEE + /xa7/xba/xa1 TAMIL GLYPH COO + /xa7/xba/xaa TAMIL GLYPH CAU + /xa7/xbb TAMIL GLYPH NYEE + /xa7/xbb/xa1 TAMIL GLYPH NYOO + /xa7/xbb/xaa TAMIL GLYPH NYAU + /xa7/xbc TAMIL GLYPH TTEE + /xa7/xbc/xa1 TAMIL GLYPH TTOO + /xa7/xbc/xaa TAMIL GLYPH TTAU + /xa7/xbd TAMIL GLYPH NNEE + /xa7/xbd/xa1 TAMIL GLYPH NNOO + /xa7/xbd/xaa TAMIL GLYPH NNAU + /xa7/xbe TAMIL GLYPH TEE + /xa7/xbe/xa1 TAMIL GLYPH TOO + /xa7/xbe/xaa TAMIL GLYPH TAU + /xa7/xbf TAMIL GLYPH NEE + /xa7/xbf/xa1 TAMIL GLYPH NOO + /xa7/xbf/xaa TAMIL GLYPH NAU + /xa7/xc0 TAMIL GLYPH PEE + /xa7/xc0/xa1 TAMIL GLYPH POO + /xa7/xc0/xaa TAMIL GLYPH PAU + /xa7/xc1 TAMIL GLYPH MEE + /xa7/xc1/xa1 TAMIL GLYPH MOO + /xa7/xc1/xaa TAMIL GLYPH MAU + /xa7/xc2 TAMIL GLYPH YEE + /xa7/xc2/xa1 TAMIL GLYPH YOO + /xa7/xc2/xaa TAMIL GLYPH YAU + /xa7/xc3 TAMIL GLYPH REE + /xa7/xc3/xa1 TAMIL GLYPH ROO + /xa7/xc3/xaa TAMIL GLYPH RAU + /xa7/xc4 TAMIL GLYPH LEE + /xa7/xc4/xa1 TAMIL GLYPH LOO + /xa7/xc4/xaa TAMIL GLYPH LAU + /xa7/xc5 TAMIL GLYPH VEE + /xa7/xc5/xa1 TAMIL GLYPH VOO + /xa7/xc5/xaa TAMIL GLYPH VAU + /xa7/xc6 TAMIL GLYPH LLLEE + /xa7/xc6/xa1 TAMIL GLYPH LLLOO + /xa7/xc6/xaa TAMIL GLYPH LLLAU + /xa7/xc7 TAMIL GLYPH LLEE + /xa7/xc7/xa1 TAMIL GLYPH LLOO + /xa7/xc7/xaa TAMIL GLYPH LLAU + /xa7/xc8 TAMIL GLYPH RREE + /xa7/xc8/xa1 TAMIL GLYPH RROO + /xa7/xc8/xaa TAMIL GLYPH RRAU + /xa7/xc9 TAMIL GLYPH NNNEE + /xa7/xc9/xa1 TAMIL GLYPH NNNOO + /xa7/xc9/xaa TAMIL GLYPH NNNAU + /xa8 TAMIL VOWEL SIGN AI + /xa8/xb8 TAMIL GLYPH KA + /xa8/xb9 TAMIL GLYPH NGA + /xa8/xba TAMIL GLYPH CA + /xa8/xbb TAMIL GLYPH NYA + /xa8/xbc TAMIL GLYPH TTA + /xa8/xbd TAMIL GLYPH NNA + /xa8/xbe TAMIL GLYPH TA + /xa8/xbf TAMIL GLYPH NA + /xa8/xc0 TAMIL GLYPH PA + /xa8/xc1 TAMIL GLYPH MA + /xa8/xc2 TAMIL GLYPH YA + /xa8/xc3 TAMIL GLYPH RA + /xa8/xc4 TAMIL GLYPH LA + /xa8/xc5 TAMIL GLYPH VA + /xa8/xc6 TAMIL GLYPH LLLA + /xa8/xc7 TAMIL GLYPH LLA + /xa8/xc8 TAMIL GLYPH RRA + /xa8/xc9 TAMIL GLYPH NNNA + /xa9 COPYRIGHT SIGN + /xaa TAMIL AU LENGTH MARK + /xab TAMIL LETTER A + /xac TAMIL LETTER AA +%IRREVERSIBLE% /xad TAMIL LETTER I + /xae TAMIL LETTER II + /xaf TAMIL LETTER U + /xb0 TAMIL LETTER UU + /xb1 TAMIL LETTER E + /xb2 TAMIL LETTER EE + /xb3 TAMIL LETTER AI + /xb4 TAMIL LETTER O + /xb5 TAMIL LETTER OO + /xb6 TAMIL LETTER AU + /xb7 TAMIL SIGN VISARGA + /xb8 TAMIL LETTER KA + /xb9 TAMIL LETTER NGA + /xba TAMIL LETTER CA + /xbb TAMIL LETTER NYA + /xbc TAMIL LETTER TTA + /xbd TAMIL LETTER NNA + /xbe TAMIL LETTER TA + /xbf TAMIL LETTER NA + /xc0 TAMIL LETTER PA + /xc1 TAMIL LETTER MA + /xc2 TAMIL LETTER YA + /xc3 TAMIL LETTER RA + /xc4 TAMIL LETTER LA + /xc5 TAMIL LETTER VA + /xc6 TAMIL LETTER LLLA + /xc7 TAMIL LETTER LLA + /xc8 TAMIL LETTER RRA + /xc9 TAMIL LETTER NNNA + /xca TAMIL GLYPH TI + /xcb TAMIL GLYPH TII + /xcc TAMIL GLYPH KU + /xcd TAMIL GLYPH CU + /xce TAMIL GLYPH TTU + /xcf TAMIL GLYPH NNU + /xd0 TAMIL GLYPH TU + /xd1 TAMIL GLYPH NU + /xd2 TAMIL GLYPH PU + /xd3 TAMIL GLYPH MU + /xd4 TAMIL GLYPH YU + /xd5 TAMIL GLYPH RU + /xd6 TAMIL GLYPH LU + /xd7 TAMIL GLYPH VU + /xd8 TAMIL GLYPH LLLU + /xd9 TAMIL GLYPH LLU + /xda TAMIL GLYPH RRU + /xdb TAMIL GLYPH NNNU + /xdc TAMIL GLYPH KUU + /xdd TAMIL GLYPH CUU + /xde TAMIL GLYPH TTUU + /xdf TAMIL GLYPH NNUU + /xe0 TAMIL GLYPH TUU + /xe1 TAMIL GLYPH NUU + /xe2 TAMIL GLYPH PUU + /xe3 TAMIL GLYPH MUU + /xe4 TAMIL GLYPH YUU + /xe5 TAMIL GLYPH RUU + /xe6 TAMIL GLYPH LUU + /xe7 TAMIL GLYPH VUU + /xe8 TAMIL GLYPH LLLUU + /xe9 TAMIL GLYPH LLUU + /xea TAMIL GLYPH RRUU + /xeb TAMIL GLYPH NNNUU + /xec TAMIL GLYPH K + /xed TAMIL GLYPH NG + /xee TAMIL GLYPH C + /xef TAMIL GLYPH NY + /xf0 TAMIL GLYPH TT + /xf1 TAMIL GLYPH NN + /xf2 TAMIL GLYPH T + /xf3 TAMIL GLYPH N + /xf4 TAMIL GLYPH P + /xf5 TAMIL GLYPH M + /xf6 TAMIL GLYPH Y + /xf7 TAMIL GLYPH R + /xf8 TAMIL GLYPH L + /xf9 TAMIL GLYPH V + /xfa TAMIL GLYPH LLL + /xfb TAMIL GLYPH LL + /xfc TAMIL GLYPH RR + /xfd TAMIL GLYPH NNN + /xfe TAMIL LETTER I +END CHARMAP + +WIDTH + 0 + 0 + 0 +END WIDTH