2 * Copyright (C) 1999-2001, 2005, 2011, 2016, 2023 Free Software Foundation, Inc.
3 * This file is part of the GNU LIBICONV Library.
5 * The GNU LIBICONV Library is free software; you can redistribute it
6 * and/or modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
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 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
17 * If not, see <https://www.gnu.org/licenses/>.
21 * GB18030 two-byte extension
24 static const unsigned short gb18030ext_2uni_pagea9
[13] = {
26 0x303e, 0x2ff0, 0x2ff1, 0x2ff2, 0x2ff3, 0x2ff4, 0x2ff5, 0x2ff6,
27 0x2ff7, 0x2ff8, 0x2ff9, 0x2ffa, 0x2ffb,
29 static const unsigned int gb18030_2005_ext_2uni_pagefe
[96] = {
31 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
32 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
33 0x2e81, 0x20087, 0x20089, 0x200cc, 0x2e84, 0x3473, 0x3447, 0x2e88,
34 0x2e8b, 0x9fb4, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e,
35 0x3918, 0x9fb5, 0x39cf, 0x39df, 0x3a73, 0x39d0, 0x9fb6, 0x9fb7,
36 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0x215d7, 0x9fb8, 0x2eaa, 0x4056,
37 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0x2298f, 0x43b1,
38 0x43ac, 0x2ebb, 0x43dd, 0x44d6, 0x4661, 0x464c, 0x9fb9, 0x4723,
39 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982,
40 0x4983, 0x4985, 0x4986, 0x499f, 0x499b, 0x49b7, 0x49b6, 0x9fba,
41 0x241fe, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13,
42 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18, 0x4d19, 0x4dae, 0x9fbb,
45 static const unsigned short gb18030_2022_ext_2uni_pagefe
[96] = {
47 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
48 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
49 0x2e81, 0xe816, 0xe817, 0xe818, 0x2e84, 0x3473, 0x3447, 0x2e88,
50 0x2e8b, 0x9fb4, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e,
51 0x3918, 0x9fb5, 0x39cf, 0x39df, 0x3a73, 0x39d0, 0x9fb6, 0x9fb7,
52 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0xe831, 0x9fb8, 0x2eaa, 0x4056,
53 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0xe83b, 0x43b1,
54 0x43ac, 0x2ebb, 0x43dd, 0x44d6, 0x4661, 0x464c, 0x9fb9, 0x4723,
55 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982,
56 0x4983, 0x4985, 0x4986, 0x499f, 0x499b, 0x49b7, 0x49b6, 0x9fba,
57 0xe855, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13,
58 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18, 0x4d19, 0x4dae, 0x9fbb,
62 gb18030_2005_ext_mbtowc (conv_t conv
, ucs4_t
*pwc
, const unsigned char *s
, size_t n
)
64 unsigned char c1
= s
[0];
65 if ((c1
== 0xa2) || (c1
>= 0xa4 && c1
<= 0xa9) || (c1
== 0xd7) || (c1
== 0xfe)) {
67 unsigned char c2
= s
[1];
68 if ((c2
>= 0x40 && c2
< 0x7f) || (c2
>= 0x80 && c2
< 0xff)) {
69 unsigned int i
= 190 * (c1
- 0x81) + (c2
- (c2
>= 0x80 ? 0x41 : 0x40));
70 unsigned int wc
= 0xfffd;
73 if (i
>= 6376 && i
<= 6381) /* 0xA2AB..0xA2B0 */
74 wc
= 0xe766 + (i
- 6376);
75 else if (i
== 6432) /* 0xA2E3 */
77 else if (i
== 6433) /* 0xA2E4 */
79 else if (i
>= 6444 && i
<= 6445) /* 0xA2EF..0xA2F0 */
80 wc
= 0xe76e + (i
- 6444);
81 else if (i
>= 6458 && i
<= 6459) /* 0xA2FD..0xA2FE */
82 wc
= 0xe770 + (i
- 6458);
85 if (i
>= 6829 && i
<= 6839) /* 0xA4F4..0xA4FE */
86 wc
= 0xe772 + (i
- 6829);
89 if (i
>= 7022 && i
<= 7029) /* 0xA5F7..0xA5FE */
90 wc
= 0xe77d + (i
- 7022);
93 if (i
>= 7150 && i
<= 7157) /* 0xA6B9..0xA6C0 */
94 wc
= 0xe785 + (i
- 7150);
95 else if (i
>= 7183 && i
<= 7184) /* 0xA6DA..0xA6DB */
96 wc
= 0xfe12 - (i
- 7183);
97 else if (i
>= 7182 && i
<= 7190) /* 0xA6D9..0xA6DF */
98 wc
= 0xfe10 + (i
- 7182);
99 else if (i
>= 7201 && i
<= 7202) /* 0xA6EC..0xA6ED */
100 wc
= 0xfe17 + (i
- 7201);
101 else if (i
== 7208) /* 0xA6F3 */
103 else if (i
>= 7211 && i
<= 7219) /* 0xA6F6..0xA6FE */
104 wc
= 0xe797 + (i
- 7211);
107 if (i
>= 7349 && i
<= 7363) /* 0xA7C2..0xA7D0 */
108 wc
= 0xe7a0 + (i
- 7349);
109 else if (i
>= 7397 && i
<= 7409) /* 0xA7F2..0xA7FE */
110 wc
= 0xe7af + (i
- 7397);
113 if (i
>= 7495 && i
<= 7505) /* 0xA896..0xA8A0 */
114 wc
= 0xe7bc + (i
- 7495);
115 else if (i
== 7533) /* 0xA8BC */
117 else if (i
== 7536) /* 0xA8BF */
119 else if (i
>= 7538 && i
<= 7541) /* 0xA8C1..0xA8C4 */
120 wc
= 0xe7c9 + (i
- 7538);
121 else if (i
>= 7579 && i
<= 7599) /* 0xA8EA..0xA8FE */
122 wc
= 0xe7cd + (i
- 7579);
125 if (i
== 7624) /* 0xA958 */
127 else if (i
== 7627) /* 0xA95B */
129 else if (i
>= 7629 && i
<= 7631) /* 0xA95D..0xA95F */
130 wc
= 0xe7e4 + (i
- 7629);
131 else if (i
>= 7672 && i
< 7685) /* 0xA989..0xA995 */
132 wc
= gb18030ext_2uni_pagea9
[i
-7672];
133 else if (i
>= 7686 && i
<= 7698) /* 0xA997..0xA9A3 */
134 wc
= 0xe7f4 + (i
- 7686);
135 else if (i
>= 7775 && i
<= 7789) /* 0xA9F0..0xA9FE */
136 wc
= 0xe801 + (i
- 7775);
139 if (i
>= 16525 && i
<= 16529) /* 0xD7FA..0xD7FE */
140 wc
= 0xe810 + (i
- 16525);
144 wc
= gb18030_2005_ext_2uni_pagefe
[i
-23750];
156 return RET_TOOFEW(0);
162 gb18030_2022_ext_mbtowc (conv_t conv
, ucs4_t
*pwc
, const unsigned char *s
, size_t n
)
164 unsigned char c1
= s
[0];
165 if ((c1
== 0xa2) || (c1
>= 0xa4 && c1
<= 0xa9) || (c1
== 0xd7) || (c1
== 0xfe)) {
167 unsigned char c2
= s
[1];
168 if ((c2
>= 0x40 && c2
< 0x7f) || (c2
>= 0x80 && c2
< 0xff)) {
169 unsigned int i
= 190 * (c1
- 0x81) + (c2
- (c2
>= 0x80 ? 0x41 : 0x40));
170 unsigned int wc
= 0xfffd;
173 if (i
>= 6376 && i
<= 6381) /* 0xA2AB..0xA2B0 */
174 wc
= 0xe766 + (i
- 6376);
175 else if (i
== 6432) /* 0xA2E3 */
177 else if (i
== 6433) /* 0xA2E4 */
179 else if (i
>= 6444 && i
<= 6445) /* 0xA2EF..0xA2F0 */
180 wc
= 0xe76e + (i
- 6444);
181 else if (i
>= 6458 && i
<= 6459) /* 0xA2FD..0xA2FE */
182 wc
= 0xe770 + (i
- 6458);
185 if (i
>= 6829 && i
<= 6839) /* 0xA4F4..0xA4FE */
186 wc
= 0xe772 + (i
- 6829);
189 if (i
>= 7022 && i
<= 7029) /* 0xA5F7..0xA5FE */
190 wc
= 0xe77d + (i
- 7022);
193 if (i
>= 7150 && i
<= 7157) /* 0xA6B9..0xA6C0 */
194 wc
= 0xe785 + (i
- 7150);
195 else if (i
>= 7183 && i
<= 7184) /* 0xA6DA..0xA6DB */
196 wc
= 0xfe12 - (i
- 7183);
197 else if (i
>= 7182 && i
<= 7190) /* 0xA6D9..0xA6DF */
198 wc
= 0xfe10 + (i
- 7182);
199 else if (i
>= 7201 && i
<= 7202) /* 0xA6EC..0xA6ED */
200 wc
= 0xfe17 + (i
- 7201);
201 else if (i
== 7208) /* 0xA6F3 */
203 else if (i
>= 7211 && i
<= 7219) /* 0xA6F6..0xA6FE */
204 wc
= 0xe797 + (i
- 7211);
207 if (i
>= 7349 && i
<= 7363) /* 0xA7C2..0xA7D0 */
208 wc
= 0xe7a0 + (i
- 7349);
209 else if (i
>= 7397 && i
<= 7409) /* 0xA7F2..0xA7FE */
210 wc
= 0xe7af + (i
- 7397);
213 if (i
>= 7495 && i
<= 7505) /* 0xA896..0xA8A0 */
214 wc
= 0xe7bc + (i
- 7495);
215 else if (i
== 7533) /* 0xA8BC */
217 else if (i
== 7536) /* 0xA8BF */
219 else if (i
>= 7538 && i
<= 7541) /* 0xA8C1..0xA8C4 */
220 wc
= 0xe7c9 + (i
- 7538);
221 else if (i
>= 7579 && i
<= 7599) /* 0xA8EA..0xA8FE */
222 wc
= 0xe7cd + (i
- 7579);
225 if (i
== 7624) /* 0xA958 */
227 else if (i
== 7627) /* 0xA95B */
229 else if (i
>= 7629 && i
<= 7631) /* 0xA95D..0xA95F */
230 wc
= 0xe7e4 + (i
- 7629);
231 else if (i
>= 7672 && i
< 7685) /* 0xA989..0xA995 */
232 wc
= gb18030ext_2uni_pagea9
[i
-7672];
233 else if (i
>= 7686 && i
<= 7698) /* 0xA997..0xA9A3 */
234 wc
= 0xe7f4 + (i
- 7686);
235 else if (i
>= 7775 && i
<= 7789) /* 0xA9F0..0xA9FE */
236 wc
= 0xe801 + (i
- 7775);
239 if (i
>= 16525 && i
<= 16529) /* 0xD7FA..0xD7FE */
240 wc
= 0xe810 + (i
- 16525);
244 wc
= gb18030_2022_ext_2uni_pagefe
[i
-23750];
256 return RET_TOOFEW(0);
261 static const unsigned short gb18030ext_page2e
[80] = {
262 0x0000, 0xfe50, 0x0000, 0x0000, 0xfe54, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/
263 0xfe57, 0x0000, 0x0000, 0xfe58, 0xfe5d, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/
264 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe5e, /*0x90-0x97*/
265 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/
266 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe6b, /*0xa0-0xa7*/
267 0x0000, 0x0000, 0xfe6e, 0x0000, 0x0000, 0x0000, 0xfe71, 0x0000, /*0xa8-0xaf*/
268 0x0000, 0x0000, 0x0000, 0xfe73, 0x0000, 0x0000, 0xfe74, 0xfe75, /*0xb0-0xb7*/
269 0x0000, 0x0000, 0x0000, 0xfe79, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/
270 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/
271 0x0000, 0x0000, 0xfe84, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/
273 static const unsigned short gb18030ext_page2f
[16] = {
274 0xa98a, 0xa98b, 0xa98c, 0xa98d, 0xa98e, 0xa98f, 0xa990, 0xa991, /*0xf0-0xf7*/
275 0xa992, 0xa993, 0xa994, 0xa995, 0x0000, 0x0000, 0x0000, 0x0000, /*0xf8-0xff*/
277 static const unsigned short gb18030ext_page34
[56] = {
278 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe56, /*0x40-0x47*/
279 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/
280 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/
281 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/
282 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/
283 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/
284 0x0000, 0x0000, 0x0000, 0xfe55, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/
286 static const unsigned short gb18030ext_page36
[24] = {
287 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe5c, 0x0000, /*0x08-0x0f*/
288 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/
289 0x0000, 0x0000, 0xfe5b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/
291 static const unsigned short gb18030ext_page39
[24] = {
292 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe62, /*0xc8-0xcf*/
293 0xfe65, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/
294 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe63, /*0xd8-0xdf*/
296 static const unsigned short gb18030ext_page43
[56] = {
297 0x0000, 0x0000, 0x0000, 0x0000, 0xfe78, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/
298 0x0000, 0xfe77, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/
299 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/
300 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/
301 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/
302 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/
303 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe7a, 0x0000, 0x0000, /*0xd8-0xdf*/
305 static const unsigned short gb18030ext_page46
[32] = {
306 0x0000, 0x0000, 0x0000, 0x0000, 0xfe7d, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/
307 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/
308 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/
309 0x0000, 0xfe7c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/
311 static const unsigned short gb18030ext_page47_1
[16] = {
312 0x0000, 0x0000, 0x0000, 0xfe80, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/
313 0x0000, 0xfe81, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/
315 static const unsigned short gb18030ext_page47_2
[24] = {
316 0x0000, 0x0000, 0x0000, 0x0000, 0xfe82, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/
317 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/
318 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe83, 0x0000, 0x0000, /*0x88-0x8f*/
320 static const unsigned short gb18030ext_page49
[120] = {
321 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe85, /*0x40-0x47*/
322 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/
323 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/
324 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/
325 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/
326 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/
327 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/
328 0x0000, 0x0000, 0xfe86, 0x0000, 0x0000, 0xfe87, 0x0000, 0x0000, /*0x78-0x7f*/
329 0x0000, 0x0000, 0xfe88, 0xfe89, 0x0000, 0xfe8a, 0xfe8b, 0x0000, /*0x80-0x87*/
330 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/
331 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/
332 0x0000, 0x0000, 0x0000, 0xfe8d, 0x0000, 0x0000, 0x0000, 0xfe8c, /*0x98-0x9f*/
333 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/
334 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/
335 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe8f, 0xfe8e, /*0xb0-0xb7*/
337 static const unsigned short gb18030ext_page4c
[56] = {
338 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe96, /*0x70-0x77*/
339 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/
340 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/
341 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/
342 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/
343 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe93, /*0x98-0x9f*/
344 0xfe94, 0xfe95, 0xfe97, 0xfe92, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/
346 static const unsigned short gb18030ext_page4d
[16] = {
347 0x0000, 0x0000, 0x0000, 0xfe98, 0xfe99, 0xfe9a, 0xfe9b, 0xfe9c, /*0x10-0x17*/
348 0xfe9d, 0xfe9e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/
350 static const unsigned short gb18030ext_page9f
[16] = {
351 0x0000, 0x0000, 0x0000, 0x0000, 0xfe59, 0xfe61, 0xfe66, 0xfe67, /*0xb0-0xb7*/
352 0xfe6d, 0xfe7e, 0xfe90, 0xfea0, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/
354 static const unsigned short gb18030ext_pagefe
[16] = {
355 0xa6d9, 0xa6db, 0xa6da, 0xa6dc, 0xa6dd, 0xa6de, 0xa6df, 0xa6ec, /*0x10-0x17*/
356 0xa6ed, 0xa6f3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/
360 gb18030ext_wctomb (conv_t conv
, unsigned char *r
, ucs4_t wc
, size_t n
)
363 unsigned short c
= 0;
366 else if (wc
== 0x1e3f)
368 else if (wc
== 0x20ac)
370 else if (wc
>= 0x2e80 && wc
< 0x2ed0)
371 c
= gb18030ext_page2e
[wc
-0x2e80];
372 else if (wc
>= 0x2ff0 && wc
< 0x3000)
373 c
= gb18030ext_page2f
[wc
-0x2ff0];
374 else if (wc
== 0x303e)
376 else if (wc
>= 0x3440 && wc
< 0x3478)
377 c
= gb18030ext_page34
[wc
-0x3440];
378 else if (wc
== 0x359e)
380 else if (wc
>= 0x3608 && wc
< 0x3620)
381 c
= gb18030ext_page36
[wc
-0x3608];
382 else if (wc
== 0x3918)
384 else if (wc
== 0x396e)
386 else if (wc
>= 0x39c8 && wc
< 0x39e0)
387 c
= gb18030ext_page39
[wc
-0x39c8];
388 else if (wc
== 0x3a73)
390 else if (wc
== 0x3b4e)
392 else if (wc
== 0x3c6e)
394 else if (wc
== 0x3ce0)
396 else if (wc
== 0x4056)
398 else if (wc
== 0x415f)
400 else if (wc
== 0x4337)
402 else if (wc
>= 0x43a8 && wc
< 0x43e0)
403 c
= gb18030ext_page43
[wc
-0x43a8];
404 else if (wc
== 0x44d6)
406 else if (wc
>= 0x4648 && wc
< 0x4668)
407 c
= gb18030ext_page46
[wc
-0x4648];
408 else if (wc
>= 0x4720 && wc
< 0x4730)
409 c
= gb18030ext_page47_1
[wc
-0x4720];
410 else if (wc
>= 0x4778 && wc
< 0x4790)
411 c
= gb18030ext_page47_2
[wc
-0x4778];
412 else if (wc
>= 0x4940 && wc
< 0x49b8)
413 c
= gb18030ext_page49
[wc
-0x4940];
414 else if (wc
>= 0x4c70 && wc
< 0x4ca8)
415 c
= gb18030ext_page4c
[wc
-0x4c70];
416 else if (wc
>= 0x4d10 && wc
< 0x4d20)
417 c
= gb18030ext_page4d
[wc
-0x4d10];
418 else if (wc
== 0x4dae)
420 else if (wc
>= 0x9fb4 && wc
< 0x9fbc)
421 c
= gb18030ext_page9f
[wc
-0x9fb0];
422 else if (wc
>= 0xfe10 && wc
< 0xfe1a)
423 c
= gb18030ext_pagefe
[wc
-0xfe10];
425 r
[0] = (c
>> 8); r
[1] = (c
& 0xff);