xref: /haiku/src/libs/iconv/hkscs2001.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
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:2001
23  */
24 
25 static const unsigned short hkscs2001_2uni_page8c[123] = {
26   /* 0x8c */
27   0x0a3b, 0x1cfe, 0x5273, 0x37a6, 0x02c9, 0x2d8f, 0x414e, 0x1d77,
28   0x12f5, 0x0620, 0x45cd, 0x0059, 0x4830, 0x1622, 0x4f32, 0x30a7,
29   0x31f6, 0x1e91, 0x1819, 0x20ba, 0x3e81, 0x5307, 0x018b, 0x3a80,
30   0x0610, 0x24e4, 0x2102, 0x0bae, 0x4d0f, 0x0409, 0x1a63, 0x54ba,
31   0x0523, 0x2c0f, 0x38fd, 0x252a, 0x5147, 0x4fea, 0x3455, 0x1d4d,
32   0x0c24, 0x3c7e, 0x33f4, 0x22d9, 0x4ee3, 0x37a7, 0x23dd, 0x08a3,
33   0x09f0, 0x0abc, 0x082f, 0x0917, 0x37a8, 0x0d34, 0x288b, 0x0f92,
34   0x0fd0, 0x3bb6, 0x1492, 0x1499, 0x15c2, 0x3d12, 0x178b, 0x3ff9,
35   0x1919, 0x1a43, 0x4063, 0x1bff, 0x38fd, 0x1f00, 0x4205, 0x208c,
36   0x03db, 0x4413, 0x1115, 0x21b9, 0x2e83, 0x47a4, 0x4695, 0x2593,
37   0x26ec, 0x27c3, 0x296c, 0x2af8, 0x2b97, 0x37a9, 0x2d90, 0x37aa,
38   0x2fb9, 0x37ab, 0x30cf, 0x2b5f, 0x36e0, 0x3221, 0x37ac, 0x50b9,
39   0x393f, 0x0471, 0x05a2, 0x101a, 0x38fd, 0x38fd, 0x38fd, 0x3568,
40   0x186b, 0x0576, 0x0e3d, 0x38fd, 0x2bd6, 0x437b, 0x2abf, 0x4c0d,
41   0x0781, 0x4a74, 0x137b, 0x4915, 0x4bbe, 0x37ad, 0x37ae, 0x1196,
42   0x37af, 0x38fd, 0x295b,
43 };
44 
45 static const ucs4_t hkscs2001_2uni_upages[85] = {
46   0x03500, 0x03c00, 0x03d00, 0x03e00, 0x04000, 0x04200, 0x04b00, 0x04c00,
47   0x04e00, 0x04f00, 0x05000, 0x05100, 0x05300, 0x05400, 0x05700, 0x05800,
48   0x05a00, 0x05b00, 0x05c00, 0x05d00, 0x05e00, 0x05f00, 0x06100, 0x06500,
49   0x06700, 0x06900, 0x06a00, 0x06c00, 0x06d00, 0x07000, 0x07100, 0x07200,
50   0x07300, 0x07400, 0x07600, 0x07700, 0x07800, 0x07a00, 0x07b00, 0x07c00,
51   0x07d00, 0x07e00, 0x08200, 0x08500, 0x08600, 0x08800, 0x08b00, 0x08e00,
52   0x08f00, 0x09100, 0x09200, 0x09300, 0x09700, 0x09800, 0x09900, 0x09f00,
53   0x0ff00, 0x21400, 0x21900, 0x21d00, 0x22000, 0x22700, 0x23200, 0x23300,
54   0x23c00, 0x24100, 0x24500, 0x24900, 0x24a00, 0x25100, 0x25600, 0x25c00,
55   0x25d00, 0x26b00, 0x26d00, 0x26f00, 0x27100, 0x28700, 0x28900, 0x28a00,
56   0x28d00, 0x29900, 0x29c00, 0x2a100, 0x2a200,
57 };
58 
59 static int
60 hkscs2001_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
61 {
62   unsigned char c1 = s[0];
63   if ((c1 == 0x8c)) {
64     if (n >= 2) {
65       unsigned char c2 = s[1];
66       if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
67         unsigned int i = 157 * (c1 - 0x80) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
68         ucs4_t wc = 0xfffd;
69         unsigned short swc;
70         {
71           if (i < 2007)
72             swc = hkscs2001_2uni_page8c[i-1884],
73             wc = hkscs2001_2uni_upages[swc>>8] | (swc & 0xff);
74         }
75         if (wc != 0xfffd) {
76           *pwc = wc;
77           return 2;
78         }
79       }
80       return RET_ILSEQ;
81     }
82     return RET_TOOFEW(0);
83   }
84   return RET_ILSEQ;
85 }
86 
87 static const unsigned short hkscs2001_2charset[116] = {
88   0x8c4b, 0x8c56, 0x8c44, 0x8caa, 0x8c5d, 0x8cc3, 0x8c60, 0x8ccb,
89   0x8cc4, 0x8c58, 0x8c49, 0x8cd2, 0x8c72, 0x8c6f, 0x8c73, 0x8c70,
90   0x8c40, 0x8c71, 0x8c5b, 0x8c68, 0x8c75, 0x8ccc, 0x8c77, 0x8c78,
91   0x8cc5, 0x8cac, 0x8cd9, 0x8c48, 0x8cd4, 0x8c7a, 0x8c7b, 0x8c7c,
92   0x8c4d, 0x8c7e, 0x8c52, 0x8cca, 0x8ca2, 0x8ca3, 0x8c5e, 0x8ca5,
93   0x8c41, 0x8c67, 0x8c47, 0x8c51, 0x8ca7, 0x8ca9, 0x8c53, 0x8c5a,
94   0x8cad, 0x8c6b, 0x8c6e, 0x8c59, 0x8c63, 0x8cb1, 0x8cb2, 0x8cb3,
95   0x8c76, 0x8cdc, 0x8cb4, 0x8cd0, 0x8cb5, 0x8cbd, 0x8cb6, 0x8cce,
96   0x8c61, 0x8c45, 0x8cb8, 0x8cae, 0x8cba, 0x8c4f, 0x8cbc, 0x8c50,
97   0x8cbf, 0x8c6a, 0x8c66, 0x8cc9, 0x8cbe, 0x8c43, 0x8c6d, 0x8c74,
98   0x8cb7, 0x8cb9, 0x8cbb, 0x8cc0, 0x8cd7, 0x8cd8, 0x8cda, 0x8cc2,
99   0x8c57, 0x8c79, 0x8c69, 0x8c7d, 0x8c54, 0x8ca1, 0x8ca4, 0x8c46,
100   0x8ca8, 0x8ccf, 0x8cab, 0x8c4a, 0x8cb0, 0x8caf, 0x8c4c, 0x8cd5,
101   0x8cd3, 0x8cd6, 0x8cd1, 0x8c5c, 0x8c6c, 0x8c4e, 0x8c65, 0x8cc1,
102   0x8c64, 0x8c42, 0x8c55, 0x8c5f,
103 };
104 
105 static const Summary16 hkscs2001_uni2indx_page35[6] = {
106   /* 0x3500 */
107   {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 },
108   {    0, 0x0000 }, {    0, 0x0200 },
109 };
110 static const Summary16 hkscs2001_uni2indx_page3c[46] = {
111   /* 0x3c00 */
112   {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 },
113   {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 },
114   {    1, 0x0800 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
115   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
116   /* 0x3d00 */
117   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
118   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
119   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
120   {    2, 0x0200 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
121   /* 0x3e00 */
122   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
123   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
124   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
125   {    3, 0x0000 }, {    3, 0x0800 },
126 };
127 static const Summary16 hkscs2001_uni2indx_page40[8] = {
128   /* 0x4000 */
129   {    4, 0x0200 }, {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0000 },
130   {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0002 },
131 };
132 static const Summary16 hkscs2001_uni2indx_page42[11] = {
133   /* 0x4200 */
134   {    6, 0x0000 }, {    6, 0x0000 }, {    6, 0x0008 }, {    7, 0x0000 },
135   {    7, 0x0000 }, {    7, 0x0000 }, {    7, 0x0000 }, {    7, 0x0040 },
136   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0004 },
137 };
138 static const Summary16 hkscs2001_uni2indx_page4b[25] = {
139   /* 0x4b00 */
140   {    9, 0x0000 }, {    9, 0x0001 }, {   10, 0x0001 }, {   11, 0x0000 },
141   {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 },
142   {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 },
143   {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 },
144   /* 0x4c00 */
145   {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 },
146   {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 }, {   11, 0x0000 },
147   {   11, 0x0002 },
148 };
149 static const Summary16 hkscs2001_uni2indx_page4e[59] = {
150   /* 0x4e00 */
151   {   12, 0x0000 }, {   12, 0x0000 }, {   12, 0x8000 }, {   13, 0x0000 },
152   {   13, 0x0000 }, {   13, 0x0000 }, {   13, 0x0000 }, {   13, 0x0000 },
153   {   13, 0x0000 }, {   13, 0x0000 }, {   13, 0x0008 }, {   14, 0x0000 },
154   {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 },
155   /* 0x4f00 */
156   {   14, 0x0000 }, {   14, 0x0080 }, {   15, 0x0000 }, {   15, 0x0000 },
157   {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 },
158   {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 },
159   {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0001 },
160   /* 0x5000 */
161   {   16, 0x0000 }, {   16, 0x0000 }, {   16, 0x0000 }, {   16, 0x0800 },
162   {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 },
163   {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x1000 },
164   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 },
165   /* 0x5100 */
166   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 },
167   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 },
168   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x4000 },
169 };
170 static const Summary16 hkscs2001_uni2indx_page53[20] = {
171   /* 0x5300 */
172   {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0010 }, {   20, 0x0000 },
173   {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 },
174   {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 },
175   {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 },
176   /* 0x5400 */
177   {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0010 },
178 };
179 static const Summary16 hkscs2001_uni2indx_page57[30] = {
180   /* 0x5700 */
181   {   21, 0x0000 }, {   21, 0x0000 }, {   21, 0x0000 }, {   21, 0x2000 },
182   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
183   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
184   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
185   /* 0x5800 */
186   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
187   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
188   {   22, 0x0000 }, {   22, 0x0004 }, {   23, 0x0000 }, {   23, 0x0000 },
189   {   23, 0x0000 }, {   23, 0x0001 },
190 };
191 static const Summary16 hkscs2001_uni2indx_page5a[93] = {
192   /* 0x5a00 */
193   {   24, 0x0000 }, {   24, 0x0400 }, {   25, 0x0000 }, {   25, 0x0000 },
194   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
195   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
196   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
197   /* 0x5b00 */
198   {   25, 0x0000 }, {   25, 0x0020 }, {   26, 0x0000 }, {   26, 0x0000 },
199   {   26, 0x0000 }, {   26, 0x0000 }, {   26, 0x0000 }, {   26, 0x0000 },
200   {   26, 0x0000 }, {   26, 0x0040 }, {   27, 0x0000 }, {   27, 0x0000 },
201   {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 },
202   /* 0x5c00 */
203   {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 },
204   {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 },
205   {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 },
206   {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0000 }, {   27, 0x0020 },
207   /* 0x5d00 */
208   {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0000 },
209   {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0800 },
210   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 },
211   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 },
212   /* 0x5e00 */
213   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 },
214   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 },
215   {   29, 0x0000 }, {   29, 0x0204 }, {   31, 0x0000 }, {   31, 0x0000 },
216   {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 },
217   /* 0x5f00 */
218   {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 },
219   {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 },
220   {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 }, {   31, 0x0000 },
221   {   31, 0x0004 },
222 };
223 static const Summary16 hkscs2001_uni2indx_page61[3] = {
224   /* 0x6100 */
225   {   32, 0x0000 }, {   32, 0x0000 }, {   32, 0x0004 },
226 };
227 static const Summary16 hkscs2001_uni2indx_page65[9] = {
228   /* 0x6500 */
229   {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 },
230   {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 },
231   {   33, 0x0800 },
232 };
233 static const Summary16 hkscs2001_uni2indx_page67[7] = {
234   /* 0x6700 */
235   {   34, 0x0000 }, {   34, 0x0200 }, {   35, 0x0000 }, {   35, 0x0000 },
236   {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0800 },
237 };
238 static const Summary16 hkscs2001_uni2indx_page69[23] = {
239   /* 0x6900 */
240   {   36, 0x0000 }, {   36, 0x0200 }, {   37, 0x0000 }, {   37, 0x0000 },
241   {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 },
242   {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 },
243   {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 },
244   /* 0x6a00 */
245   {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 },
246   {   37, 0x0008 }, {   38, 0x0000 }, {   38, 0x0008 },
247 };
248 static const Summary16 hkscs2001_uni2indx_page6c[32] = {
249   /* 0x6c00 */
250   {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 },
251   {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 },
252   {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 },
253   {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x8000 },
254   /* 0x6d00 */
255   {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 },
256   {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 },
257   {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 },
258   {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x4000 },
259 };
260 static const Summary16 hkscs2001_uni2indx_page70[76] = {
261   /* 0x7000 */
262   {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 },
263   {   41, 0x2000 }, {   42, 0x0000 }, {   42, 0x0000 }, {   42, 0x0080 },
264   {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 },
265   {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 },
266   /* 0x7100 */
267   {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 },
268   {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 }, {   43, 0x0000 },
269   {   43, 0x0000 }, {   43, 0x0002 }, {   44, 0x0000 }, {   44, 0x0000 },
270   {   44, 0x0000 }, {   44, 0x0000 }, {   44, 0x0000 }, {   44, 0x0000 },
271   /* 0x7200 */
272   {   44, 0x0001 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
273   {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
274   {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
275   {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
276   /* 0x7300 */
277   {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
278   {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 }, {   45, 0x0000 },
279   {   45, 0x1000 }, {   46, 0x0000 }, {   46, 0x0000 }, {   46, 0x0400 },
280   {   47, 0x0000 }, {   47, 0x0000 }, {   47, 0x0000 }, {   47, 0x0000 },
281   /* 0x7400 */
282   {   47, 0x0004 }, {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 },
283   {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 },
284   {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0200 },
285 };
286 static const Summary16 hkscs2001_uni2indx_page76[47] = {
287   /* 0x7600 */
288   {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 },
289   {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 },
290   {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 },
291   {   49, 0x0000 }, {   49, 0x0200 }, {   50, 0x0000 }, {   50, 0x0000 },
292   /* 0x7700 */
293   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 },
294   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 },
295   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 },
296   {   50, 0x0000 }, {   50, 0x2000 }, {   51, 0x0000 }, {   51, 0x0000 },
297   /* 0x7800 */
298   {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 },
299   {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 },
300   {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0000 },
301   {   51, 0x0000 }, {   51, 0x0000 }, {   51, 0x0010 },
302 };
303 static const Summary16 hkscs2001_uni2indx_page7a[71] = {
304   /* 0x7a00 */
305   {   52, 0x0000 }, {   52, 0x0000 }, {   52, 0x0400 }, {   53, 0x0000 },
306   {   53, 0x0000 }, {   53, 0x0000 }, {   53, 0x0000 }, {   53, 0x0000 },
307   {   53, 0x0000 }, {   53, 0x0008 }, {   54, 0x0000 }, {   54, 0x0000 },
308   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
309   /* 0x7b00 */
310   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
311   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
312   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
313   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x1000 }, {   55, 0x0000 },
314   /* 0x7c00 */
315   {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 },
316   {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 },
317   {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 },
318   {   55, 0x0008 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 },
319   /* 0x7d00 */
320   {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 },
321   {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 },
322   {   56, 0x0800 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
323   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
324   /* 0x7e00 */
325   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
326   {   57, 0x0000 }, {   57, 0x0800 }, {   58, 0x1000 },
327 };
328 static const Summary16 hkscs2001_uni2indx_page82[16] = {
329   /* 0x8200 */
330   {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 },
331   {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 },
332   {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x8000 },
333   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0100 },
334 };
335 static const Summary16 hkscs2001_uni2indx_page85[17] = {
336   /* 0x8500 */
337   {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 },
338   {   61, 0x0000 }, {   61, 0x8000 }, {   62, 0x0000 }, {   62, 0x0000 },
339   {   62, 0x0000 }, {   62, 0x0080 }, {   63, 0x0000 }, {   63, 0x0000 },
340   {   63, 0x0000 }, {   63, 0x0040 }, {   64, 0x0000 }, {   64, 0x0000 },
341   /* 0x8600 */
342   {   64, 0x8000 },
343 };
344 static const Summary16 hkscs2001_uni2indx_page88[10] = {
345   /* 0x8800 */
346   {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 },
347   {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 },
348   {   65, 0x8000 }, {   66, 0x0001 },
349 };
350 static const Summary16 hkscs2001_uni2indx_page8b[9] = {
351   /* 0x8b00 */
352   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 },
353   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 },
354   {   67, 0x0008 },
355 };
356 static const Summary16 hkscs2001_uni2indx_page8e[29] = {
357   /* 0x8e00 */
358   {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0000 },
359   {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0000 },
360   {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0000 }, {   68, 0x0200 },
361   {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 },
362   /* 0x8f00 */
363   {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 },
364   {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0000 },
365   {   69, 0x0000 }, {   69, 0x0000 }, {   69, 0x0080 }, {   70, 0x0000 },
366   {   70, 0x8000 },
367 };
368 static const Summary16 hkscs2001_uni2indx_page91[48] = {
369   /* 0x9100 */
370   {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 },
371   {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 },
372   {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 },
373   {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0000 }, {   71, 0x0040 },
374   /* 0x9200 */
375   {   72, 0x0000 }, {   72, 0x0000 }, {   72, 0x0002 }, {   73, 0x0000 },
376   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
377   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
378   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
379   /* 0x9300 */
380   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
381   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
382   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 },
383   {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0000 }, {   73, 0x0010 },
384 };
385 static const Summary16 hkscs2001_uni2indx_page97[47] = {
386   /* 0x9700 */
387   {   74, 0x0000 }, {   74, 0x0000 }, {   74, 0x0000 }, {   74, 0x0000 },
388   {   74, 0x0000 }, {   74, 0x0020 }, {   75, 0x0000 }, {   75, 0x0000 },
389   {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 },
390   {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 },
391   /* 0x9800 */
392   {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0000 },
393   {   75, 0x0000 }, {   75, 0x0000 }, {   75, 0x0100 }, {   76, 0x0000 },
394   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 },
395   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 },
396   /* 0x9900 */
397   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 },
398   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 },
399   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0000 },
400   {   76, 0x0000 }, {   76, 0x0000 }, {   76, 0x0001 },
401 };
402 static const Summary16 hkscs2001_uni2indx_page9f[11] = {
403   /* 0x9f00 */
404   {   77, 0x0000 }, {   77, 0x0000 }, {   77, 0x0000 }, {   77, 0x0000 },
405   {   77, 0x0000 }, {   77, 0x0000 }, {   77, 0x0000 }, {   77, 0x0000 },
406   {   77, 0x0000 }, {   77, 0x0000 }, {   77, 0xffc0 },
407 };
408 static const Summary16 hkscs2001_uni2indx_page214[4] = {
409   /* 0x21400 */
410   {   87, 0x0000 }, {   87, 0x0000 }, {   87, 0x0000 }, {   87, 0x8000 },
411 };
412 static const Summary16 hkscs2001_uni2indx_page219[9] = {
413   /* 0x21900 */
414   {   88, 0x0000 }, {   88, 0x0000 }, {   88, 0x0000 }, {   88, 0x0000 },
415   {   88, 0x0000 }, {   88, 0x0000 }, {   88, 0x0000 }, {   88, 0x0000 },
416   {   88, 0x0001 },
417 };
418 static const Summary16 hkscs2001_uni2indx_page21d[12] = {
419   /* 0x21d00 */
420   {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0000 },
421   {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0000 },
422   {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0000 }, {   89, 0x0040 },
423 };
424 static const Summary16 hkscs2001_uni2indx_page220[8] = {
425   /* 0x22000 */
426   {   90, 0x0000 }, {   90, 0x0000 }, {   90, 0x0000 }, {   90, 0x0000 },
427   {   90, 0x0000 }, {   90, 0x0000 }, {   90, 0x0000 }, {   90, 0x4000 },
428 };
429 static const Summary16 hkscs2001_uni2indx_page227[2] = {
430   /* 0x22700 */
431   {   91, 0x0000 }, {   91, 0x0004 },
432 };
433 static const Summary16 hkscs2001_uni2indx_page232[32] = {
434   /* 0x23200 */
435   {   92, 0x0000 }, {   92, 0x0000 }, {   92, 0x0000 }, {   92, 0x0000 },
436   {   92, 0x0000 }, {   92, 0x0000 }, {   92, 0x0000 }, {   92, 0x0000 },
437   {   92, 0x0002 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 },
438   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 },
439   /* 0x23300 */
440   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 },
441   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 },
442   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 },
443   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0200 },
444 };
445 static const Summary16 hkscs2001_uni2indx_page23c[7] = {
446   /* 0x23c00 */
447   {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 },
448   {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0008 },
449 };
450 static const Summary16 hkscs2001_uni2indx_page241[5] = {
451   /* 0x24100 */
452   {   95, 0x0000 }, {   95, 0x0000 }, {   95, 0x0000 }, {   95, 0x0000 },
453   {   95, 0x4000 },
454 };
455 static const Summary16 hkscs2001_uni2indx_page245[1] = {
456   /* 0x24500 */
457   {   96, 0x0020 },
458 };
459 static const Summary16 hkscs2001_uni2indx_page249[18] = {
460   /* 0x24900 */
461   {   97, 0x0000 }, {   97, 0x0000 }, {   97, 0x0000 }, {   97, 0x0000 },
462   {   97, 0x0000 }, {   97, 0x0000 }, {   97, 0x0000 }, {   97, 0x0800 },
463   {   98, 0x0000 }, {   98, 0x0000 }, {   98, 0x0000 }, {   98, 0x0000 },
464   {   98, 0x0000 }, {   98, 0x0000 }, {   98, 0x0000 }, {   98, 0x0000 },
465   /* 0x24a00 */
466   {   98, 0x0000 }, {   98, 0x0008 },
467 };
468 static const Summary16 hkscs2001_uni2indx_page251[13] = {
469   /* 0x25100 */
470   {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 },
471   {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 },
472   {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 }, {   99, 0x0000 },
473   {   99, 0x2000 },
474 };
475 static const Summary16 hkscs2001_uni2indx_page256[10] = {
476   /* 0x25600 */
477   {  100, 0x0000 }, {  100, 0x0000 }, {  100, 0x0000 }, {  100, 0x0000 },
478   {  100, 0x0000 }, {  100, 0x0000 }, {  100, 0x0000 }, {  100, 0x0000 },
479   {  100, 0x0000 }, {  100, 0x0020 },
480 };
481 static const Summary16 hkscs2001_uni2indx_page25c[20] = {
482   /* 0x25c00 */
483   {  101, 0x0000 }, {  101, 0x0000 }, {  101, 0x0000 }, {  101, 0x0000 },
484   {  101, 0x0000 }, {  101, 0x0000 }, {  101, 0x0000 }, {  101, 0x0000 },
485   {  101, 0x0000 }, {  101, 0x0000 }, {  101, 0x0010 }, {  102, 0x0000 },
486   {  102, 0x0000 }, {  102, 0x0000 }, {  102, 0x0000 }, {  102, 0x0000 },
487   /* 0x25d00 */
488   {  102, 0x0000 }, {  102, 0x0000 }, {  102, 0x0000 }, {  102, 0x0001 },
489 };
490 static const Summary16 hkscs2001_uni2indx_page26b[2] = {
491   /* 0x26b00 */
492   {  103, 0x0000 }, {  103, 0x0020 },
493 };
494 static const Summary16 hkscs2001_uni2indx_page26d[8] = {
495   /* 0x26d00 */
496   {  104, 0x0000 }, {  104, 0x0000 }, {  104, 0x0000 }, {  104, 0x0000 },
497   {  104, 0x0000 }, {  104, 0x0000 }, {  104, 0x0000 }, {  104, 0x0010 },
498 };
499 static const Summary16 hkscs2001_uni2indx_page26f[12] = {
500   /* 0x26f00 */
501   {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x0000 },
502   {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x0000 },
503   {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x0000 }, {  105, 0x4000 },
504 };
505 static const Summary16 hkscs2001_uni2indx_page271[1] = {
506   /* 0x27100 */
507   {  106, 0x2000 },
508 };
509 static const Summary16 hkscs2001_uni2indx_page287[1] = {
510   /* 0x28700 */
511   {  107, 0x8000 },
512 };
513 static const Summary16 hkscs2001_uni2indx_page289[31] = {
514   /* 0x28900 */
515   {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 },
516   {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 },
517   {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0000 },
518   {  108, 0x0000 }, {  108, 0x0000 }, {  108, 0x0008 }, {  109, 0x0000 },
519   /* 0x28a00 */
520   {  109, 0x0000 }, {  109, 0x0000 }, {  109, 0x0000 }, {  109, 0x0004 },
521   {  110, 0x0000 }, {  110, 0x0000 }, {  110, 0x0000 }, {  110, 0x0000 },
522   {  110, 0x0000 }, {  110, 0x0000 }, {  110, 0x0000 }, {  110, 0x0000 },
523   {  110, 0x0000 }, {  110, 0x0000 }, {  110, 0x0400 },
524 };
525 static const Summary16 hkscs2001_uni2indx_page28d[12] = {
526   /* 0x28d00 */
527   {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0000 },
528   {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0000 },
529   {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0000 }, {  111, 0x0200 },
530 };
531 static const Summary16 hkscs2001_uni2indx_page299[5] = {
532   /* 0x29900 */
533   {  112, 0x0000 }, {  112, 0x0000 }, {  112, 0x0000 }, {  112, 0x0000 },
534   {  112, 0x0080 },
535 };
536 static const Summary16 hkscs2001_uni2indx_page29c[8] = {
537   /* 0x29c00 */
538   {  113, 0x0000 }, {  113, 0x0000 }, {  113, 0x0000 }, {  113, 0x0000 },
539   {  113, 0x0000 }, {  113, 0x0000 }, {  113, 0x0000 }, {  113, 0x0008 },
540 };
541 static const Summary16 hkscs2001_uni2indx_page2a1[28] = {
542   /* 0x2a100 */
543   {  114, 0x0080 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
544   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
545   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
546   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
547   /* 0x2a200 */
548   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
549   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 },
550   {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0000 }, {  115, 0x0400 },
551 };
552 
553 static int
554 hkscs2001_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
555 {
556   if (n >= 2) {
557     const Summary16 *summary = NULL;
558     if (wc < 0x9f00) {
559       if (wc < 0x6900) {
560         if (wc >= 0x3500 && wc < 0x3560)
561           summary = &hkscs2001_uni2indx_page35[(wc>>4)-0x350];
562         else if (wc >= 0x3c00 && wc < 0x3ee0)
563           summary = &hkscs2001_uni2indx_page3c[(wc>>4)-0x3c0];
564         else if (wc >= 0x4000 && wc < 0x4080)
565           summary = &hkscs2001_uni2indx_page40[(wc>>4)-0x400];
566         else if (wc >= 0x4200 && wc < 0x42b0)
567           summary = &hkscs2001_uni2indx_page42[(wc>>4)-0x420];
568         else if (wc >= 0x4b00 && wc < 0x4c90)
569           summary = &hkscs2001_uni2indx_page4b[(wc>>4)-0x4b0];
570         else if (wc >= 0x4e00 && wc < 0x51b0)
571           summary = &hkscs2001_uni2indx_page4e[(wc>>4)-0x4e0];
572         else if (wc >= 0x5300 && wc < 0x5440)
573           summary = &hkscs2001_uni2indx_page53[(wc>>4)-0x530];
574         else if (wc >= 0x5700 && wc < 0x58e0)
575           summary = &hkscs2001_uni2indx_page57[(wc>>4)-0x570];
576         else if (wc >= 0x5a00 && wc < 0x5fd0)
577           summary = &hkscs2001_uni2indx_page5a[(wc>>4)-0x5a0];
578         else if (wc >= 0x6100 && wc < 0x6130)
579           summary = &hkscs2001_uni2indx_page61[(wc>>4)-0x610];
580         else if (wc >= 0x6500 && wc < 0x6590)
581           summary = &hkscs2001_uni2indx_page65[(wc>>4)-0x650];
582         else if (wc >= 0x6700 && wc < 0x6770)
583           summary = &hkscs2001_uni2indx_page67[(wc>>4)-0x670];
584       } else {
585         if (wc >= 0x6900 && wc < 0x6a70)
586           summary = &hkscs2001_uni2indx_page69[(wc>>4)-0x690];
587         else if (wc >= 0x6c00 && wc < 0x6e00)
588           summary = &hkscs2001_uni2indx_page6c[(wc>>4)-0x6c0];
589         else if (wc >= 0x7000 && wc < 0x74c0)
590           summary = &hkscs2001_uni2indx_page70[(wc>>4)-0x700];
591         else if (wc >= 0x7600 && wc < 0x78f0)
592           summary = &hkscs2001_uni2indx_page76[(wc>>4)-0x760];
593         else if (wc >= 0x7a00 && wc < 0x7e70)
594           summary = &hkscs2001_uni2indx_page7a[(wc>>4)-0x7a0];
595         else if (wc >= 0x8200 && wc < 0x8300)
596           summary = &hkscs2001_uni2indx_page82[(wc>>4)-0x820];
597         else if (wc >= 0x8500 && wc < 0x8610)
598           summary = &hkscs2001_uni2indx_page85[(wc>>4)-0x850];
599         else if (wc >= 0x8800 && wc < 0x88a0)
600           summary = &hkscs2001_uni2indx_page88[(wc>>4)-0x880];
601         else if (wc >= 0x8b00 && wc < 0x8b90)
602           summary = &hkscs2001_uni2indx_page8b[(wc>>4)-0x8b0];
603         else if (wc >= 0x8e00 && wc < 0x8fd0)
604           summary = &hkscs2001_uni2indx_page8e[(wc>>4)-0x8e0];
605         else if (wc >= 0x9100 && wc < 0x9400)
606           summary = &hkscs2001_uni2indx_page91[(wc>>4)-0x910];
607         else if (wc >= 0x9700 && wc < 0x99f0)
608           summary = &hkscs2001_uni2indx_page97[(wc>>4)-0x970];
609       }
610     } else {
611       if (wc < 0x25600) {
612         if (wc >= 0x9f00 && wc < 0x9fb0)
613           summary = &hkscs2001_uni2indx_page9f[(wc>>4)-0x9f0];
614         else if (wc >= 0x21400 && wc < 0x21440)
615           summary = &hkscs2001_uni2indx_page214[(wc>>4)-0x2140];
616         else if (wc >= 0x21900 && wc < 0x21990)
617           summary = &hkscs2001_uni2indx_page219[(wc>>4)-0x2190];
618         else if (wc >= 0x21d00 && wc < 0x21dc0)
619           summary = &hkscs2001_uni2indx_page21d[(wc>>4)-0x21d0];
620         else if (wc >= 0x22000 && wc < 0x22080)
621           summary = &hkscs2001_uni2indx_page220[(wc>>4)-0x2200];
622         else if (wc >= 0x22700 && wc < 0x22720)
623           summary = &hkscs2001_uni2indx_page227[(wc>>4)-0x2270];
624         else if (wc >= 0x23200 && wc < 0x23400)
625           summary = &hkscs2001_uni2indx_page232[(wc>>4)-0x2320];
626         else if (wc >= 0x23c00 && wc < 0x23c70)
627           summary = &hkscs2001_uni2indx_page23c[(wc>>4)-0x23c0];
628         else if (wc >= 0x24100 && wc < 0x24150)
629           summary = &hkscs2001_uni2indx_page241[(wc>>4)-0x2410];
630         else if (wc >= 0x24500 && wc < 0x24510)
631           summary = &hkscs2001_uni2indx_page245[(wc>>4)-0x2450];
632         else if (wc >= 0x24900 && wc < 0x24a20)
633           summary = &hkscs2001_uni2indx_page249[(wc>>4)-0x2490];
634         else if (wc >= 0x25100 && wc < 0x251d0)
635           summary = &hkscs2001_uni2indx_page251[(wc>>4)-0x2510];
636       } else {
637         if (wc >= 0x25600 && wc < 0x256a0)
638           summary = &hkscs2001_uni2indx_page256[(wc>>4)-0x2560];
639         else if (wc >= 0x25c00 && wc < 0x25d40)
640           summary = &hkscs2001_uni2indx_page25c[(wc>>4)-0x25c0];
641         else if (wc >= 0x26b00 && wc < 0x26b20)
642           summary = &hkscs2001_uni2indx_page26b[(wc>>4)-0x26b0];
643         else if (wc >= 0x26d00 && wc < 0x26d80)
644           summary = &hkscs2001_uni2indx_page26d[(wc>>4)-0x26d0];
645         else if (wc >= 0x26f00 && wc < 0x26fc0)
646           summary = &hkscs2001_uni2indx_page26f[(wc>>4)-0x26f0];
647         else if (wc >= 0x27100 && wc < 0x27110)
648           summary = &hkscs2001_uni2indx_page271[(wc>>4)-0x2710];
649         else if (wc >= 0x28700 && wc < 0x28710)
650           summary = &hkscs2001_uni2indx_page287[(wc>>4)-0x2870];
651         else if (wc >= 0x28900 && wc < 0x28af0)
652           summary = &hkscs2001_uni2indx_page289[(wc>>4)-0x2890];
653         else if (wc >= 0x28d00 && wc < 0x28dc0)
654           summary = &hkscs2001_uni2indx_page28d[(wc>>4)-0x28d0];
655         else if (wc >= 0x29900 && wc < 0x29950)
656           summary = &hkscs2001_uni2indx_page299[(wc>>4)-0x2990];
657         else if (wc >= 0x29c00 && wc < 0x29c80)
658           summary = &hkscs2001_uni2indx_page29c[(wc>>4)-0x29c0];
659         else if (wc >= 0x2a100 && wc < 0x2a2c0)
660           summary = &hkscs2001_uni2indx_page2a1[(wc>>4)-0x2a10];
661       }
662     }
663     if (summary) {
664       unsigned short used = summary->used;
665       unsigned int i = wc & 0x0f;
666       if (used & ((unsigned short) 1 << i)) {
667         unsigned short c;
668         /* Keep in `used' only the bits 0..i-1. */
669         used &= ((unsigned short) 1 << i) - 1;
670         /* Add `summary->indx' and the number of bits set in `used'. */
671         used = (used & 0x5555) + ((used & 0xaaaa) >> 1);
672         used = (used & 0x3333) + ((used & 0xcccc) >> 2);
673         used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);
674         used = (used & 0x00ff) + (used >> 8);
675         c = hkscs2001_2charset[summary->indx + used];
676         r[0] = (c >> 8); r[1] = (c & 0xff);
677         return 2;
678       }
679     }
680     return RET_ILUNI;
681   }
682   return RET_TOOSMALL;
683 }
684