]> git.lyx.org Git - lyx.git/blob - 3rdparty/libiconv/1.15/lib/hkscs2008.h
Implement auto-nesting.
[lyx.git] / 3rdparty / libiconv / 1.15 / lib / hkscs2008.h
1 /*
2  * Copyright (C) 1999-2010, 2012, 2016 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, see <http://www.gnu.org/licenses/>.
18  */
19
20 /*
21  * HKSCS:2008
22  */
23
24 static const unsigned short hkscs2008_2uni_page87[126] = {
25   /* 0x87 */
26   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
27   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
28   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
29   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
30   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
31   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
32   0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd, 0x22fd,
33   0x22fd, 0x22fd, 0x0175, 0x2453, 0x299e, 0x2d21, 0x03ec, 0x2bde,
34   0x02f5, 0x16fc, 0x2197, 0x2a61, 0x300d, 0x26ea, 0x238a, 0x275e,
35   0x060a, 0x1884, 0x2196, 0x1f2f, 0x0930, 0x1a13, 0x0d96, 0x204a,
36   0x1e18, 0x15d0, 0x1632, 0x0f60, 0x1129, 0x1b9d, 0x144c, 0x17c5,
37   0x1082, 0x162c, 0x0a4f, 0x1d46, 0x00e6, 0x13c4, 0x2cb9, 0x14c6,
38   0x21c7, 0x0cb3, 0x092f, 0x0b4c, 0x0531, 0x298e, 0x0d18, 0x1672,
39   0x2f65, 0x1c8f, 0x08ae, 0x2e88, 0x0581, 0x2c99, 0x17ae, 0x25bc,
40   0x21c8, 0x25c1, 0x25c9, 0x25cc, 0x21c9, 0x1904, 0x28bb, 0x04b4,
41   0x21ca, 0x07e1, 0x31ff, 0x0ec1, 0x126e, 0x21cb,
42 };
43
44 static const ucs4_t hkscs2008_2uni_upages[50] = {
45   0x03400, 0x03800, 0x03a00, 0x03e00, 0x04000, 0x04100, 0x04300, 0x04400,
46   0x04600, 0x04900, 0x05200, 0x05400, 0x05700, 0x05800, 0x06200, 0x06600,
47   0x06700, 0x06a00, 0x07000, 0x07300, 0x07400, 0x07900, 0x07a00, 0x07b00,
48   0x08400, 0x08500, 0x08600, 0x08800, 0x08b00, 0x09000, 0x09200, 0x09400,
49   0x09700, 0x09f00, 0x0ff00, 0x20a00, 0x21d00, 0x22400, 0x23100, 0x23200,
50   0x23500, 0x23600, 0x24100, 0x25800, 0x25d00, 0x26000, 0x26e00, 0x27b00,
51   0x28900, 0x2ad00,
52 };
53
54 static int
55 hkscs2008_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)
56 {
57   unsigned char c1 = s[0];
58   if ((c1 == 0x87)) {
59     if (n >= 2) {
60       unsigned char c2 = s[1];
61       if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) {
62         unsigned int i = 157 * (c1 - 0x80) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40));
63         ucs4_t wc = 0xfffd;
64         unsigned short swc;
65         {
66           if (i < 1225)
67             swc = hkscs2008_2uni_page87[i-1099],
68             wc = hkscs2008_2uni_upages[swc>>8] | (swc & 0xff);
69         }
70         if (wc != 0xfffd) {
71           *pwc = wc;
72           return 2;
73         }
74       }
75       return RET_ILSEQ;
76     }
77     return RET_TOOFEW(0);
78   }
79   return RET_ILSEQ;
80 }
81
82 static const unsigned short hkscs2008_2charset[68] = {
83   0x87be, 0x877a, 0x87a2, 0x877e, 0x87d9, 0x87c6, 0x87ce, 0x87aa,
84   0x87db, 0x87cc, 0x87c4, 0x87ae, 0x87bc, 0x87c5, 0x87c3, 0x87c8,
85   0x87b0, 0x87dd, 0x87b5, 0x87ba, 0x87b6, 0x87de, 0x87bf, 0x87b8,
86   0x87c1, 0x87b3, 0x87bb, 0x87b4, 0x87c9, 0x87a3, 0x87d0, 0x87b9,
87   0x87ab, 0x87d7, 0x87af, 0x87b7, 0x87cb, 0x87bd, 0x87b2, 0x87ad,
88   0x87b1, 0x87ac, 0x87a4, 0x87c2, 0x87d2, 0x87d6, 0x87da, 0x87df,
89   0x87a8, 0x877b, 0x87d1, 0x87d3, 0x87d4, 0x87d5, 0x87a7, 0x87a9,
90   0x87d8, 0x87c7, 0x877c, 0x87a5, 0x87a1, 0x87cf, 0x87c0, 0x877d,
91   0x87cd, 0x87ca, 0x87a6, 0x87dc,
92 };
93
94 static const Summary16 hkscs2008_uni2indx_page34[15] = {
95   /* 0x3400 */
96   {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 },
97   {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 },
98   {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0000 },
99   {    0, 0x0000 }, {    0, 0x0000 }, {    0, 0x0040 },
100 };
101 static const Summary16 hkscs2008_uni2indx_page38[8] = {
102   /* 0x3800 */
103   {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 },
104   {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0000 }, {    1, 0x0020 },
105 };
106 static const Summary16 hkscs2008_uni2indx_page3a[16] = {
107   /* 0x3a00 */
108   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
109   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
110   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 },
111   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x0020 },
112 };
113 static const Summary16 hkscs2008_uni2indx_page3e[15] = {
114   /* 0x3e00 */
115   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
116   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
117   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x0000 },
118   {    3, 0x0000 }, {    3, 0x0000 }, {    3, 0x1000 },
119 };
120 static const Summary16 hkscs2008_uni2indx_page40[25] = {
121   /* 0x4000 */
122   {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0000 },
123   {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0000 },
124   {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0000 }, {    4, 0x0010 },
125   {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0000 },
126   /* 0x4100 */
127   {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0000 }, {    5, 0x0002 },
128   {    6, 0x0000 }, {    6, 0x0000 }, {    6, 0x0000 }, {    6, 0x0000 },
129   {    6, 0x0002 },
130 };
131 static const Summary16 hkscs2008_uni2indx_page43[31] = {
132   /* 0x4300 */
133   {    7, 0x0400 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
134   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
135   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
136   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
137   /* 0x4400 */
138   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
139   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
140   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0000 },
141   {    8, 0x0000 }, {    8, 0x0000 }, {    8, 0x0002 },
142 };
143 static const Summary16 hkscs2008_uni2indx_page46[11] = {
144   /* 0x4600 */
145   {    9, 0x0000 }, {    9, 0x0000 }, {    9, 0x0000 }, {    9, 0x0000 },
146   {    9, 0x0000 }, {    9, 0x0000 }, {    9, 0x0000 }, {    9, 0x0000 },
147   {    9, 0x0000 }, {    9, 0x0000 }, {    9, 0x4000 },
148 };
149 static const Summary16 hkscs2008_uni2indx_page49[4] = {
150   /* 0x4900 */
151   {   10, 0x0000 }, {   10, 0x0000 }, {   10, 0x8000 }, {   11, 0x0001 },
152 };
153 static const Summary16 hkscs2008_uni2indx_page52[5] = {
154   /* 0x5200 */
155   {   12, 0x0000 }, {   12, 0x0000 }, {   12, 0x0000 }, {   12, 0x0000 },
156   {   12, 0x8000 },
157 };
158 static const Summary16 hkscs2008_uni2indx_page54[5] = {
159   /* 0x5400 */
160   {   13, 0x0000 }, {   13, 0x0000 }, {   13, 0x0000 }, {   13, 0x0000 },
161   {   13, 0x1000 },
162 };
163 static const Summary16 hkscs2008_uni2indx_page57[26] = {
164   /* 0x5700 */
165   {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 },
166   {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 },
167   {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0000 }, {   14, 0x0008 },
168   {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 }, {   15, 0x0000 },
169   /* 0x5800 */
170   {   15, 0x0000 }, {   15, 0x0100 }, {   16, 0x0000 }, {   16, 0x0000 },
171   {   16, 0x0000 }, {   16, 0x0000 }, {   16, 0x0000 }, {   16, 0x0000 },
172   {   16, 0x0000 }, {   16, 0x0040 },
173 };
174 static const Summary16 hkscs2008_uni2indx_page62[13] = {
175   /* 0x6200 */
176   {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 },
177   {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 },
178   {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 }, {   17, 0x0000 },
179   {   17, 0x0002 },
180 };
181 static const Summary16 hkscs2008_uni2indx_page66[25] = {
182   /* 0x6600 */
183   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0000 },
184   {   18, 0x0000 }, {   18, 0x0000 }, {   18, 0x0001 }, {   19, 0x0000 },
185   {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 },
186   {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 },
187   /* 0x6700 */
188   {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 },
189   {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 }, {   19, 0x0000 },
190   {   19, 0x0004 },
191 };
192 static const Summary16 hkscs2008_uni2indx_page6a[3] = {
193   /* 0x6a00 */
194   {   20, 0x0000 }, {   20, 0x0000 }, {   20, 0x0200 },
195 };
196 static const Summary16 hkscs2008_uni2indx_page70[7] = {
197   /* 0x7000 */
198   {   21, 0x0000 }, {   21, 0x0000 }, {   21, 0x0000 }, {   21, 0x0000 },
199   {   21, 0x0000 }, {   21, 0x0000 }, {   21, 0x4000 },
200 };
201 static const Summary16 hkscs2008_uni2indx_page73[29] = {
202   /* 0x7300 */
203   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
204   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
205   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
206   {   22, 0x0010 }, {   23, 0x0000 }, {   23, 0x0000 }, {   23, 0x0000 },
207   /* 0x7400 */
208   {   23, 0x0000 }, {   23, 0x0000 }, {   23, 0x0000 }, {   23, 0x0000 },
209   {   23, 0x1000 }, {   24, 0x0000 }, {   24, 0x0000 }, {   24, 0x0000 },
210   {   24, 0x0000 }, {   24, 0x0000 }, {   24, 0x0000 }, {   24, 0x0000 },
211   {   24, 0x0040 },
212 };
213 static const Summary16 hkscs2008_uni2indx_page79[45] = {
214   /* 0x7900 */
215   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
216   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
217   {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 }, {   25, 0x0000 },
218   {   25, 0x0000 }, {   25, 0x0001 }, {   26, 0x0000 }, {   26, 0x0000 },
219   /* 0x7a00 */
220   {   26, 0x0000 }, {   26, 0x0000 }, {   26, 0x1000 }, {   27, 0x0004 },
221   {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0000 }, {   28, 0x0004 },
222   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 },
223   {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x0000 }, {   29, 0x1000 },
224   /* 0x7b00 */
225   {   30, 0x0000 }, {   30, 0x0000 }, {   30, 0x0000 }, {   30, 0x0000 },
226   {   30, 0x0000 }, {   30, 0x0000 }, {   30, 0x0000 }, {   30, 0x0000 },
227   {   30, 0x0000 }, {   30, 0x0000 }, {   30, 0x4000 }, {   31, 0x0000 },
228   {   31, 0x0020 },
229 };
230 static const Summary16 hkscs2008_uni2indx_page84[34] = {
231   /* 0x8400 */
232   {   32, 0x0000 }, {   32, 0x0000 }, {   32, 0x0000 }, {   32, 0x0000 },
233   {   32, 0x0000 }, {   32, 0x0000 }, {   32, 0x0000 }, {   32, 0x0000 },
234   {   32, 0x0010 }, {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 },
235   {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0000 },
236   /* 0x8500 */
237   {   33, 0x0010 }, {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 },
238   {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 },
239   {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 },
240   {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 }, {   34, 0x0000 },
241   /* 0x8600 */
242   {   34, 0x0000 }, {   34, 0x0008 },
243 };
244 static const Summary16 hkscs2008_uni2indx_page88[10] = {
245   /* 0x8800 */
246   {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 },
247   {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 },
248   {   35, 0x0000 }, {   35, 0x2000 },
249 };
250 static const Summary16 hkscs2008_uni2indx_page8b[9] = {
251   /* 0x8b00 */
252   {   36, 0x0000 }, {   36, 0x0000 }, {   36, 0x0000 }, {   36, 0x0000 },
253   {   36, 0x0000 }, {   36, 0x0000 }, {   36, 0x0000 }, {   36, 0x0000 },
254   {   36, 0x8000 },
255 };
256 static const Summary16 hkscs2008_uni2indx_page90[5] = {
257   /* 0x9000 */
258   {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 }, {   37, 0x0000 },
259   {   37, 0x0040 },
260 };
261 static const Summary16 hkscs2008_uni2indx_page92[2] = {
262   /* 0x9200 */
263   {   38, 0x0000 }, {   38, 0x0100 },
264 };
265 static const Summary16 hkscs2008_uni2indx_page94[3] = {
266   /* 0x9400 */
267   {   39, 0x0000 }, {   39, 0x0000 }, {   39, 0x8000 },
268 };
269 static const Summary16 hkscs2008_uni2indx_page97[5] = {
270   /* 0x9700 */
271   {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 }, {   40, 0x0000 },
272   {   40, 0x0400 },
273 };
274 static const Summary16 hkscs2008_uni2indx_page9f[13] = {
275   /* 0x9f00 */
276   {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 },
277   {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 }, {   41, 0x0000 },
278   {   41, 0x0000 }, {   41, 0x00c0 }, {   43, 0x0000 }, {   43, 0x0000 },
279   {   43, 0x0f80 },
280 };
281 static const Summary16 hkscs2008_uni2indx_page20a[9] = {
282   /* 0x20a00 */
283   {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 },
284   {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 }, {   48, 0x0000 },
285   {   48, 0x0400 },
286 };
287 static const Summary16 hkscs2008_uni2indx_page21d[6] = {
288   /* 0x21d00 */
289   {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 }, {   49, 0x0000 },
290   {   49, 0x0000 }, {   49, 0x0008 },
291 };
292 static const Summary16 hkscs2008_uni2indx_page224[13] = {
293   /* 0x22400 */
294   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 },
295   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 },
296   {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x0000 }, {   50, 0x1000 },
297   {   51, 0x1202 },
298 };
299 static const Summary16 hkscs2008_uni2indx_page231[22] = {
300   /* 0x23100 */
301   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
302   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
303   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0000 },
304   {   54, 0x0000 }, {   54, 0x0000 }, {   54, 0x0400 }, {   55, 0x0000 },
305   /* 0x23200 */
306   {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 }, {   55, 0x0000 },
307   {   55, 0x0000 }, {   55, 0x4000 },
308 };
309 static const Summary16 hkscs2008_uni2indx_page235[26] = {
310   /* 0x23500 */
311   {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 },
312   {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 },
313   {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0000 }, {   56, 0x0800 },
314   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
315   /* 0x23600 */
316   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
317   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 },
318   {   57, 0x4000 }, {   58, 0x4000 },
319 };
320 static const Summary16 hkscs2008_uni2indx_page241[7] = {
321   /* 0x24100 */
322   {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0000 },
323   {   59, 0x0000 }, {   59, 0x0000 }, {   59, 0x0002 },
324 };
325 static const Summary16 hkscs2008_uni2indx_page258[14] = {
326   /* 0x25800 */
327   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 },
328   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 },
329   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 },
330   {   60, 0x0000 }, {   60, 0x4000 },
331 };
332 static const Summary16 hkscs2008_uni2indx_page25d[12] = {
333   /* 0x25d00 */
334   {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 },
335   {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 }, {   61, 0x0000 },
336   {   61, 0x0000 }, {   61, 0x0200 }, {   62, 0x0000 }, {   62, 0x0200 },
337 };
338 static const Summary16 hkscs2008_uni2indx_page260[3] = {
339   /* 0x26000 */
340   {   63, 0x0000 }, {   63, 0x0000 }, {   63, 0x0002 },
341 };
342 static const Summary16 hkscs2008_uni2indx_page26e[9] = {
343   /* 0x26e00 */
344   {   64, 0x0000 }, {   64, 0x0000 }, {   64, 0x0000 }, {   64, 0x0000 },
345   {   64, 0x0000 }, {   64, 0x0000 }, {   64, 0x0000 }, {   64, 0x0000 },
346   {   64, 0x0100 },
347 };
348 static const Summary16 hkscs2008_uni2indx_page27b[7] = {
349   /* 0x27b00 */
350   {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 },
351   {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0020 },
352 };
353 static const Summary16 hkscs2008_uni2indx_page289[1] = {
354   /* 0x28900 */
355   {   66, 0x2000 },
356 };
357 static const Summary16 hkscs2008_uni2indx_page2ad[16] = {
358   /* 0x2ad00 */
359   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 },
360   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 },
361   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 },
362   {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x0000 }, {   67, 0x8000 },
363 };
364
365 static int
366 hkscs2008_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n)
367 {
368   if (n >= 2) {
369     const Summary16 *summary = NULL;
370     if (wc >= 0x3400 && wc < 0x34f0)
371       summary = &hkscs2008_uni2indx_page34[(wc>>4)-0x340];
372     else if (wc >= 0x3800 && wc < 0x3880)
373       summary = &hkscs2008_uni2indx_page38[(wc>>4)-0x380];
374     else if (wc >= 0x3a00 && wc < 0x3b00)
375       summary = &hkscs2008_uni2indx_page3a[(wc>>4)-0x3a0];
376     else if (wc >= 0x3e00 && wc < 0x3ef0)
377       summary = &hkscs2008_uni2indx_page3e[(wc>>4)-0x3e0];
378     else if (wc >= 0x4000 && wc < 0x4190)
379       summary = &hkscs2008_uni2indx_page40[(wc>>4)-0x400];
380     else if (wc >= 0x4300 && wc < 0x44f0)
381       summary = &hkscs2008_uni2indx_page43[(wc>>4)-0x430];
382     else if (wc >= 0x4600 && wc < 0x46b0)
383       summary = &hkscs2008_uni2indx_page46[(wc>>4)-0x460];
384     else if (wc >= 0x4900 && wc < 0x4940)
385       summary = &hkscs2008_uni2indx_page49[(wc>>4)-0x490];
386     else if (wc >= 0x5200 && wc < 0x5250)
387       summary = &hkscs2008_uni2indx_page52[(wc>>4)-0x520];
388     else if (wc >= 0x5400 && wc < 0x5450)
389       summary = &hkscs2008_uni2indx_page54[(wc>>4)-0x540];
390     else if (wc >= 0x5700 && wc < 0x58a0)
391       summary = &hkscs2008_uni2indx_page57[(wc>>4)-0x570];
392     else if (wc >= 0x6200 && wc < 0x62d0)
393       summary = &hkscs2008_uni2indx_page62[(wc>>4)-0x620];
394     else if (wc >= 0x6600 && wc < 0x6790)
395       summary = &hkscs2008_uni2indx_page66[(wc>>4)-0x660];
396     else if (wc >= 0x6a00 && wc < 0x6a30)
397       summary = &hkscs2008_uni2indx_page6a[(wc>>4)-0x6a0];
398     else if (wc >= 0x7000 && wc < 0x7070)
399       summary = &hkscs2008_uni2indx_page70[(wc>>4)-0x700];
400     else if (wc >= 0x7300 && wc < 0x74d0)
401       summary = &hkscs2008_uni2indx_page73[(wc>>4)-0x730];
402     else if (wc >= 0x7900 && wc < 0x7bd0)
403       summary = &hkscs2008_uni2indx_page79[(wc>>4)-0x790];
404     else if (wc >= 0x8400 && wc < 0x8620)
405       summary = &hkscs2008_uni2indx_page84[(wc>>4)-0x840];
406     else if (wc >= 0x8800 && wc < 0x88a0)
407       summary = &hkscs2008_uni2indx_page88[(wc>>4)-0x880];
408     else if (wc >= 0x8b00 && wc < 0x8b90)
409       summary = &hkscs2008_uni2indx_page8b[(wc>>4)-0x8b0];
410     else if (wc >= 0x9000 && wc < 0x9050)
411       summary = &hkscs2008_uni2indx_page90[(wc>>4)-0x900];
412     else if (wc >= 0x9200 && wc < 0x9220)
413       summary = &hkscs2008_uni2indx_page92[(wc>>4)-0x920];
414     else if (wc >= 0x9400 && wc < 0x9430)
415       summary = &hkscs2008_uni2indx_page94[(wc>>4)-0x940];
416     else if (wc >= 0x9700 && wc < 0x9750)
417       summary = &hkscs2008_uni2indx_page97[(wc>>4)-0x970];
418     else if (wc >= 0x9f00 && wc < 0x9fd0)
419       summary = &hkscs2008_uni2indx_page9f[(wc>>4)-0x9f0];
420     else if (wc >= 0x20a00 && wc < 0x20a90)
421       summary = &hkscs2008_uni2indx_page20a[(wc>>4)-0x20a0];
422     else if (wc >= 0x21d00 && wc < 0x21d60)
423       summary = &hkscs2008_uni2indx_page21d[(wc>>4)-0x21d0];
424     else if (wc >= 0x22400 && wc < 0x224d0)
425       summary = &hkscs2008_uni2indx_page224[(wc>>4)-0x2240];
426     else if (wc >= 0x23100 && wc < 0x23260)
427       summary = &hkscs2008_uni2indx_page231[(wc>>4)-0x2310];
428     else if (wc >= 0x23500 && wc < 0x236a0)
429       summary = &hkscs2008_uni2indx_page235[(wc>>4)-0x2350];
430     else if (wc >= 0x24100 && wc < 0x24170)
431       summary = &hkscs2008_uni2indx_page241[(wc>>4)-0x2410];
432     else if (wc >= 0x25800 && wc < 0x258e0)
433       summary = &hkscs2008_uni2indx_page258[(wc>>4)-0x2580];
434     else if (wc >= 0x25d00 && wc < 0x25dc0)
435       summary = &hkscs2008_uni2indx_page25d[(wc>>4)-0x25d0];
436     else if (wc >= 0x26000 && wc < 0x26030)
437       summary = &hkscs2008_uni2indx_page260[(wc>>4)-0x2600];
438     else if (wc >= 0x26e00 && wc < 0x26e90)
439       summary = &hkscs2008_uni2indx_page26e[(wc>>4)-0x26e0];
440     else if (wc >= 0x27b00 && wc < 0x27b70)
441       summary = &hkscs2008_uni2indx_page27b[(wc>>4)-0x27b0];
442     else if (wc >= 0x28900 && wc < 0x28910)
443       summary = &hkscs2008_uni2indx_page289[(wc>>4)-0x2890];
444     else if (wc >= 0x2ad00 && wc < 0x2ae00)
445       summary = &hkscs2008_uni2indx_page2ad[(wc>>4)-0x2ad0];
446     if (summary) {
447       unsigned short used = summary->used;
448       unsigned int i = wc & 0x0f;
449       if (used & ((unsigned short) 1 << i)) {
450         unsigned short c;
451         /* Keep in 'used' only the bits 0..i-1. */
452         used &= ((unsigned short) 1 << i) - 1;
453         /* Add 'summary->indx' and the number of bits set in 'used'. */
454         used = (used & 0x5555) + ((used & 0xaaaa) >> 1);
455         used = (used & 0x3333) + ((used & 0xcccc) >> 2);
456         used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);
457         used = (used & 0x00ff) + (used >> 8);
458         c = hkscs2008_2charset[summary->indx + used];
459         r[0] = (c >> 8); r[1] = (c & 0xff);
460         return 2;
461       }
462     }
463     return RET_ILUNI;
464   }
465   return RET_TOOSMALL;
466 }