1/* 2 * Copyright (C) 1999-2006 Free Software Foundation, Inc. 3 * This file is part of the GNU LIBICONV Library. 4 * 5 * The GNU LIBICONV Library is free software; you can redistribute it 6 * and/or modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * The GNU LIBICONV Library is distributed in the hope that it will be 11 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, 18 * Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21/* 22 * HKSCS:2004 23 */ 24 25static const unsigned short hkscs2004_2uni_page87[58] = { 26 /* 0x87 */ 27 0x0af0, 0x1032, 0x0d03, 0x0ca6, 0x0c78, 0x4167, 0x1177, 0x0cb3, 28 0x44b1, 0x10e2, 0x44c5, 0x0595, 0x0e36, 0x0e44, 0x1047, 0x1040, 29 0x39bf, 0x3417, 0x4252, 0x3f8b, 0x40d2, 0x1057, 0x4d51, 0x0e4f, 30 0x0cda, 0x1085, 0x446c, 0x1107, 0x0fa4, 0x0da1, 0x3d23, 0x1e25, 31 0x3c54, 0x2d63, 0x3606, 0x3761, 0x1a4d, 0x13fb, 0x28fd, 0x2195, 32 0x141d, 0x47b9, 0x06f4, 0x2534, 0x43ef, 0x16db, 0x2e5e, 0x15a4, 33 0x0125, 0x4bb0, 0x15d1, 0x16b7, 0x17fc, 0x1b6e, 0x2393, 0x4a45, 34 0x1f61, 0x1f9d, 35}; 36static const unsigned short hkscs2004_2uni_page8c[189] = { 37 /* 0x8c */ 38 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 39 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 40 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 41 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 42 0x28fd, 0x28fd, 0x2b6f, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 43 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 44 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 45 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 46 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 47 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 48 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 49 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 50 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 51 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 52 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 0x28fd, 53 0x28fd, 0x1ae7, 0x28fd, 0x1c57, 0x20ca, 0x0688, 0x0bc3, 0x3256, 54 0x3196, 0x0a9a, 0x0c36, 0x28fd, 0x17d5, 0x351a, 0x24f9, 0x1778, 55 0x0612, 0x3351, 0x1878, 0x27b2, 0x1d57, 0x0c58, 0x38ec, 0x2f23, 56 0x1077, 0x0478, 0x004a, 0x29a4, 0x3e41, 0x24cc, 0x12b4, 0x2a39, 57 0x14bf, 0x226c, 0x2656, 0x49fa, 0x193b, 58 /* 0x8d */ 59 0x2c9f, 0x28fd, 0x30c1, 0x466d, 0x0902, 0x0dbb, 0x4879, 0x0707, 60 0x27b3, 0x4cb5, 0x08f8, 0x02d6, 0x0df7, 0x3e46, 0x097c, 0x45b2, 61 0x42ff, 0x0c6d, 0x03d4, 0x3b9a, 0x0c61, 0x0c1b, 0x1189, 0x107b, 62 0x1176, 0x0cea, 0x07c8, 0x3a0f, 0x0161, 0x0bde, 0x0bbd, 0x09ed, 63}; 64 65static const ucs4_t hkscs2004_2uni_upages[78] = { 66 0x03400, 0x03600, 0x03700, 0x03800, 0x03900, 0x03b00, 0x03d00, 0x03f00, 67 0x04000, 0x04100, 0x04300, 0x04400, 0x04500, 0x04600, 0x04700, 0x04a00, 68 0x04c00, 0x04d00, 0x04f00, 0x05600, 0x05900, 0x05a00, 0x05b00, 0x05c00, 69 0x05d00, 0x05f00, 0x06600, 0x06700, 0x06e00, 0x07100, 0x07200, 0x07400, 70 0x07900, 0x07d00, 0x08100, 0x08500, 0x08a00, 0x09700, 0x09800, 0x09f00, 71 0x0ff00, 0x20100, 0x20200, 0x20a00, 0x20b00, 0x21a00, 0x21d00, 0x21e00, 72 0x22100, 0x22700, 0x23200, 0x23500, 0x23600, 0x23b00, 0x23e00, 0x23f00, 73 0x24000, 0x24200, 0x24b00, 0x25400, 0x25a00, 0x26b00, 0x26c00, 0x26e00, 74 0x27000, 0x27200, 0x27300, 0x27b00, 0x27c00, 0x28600, 0x28900, 0x28b00, 75 0x29000, 0x29800, 0x29900, 0x29e00, 0x2a100, 0x2a300, 76}; 77 78static int 79hkscs2004_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) 80{ 81 unsigned char c1 = s[0]; 82 if ((c1 == 0x87) || (c1 >= 0x8c && c1 <= 0x8d)) { 83 if (n >= 2) { 84 unsigned char c2 = s[1]; 85 if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { 86 unsigned int i = 157 * (c1 - 0x80) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); 87 ucs4_t wc = 0xfffd; 88 unsigned short swc; 89 if (i < 1884) { 90 if (i < 1157) 91 swc = hkscs2004_2uni_page87[i-1099], 92 wc = hkscs2004_2uni_upages[swc>>8] | (swc & 0xff); 93 } else { 94 if (i < 2073) 95 swc = hkscs2004_2uni_page8c[i-1884], 96 wc = hkscs2004_2uni_upages[swc>>8] | (swc & 0xff); 97 } 98 if (wc != 0xfffd) { 99 *pwc = wc; 100 return 2; 101 } 102 } 103 return RET_ILSEQ; 104 } 105 return RET_TOOFEW(0); 106 } 107 return RET_ILSEQ; 108} 109 110static const unsigned short hkscs2004_2charset[123] = { 111 0x8cf4, 0x8770, 0x8d5c, 0x8d4b, 0x8d52, 0x8cf3, 0x874b, 0x8cea, 112 0x8cdf, 0x876a, 0x8d47, 0x8d5a, 0x8d4a, 0x8d44, 0x8d4e, 0x8d5f, 113 0x8ce3, 0x8740, 0x8d5e, 0x8ce0, 0x8d5d, 0x8d55, 0x8ce4, 0x8cef, 114 0x8d54, 0x8d51, 0x8744, 0x8743, 0x8747, 0x8758, 0x8d59, 0x8742, 115 0x875d, 0x8d45, 0x8d4c, 0x874c, 0x874d, 0x8757, 0x875c, 0x8741, 116 0x874f, 0x874e, 0x8755, 0x8cf2, 0x8d57, 0x8759, 0x8749, 0x875b, 117 0x8d58, 0x8746, 0x8d56, 0x8cf8, 0x8765, 0x8768, 0x8cfa, 0x876f, 118 0x8772, 0x8773, 0x876d, 0x8ce9, 0x8ce6, 0x8774, 0x8cec, 0x8cfe, 119 0x8764, 0x8cdb, 0x8775, 0x8cdd, 0x8cee, 0x875f, 0x8778, 0x8779, 120 0x8cde, 0x8767, 0x8cfb, 0x8776, 0x8cf7, 0x8ce8, 0x876b, 0x8cfc, 121 0x8ced, 0x8d48, 0x8cf5, 0x8cf9, 0x8c62, 0x8d40, 0x8761, 0x876e, 122 0x8cf1, 0x8d42, 0x8ce2, 0x8ce1, 0x8ceb, 0x8751, 0x8ce7, 0x8762, 123 0x8763, 0x8cf0, 0x8750, 0x8d5b, 0x8d53, 0x8760, 0x875e, 0x8cf6, 124 0x8d4d, 0x8753, 0x8754, 0x8745, 0x8752, 0x8d50, 0x876c, 0x875a, 125 0x8748, 0x874a, 0x8d4f, 0x8d43, 0x8769, 0x8d46, 0x8cfd, 0x8777, 126 0x8771, 0x8d49, 0x8756, 127}; 128 129static const Summary16 hkscs2004_uni2indx_page34[5] = { 130 /* 0x3400 */ 131 { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, 132 { 0, 0x0400 }, 133}; 134static const Summary16 hkscs2004_uni2indx_page36[56] = { 135 /* 0x3600 */ 136 { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0020 }, { 2, 0x0000 }, 137 { 2, 0x0000 }, { 2, 0x0000 }, { 2, 0x0002 }, { 3, 0x0000 }, 138 { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, 139 { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, 140 /* 0x3700 */ 141 { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, 142 { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, 143 { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, { 3, 0x0000 }, 144 { 3, 0x0000 }, { 3, 0x0040 }, { 4, 0x0000 }, { 4, 0x0000 }, 145 /* 0x3800 */ 146 { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, 147 { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, 148 { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, { 4, 0x0000 }, 149 { 4, 0x0000 }, { 4, 0x0010 }, { 5, 0x0000 }, { 5, 0x0000 }, 150 /* 0x3900 */ 151 { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, 152 { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0000 }, { 5, 0x0100 }, 153}; 154static const Summary16 hkscs2004_uni2indx_page3b[10] = { 155 /* 0x3b00 */ 156 { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, 157 { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, { 6, 0x0000 }, 158 { 6, 0x0000 }, { 6, 0x0020 }, 159}; 160static const Summary16 hkscs2004_uni2indx_page3d[16] = { 161 /* 0x3d00 */ 162 { 7, 0x0000 }, { 7, 0x0004 }, { 8, 0x0000 }, { 8, 0x0000 }, 163 { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, { 8, 0x0000 }, 164 { 8, 0x0100 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, 165 { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0010 }, 166}; 167static const Summary16 hkscs2004_uni2indx_page3f[47] = { 168 /* 0x3f00 */ 169 { 10, 0x0080 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, 170 { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, 171 { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, { 11, 0x0000 }, 172 { 11, 0x0100 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, 173 /* 0x4000 */ 174 { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, 175 { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, 176 { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, 177 { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0100 }, 178 /* 0x4100 */ 179 { 13, 0x0004 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, 180 { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x1000 }, 181 { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x0000 }, 182 { 15, 0x0000 }, { 15, 0x0000 }, { 15, 0x2000 }, 183}; 184static const Summary16 hkscs2004_uni2indx_page43[69] = { 185 /* 0x4300 */ 186 { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, 187 { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, { 16, 0x0000 }, 188 { 16, 0x0000 }, { 16, 0x0400 }, { 17, 0x0000 }, { 17, 0x0000 }, 189 { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0000 }, { 17, 0x0001 }, 190 /* 0x4400 */ 191 { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, 192 { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, 193 { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x0000 }, { 18, 0x2000 }, 194 { 19, 0x0008 }, { 20, 0x4000 }, { 21, 0x0000 }, { 21, 0x0000 }, 195 /* 0x4500 */ 196 { 21, 0x0000 }, { 21, 0x0800 }, { 22, 0x0000 }, { 22, 0x0040 }, 197 { 23, 0x0000 }, { 23, 0x0100 }, { 24, 0x2002 }, { 26, 0x0100 }, 198 { 27, 0x0000 }, { 27, 0x0000 }, { 27, 0x0040 }, { 28, 0x0008 }, 199 { 29, 0x0000 }, { 29, 0x0400 }, { 30, 0x0400 }, { 31, 0x0000 }, 200 /* 0x4600 */ 201 { 31, 0x0008 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, 202 { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0000 }, 203 { 32, 0x0000 }, { 32, 0x0000 }, { 32, 0x0002 }, { 33, 0x0800 }, 204 { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0000 }, { 34, 0x0080 }, 205 /* 0x4700 */ 206 { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0040 }, 207 { 36, 0x8010 }, 208}; 209static const Summary16 hkscs2004_uni2indx_page4a[11] = { 210 /* 0x4a00 */ 211 { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, 212 { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0000 }, 213 { 38, 0x0000 }, { 38, 0x0000 }, { 38, 0x0010 }, 214}; 215static const Summary16 hkscs2004_uni2indx_page4c[25] = { 216 /* 0x4c00 */ 217 { 39, 0x0000 }, { 39, 0x0000 }, { 39, 0x0000 }, { 39, 0x0004 }, 218 { 40, 0x0081 }, { 42, 0x0080 }, { 43, 0x0000 }, { 43, 0x0880 }, 219 { 45, 0x0020 }, { 46, 0x0000 }, { 46, 0x0000 }, { 46, 0x0000 }, 220 { 46, 0x0000 }, { 46, 0x0000 }, { 46, 0x0004 }, { 47, 0x0000 }, 221 /* 0x4d00 */ 222 { 47, 0x0080 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, 223 { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x0000 }, { 48, 0x00c0 }, 224 { 50, 0x0200 }, 225}; 226static const Summary16 hkscs2004_uni2indx_page4f[12] = { 227 /* 0x4f00 */ 228 { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, 229 { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, 230 { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0000 }, { 51, 0x0010 }, 231}; 232static const Summary16 hkscs2004_uni2indx_page56[16] = { 233 /* 0x5600 */ 234 { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, 235 { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, 236 { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, 237 { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0000 }, { 52, 0x0800 }, 238}; 239static const Summary16 hkscs2004_uni2indx_page59[72] = { 240 /* 0x5900 */ 241 { 53, 0x0000 }, { 53, 0x2000 }, { 54, 0x0000 }, { 54, 0x0000 }, 242 { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, 243 { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x0000 }, { 54, 0x8000 }, 244 { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, 245 /* 0x5a00 */ 246 { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, 247 { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0000 }, 248 { 55, 0x0000 }, { 55, 0x0000 }, { 55, 0x0010 }, { 56, 0x0000 }, 249 { 56, 0x0000 }, { 56, 0x0002 }, { 57, 0x0000 }, { 57, 0x0000 }, 250 /* 0x5b00 */ 251 { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, 252 { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, 253 { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0000 }, { 57, 0x0080 }, 254 { 58, 0x0000 }, { 58, 0x0800 }, { 59, 0x0000 }, { 59, 0x0000 }, 255 /* 0x5c00 */ 256 { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, 257 { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0000 }, { 59, 0x0100 }, 258 { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, 259 { 60, 0x0000 }, { 60, 0x0020 }, { 61, 0x0000 }, { 61, 0x1000 }, 260 /* 0x5d00 */ 261 { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, 262 { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0100 }, 263}; 264static const Summary16 hkscs2004_uni2indx_page5f[4] = { 265 /* 0x5f00 */ 266 { 63, 0x0000 }, { 63, 0x0000 }, { 63, 0x0000 }, { 63, 0x0800 }, 267}; 268static const Summary16 hkscs2004_uni2indx_page66[23] = { 269 /* 0x6600 */ 270 { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 }, { 64, 0x0000 }, 271 { 64, 0x2000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, 272 { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, 273 { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0080 }, { 66, 0x0000 }, 274 /* 0x6700 */ 275 { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x0000 }, 276 { 66, 0x0000 }, { 66, 0x0000 }, { 66, 0x4000 }, 277}; 278static const Summary16 hkscs2004_uni2indx_page6e[6] = { 279 /* 0x6e00 */ 280 { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, { 67, 0x0000 }, 281 { 67, 0x0000 }, { 67, 0x0080 }, 282}; 283static const Summary16 hkscs2004_uni2indx_page71[19] = { 284 /* 0x7100 */ 285 { 68, 0x0000 }, { 68, 0x0000 }, { 68, 0x0000 }, { 68, 0x0000 }, 286 { 68, 0x0000 }, { 68, 0x0080 }, { 69, 0x0000 }, { 69, 0x0000 }, 287 { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, 288 { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0000 }, 289 /* 0x7200 */ 290 { 69, 0x0000 }, { 69, 0x0000 }, { 69, 0x0020 }, 291}; 292static const Summary16 hkscs2004_uni2indx_page74[10] = { 293 /* 0x7400 */ 294 { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0000 }, 295 { 70, 0x0000 }, { 70, 0x0000 }, { 70, 0x0002 }, { 71, 0x0000 }, 296 { 71, 0x0000 }, { 71, 0x2000 }, 297}; 298static const Summary16 hkscs2004_uni2indx_page79[13] = { 299 /* 0x7900 */ 300 { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, 301 { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, 302 { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, { 72, 0x0000 }, 303 { 72, 0x0400 }, 304}; 305static const Summary16 hkscs2004_uni2indx_page7d[10] = { 306 /* 0x7d00 */ 307 { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, 308 { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, 309 { 73, 0x0000 }, { 73, 0x0020 }, 310}; 311static const Summary16 hkscs2004_uni2indx_page81[7] = { 312 /* 0x8100 */ 313 { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x0000 }, 314 { 74, 0x0000 }, { 74, 0x0000 }, { 74, 0x1000 }, 315}; 316static const Summary16 hkscs2004_uni2indx_page85[10] = { 317 /* 0x8500 */ 318 { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, 319 { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, { 75, 0x0000 }, 320 { 75, 0x0000 }, { 75, 0x0008 }, 321}; 322static const Summary16 hkscs2004_uni2indx_page8a[16] = { 323 /* 0x8a00 */ 324 { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, 325 { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, 326 { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, { 76, 0x0000 }, 327 { 76, 0x1000 }, { 77, 0x0000 }, { 77, 0x0000 }, { 77, 0x0200 }, 328}; 329static const Summary16 hkscs2004_uni2indx_page97[22] = { 330 /* 0x9700 */ 331 { 78, 0x0000 }, { 78, 0x0000 }, { 78, 0x0000 }, { 78, 0x0010 }, 332 { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, 333 { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, 334 { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, 335 /* 0x9800 */ 336 { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, { 79, 0x0000 }, 337 { 79, 0x0000 }, { 79, 0x0040 }, 338}; 339static const Summary16 hkscs2004_uni2indx_page9f[12] = { 340 /* 0x9f00 */ 341 { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, 342 { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, 343 { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x0000 }, { 80, 0x000c }, 344}; 345static const Summary16 hkscs2004_uni2indx_page201[20] = { 346 /* 0x20100 */ 347 { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, 348 { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0000 }, 349 { 82, 0x0000 }, { 82, 0x0000 }, { 82, 0x0010 }, { 83, 0x0000 }, 350 { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, 351 /* 0x20200 */ 352 { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0200 }, 353}; 354static const Summary16 hkscs2004_uni2indx_page20a[26] = { 355 /* 0x20a00 */ 356 { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x0000 }, 357 { 84, 0x0000 }, { 84, 0x0000 }, { 84, 0x8000 }, { 85, 0x0000 }, 358 { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, 359 { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, 360 /* 0x20b00 */ 361 { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, 362 { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, { 85, 0x0000 }, 363 { 85, 0x0000 }, { 85, 0x8000 }, 364}; 365static const Summary16 hkscs2004_uni2indx_page21a[7] = { 366 /* 0x21a00 */ 367 { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0000 }, 368 { 86, 0x0000 }, { 86, 0x0000 }, { 86, 0x0008 }, 369}; 370static const Summary16 hkscs2004_uni2indx_page21d[19] = { 371 /* 0x21d00 */ 372 { 87, 0x0000 }, { 87, 0x0000 }, { 87, 0x0000 }, { 87, 0x0000 }, 373 { 87, 0x0000 }, { 87, 0x4000 }, { 88, 0x0000 }, { 88, 0x0000 }, 374 { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, 375 { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0000 }, 376 /* 0x21e00 */ 377 { 88, 0x0000 }, { 88, 0x0000 }, { 88, 0x0008 }, 378}; 379static const Summary16 hkscs2004_uni2indx_page221[13] = { 380 /* 0x22100 */ 381 { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, 382 { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, 383 { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, { 89, 0x0000 }, 384 { 89, 0x0002 }, 385}; 386static const Summary16 hkscs2004_uni2indx_page227[10] = { 387 /* 0x22700 */ 388 { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, 389 { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, { 90, 0x0000 }, 390 { 90, 0x0000 }, { 90, 0x0040 }, 391}; 392static const Summary16 hkscs2004_uni2indx_page232[6] = { 393 /* 0x23200 */ 394 { 91, 0x0000 }, { 91, 0x0000 }, { 91, 0x0000 }, { 91, 0x0000 }, 395 { 91, 0x0000 }, { 91, 0x0040 }, 396}; 397static const Summary16 hkscs2004_uni2indx_page235[18] = { 398 /* 0x23500 */ 399 { 92, 0x0000 }, { 92, 0x0000 }, { 92, 0x0000 }, { 92, 0x0000 }, 400 { 92, 0x0000 }, { 92, 0x0002 }, { 93, 0x0000 }, { 93, 0x0000 }, 401 { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, 402 { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, { 93, 0x0000 }, 403 /* 0x23600 */ 404 { 93, 0x0000 }, { 93, 0x0080 }, 405}; 406static const Summary16 hkscs2004_uni2indx_page23b[2] = { 407 /* 0x23b00 */ 408 { 94, 0x0000 }, { 94, 0x0400 }, 409}; 410static const Summary16 hkscs2004_uni2indx_page23e[47] = { 411 /* 0x23e00 */ 412 { 95, 0x0040 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, 413 { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, 414 { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, 415 { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, 416 /* 0x23f00 */ 417 { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0000 }, 418 { 96, 0x0000 }, { 96, 0x0000 }, { 96, 0x0002 }, { 97, 0x0000 }, 419 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, 420 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, 421 /* 0x24000 */ 422 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, 423 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, 424 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x0000 }, 425 { 97, 0x0000 }, { 97, 0x0000 }, { 97, 0x1000 }, 426}; 427static const Summary16 hkscs2004_uni2indx_page242[12] = { 428 /* 0x24200 */ 429 { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, 430 { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, 431 { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x0000 }, { 98, 0x8000 }, 432}; 433static const Summary16 hkscs2004_uni2indx_page24b[1] = { 434 /* 0x24b00 */ 435 { 99, 0x8000 }, 436}; 437static const Summary16 hkscs2004_uni2indx_page254[10] = { 438 /* 0x25400 */ 439 { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, 440 { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, { 100, 0x0000 }, 441 { 100, 0x0000 }, { 100, 0x0400 }, 442}; 443static const Summary16 hkscs2004_uni2indx_page25a[6] = { 444 /* 0x25a00 */ 445 { 101, 0x0000 }, { 101, 0x0000 }, { 101, 0x0000 }, { 101, 0x0000 }, 446 { 101, 0x0000 }, { 101, 0x0010 }, 447}; 448static const Summary16 hkscs2004_uni2indx_page26b[21] = { 449 /* 0x26b00 */ 450 { 102, 0x0000 }, { 102, 0x0000 }, { 102, 0x0008 }, { 103, 0x0000 }, 451 { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, 452 { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, 453 { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, 454 /* 0x26c00 */ 455 { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, { 103, 0x0000 }, 456 { 103, 0x0042 }, 457}; 458static const Summary16 hkscs2004_uni2indx_page26e[9] = { 459 /* 0x26e00 */ 460 { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, 461 { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, { 105, 0x0000 }, 462 { 105, 0x0800 }, 463}; 464static const Summary16 hkscs2004_uni2indx_page270[14] = { 465 /* 0x27000 */ 466 { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, 467 { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, 468 { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, { 106, 0x0000 }, 469 { 106, 0x0000 }, { 106, 0x0004 }, 470}; 471static const Summary16 hkscs2004_uni2indx_page272[32] = { 472 /* 0x27200 */ 473 { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0000 }, 474 { 107, 0x0000 }, { 107, 0x0000 }, { 107, 0x0080 }, { 108, 0x0000 }, 475 { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, 476 { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, 477 /* 0x27300 */ 478 { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, { 108, 0x0000 }, 479 { 108, 0x0000 }, { 108, 0x0004 }, { 109, 0x0000 }, { 109, 0x0000 }, 480 { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 }, 481 { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x0000 }, { 109, 0x8000 }, 482}; 483static const Summary16 hkscs2004_uni2indx_page27b[29] = { 484 /* 0x27b00 */ 485 { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, 486 { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, 487 { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x0000 }, 488 { 110, 0x0000 }, { 110, 0x0000 }, { 110, 0x8000 }, { 111, 0x0000 }, 489 /* 0x27c00 */ 490 { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x0000 }, 491 { 111, 0x0000 }, { 111, 0x0000 }, { 111, 0x1000 }, { 112, 0x0000 }, 492 { 112, 0x0000 }, { 112, 0x0000 }, { 112, 0x0000 }, { 112, 0x0002 }, 493 { 113, 0x0020 }, 494}; 495static const Summary16 hkscs2004_uni2indx_page286[12] = { 496 /* 0x28600 */ 497 { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, 498 { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, 499 { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0000 }, { 114, 0x0004 }, 500}; 501static const Summary16 hkscs2004_uni2indx_page289[7] = { 502 /* 0x28900 */ 503 { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x0000 }, 504 { 115, 0x0000 }, { 115, 0x0000 }, { 115, 0x2000 }, 505}; 506static const Summary16 hkscs2004_uni2indx_page28b[12] = { 507 /* 0x28b00 */ 508 { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, 509 { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, 510 { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0000 }, { 116, 0x0200 }, 511}; 512static const Summary16 hkscs2004_uni2indx_page290[8] = { 513 /* 0x29000 */ 514 { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 }, 515 { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0000 }, { 117, 0x0200 }, 516}; 517static const Summary16 hkscs2004_uni2indx_page298[21] = { 518 /* 0x29800 */ 519 { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, 520 { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, 521 { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, 522 { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0000 }, { 118, 0x0400 }, 523 /* 0x29900 */ 524 { 119, 0x0000 }, { 119, 0x0000 }, { 119, 0x0000 }, { 119, 0x0000 }, 525 { 119, 0x0020 }, 526}; 527static const Summary16 hkscs2004_uni2indx_page29e[12] = { 528 /* 0x29e00 */ 529 { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, 530 { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, 531 { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0000 }, { 120, 0x0001 }, 532}; 533static const Summary16 hkscs2004_uni2indx_page2a1[12] = { 534 /* 0x2a100 */ 535 { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, 536 { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, 537 { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0000 }, { 121, 0x0020 }, 538}; 539static const Summary16 hkscs2004_uni2indx_page2a3[6] = { 540 /* 0x2a300 */ 541 { 122, 0x0000 }, { 122, 0x0000 }, { 122, 0x0000 }, { 122, 0x0000 }, 542 { 122, 0x0000 }, { 122, 0x0002 }, 543}; 544 545static int 546hkscs2004_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) 547{ 548 if (n >= 2) { 549 const Summary16 *summary = NULL; 550 if (wc < 0x21a00) { 551 if (wc < 0x6e00) { 552 if (wc >= 0x3400 && wc < 0x3450) 553 summary = &hkscs2004_uni2indx_page34[(wc>>4)-0x340]; 554 else if (wc >= 0x3600 && wc < 0x3980) 555 summary = &hkscs2004_uni2indx_page36[(wc>>4)-0x360]; 556 else if (wc >= 0x3b00 && wc < 0x3ba0) 557 summary = &hkscs2004_uni2indx_page3b[(wc>>4)-0x3b0]; 558 else if (wc >= 0x3d00 && wc < 0x3e00) 559 summary = &hkscs2004_uni2indx_page3d[(wc>>4)-0x3d0]; 560 else if (wc >= 0x3f00 && wc < 0x41f0) 561 summary = &hkscs2004_uni2indx_page3f[(wc>>4)-0x3f0]; 562 else if (wc >= 0x4300 && wc < 0x4750) 563 summary = &hkscs2004_uni2indx_page43[(wc>>4)-0x430]; 564 else if (wc >= 0x4a00 && wc < 0x4ab0) 565 summary = &hkscs2004_uni2indx_page4a[(wc>>4)-0x4a0]; 566 else if (wc >= 0x4c00 && wc < 0x4d90) 567 summary = &hkscs2004_uni2indx_page4c[(wc>>4)-0x4c0]; 568 else if (wc >= 0x4f00 && wc < 0x4fc0) 569 summary = &hkscs2004_uni2indx_page4f[(wc>>4)-0x4f0]; 570 else if (wc >= 0x5600 && wc < 0x5700) 571 summary = &hkscs2004_uni2indx_page56[(wc>>4)-0x560]; 572 else if (wc >= 0x5900 && wc < 0x5d80) 573 summary = &hkscs2004_uni2indx_page59[(wc>>4)-0x590]; 574 else if (wc >= 0x5f00 && wc < 0x5f40) 575 summary = &hkscs2004_uni2indx_page5f[(wc>>4)-0x5f0]; 576 else if (wc >= 0x6600 && wc < 0x6770) 577 summary = &hkscs2004_uni2indx_page66[(wc>>4)-0x660]; 578 } else { 579 if (wc >= 0x6e00 && wc < 0x6e60) 580 summary = &hkscs2004_uni2indx_page6e[(wc>>4)-0x6e0]; 581 else if (wc >= 0x7100 && wc < 0x7230) 582 summary = &hkscs2004_uni2indx_page71[(wc>>4)-0x710]; 583 else if (wc >= 0x7400 && wc < 0x74a0) 584 summary = &hkscs2004_uni2indx_page74[(wc>>4)-0x740]; 585 else if (wc >= 0x7900 && wc < 0x79d0) 586 summary = &hkscs2004_uni2indx_page79[(wc>>4)-0x790]; 587 else if (wc >= 0x7d00 && wc < 0x7da0) 588 summary = &hkscs2004_uni2indx_page7d[(wc>>4)-0x7d0]; 589 else if (wc >= 0x8100 && wc < 0x8170) 590 summary = &hkscs2004_uni2indx_page81[(wc>>4)-0x810]; 591 else if (wc >= 0x8500 && wc < 0x85a0) 592 summary = &hkscs2004_uni2indx_page85[(wc>>4)-0x850]; 593 else if (wc >= 0x8a00 && wc < 0x8b00) 594 summary = &hkscs2004_uni2indx_page8a[(wc>>4)-0x8a0]; 595 else if (wc >= 0x9700 && wc < 0x9860) 596 summary = &hkscs2004_uni2indx_page97[(wc>>4)-0x970]; 597 else if (wc >= 0x9f00 && wc < 0x9fc0) 598 summary = &hkscs2004_uni2indx_page9f[(wc>>4)-0x9f0]; 599 else if (wc >= 0x20100 && wc < 0x20240) 600 summary = &hkscs2004_uni2indx_page201[(wc>>4)-0x2010]; 601 else if (wc >= 0x20a00 && wc < 0x20ba0) 602 summary = &hkscs2004_uni2indx_page20a[(wc>>4)-0x20a0]; 603 } 604 } else { 605 if (wc < 0x26b00) { 606 if (wc >= 0x21a00 && wc < 0x21a70) 607 summary = &hkscs2004_uni2indx_page21a[(wc>>4)-0x21a0]; 608 else if (wc >= 0x21d00 && wc < 0x21e30) 609 summary = &hkscs2004_uni2indx_page21d[(wc>>4)-0x21d0]; 610 else if (wc >= 0x22100 && wc < 0x221d0) 611 summary = &hkscs2004_uni2indx_page221[(wc>>4)-0x2210]; 612 else if (wc >= 0x22700 && wc < 0x227a0) 613 summary = &hkscs2004_uni2indx_page227[(wc>>4)-0x2270]; 614 else if (wc >= 0x23200 && wc < 0x23260) 615 summary = &hkscs2004_uni2indx_page232[(wc>>4)-0x2320]; 616 else if (wc >= 0x23500 && wc < 0x23620) 617 summary = &hkscs2004_uni2indx_page235[(wc>>4)-0x2350]; 618 else if (wc >= 0x23b00 && wc < 0x23b20) 619 summary = &hkscs2004_uni2indx_page23b[(wc>>4)-0x23b0]; 620 else if (wc >= 0x23e00 && wc < 0x240f0) 621 summary = &hkscs2004_uni2indx_page23e[(wc>>4)-0x23e0]; 622 else if (wc >= 0x24200 && wc < 0x242c0) 623 summary = &hkscs2004_uni2indx_page242[(wc>>4)-0x2420]; 624 else if (wc >= 0x24b00 && wc < 0x24b10) 625 summary = &hkscs2004_uni2indx_page24b[(wc>>4)-0x24b0]; 626 else if (wc >= 0x25400 && wc < 0x254a0) 627 summary = &hkscs2004_uni2indx_page254[(wc>>4)-0x2540]; 628 else if (wc >= 0x25a00 && wc < 0x25a60) 629 summary = &hkscs2004_uni2indx_page25a[(wc>>4)-0x25a0]; 630 } else { 631 if (wc >= 0x26b00 && wc < 0x26c50) 632 summary = &hkscs2004_uni2indx_page26b[(wc>>4)-0x26b0]; 633 else if (wc >= 0x26e00 && wc < 0x26e90) 634 summary = &hkscs2004_uni2indx_page26e[(wc>>4)-0x26e0]; 635 else if (wc >= 0x27000 && wc < 0x270e0) 636 summary = &hkscs2004_uni2indx_page270[(wc>>4)-0x2700]; 637 else if (wc >= 0x27200 && wc < 0x27400) 638 summary = &hkscs2004_uni2indx_page272[(wc>>4)-0x2720]; 639 else if (wc >= 0x27b00 && wc < 0x27cd0) 640 summary = &hkscs2004_uni2indx_page27b[(wc>>4)-0x27b0]; 641 else if (wc >= 0x28600 && wc < 0x286c0) 642 summary = &hkscs2004_uni2indx_page286[(wc>>4)-0x2860]; 643 else if (wc >= 0x28900 && wc < 0x28970) 644 summary = &hkscs2004_uni2indx_page289[(wc>>4)-0x2890]; 645 else if (wc >= 0x28b00 && wc < 0x28bc0) 646 summary = &hkscs2004_uni2indx_page28b[(wc>>4)-0x28b0]; 647 else if (wc >= 0x29000 && wc < 0x29080) 648 summary = &hkscs2004_uni2indx_page290[(wc>>4)-0x2900]; 649 else if (wc >= 0x29800 && wc < 0x29950) 650 summary = &hkscs2004_uni2indx_page298[(wc>>4)-0x2980]; 651 else if (wc >= 0x29e00 && wc < 0x29ec0) 652 summary = &hkscs2004_uni2indx_page29e[(wc>>4)-0x29e0]; 653 else if (wc >= 0x2a100 && wc < 0x2a1c0) 654 summary = &hkscs2004_uni2indx_page2a1[(wc>>4)-0x2a10]; 655 else if (wc >= 0x2a300 && wc < 0x2a360) 656 summary = &hkscs2004_uni2indx_page2a3[(wc>>4)-0x2a30]; 657 } 658 } 659 if (summary) { 660 unsigned short used = summary->used; 661 unsigned int i = wc & 0x0f; 662 if (used & ((unsigned short) 1 << i)) { 663 unsigned short c; 664 /* Keep in `used' only the bits 0..i-1. */ 665 used &= ((unsigned short) 1 << i) - 1; 666 /* Add `summary->indx' and the number of bits set in `used'. */ 667 used = (used & 0x5555) + ((used & 0xaaaa) >> 1); 668 used = (used & 0x3333) + ((used & 0xcccc) >> 2); 669 used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); 670 used = (used & 0x00ff) + (used >> 8); 671 c = hkscs2004_2charset[summary->indx + used]; 672 r[0] = (c >> 8); r[1] = (c & 0xff); 673 return 2; 674 } 675 } 676 return RET_ILUNI; 677 } 678 return RET_TOOSMALL; 679} 680