2 * Copyright (C) 1999-2011, 2016 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 * CP50221 JISX0212 extensions
24 static const unsigned short cp50221_0212_ext_2uni
[112] = {
26 0xfffd, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176,
27 0x2177, 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
29 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff07, 0xff02, 0xfffd,
30 0xfffd, 0xfffd, 0x70bb, 0x4efc, 0x50f4, 0x51ec, 0x5307, 0x5324,
32 0xfa0e, 0x548a, 0x5759, 0xfa0f, 0xfa10, 0x589e, 0x5bec, 0x5cf5,
33 0x5d53, 0xfa11, 0x5fb7, 0x6085, 0x6120, 0x654e, 0xfffd, 0x6665,
35 0xfa12, 0xf929, 0x6801, 0xfa13, 0xfa14, 0x6a6b, 0x6ae2, 0x6df8,
36 0x6df2, 0x7028, 0xfa15, 0xfa16, 0x7501, 0x7682, 0x769e, 0xfa17,
38 0x7930, 0xfa18, 0xfa19, 0xfa1a, 0xfa1b, 0x7ae7, 0xfa1c, 0xfa1d,
39 0x7da0, 0x7dd6, 0xfa1e, 0x8362, 0xfa1f, 0x85b0, 0xfa20, 0xfa21,
41 0x8807, 0xfa22, 0x8b7f, 0x8cf4, 0x8d76, 0xfa23, 0xfa24, 0xfa25,
42 0x90de, 0xfa26, 0x9115, 0xfa27, 0xfa28, 0x9592, 0xf9dc, 0xfa29,
44 0x973b, 0xfffd, 0x9751, 0xfa2a, 0xfa2b, 0xfa2c, 0x999e, 0x9ad9,
45 0x9b72, 0xfa2d, 0x9ed1, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
49 cp50221_0212_ext_mbtowc (conv_t conv
, ucs4_t
*pwc
, const unsigned char *s
, size_t n
)
53 unsigned short wc
= cp50221_0212_ext_2uni
[c
];
66 static const unsigned char cp50221_0212_ext_page21
[16] = {
67 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* 0x70-0x77 */
68 0x09, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
70 static const unsigned char cp50221_0212_ext_page53
[40] = {
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, /* 0x00-0x07 */
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
75 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, /* 0x20-0x27 */
77 static const unsigned char cp50221_0212_ext_page6d
[16] = {
78 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
79 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
81 static const unsigned char cp50221_0212_ext_page76
[32] = {
82 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, /* 0x98-0x9f */
87 static const unsigned char cp50221_0212_ext_page7d
[56] = {
88 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, /* 0xd0-0xd7 */
96 static const unsigned char cp50221_0212_ext_page97
[32] = {
97 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
99 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, /* 0x48-0x4f */
100 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
102 static const unsigned char cp50221_0212_ext_pagefa
[40] = {
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x23, /* 0x08-0x0f */
104 0x24, 0x29, 0x30, 0x33, 0x34, 0x3a, 0x3b, 0x3f, /* 0x10-0x17 */
105 0x41, 0x42, 0x43, 0x44, 0x46, 0x47, 0x4a, 0x4c, /* 0x18-0x1f */
106 0x4e, 0x4f, 0x51, 0x55, 0x56, 0x57, 0x59, 0x5b, /* 0x20-0x27 */
107 0x5c, 0x5f, 0x63, 0x64, 0x65, 0x69, 0x00, 0x00, /* 0x28-0x2f */
109 static const unsigned char cp50221_0212_ext_pageff
[8] = {
110 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x15, /* 0x00-0x07 */
114 cp50221_0212_ext_wctomb (conv_t conv
, unsigned char *r
, ucs4_t wc
, size_t n
)
117 if (wc
>= 0x2170 && wc
< 0x2180)
118 c
= cp50221_0212_ext_page21
[wc
-0x2170];
119 else if (wc
== 0x4efc)
121 else if (wc
== 0x50f4)
123 else if (wc
== 0x51ec)
125 else if (wc
>= 0x5300 && wc
< 0x5328)
126 c
= cp50221_0212_ext_page53
[wc
-0x5300];
127 else if (wc
== 0x548a)
129 else if (wc
== 0x5759)
131 else if (wc
== 0x589e)
133 else if (wc
== 0x5bec)
135 else if (wc
== 0x5cf5)
137 else if (wc
== 0x5d53)
139 else if (wc
== 0x5fb7)
141 else if (wc
== 0x6085)
143 else if (wc
== 0x6120)
145 else if (wc
== 0x654e)
147 else if (wc
== 0x6665)
149 else if (wc
== 0x6801)
151 else if (wc
== 0x6a6b)
153 else if (wc
== 0x6ae2)
155 else if (wc
>= 0x6df0 && wc
< 0x6e00)
156 c
= cp50221_0212_ext_page6d
[wc
-0x6df0];
157 else if (wc
== 0x7028)
159 else if (wc
== 0x70bb)
161 else if (wc
== 0x7501)
163 else if (wc
>= 0x7680 && wc
< 0x76a0)
164 c
= cp50221_0212_ext_page76
[wc
-0x7680];
165 else if (wc
== 0x7930)
167 else if (wc
== 0x7ae7)
169 else if (wc
>= 0x7da0 && wc
< 0x7dd8)
170 c
= cp50221_0212_ext_page7d
[wc
-0x7da0];
171 else if (wc
== 0x8362)
173 else if (wc
== 0x85b0)
175 else if (wc
== 0x8807)
177 else if (wc
== 0x8b7f)
179 else if (wc
== 0x8cf4)
181 else if (wc
== 0x8d76)
183 else if (wc
== 0x90de)
185 else if (wc
== 0x9115)
187 else if (wc
== 0x9592)
189 else if (wc
>= 0x9738 && wc
< 0x9758)
190 c
= cp50221_0212_ext_page97
[wc
-0x9738];
191 else if (wc
== 0x999e)
193 else if (wc
== 0x9ad9)
195 else if (wc
== 0x9b72)
197 else if (wc
== 0x9ed1)
199 else if (wc
== 0xf929)
201 else if (wc
== 0xf9dc)
203 else if (wc
>= 0xfa08 && wc
< 0xfa30)
204 c
= cp50221_0212_ext_pagefa
[wc
-0xfa08];
205 else if (wc
>= 0xff00 && wc
< 0xff08)
206 c
= cp50221_0212_ext_pageff
[wc
-0xff00];