xref: /haiku/src/libs/iconv/cp932ext.h (revision aef5731f38da6f7b913e0f64acd8a40555491ce5)
1 /*
2  * Copyright (C) 1999-2001 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  * CP932 extensions
23  */
24 
25 static const unsigned short cp932ext_2uni_page87[92] = {
26   /* 0x87 */
27   0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
28   0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f,
29   0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, 0x2163,
30   0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0xfffd, 0x3349,
31   0x3314, 0x3322, 0x334d, 0x3318, 0x3327, 0x3303, 0x3336, 0x3351,
32   0x3357, 0x330d, 0x3326, 0x3323, 0x332b, 0x334a, 0x333b, 0x339c,
33   0x339d, 0x339e, 0x338e, 0x338f, 0x33c4, 0x33a1, 0xfffd, 0xfffd,
34   0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x337b, 0x301d,
35   0x301f, 0x2116, 0x33cd, 0x2121, 0x32a4, 0x32a5, 0x32a6, 0x32a7,
36   0x32a8, 0x3231, 0x3232, 0x3239, 0x337e, 0x337d, 0x337c, 0x2252,
37   0x2261, 0x222b, 0x222e, 0x2211, 0x221a, 0x22a5, 0x2220, 0x221f,
38   0x22bf, 0x2235, 0x2229, 0x222a,
39 };
40 static const unsigned short cp932ext_2uni_pageed[376] = {
41   /* 0xed */
42   0x7e8a, 0x891c, 0x9348, 0x9288, 0x84dc, 0x4fc9, 0x70bb, 0x6631,
43   0x68c8, 0x92f9, 0x66fb, 0x5f45, 0x4e28, 0x4ee1, 0x4efc, 0x4f00,
44   0x4f03, 0x4f39, 0x4f56, 0x4f92, 0x4f8a, 0x4f9a, 0x4f94, 0x4fcd,
45   0x5040, 0x5022, 0x4fff, 0x501e, 0x5046, 0x5070, 0x5042, 0x5094,
46   0x50f4, 0x50d8, 0x514a, 0x5164, 0x519d, 0x51be, 0x51ec, 0x5215,
47   0x529c, 0x52a6, 0x52c0, 0x52db, 0x5300, 0x5307, 0x5324, 0x5372,
48   0x5393, 0x53b2, 0x53dd, 0xfa0e, 0x549c, 0x548a, 0x54a9, 0x54ff,
49   0x5586, 0x5759, 0x5765, 0x57ac, 0x57c8, 0x57c7, 0xfa0f, 0xfa10,
50   0x589e, 0x58b2, 0x590b, 0x5953, 0x595b, 0x595d, 0x5963, 0x59a4,
51   0x59ba, 0x5b56, 0x5bc0, 0x752f, 0x5bd8, 0x5bec, 0x5c1e, 0x5ca6,
52   0x5cba, 0x5cf5, 0x5d27, 0x5d53, 0xfa11, 0x5d42, 0x5d6d, 0x5db8,
53   0x5db9, 0x5dd0, 0x5f21, 0x5f34, 0x5f67, 0x5fb7, 0x5fde, 0x605d,
54   0x6085, 0x608a, 0x60de, 0x60d5, 0x6120, 0x60f2, 0x6111, 0x6137,
55   0x6130, 0x6198, 0x6213, 0x62a6, 0x63f5, 0x6460, 0x649d, 0x64ce,
56   0x654e, 0x6600, 0x6615, 0x663b, 0x6609, 0x662e, 0x661e, 0x6624,
57   0x6665, 0x6657, 0x6659, 0xfa12, 0x6673, 0x6699, 0x66a0, 0x66b2,
58   0x66bf, 0x66fa, 0x670e, 0xf929, 0x6766, 0x67bb, 0x6852, 0x67c0,
59   0x6801, 0x6844, 0x68cf, 0xfa13, 0x6968, 0xfa14, 0x6998, 0x69e2,
60   0x6a30, 0x6a6b, 0x6a46, 0x6a73, 0x6a7e, 0x6ae2, 0x6ae4, 0x6bd6,
61   0x6c3f, 0x6c5c, 0x6c86, 0x6c6f, 0x6cda, 0x6d04, 0x6d87, 0x6d6f,
62   0x6d96, 0x6dac, 0x6dcf, 0x6df8, 0x6df2, 0x6dfc, 0x6e39, 0x6e5c,
63   0x6e27, 0x6e3c, 0x6ebf, 0x6f88, 0x6fb5, 0x6ff5, 0x7005, 0x7007,
64   0x7028, 0x7085, 0x70ab, 0x710f, 0x7104, 0x715c, 0x7146, 0x7147,
65   0xfa15, 0x71c1, 0x71fe, 0x72b1,
66   /* 0xee */
67   0x72be, 0x7324, 0xfa16, 0x7377, 0x73bd, 0x73c9, 0x73d6, 0x73e3,
68   0x73d2, 0x7407, 0x73f5, 0x7426, 0x742a, 0x7429, 0x742e, 0x7462,
69   0x7489, 0x749f, 0x7501, 0x756f, 0x7682, 0x769c, 0x769e, 0x769b,
70   0x76a6, 0xfa17, 0x7746, 0x52af, 0x7821, 0x784e, 0x7864, 0x787a,
71   0x7930, 0xfa18, 0xfa19, 0xfa1a, 0x7994, 0xfa1b, 0x799b, 0x7ad1,
72   0x7ae7, 0xfa1c, 0x7aeb, 0x7b9e, 0xfa1d, 0x7d48, 0x7d5c, 0x7db7,
73   0x7da0, 0x7dd6, 0x7e52, 0x7f47, 0x7fa1, 0xfa1e, 0x8301, 0x8362,
74   0x837f, 0x83c7, 0x83f6, 0x8448, 0x84b4, 0x8553, 0x8559, 0x856b,
75   0xfa1f, 0x85b0, 0xfa20, 0xfa21, 0x8807, 0x88f5, 0x8a12, 0x8a37,
76   0x8a79, 0x8aa7, 0x8abe, 0x8adf, 0xfa22, 0x8af6, 0x8b53, 0x8b7f,
77   0x8cf0, 0x8cf4, 0x8d12, 0x8d76, 0xfa23, 0x8ecf, 0xfa24, 0xfa25,
78   0x9067, 0x90de, 0xfa26, 0x9115, 0x9127, 0x91da, 0x91d7, 0x91de,
79   0x91ed, 0x91ee, 0x91e4, 0x91e5, 0x9206, 0x9210, 0x920a, 0x923a,
80   0x9240, 0x923c, 0x924e, 0x9259, 0x9251, 0x9239, 0x9267, 0x92a7,
81   0x9277, 0x9278, 0x92e7, 0x92d7, 0x92d9, 0x92d0, 0xfa27, 0x92d5,
82   0x92e0, 0x92d3, 0x9325, 0x9321, 0x92fb, 0xfa28, 0x931e, 0x92ff,
83   0x931d, 0x9302, 0x9370, 0x9357, 0x93a4, 0x93c6, 0x93de, 0x93f8,
84   0x9431, 0x9445, 0x9448, 0x9592, 0xf9dc, 0xfa29, 0x969d, 0x96af,
85   0x9733, 0x973b, 0x9743, 0x974d, 0x974f, 0x9751, 0x9755, 0x9857,
86   0x9865, 0xfa2a, 0xfa2b, 0x9927, 0xfa2c, 0x999e, 0x9a4e, 0x9ad9,
87   0x9adc, 0x9b75, 0x9b72, 0x9b8f, 0x9bb1, 0x9bbb, 0x9c00, 0x9d70,
88   0x9d6b, 0xfa2d, 0x9e19, 0x9ed1, 0xfffd, 0xfffd, 0x2170, 0x2171,
89   0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179,
90   0xffe2, 0xffe4, 0xff07, 0xff02,
91 };
92 static const unsigned short cp932ext_2uni_pagefa[388] = {
93   /* 0xfa */
94   0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177,
95   0x2178, 0x2179, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165,
96   0x2166, 0x2167, 0x2168, 0x2169, 0xffe2, 0xffe4, 0xff07, 0xff02,
97   0x3231, 0x2116, 0x2121, 0x2235, 0x7e8a, 0x891c, 0x9348, 0x9288,
98   0x84dc, 0x4fc9, 0x70bb, 0x6631, 0x68c8, 0x92f9, 0x66fb, 0x5f45,
99   0x4e28, 0x4ee1, 0x4efc, 0x4f00, 0x4f03, 0x4f39, 0x4f56, 0x4f92,
100   0x4f8a, 0x4f9a, 0x4f94, 0x4fcd, 0x5040, 0x5022, 0x4fff, 0x501e,
101   0x5046, 0x5070, 0x5042, 0x5094, 0x50f4, 0x50d8, 0x514a, 0x5164,
102   0x519d, 0x51be, 0x51ec, 0x5215, 0x529c, 0x52a6, 0x52c0, 0x52db,
103   0x5300, 0x5307, 0x5324, 0x5372, 0x5393, 0x53b2, 0x53dd, 0xfa0e,
104   0x549c, 0x548a, 0x54a9, 0x54ff, 0x5586, 0x5759, 0x5765, 0x57ac,
105   0x57c8, 0x57c7, 0xfa0f, 0xfa10, 0x589e, 0x58b2, 0x590b, 0x5953,
106   0x595b, 0x595d, 0x5963, 0x59a4, 0x59ba, 0x5b56, 0x5bc0, 0x752f,
107   0x5bd8, 0x5bec, 0x5c1e, 0x5ca6, 0x5cba, 0x5cf5, 0x5d27, 0x5d53,
108   0xfa11, 0x5d42, 0x5d6d, 0x5db8, 0x5db9, 0x5dd0, 0x5f21, 0x5f34,
109   0x5f67, 0x5fb7, 0x5fde, 0x605d, 0x6085, 0x608a, 0x60de, 0x60d5,
110   0x6120, 0x60f2, 0x6111, 0x6137, 0x6130, 0x6198, 0x6213, 0x62a6,
111   0x63f5, 0x6460, 0x649d, 0x64ce, 0x654e, 0x6600, 0x6615, 0x663b,
112   0x6609, 0x662e, 0x661e, 0x6624, 0x6665, 0x6657, 0x6659, 0xfa12,
113   0x6673, 0x6699, 0x66a0, 0x66b2, 0x66bf, 0x66fa, 0x670e, 0xf929,
114   0x6766, 0x67bb, 0x6852, 0x67c0, 0x6801, 0x6844, 0x68cf, 0xfa13,
115   0x6968, 0xfa14, 0x6998, 0x69e2, 0x6a30, 0x6a6b, 0x6a46, 0x6a73,
116   0x6a7e, 0x6ae2, 0x6ae4, 0x6bd6, 0x6c3f, 0x6c5c, 0x6c86, 0x6c6f,
117   0x6cda, 0x6d04, 0x6d87, 0x6d6f,
118   /* 0xfb */
119   0x6d96, 0x6dac, 0x6dcf, 0x6df8, 0x6df2, 0x6dfc, 0x6e39, 0x6e5c,
120   0x6e27, 0x6e3c, 0x6ebf, 0x6f88, 0x6fb5, 0x6ff5, 0x7005, 0x7007,
121   0x7028, 0x7085, 0x70ab, 0x710f, 0x7104, 0x715c, 0x7146, 0x7147,
122   0xfa15, 0x71c1, 0x71fe, 0x72b1, 0x72be, 0x7324, 0xfa16, 0x7377,
123   0x73bd, 0x73c9, 0x73d6, 0x73e3, 0x73d2, 0x7407, 0x73f5, 0x7426,
124   0x742a, 0x7429, 0x742e, 0x7462, 0x7489, 0x749f, 0x7501, 0x756f,
125   0x7682, 0x769c, 0x769e, 0x769b, 0x76a6, 0xfa17, 0x7746, 0x52af,
126   0x7821, 0x784e, 0x7864, 0x787a, 0x7930, 0xfa18, 0xfa19, 0xfa1a,
127   0x7994, 0xfa1b, 0x799b, 0x7ad1, 0x7ae7, 0xfa1c, 0x7aeb, 0x7b9e,
128   0xfa1d, 0x7d48, 0x7d5c, 0x7db7, 0x7da0, 0x7dd6, 0x7e52, 0x7f47,
129   0x7fa1, 0xfa1e, 0x8301, 0x8362, 0x837f, 0x83c7, 0x83f6, 0x8448,
130   0x84b4, 0x8553, 0x8559, 0x856b, 0xfa1f, 0x85b0, 0xfa20, 0xfa21,
131   0x8807, 0x88f5, 0x8a12, 0x8a37, 0x8a79, 0x8aa7, 0x8abe, 0x8adf,
132   0xfa22, 0x8af6, 0x8b53, 0x8b7f, 0x8cf0, 0x8cf4, 0x8d12, 0x8d76,
133   0xfa23, 0x8ecf, 0xfa24, 0xfa25, 0x9067, 0x90de, 0xfa26, 0x9115,
134   0x9127, 0x91da, 0x91d7, 0x91de, 0x91ed, 0x91ee, 0x91e4, 0x91e5,
135   0x9206, 0x9210, 0x920a, 0x923a, 0x9240, 0x923c, 0x924e, 0x9259,
136   0x9251, 0x9239, 0x9267, 0x92a7, 0x9277, 0x9278, 0x92e7, 0x92d7,
137   0x92d9, 0x92d0, 0xfa27, 0x92d5, 0x92e0, 0x92d3, 0x9325, 0x9321,
138   0x92fb, 0xfa28, 0x931e, 0x92ff, 0x931d, 0x9302, 0x9370, 0x9357,
139   0x93a4, 0x93c6, 0x93de, 0x93f8, 0x9431, 0x9445, 0x9448, 0x9592,
140   0xf9dc, 0xfa29, 0x969d, 0x96af, 0x9733, 0x973b, 0x9743, 0x974d,
141   0x974f, 0x9751, 0x9755, 0x9857, 0x9865, 0xfa2a, 0xfa2b, 0x9927,
142   0xfa2c, 0x999e, 0x9a4e, 0x9ad9,
143   /* 0xfc */
144   0x9adc, 0x9b75, 0x9b72, 0x9b8f, 0x9bb1, 0x9bbb, 0x9c00, 0x9d70,
145   0x9d6b, 0xfa2d, 0x9e19, 0x9ed1,
146 };
147 
148 static int
cp932ext_mbtowc(conv_t conv,ucs4_t * pwc,const unsigned char * s,int n)149 cp932ext_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
150 {
151   unsigned char c1 = s[0];
152   if ((c1 == 0x87) || (c1 >= 0xed && c1 <= 0xee) || (c1 >= 0xfa && c1 <= 0xfc)) {
153     if (n >= 2) {
154       unsigned char c2 = s[1];
155       if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xfd)) {
156         unsigned int i = 188 * (c1 - (c1 >= 0xe0 ? 0xc1 : 0x81)) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40));
157         unsigned short wc = 0xfffd;
158         if (i < 8272) {
159           if (i < 1220)
160             wc = cp932ext_2uni_page87[i-1128];
161         } else if (i < 10716) {
162           if (i < 8648)
163             wc = cp932ext_2uni_pageed[i-8272];
164         } else {
165           if (i < 11104)
166             wc = cp932ext_2uni_pagefa[i-10716];
167         }
168         if (wc != 0xfffd) {
169           *pwc = (ucs4_t) wc;
170           return 2;
171         }
172       }
173       return RET_ILSEQ;
174     }
175     return RET_TOOFEW(0);
176   }
177   return RET_ILSEQ;
178 }
179 
180 static const unsigned short cp932ext_2charset[457] = {
181   0xfa59, 0xfa5a, 0xfa4a, 0xfa4b, 0xfa4c, 0xfa4d, 0xfa4e, 0xfa4f,
182   0xfa50, 0xfa51, 0xfa52, 0xfa53, 0xfa40, 0xfa41, 0xfa42, 0xfa43,
183   0xfa44, 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0x8794, 0x8795,
184   0x8798, 0x8797, 0x879b, 0x879c, 0x8792, 0x8793, 0xfa5b, 0x8790,
185   0x8791, 0x8796, 0x8799, 0x8740, 0x8741, 0x8742, 0x8743, 0x8744,
186   0x8745, 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c,
187   0x874d, 0x874e, 0x874f, 0x8750, 0x8751, 0x8752, 0x8753, 0x8780,
188   0x8781, 0xfa58, 0x878b, 0x878c, 0x8785, 0x8786, 0x8787, 0x8788,
189   0x8789, 0x8765, 0x8769, 0x8760, 0x8763, 0x8761, 0x876b, 0x876a,
190   0x8764, 0x876c, 0x8766, 0x876e, 0x875f, 0x876d, 0x8762, 0x8767,
191   0x8768, 0x877e, 0x878f, 0x878e, 0x878d, 0x8772, 0x8773, 0x876f,
192   0x8770, 0x8771, 0x8775, 0x8774, 0x8783, 0xfa68, 0xfa69, 0xfa6a,
193   0xfa6b, 0xfa6c, 0xfa6d, 0xfa6e, 0xfa70, 0xfa6f, 0xfa72, 0xfa71,
194   0xfa61, 0xfa73, 0xfa76, 0xfa77, 0xfa75, 0xfa74, 0xfa7a, 0xfa78,
195   0xfa79, 0xfa7b, 0xfa7d, 0xfa7c, 0xfa7e, 0xfa80, 0xfa81, 0xfa82,
196   0xfa83, 0xfa84, 0xfa85, 0xfa86, 0xfb77, 0xfa87, 0xfa88, 0xfa89,
197   0xfa8a, 0xfa8b, 0xfa8c, 0xfa8d, 0xfa8e, 0xfa8f, 0xfa92, 0xfa91,
198   0xfa93, 0xfa94, 0xfa95, 0xfa96, 0xfa97, 0xfa98, 0xfa9a, 0xfa99,
199   0xfa9d, 0xfa9e, 0xfa9f, 0xfaa0, 0xfaa1, 0xfaa2, 0xfaa3, 0xfaa4,
200   0xfaa5, 0xfaa6, 0xfaa7, 0xfaa9, 0xfaaa, 0xfaab, 0xfaac, 0xfaad,
201   0xfaae, 0xfaaf, 0xfab2, 0xfab0, 0xfab3, 0xfab4, 0xfab5, 0xfab6,
202   0xfab7, 0xfab8, 0xfa67, 0xfab9, 0xfaba, 0xfabb, 0xfabc, 0xfabd,
203   0xfabe, 0xfac0, 0xfabf, 0xfac2, 0xfac3, 0xfac1, 0xfac5, 0xfac4,
204   0xfac6, 0xfac7, 0xfac8, 0xfac9, 0xfaca, 0xfacb, 0xfacc, 0xfacd,
205   0xface, 0xfad1, 0xfacf, 0xfad3, 0xfad4, 0xfad2, 0xfa63, 0xfad0,
206   0xfad6, 0xfad7, 0xfad5, 0xfad9, 0xfada, 0xfadb, 0xfadc, 0xfadd,
207   0xfade, 0xfa66, 0xfadf, 0xfae1, 0xfae2, 0xfae4, 0xfae5, 0xfae6,
208   0xfae3, 0xfa64, 0xfae7, 0xfae9, 0xfaeb, 0xfaec, 0xfaed, 0xfaef,
209   0xfaee, 0xfaf0, 0xfaf1, 0xfaf2, 0xfaf3, 0xfaf4, 0xfaf5, 0xfaf6,
210   0xfaf8, 0xfaf7, 0xfaf9, 0xfafa, 0xfafc, 0xfafb, 0xfb40, 0xfb41,
211   0xfb42, 0xfb44, 0xfb43, 0xfb45, 0xfb48, 0xfb46, 0xfb49, 0xfb47,
212   0xfb4a, 0xfb4b, 0xfb4c, 0xfb4d, 0xfb4e, 0xfb4f, 0xfb50, 0xfb51,
213   0xfb52, 0xfa62, 0xfb54, 0xfb53, 0xfb56, 0xfb57, 0xfb55, 0xfb59,
214   0xfb5a, 0xfb5b, 0xfb5c, 0xfb5d, 0xfb5f, 0xfb60, 0xfb61, 0xfb64,
215   0xfb62, 0xfb63, 0xfb66, 0xfb65, 0xfb67, 0xfb69, 0xfb68, 0xfb6a,
216   0xfb6b, 0xfb6c, 0xfb6d, 0xfb6e, 0xfaa8, 0xfb6f, 0xfb70, 0xfb73,
217   0xfb71, 0xfb72, 0xfb74, 0xfb76, 0xfb78, 0xfb79, 0xfb7a, 0xfb7b,
218   0xfb7c, 0xfb81, 0xfb83, 0xfb84, 0xfb85, 0xfb87, 0xfb88, 0xfb8a,
219   0xfb8b, 0xfb8d, 0xfb8c, 0xfb8e, 0xfb8f, 0xfa5c, 0xfb90, 0xfb91,
220   0xfb93, 0xfb94, 0xfb95, 0xfb96, 0xfb97, 0xfb98, 0xfb99, 0xfa60,
221   0xfb9a, 0xfb9b, 0xfb9c, 0xfb9e, 0xfba1, 0xfba2, 0xfa5d, 0xfba3,
222   0xfba4, 0xfba5, 0xfba6, 0xfba7, 0xfba8, 0xfbaa, 0xfbab, 0xfbac,
223   0xfbad, 0xfbae, 0xfbaf, 0xfbb0, 0xfbb2, 0xfbb5, 0xfbb6, 0xfbb8,
224   0xfbb9, 0xfbbb, 0xfbba, 0xfbbc, 0xfbbf, 0xfbc0, 0xfbbd, 0xfbbe,
225   0xfbc1, 0xfbc3, 0xfbc2, 0xfbca, 0xfbc4, 0xfbc6, 0xfbc5, 0xfbc7,
226   0xfbc9, 0xfbc8, 0xfbcb, 0xfbcd, 0xfbce, 0xfa5f, 0xfbcc, 0xfbd2,
227   0xfbd6, 0xfbd4, 0xfbd0, 0xfbd1, 0xfbd5, 0xfbcf, 0xfa65, 0xfbd9,
228   0xfbdc, 0xfbde, 0xfbdd, 0xfbdb, 0xfbd8, 0xfbd7, 0xfa5e, 0xfbe0,
229   0xfbdf, 0xfbe1, 0xfbe2, 0xfbe3, 0xfbe4, 0xfbe5, 0xfbe6, 0xfbe7,
230   0xfbe8, 0xfbeb, 0xfbec, 0xfbed, 0xfbee, 0xfbef, 0xfbf0, 0xfbf1,
231   0xfbf2, 0xfbf3, 0xfbf4, 0xfbf5, 0xfbf8, 0xfbfa, 0xfbfb, 0xfbfc,
232   0xfc40, 0xfc42, 0xfc41, 0xfc43, 0xfc44, 0xfc45, 0xfc46, 0xfc48,
233   0xfc47, 0xfc4a, 0xfc4b, 0xfae0, 0xfbe9, 0xfa90, 0xfa9b, 0xfa9c,
234   0xfab1, 0xfad8, 0xfae8, 0xfaea, 0xfb58, 0xfb5e, 0xfb75, 0xfb7d,
235   0xfb7e, 0xfb80, 0xfb82, 0xfb86, 0xfb89, 0xfb92, 0xfb9d, 0xfb9f,
236   0xfba0, 0xfba9, 0xfbb1, 0xfbb3, 0xfbb4, 0xfbb7, 0xfbd3, 0xfbda,
237   0xfbea, 0xfbf6, 0xfbf7, 0xfbf9, 0xfc49, 0xfa57, 0xfa56, 0xfa54,
238   0xfa55,
239 };
240 
241 static const Summary16 cp932ext_uni2indx_page21[28] = {
242   /* 0x2100 */
243   {    0, 0x0000 }, {    0, 0x0040 }, {    1, 0x0002 }, {    2, 0x0000 },
244   {    2, 0x0000 }, {    2, 0x0000 }, {    2, 0x03ff }, {   12, 0x03ff },
245   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
246   {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 }, {   22, 0x0000 },
247   /* 0x2200 */
248   {   22, 0x0000 }, {   22, 0x8402 }, {   25, 0x4e01 }, {   30, 0x0020 },
249   {   31, 0x0000 }, {   31, 0x0004 }, {   32, 0x0002 }, {   33, 0x0000 },
250   {   33, 0x0000 }, {   33, 0x0000 }, {   33, 0x0020 }, {   34, 0x8000 },
251 };
252 static const Summary16 cp932ext_uni2indx_page24[8] = {
253   /* 0x2400 */
254   {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0x0000 },
255   {   35, 0x0000 }, {   35, 0x0000 }, {   35, 0xffff }, {   51, 0x000f },
256 };
257 static const Summary16 cp932ext_uni2indx_page30[2] = {
258   /* 0x3000 */
259   {   55, 0x0000 }, {   55, 0xa000 },
260 };
261 static const Summary16 cp932ext_uni2indx_page32[29] = {
262   /* 0x3200 */
263   {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0000 }, {   57, 0x0206 },
264   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x0000 },
265   {   60, 0x0000 }, {   60, 0x0000 }, {   60, 0x01f0 }, {   65, 0x0000 },
266   {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 }, {   65, 0x0000 },
267   /* 0x3300 */
268   {   65, 0x2008 }, {   67, 0x0110 }, {   69, 0x08cc }, {   74, 0x0840 },
269   {   76, 0x2600 }, {   79, 0x0082 }, {   81, 0x0000 }, {   81, 0x7800 },
270   {   85, 0xc000 }, {   87, 0x7000 }, {   90, 0x0002 }, {   91, 0x0000 },
271   {   91, 0x2010 },
272 };
273 static const Summary16 cp932ext_uni2indx_page4e[121] = {
274   /* 0x4e00 */
275   {   93, 0x0000 }, {   93, 0x0000 }, {   93, 0x0100 }, {   94, 0x0000 },
276   {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 },
277   {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0000 },
278   {   94, 0x0000 }, {   94, 0x0000 }, {   94, 0x0002 }, {   95, 0x1000 },
279   /* 0x4f00 */
280   {   96, 0x0009 }, {   98, 0x0000 }, {   98, 0x0000 }, {   98, 0x0200 },
281   {   99, 0x0000 }, {   99, 0x0040 }, {  100, 0x0000 }, {  100, 0x0000 },
282   {  100, 0x0400 }, {  101, 0x0414 }, {  104, 0x0000 }, {  104, 0x0000 },
283   {  104, 0x2200 }, {  106, 0x0000 }, {  106, 0x0000 }, {  106, 0x8000 },
284   /* 0x5000 */
285   {  107, 0x0000 }, {  107, 0x4000 }, {  108, 0x0004 }, {  109, 0x0000 },
286   {  109, 0x0045 }, {  112, 0x0000 }, {  112, 0x0000 }, {  112, 0x0001 },
287   {  113, 0x0000 }, {  113, 0x0010 }, {  114, 0x0000 }, {  114, 0x0000 },
288   {  114, 0x0000 }, {  114, 0x0100 }, {  115, 0x0000 }, {  115, 0x0010 },
289   /* 0x5100 */
290   {  116, 0x0000 }, {  116, 0x0000 }, {  116, 0x0000 }, {  116, 0x0000 },
291   {  116, 0x0400 }, {  117, 0x0000 }, {  117, 0x0010 }, {  118, 0x0000 },
292   {  118, 0x0000 }, {  118, 0x2000 }, {  119, 0x0000 }, {  119, 0x4000 },
293   {  120, 0x0000 }, {  120, 0x0000 }, {  120, 0x1000 }, {  121, 0x0000 },
294   /* 0x5200 */
295   {  121, 0x0000 }, {  121, 0x0020 }, {  122, 0x0000 }, {  122, 0x0000 },
296   {  122, 0x0000 }, {  122, 0x0000 }, {  122, 0x0000 }, {  122, 0x0000 },
297   {  122, 0x0000 }, {  122, 0x1000 }, {  123, 0x8040 }, {  125, 0x0000 },
298   {  125, 0x0001 }, {  126, 0x0800 }, {  127, 0x0000 }, {  127, 0x0000 },
299   /* 0x5300 */
300   {  127, 0x0081 }, {  129, 0x0000 }, {  129, 0x0010 }, {  130, 0x0000 },
301   {  130, 0x0000 }, {  130, 0x0000 }, {  130, 0x0000 }, {  130, 0x0004 },
302   {  131, 0x0000 }, {  131, 0x0008 }, {  132, 0x0000 }, {  132, 0x0004 },
303   {  133, 0x0000 }, {  133, 0x2000 }, {  134, 0x0000 }, {  134, 0x0000 },
304   /* 0x5400 */
305   {  134, 0x0000 }, {  134, 0x0000 }, {  134, 0x0000 }, {  134, 0x0000 },
306   {  134, 0x0000 }, {  134, 0x0000 }, {  134, 0x0000 }, {  134, 0x0000 },
307   {  134, 0x0400 }, {  135, 0x1000 }, {  136, 0x0200 }, {  137, 0x0000 },
308   {  137, 0x0000 }, {  137, 0x0000 }, {  137, 0x0000 }, {  137, 0x8000 },
309   /* 0x5500 */
310   {  138, 0x0000 }, {  138, 0x0000 }, {  138, 0x0000 }, {  138, 0x0000 },
311   {  138, 0x0000 }, {  138, 0x0000 }, {  138, 0x0000 }, {  138, 0x0000 },
312   {  138, 0x0040 },
313 };
314 static const Summary16 cp932ext_uni2indx_page57[44] = {
315   /* 0x5700 */
316   {  139, 0x0000 }, {  139, 0x0000 }, {  139, 0x0000 }, {  139, 0x0000 },
317   {  139, 0x0000 }, {  139, 0x0200 }, {  140, 0x0020 }, {  141, 0x0000 },
318   {  141, 0x0000 }, {  141, 0x0000 }, {  141, 0x1000 }, {  142, 0x0000 },
319   {  142, 0x0180 }, {  144, 0x0000 }, {  144, 0x0000 }, {  144, 0x0000 },
320   /* 0x5800 */
321   {  144, 0x0000 }, {  144, 0x0000 }, {  144, 0x0000 }, {  144, 0x0000 },
322   {  144, 0x0000 }, {  144, 0x0000 }, {  144, 0x0000 }, {  144, 0x0000 },
323   {  144, 0x0000 }, {  144, 0x4000 }, {  145, 0x0000 }, {  145, 0x0004 },
324   {  146, 0x0000 }, {  146, 0x0000 }, {  146, 0x0000 }, {  146, 0x0000 },
325   /* 0x5900 */
326   {  146, 0x0800 }, {  147, 0x0000 }, {  147, 0x0000 }, {  147, 0x0000 },
327   {  147, 0x0000 }, {  147, 0x2808 }, {  150, 0x0008 }, {  151, 0x0000 },
328   {  151, 0x0000 }, {  151, 0x0000 }, {  151, 0x0010 }, {  152, 0x0400 },
329 };
330 static const Summary16 cp932ext_uni2indx_page5b[46] = {
331   /* 0x5b00 */
332   {  153, 0x0000 }, {  153, 0x0000 }, {  153, 0x0000 }, {  153, 0x0000 },
333   {  153, 0x0000 }, {  153, 0x0040 }, {  154, 0x0000 }, {  154, 0x0000 },
334   {  154, 0x0000 }, {  154, 0x0000 }, {  154, 0x0000 }, {  154, 0x0000 },
335   {  154, 0x0001 }, {  155, 0x0100 }, {  156, 0x1000 }, {  157, 0x0000 },
336   /* 0x5c00 */
337   {  157, 0x0000 }, {  157, 0x4000 }, {  158, 0x0000 }, {  158, 0x0000 },
338   {  158, 0x0000 }, {  158, 0x0000 }, {  158, 0x0000 }, {  158, 0x0000 },
339   {  158, 0x0000 }, {  158, 0x0000 }, {  158, 0x0040 }, {  159, 0x0400 },
340   {  160, 0x0000 }, {  160, 0x0000 }, {  160, 0x0000 }, {  160, 0x0020 },
341   /* 0x5d00 */
342   {  161, 0x0000 }, {  161, 0x0000 }, {  161, 0x0080 }, {  162, 0x0000 },
343   {  162, 0x0004 }, {  163, 0x0008 }, {  164, 0x2000 }, {  165, 0x0000 },
344   {  165, 0x0000 }, {  165, 0x0000 }, {  165, 0x0000 }, {  165, 0x0300 },
345   {  167, 0x0000 }, {  167, 0x0001 },
346 };
347 static const Summary16 cp932ext_uni2indx_page5f[458] = {
348   /* 0x5f00 */
349   {  168, 0x0000 }, {  168, 0x0000 }, {  168, 0x0002 }, {  169, 0x0010 },
350   {  170, 0x0020 }, {  171, 0x0000 }, {  171, 0x0080 }, {  172, 0x0000 },
351   {  172, 0x0000 }, {  172, 0x0000 }, {  172, 0x0000 }, {  172, 0x0080 },
352   {  173, 0x0000 }, {  173, 0x4000 }, {  174, 0x0000 }, {  174, 0x0000 },
353   /* 0x6000 */
354   {  174, 0x0000 }, {  174, 0x0000 }, {  174, 0x0000 }, {  174, 0x0000 },
355   {  174, 0x0000 }, {  174, 0x2000 }, {  175, 0x0000 }, {  175, 0x0000 },
356   {  175, 0x0420 }, {  177, 0x0000 }, {  177, 0x0000 }, {  177, 0x0000 },
357   {  177, 0x0000 }, {  177, 0x4020 }, {  179, 0x0000 }, {  179, 0x0004 },
358   /* 0x6100 */
359   {  180, 0x0000 }, {  180, 0x0002 }, {  181, 0x0001 }, {  182, 0x0081 },
360   {  184, 0x0000 }, {  184, 0x0000 }, {  184, 0x0000 }, {  184, 0x0000 },
361   {  184, 0x0000 }, {  184, 0x0100 }, {  185, 0x0000 }, {  185, 0x0000 },
362   {  185, 0x0000 }, {  185, 0x0000 }, {  185, 0x0000 }, {  185, 0x0000 },
363   /* 0x6200 */
364   {  185, 0x0000 }, {  185, 0x0008 }, {  186, 0x0000 }, {  186, 0x0000 },
365   {  186, 0x0000 }, {  186, 0x0000 }, {  186, 0x0000 }, {  186, 0x0000 },
366   {  186, 0x0000 }, {  186, 0x0000 }, {  186, 0x0040 }, {  187, 0x0000 },
367   {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 },
368   /* 0x6300 */
369   {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 },
370   {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 },
371   {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 },
372   {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0000 }, {  187, 0x0020 },
373   /* 0x6400 */
374   {  188, 0x0000 }, {  188, 0x0000 }, {  188, 0x0000 }, {  188, 0x0000 },
375   {  188, 0x0000 }, {  188, 0x0000 }, {  188, 0x0001 }, {  189, 0x0000 },
376   {  189, 0x0000 }, {  189, 0x2000 }, {  190, 0x0000 }, {  190, 0x0000 },
377   {  190, 0x4000 }, {  191, 0x0000 }, {  191, 0x0000 }, {  191, 0x0000 },
378   /* 0x6500 */
379   {  191, 0x0000 }, {  191, 0x0000 }, {  191, 0x0000 }, {  191, 0x0000 },
380   {  191, 0x4000 }, {  192, 0x0000 }, {  192, 0x0000 }, {  192, 0x0000 },
381   {  192, 0x0000 }, {  192, 0x0000 }, {  192, 0x0000 }, {  192, 0x0000 },
382   {  192, 0x0000 }, {  192, 0x0000 }, {  192, 0x0000 }, {  192, 0x0000 },
383   /* 0x6600 */
384   {  192, 0x0201 }, {  194, 0x4020 }, {  196, 0x4010 }, {  198, 0x0802 },
385   {  200, 0x0000 }, {  200, 0x0280 }, {  202, 0x0020 }, {  203, 0x0008 },
386   {  204, 0x0000 }, {  204, 0x0200 }, {  205, 0x0001 }, {  206, 0x8004 },
387   {  208, 0x0000 }, {  208, 0x0000 }, {  208, 0x0000 }, {  208, 0x0c00 },
388   /* 0x6700 */
389   {  210, 0x4000 }, {  211, 0x0000 }, {  211, 0x0000 }, {  211, 0x0000 },
390   {  211, 0x0000 }, {  211, 0x0000 }, {  211, 0x0040 }, {  212, 0x0000 },
391   {  212, 0x0000 }, {  212, 0x0000 }, {  212, 0x0000 }, {  212, 0x0800 },
392   {  213, 0x0001 }, {  214, 0x0000 }, {  214, 0x0000 }, {  214, 0x0000 },
393   /* 0x6800 */
394   {  214, 0x0002 }, {  215, 0x0000 }, {  215, 0x0000 }, {  215, 0x0000 },
395   {  215, 0x0010 }, {  216, 0x0004 }, {  217, 0x0000 }, {  217, 0x0000 },
396   {  217, 0x0000 }, {  217, 0x0000 }, {  217, 0x0000 }, {  217, 0x0000 },
397   {  217, 0x8100 }, {  219, 0x0000 }, {  219, 0x0000 }, {  219, 0x0000 },
398   /* 0x6900 */
399   {  219, 0x0000 }, {  219, 0x0000 }, {  219, 0x0000 }, {  219, 0x0000 },
400   {  219, 0x0000 }, {  219, 0x0000 }, {  219, 0x0100 }, {  220, 0x0000 },
401   {  220, 0x0000 }, {  220, 0x0100 }, {  221, 0x0000 }, {  221, 0x0000 },
402   {  221, 0x0000 }, {  221, 0x0000 }, {  221, 0x0004 }, {  222, 0x0000 },
403   /* 0x6a00 */
404   {  222, 0x0000 }, {  222, 0x0000 }, {  222, 0x0000 }, {  222, 0x0001 },
405   {  223, 0x0040 }, {  224, 0x0000 }, {  224, 0x0800 }, {  225, 0x4008 },
406   {  227, 0x0000 }, {  227, 0x0000 }, {  227, 0x0000 }, {  227, 0x0000 },
407   {  227, 0x0000 }, {  227, 0x0000 }, {  227, 0x0014 }, {  229, 0x0000 },
408   /* 0x6b00 */
409   {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 },
410   {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 },
411   {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 }, {  229, 0x0000 },
412   {  229, 0x0000 }, {  229, 0x0040 }, {  230, 0x0000 }, {  230, 0x0000 },
413   /* 0x6c00 */
414   {  230, 0x0000 }, {  230, 0x0000 }, {  230, 0x0000 }, {  230, 0x8000 },
415   {  231, 0x0000 }, {  231, 0x1000 }, {  232, 0x8000 }, {  233, 0x0000 },
416   {  233, 0x0040 }, {  234, 0x0000 }, {  234, 0x0000 }, {  234, 0x0000 },
417   {  234, 0x0000 }, {  234, 0x0400 }, {  235, 0x0000 }, {  235, 0x0000 },
418   /* 0x6d00 */
419   {  235, 0x0010 }, {  236, 0x0000 }, {  236, 0x0000 }, {  236, 0x0000 },
420   {  236, 0x0000 }, {  236, 0x0000 }, {  236, 0x8000 }, {  237, 0x0000 },
421   {  237, 0x0080 }, {  238, 0x0040 }, {  239, 0x1000 }, {  240, 0x0000 },
422   {  240, 0x8000 }, {  241, 0x0000 }, {  241, 0x0000 }, {  241, 0x1104 },
423   /* 0x6e00 */
424   {  244, 0x0000 }, {  244, 0x0000 }, {  244, 0x0080 }, {  245, 0x1200 },
425   {  247, 0x0000 }, {  247, 0x1000 }, {  248, 0x0000 }, {  248, 0x0000 },
426   {  248, 0x0000 }, {  248, 0x0000 }, {  248, 0x0000 }, {  248, 0x8000 },
427   {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 },
428   /* 0x6f00 */
429   {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 },
430   {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 }, {  249, 0x0000 },
431   {  249, 0x0100 }, {  250, 0x0000 }, {  250, 0x0000 }, {  250, 0x0020 },
432   {  251, 0x0000 }, {  251, 0x0000 }, {  251, 0x0000 }, {  251, 0x0020 },
433   /* 0x7000 */
434   {  252, 0x00a0 }, {  254, 0x0000 }, {  254, 0x0100 }, {  255, 0x0000 },
435   {  255, 0x0000 }, {  255, 0x0000 }, {  255, 0x0000 }, {  255, 0x0000 },
436   {  255, 0x0020 }, {  256, 0x0000 }, {  256, 0x0800 }, {  257, 0x0800 },
437   {  258, 0x0000 }, {  258, 0x0000 }, {  258, 0x0000 }, {  258, 0x0000 },
438   /* 0x7100 */
439   {  258, 0x8010 }, {  260, 0x0000 }, {  260, 0x0000 }, {  260, 0x0000 },
440   {  260, 0x00c0 }, {  262, 0x1000 }, {  263, 0x0000 }, {  263, 0x0000 },
441   {  263, 0x0000 }, {  263, 0x0000 }, {  263, 0x0000 }, {  263, 0x0000 },
442   {  263, 0x0002 }, {  264, 0x0000 }, {  264, 0x0000 }, {  264, 0x4000 },
443   /* 0x7200 */
444   {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x0000 },
445   {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x0000 },
446   {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x0000 }, {  265, 0x4002 },
447   {  267, 0x0000 }, {  267, 0x0000 }, {  267, 0x0000 }, {  267, 0x0000 },
448   /* 0x7300 */
449   {  267, 0x0000 }, {  267, 0x0000 }, {  267, 0x0010 }, {  268, 0x0000 },
450   {  268, 0x0000 }, {  268, 0x0000 }, {  268, 0x0000 }, {  268, 0x0080 },
451   {  269, 0x0000 }, {  269, 0x0000 }, {  269, 0x0000 }, {  269, 0x2000 },
452   {  270, 0x0200 }, {  271, 0x0044 }, {  273, 0x0008 }, {  274, 0x0020 },
453   /* 0x7400 */
454   {  275, 0x0080 }, {  276, 0x0000 }, {  276, 0x4640 }, {  280, 0x0000 },
455   {  280, 0x0000 }, {  280, 0x0000 }, {  280, 0x0004 }, {  281, 0x0000 },
456   {  281, 0x0200 }, {  282, 0x8000 }, {  283, 0x0000 }, {  283, 0x0000 },
457   {  283, 0x0000 }, {  283, 0x0000 }, {  283, 0x0000 }, {  283, 0x0000 },
458   /* 0x7500 */
459   {  283, 0x0002 }, {  284, 0x0000 }, {  284, 0x8000 }, {  285, 0x0000 },
460   {  285, 0x0000 }, {  285, 0x0000 }, {  285, 0x8000 }, {  286, 0x0000 },
461   {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 },
462   {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 },
463   /* 0x7600 */
464   {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 },
465   {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 }, {  286, 0x0000 },
466   {  286, 0x0004 }, {  287, 0x5800 }, {  290, 0x0040 }, {  291, 0x0000 },
467   {  291, 0x0000 }, {  291, 0x0000 }, {  291, 0x0000 }, {  291, 0x0000 },
468   /* 0x7700 */
469   {  291, 0x0000 }, {  291, 0x0000 }, {  291, 0x0000 }, {  291, 0x0000 },
470   {  291, 0x0040 }, {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0000 },
471   {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0000 },
472   {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0000 },
473   /* 0x7800 */
474   {  292, 0x0000 }, {  292, 0x0000 }, {  292, 0x0002 }, {  293, 0x0000 },
475   {  293, 0x4000 }, {  294, 0x0000 }, {  294, 0x0010 }, {  295, 0x0400 },
476   {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0000 },
477   {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0000 },
478   /* 0x7900 */
479   {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0000 }, {  296, 0x0001 },
480   {  297, 0x0000 }, {  297, 0x0000 }, {  297, 0x0000 }, {  297, 0x0000 },
481   {  297, 0x0000 }, {  297, 0x0810 }, {  299, 0x0000 }, {  299, 0x0000 },
482   {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 },
483   /* 0x7a00 */
484   {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 },
485   {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 },
486   {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 }, {  299, 0x0000 },
487   {  299, 0x0000 }, {  299, 0x0002 }, {  300, 0x0880 }, {  302, 0x0000 },
488   /* 0x7b00 */
489   {  302, 0x0000 }, {  302, 0x0000 }, {  302, 0x0000 }, {  302, 0x0000 },
490   {  302, 0x0000 }, {  302, 0x0000 }, {  302, 0x0000 }, {  302, 0x0000 },
491   {  302, 0x0000 }, {  302, 0x4000 },
492 };
493 static const Summary16 cp932ext_uni2indx_page7d[43] = {
494   /* 0x7d00 */
495   {  303, 0x0000 }, {  303, 0x0000 }, {  303, 0x0000 }, {  303, 0x0000 },
496   {  303, 0x0100 }, {  304, 0x1000 }, {  305, 0x0000 }, {  305, 0x0000 },
497   {  305, 0x0000 }, {  305, 0x0000 }, {  305, 0x0001 }, {  306, 0x0080 },
498   {  307, 0x0000 }, {  307, 0x0040 }, {  308, 0x0000 }, {  308, 0x0000 },
499   /* 0x7e00 */
500   {  308, 0x0000 }, {  308, 0x0000 }, {  308, 0x0000 }, {  308, 0x0000 },
501   {  308, 0x0000 }, {  308, 0x0004 }, {  309, 0x0000 }, {  309, 0x0000 },
502   {  309, 0x0400 }, {  310, 0x0000 }, {  310, 0x0000 }, {  310, 0x0000 },
503   {  310, 0x0000 }, {  310, 0x0000 }, {  310, 0x0000 }, {  310, 0x0000 },
504   /* 0x7f00 */
505   {  310, 0x0000 }, {  310, 0x0000 }, {  310, 0x0000 }, {  310, 0x0000 },
506   {  310, 0x0080 }, {  311, 0x0000 }, {  311, 0x0000 }, {  311, 0x0000 },
507   {  311, 0x0000 }, {  311, 0x0000 }, {  311, 0x0002 },
508 };
509 static const Summary16 cp932ext_uni2indx_page83[44] = {
510   /* 0x8300 */
511   {  312, 0x0002 }, {  313, 0x0000 }, {  313, 0x0000 }, {  313, 0x0000 },
512   {  313, 0x0000 }, {  313, 0x0000 }, {  313, 0x0004 }, {  314, 0x8000 },
513   {  315, 0x0000 }, {  315, 0x0000 }, {  315, 0x0000 }, {  315, 0x0000 },
514   {  315, 0x0080 }, {  316, 0x0000 }, {  316, 0x0000 }, {  316, 0x0040 },
515   /* 0x8400 */
516   {  317, 0x0000 }, {  317, 0x0000 }, {  317, 0x0000 }, {  317, 0x0000 },
517   {  317, 0x0100 }, {  318, 0x0000 }, {  318, 0x0000 }, {  318, 0x0000 },
518   {  318, 0x0000 }, {  318, 0x0000 }, {  318, 0x0000 }, {  318, 0x0010 },
519   {  319, 0x0000 }, {  319, 0x1000 }, {  320, 0x0000 }, {  320, 0x0000 },
520   /* 0x8500 */
521   {  320, 0x0000 }, {  320, 0x0000 }, {  320, 0x0000 }, {  320, 0x0000 },
522   {  320, 0x0000 }, {  320, 0x0208 }, {  322, 0x0800 }, {  323, 0x0000 },
523   {  323, 0x0000 }, {  323, 0x0000 }, {  323, 0x0000 }, {  323, 0x0001 },
524 };
525 static const Summary16 cp932ext_uni2indx_page88[109] = {
526   /* 0x8800 */
527   {  324, 0x0080 }, {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 },
528   {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 },
529   {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 },
530   {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0000 }, {  325, 0x0020 },
531   /* 0x8900 */
532   {  326, 0x0000 }, {  326, 0x1000 }, {  327, 0x0000 }, {  327, 0x0000 },
533   {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 },
534   {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 },
535   {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 }, {  327, 0x0000 },
536   /* 0x8a00 */
537   {  327, 0x0000 }, {  327, 0x0004 }, {  328, 0x0000 }, {  328, 0x0080 },
538   {  329, 0x0000 }, {  329, 0x0000 }, {  329, 0x0000 }, {  329, 0x0200 },
539   {  330, 0x0000 }, {  330, 0x0000 }, {  330, 0x0080 }, {  331, 0x4000 },
540   {  332, 0x0000 }, {  332, 0x8000 }, {  333, 0x0000 }, {  333, 0x0040 },
541   /* 0x8b00 */
542   {  334, 0x0000 }, {  334, 0x0000 }, {  334, 0x0000 }, {  334, 0x0000 },
543   {  334, 0x0000 }, {  334, 0x0008 }, {  335, 0x0000 }, {  335, 0x8000 },
544   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 },
545   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 },
546   /* 0x8c00 */
547   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 },
548   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 },
549   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 },
550   {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0000 }, {  336, 0x0011 },
551   /* 0x8d00 */
552   {  338, 0x0000 }, {  338, 0x0004 }, {  339, 0x0000 }, {  339, 0x0000 },
553   {  339, 0x0000 }, {  339, 0x0000 }, {  339, 0x0000 }, {  339, 0x0040 },
554   {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 },
555   {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 },
556   /* 0x8e00 */
557   {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 },
558   {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 },
559   {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 }, {  340, 0x0000 },
560   {  340, 0x8000 },
561 };
562 static const Summary16 cp932ext_uni2indx_page90[238] = {
563   /* 0x9000 */
564   {  341, 0x0000 }, {  341, 0x0000 }, {  341, 0x0000 }, {  341, 0x0000 },
565   {  341, 0x0000 }, {  341, 0x0000 }, {  341, 0x0080 }, {  342, 0x0000 },
566   {  342, 0x0000 }, {  342, 0x0000 }, {  342, 0x0000 }, {  342, 0x0000 },
567   {  342, 0x0000 }, {  342, 0x4000 }, {  343, 0x0000 }, {  343, 0x0000 },
568   /* 0x9100 */
569   {  343, 0x0000 }, {  343, 0x0020 }, {  344, 0x0080 }, {  345, 0x0000 },
570   {  345, 0x0000 }, {  345, 0x0000 }, {  345, 0x0000 }, {  345, 0x0000 },
571   {  345, 0x0000 }, {  345, 0x0000 }, {  345, 0x0000 }, {  345, 0x0000 },
572   {  345, 0x0000 }, {  345, 0x4480 }, {  348, 0x6030 }, {  352, 0x0000 },
573   /* 0x9200 */
574   {  352, 0x0440 }, {  354, 0x0001 }, {  355, 0x0000 }, {  355, 0x1600 },
575   {  358, 0x4001 }, {  360, 0x0202 }, {  362, 0x0080 }, {  363, 0x0180 },
576   {  365, 0x0100 }, {  366, 0x0000 }, {  366, 0x0080 }, {  367, 0x0000 },
577   {  367, 0x0000 }, {  367, 0x02a9 }, {  372, 0x0081 }, {  374, 0x8a00 },
578   /* 0x9300 */
579   {  377, 0x0004 }, {  378, 0x6000 }, {  380, 0x0022 }, {  382, 0x0000 },
580   {  382, 0x0100 }, {  383, 0x0080 }, {  384, 0x0000 }, {  384, 0x0001 },
581   {  385, 0x0000 }, {  385, 0x0000 }, {  385, 0x0010 }, {  386, 0x0000 },
582   {  386, 0x0040 }, {  387, 0x4000 }, {  388, 0x0000 }, {  388, 0x0100 },
583   /* 0x9400 */
584   {  389, 0x0000 }, {  389, 0x0000 }, {  389, 0x0000 }, {  389, 0x0002 },
585   {  390, 0x0120 }, {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 },
586   {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 },
587   {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 },
588   /* 0x9500 */
589   {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 },
590   {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 }, {  392, 0x0000 },
591   {  392, 0x0000 }, {  392, 0x0004 }, {  393, 0x0000 }, {  393, 0x0000 },
592   {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 },
593   /* 0x9600 */
594   {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 },
595   {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 }, {  393, 0x0000 },
596   {  393, 0x0000 }, {  393, 0x2000 }, {  394, 0x8000 }, {  395, 0x0000 },
597   {  395, 0x0000 }, {  395, 0x0000 }, {  395, 0x0000 }, {  395, 0x0000 },
598   /* 0x9700 */
599   {  395, 0x0000 }, {  395, 0x0000 }, {  395, 0x0000 }, {  395, 0x0808 },
600   {  397, 0xa008 }, {  400, 0x0022 }, {  402, 0x0000 }, {  402, 0x0000 },
601   {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 },
602   {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 },
603   /* 0x9800 */
604   {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 }, {  402, 0x0000 },
605   {  402, 0x0000 }, {  402, 0x0080 }, {  403, 0x0020 }, {  404, 0x0000 },
606   {  404, 0x0000 }, {  404, 0x0000 }, {  404, 0x0000 }, {  404, 0x0000 },
607   {  404, 0x0000 }, {  404, 0x0000 }, {  404, 0x0000 }, {  404, 0x0000 },
608   /* 0x9900 */
609   {  404, 0x0000 }, {  404, 0x0000 }, {  404, 0x0080 }, {  405, 0x0000 },
610   {  405, 0x0000 }, {  405, 0x0000 }, {  405, 0x0000 }, {  405, 0x0000 },
611   {  405, 0x0000 }, {  405, 0x4000 }, {  406, 0x0000 }, {  406, 0x0000 },
612   {  406, 0x0000 }, {  406, 0x0000 }, {  406, 0x0000 }, {  406, 0x0000 },
613   /* 0x9a00 */
614   {  406, 0x0000 }, {  406, 0x0000 }, {  406, 0x0000 }, {  406, 0x0000 },
615   {  406, 0x4000 }, {  407, 0x0000 }, {  407, 0x0000 }, {  407, 0x0000 },
616   {  407, 0x0000 }, {  407, 0x0000 }, {  407, 0x0000 }, {  407, 0x0000 },
617   {  407, 0x0000 }, {  407, 0x1200 }, {  409, 0x0000 }, {  409, 0x0000 },
618   /* 0x9b00 */
619   {  409, 0x0000 }, {  409, 0x0000 }, {  409, 0x0000 }, {  409, 0x0000 },
620   {  409, 0x0000 }, {  409, 0x0000 }, {  409, 0x0000 }, {  409, 0x0024 },
621   {  411, 0x8000 }, {  412, 0x0000 }, {  412, 0x0000 }, {  412, 0x0802 },
622   {  414, 0x0000 }, {  414, 0x0000 }, {  414, 0x0000 }, {  414, 0x0000 },
623   /* 0x9c00 */
624   {  414, 0x0001 }, {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 },
625   {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 },
626   {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 },
627   {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 },
628   /* 0x9d00 */
629   {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0000 },
630   {  415, 0x0000 }, {  415, 0x0000 }, {  415, 0x0800 }, {  416, 0x0001 },
631   {  417, 0x0000 }, {  417, 0x0000 }, {  417, 0x0000 }, {  417, 0x0000 },
632   {  417, 0x0000 }, {  417, 0x0000 }, {  417, 0x0000 }, {  417, 0x0000 },
633   /* 0x9e00 */
634   {  417, 0x0000 }, {  417, 0x0200 }, {  418, 0x0000 }, {  418, 0x0000 },
635   {  418, 0x0000 }, {  418, 0x0000 }, {  418, 0x0000 }, {  418, 0x0000 },
636   {  418, 0x0000 }, {  418, 0x0000 }, {  418, 0x0000 }, {  418, 0x0000 },
637   {  418, 0x0000 }, {  418, 0x0002 },
638 };
639 static const Summary16 cp932ext_uni2indx_pagef9[19] = {
640   /* 0xf900 */
641   {  419, 0x0000 }, {  419, 0x0000 }, {  419, 0x0200 }, {  420, 0x0000 },
642   {  420, 0x0000 }, {  420, 0x0000 }, {  420, 0x0000 }, {  420, 0x0000 },
643   {  420, 0x0000 }, {  420, 0x0000 }, {  420, 0x0000 }, {  420, 0x0000 },
644   {  420, 0x0000 }, {  420, 0x1000 }, {  421, 0x0000 }, {  421, 0x0000 },
645   /* 0xfa00 */
646   {  421, 0xc000 }, {  423, 0xffff }, {  439, 0x3fff },
647 };
648 static const Summary16 cp932ext_uni2indx_pageff[15] = {
649   /* 0xff00 */
650   {  453, 0x0084 }, {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0000 },
651   {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0000 },
652   {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0000 },
653   {  455, 0x0000 }, {  455, 0x0000 }, {  455, 0x0014 },
654 };
655 
656 static int
cp932ext_wctomb(conv_t conv,unsigned char * r,ucs4_t wc,int n)657 cp932ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
658 {
659   if (n >= 2) {
660     const Summary16 *summary = NULL;
661     if (wc >= 0x2100 && wc < 0x22c0)
662       summary = &cp932ext_uni2indx_page21[(wc>>4)-0x210];
663     else if (wc >= 0x2400 && wc < 0x2480)
664       summary = &cp932ext_uni2indx_page24[(wc>>4)-0x240];
665     else if (wc >= 0x3000 && wc < 0x3020)
666       summary = &cp932ext_uni2indx_page30[(wc>>4)-0x300];
667     else if (wc >= 0x3200 && wc < 0x33d0)
668       summary = &cp932ext_uni2indx_page32[(wc>>4)-0x320];
669     else if (wc >= 0x4e00 && wc < 0x5590)
670       summary = &cp932ext_uni2indx_page4e[(wc>>4)-0x4e0];
671     else if (wc >= 0x5700 && wc < 0x59c0)
672       summary = &cp932ext_uni2indx_page57[(wc>>4)-0x570];
673     else if (wc >= 0x5b00 && wc < 0x5de0)
674       summary = &cp932ext_uni2indx_page5b[(wc>>4)-0x5b0];
675     else if (wc >= 0x5f00 && wc < 0x7ba0)
676       summary = &cp932ext_uni2indx_page5f[(wc>>4)-0x5f0];
677     else if (wc >= 0x7d00 && wc < 0x7fb0)
678       summary = &cp932ext_uni2indx_page7d[(wc>>4)-0x7d0];
679     else if (wc >= 0x8300 && wc < 0x85c0)
680       summary = &cp932ext_uni2indx_page83[(wc>>4)-0x830];
681     else if (wc >= 0x8800 && wc < 0x8ed0)
682       summary = &cp932ext_uni2indx_page88[(wc>>4)-0x880];
683     else if (wc >= 0x9000 && wc < 0x9ee0)
684       summary = &cp932ext_uni2indx_page90[(wc>>4)-0x900];
685     else if (wc >= 0xf900 && wc < 0xfa30)
686       summary = &cp932ext_uni2indx_pagef9[(wc>>4)-0xf90];
687     else if (wc >= 0xff00 && wc < 0xfff0)
688       summary = &cp932ext_uni2indx_pageff[(wc>>4)-0xff0];
689     if (summary) {
690       unsigned short used = summary->used;
691       unsigned int i = wc & 0x0f;
692       if (used & ((unsigned short) 1 << i)) {
693         unsigned short c;
694         /* Keep in `used' only the bits 0..i-1. */
695         used &= ((unsigned short) 1 << i) - 1;
696         /* Add `summary->indx' and the number of bits set in `used'. */
697         used = (used & 0x5555) + ((used & 0xaaaa) >> 1);
698         used = (used & 0x3333) + ((used & 0xcccc) >> 2);
699         used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);
700         used = (used & 0x00ff) + (used >> 8);
701         c = cp932ext_2charset[summary->indx + used];
702         r[0] = (c >> 8); r[1] = (c & 0xff);
703         return 2;
704       }
705     }
706     return RET_ILUNI;
707   }
708   return RET_TOOSMALL;
709 }
710