11ab64890Smrg 21ab64890Smrg/* 31ab64890Smrg * TIS620-0 41ab64890Smrg */ 51ab64890Smrg 61ab64890Smrgstatic const unsigned short tis620_2uni[96] = { 71ab64890Smrg /* 0xa0 */ 81ab64890Smrg 0xfffd, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 91ab64890Smrg 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 101ab64890Smrg /* 0xb0 */ 111ab64890Smrg 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 121ab64890Smrg 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 131ab64890Smrg /* 0xc0 */ 141ab64890Smrg 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 151ab64890Smrg 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, 161ab64890Smrg /* 0xd0 */ 171ab64890Smrg 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, 181ab64890Smrg 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, 191ab64890Smrg /* 0xe0 */ 201ab64890Smrg 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 211ab64890Smrg 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, 221ab64890Smrg /* 0xf0 */ 231ab64890Smrg 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 241ab64890Smrg 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 251ab64890Smrg}; 261ab64890Smrg 271ab64890Smrgstatic int 281ab64890Smrgtis620_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) 291ab64890Smrg{ 301ab64890Smrg unsigned char c = *s; 311ab64890Smrg if (c < 0x80) { 321ab64890Smrg *pwc = (ucs4_t) c; 331ab64890Smrg return 1; 341ab64890Smrg } 351ab64890Smrg else if (c < 0xa0) { 361ab64890Smrg } 371ab64890Smrg else { 381ab64890Smrg unsigned short wc = tis620_2uni[c-0xa0]; 391ab64890Smrg if (wc != 0xfffd) { 401ab64890Smrg *pwc = (ucs4_t) wc; 411ab64890Smrg return 1; 421ab64890Smrg } 431ab64890Smrg } 441ab64890Smrg return RET_ILSEQ; 451ab64890Smrg} 461ab64890Smrg 471ab64890Smrgstatic const unsigned char tis620_page0e[96] = { 481ab64890Smrg 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 491ab64890Smrg 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ 501ab64890Smrg 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 511ab64890Smrg 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 521ab64890Smrg 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 531ab64890Smrg 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 541ab64890Smrg 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 551ab64890Smrg 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ 561ab64890Smrg 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 571ab64890Smrg 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 581ab64890Smrg 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 591ab64890Smrg 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 601ab64890Smrg}; 611ab64890Smrg 621ab64890Smrgstatic int 631ab64890Smrgtis620_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) 641ab64890Smrg{ 651ab64890Smrg unsigned char c = 0; 661ab64890Smrg if (wc < 0x0080) { 679c019ec5Smaya *r = (unsigned char) wc; 681ab64890Smrg return 1; 691ab64890Smrg } 701ab64890Smrg else if (wc >= 0x0e00 && wc < 0x0e60) 711ab64890Smrg c = tis620_page0e[wc-0x0e00]; 721ab64890Smrg if (c != 0) { 731ab64890Smrg *r = c; 741ab64890Smrg return 1; 751ab64890Smrg } 761ab64890Smrg return RET_ILSEQ; 771ab64890Smrg} 78