1 /* $NetBSD: char.c,v 1.8 2001/09/14 14:03:59 wiz Exp $ */
4 * Copyright (c) 1980, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/cdefs.h>
35 static char sccsid
[] = "@(#)char.c 8.1 (Berkeley) 5/31/93";
37 __RCSID("$NetBSD: char.c,v 1.8 2001/09/14 14:03:59 wiz Exp $");
43 unsigned short _cmap
[256] = {
45 _CTR
, _CTR
, _CTR
, _CTR
,
48 _CTR
, _CTR
, _CTR
, _CTR
,
51 _CTR
, _CTR
|_SP
|_META
, _CTR
|_NL
|_META
, _CTR
,
54 _CTR
, _CTR
, _CTR
, _CTR
,
57 _CTR
, _CTR
, _CTR
, _CTR
,
60 _CTR
, _CTR
, _CTR
, _CTR
,
63 _CTR
, _CTR
, _CTR
, _CTR
,
66 _CTR
, _CTR
, _CTR
, _CTR
,
69 _SP
|_META
, 0, _QF
, _META
,
72 _DOL
, 0, _META
|_CMD
, _QF
,
75 _META
|_CMD
, _META
, _GLOB
, 0,
81 _DIG
|_XD
, _DIG
|_XD
, _DIG
|_XD
, _DIG
|_XD
,
84 _DIG
|_XD
, _DIG
|_XD
, _DIG
|_XD
, _DIG
|_XD
,
87 _DIG
|_XD
, _DIG
|_XD
, 0, _META
|_CMD
,
90 _META
, 0, _META
, _GLOB
,
93 0, _LET
|_UP
|_XD
, _LET
|_UP
|_XD
, _LET
|_UP
|_XD
,
96 _LET
|_UP
|_XD
, _LET
|_UP
|_XD
, _LET
|_UP
|_XD
, _LET
|_UP
,
99 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
102 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
105 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
108 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
111 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _GLOB
,
117 _QB
|_GLOB
|_META
, _LET
|_LOW
|_XD
, _LET
|_LOW
|_XD
, _LET
|_LOW
|_XD
,
120 _LET
|_LOW
|_XD
, _LET
|_LOW
|_XD
, _LET
|_LOW
|_XD
, _LET
|_LOW
,
123 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
126 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
129 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
132 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
135 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _GLOB
,
138 _META
|_CMD
, 0, 0, _CTR
,
140 #if defined(SHORT_STRINGS) && !defined(KANJI)
141 /****************************************************************/
142 /* 128 - 255 The below is supposedly ISO 8859/1 */
143 /****************************************************************/
144 /* (undef) (undef) (undef) (undef) */
145 _CTR
, _CTR
, _CTR
, _CTR
,
147 /* (undef) (undef) (undef) (undef) */
148 _CTR
, _CTR
, _CTR
, _CTR
,
150 /* (undef) (undef) (undef) (undef) */
151 _CTR
, _CTR
, _CTR
, _CTR
,
153 /* (undef) (undef) (undef) (undef) */
154 _CTR
, _CTR
, _CTR
, _CTR
,
156 /* (undef) (undef) (undef) (undef) */
157 _CTR
, _CTR
, _CTR
, _CTR
,
159 /* (undef) (undef) (undef) (undef) */
160 _CTR
, _CTR
, _CTR
, _CTR
,
162 /* (undef) (undef) (undef) (undef) */
163 _CTR
, _CTR
, _CTR
, _CTR
,
165 /* (undef) (undef) (undef) (undef) */
166 _CTR
, _CTR
, _CTR
, _CTR
,
168 /* nobreakspace exclamdown cent sterling */
171 /* currency yen brokenbar section */
174 /* diaeresis copyright ordfeminine guillemotleft */
177 /* notsign hyphen registered macron */
180 /* degree plusminus twosuperior threesuperior */
183 /* acute mu paragraph periodcentered */
186 /* cedilla onesuperior masculine guillemotright */
189 /* onequarter onehalf threequarters questiondown */
192 /* Agrave Aacute Acircumflex Atilde */
193 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
195 /* Adiaeresis Aring AE Ccedilla */
196 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
198 /* Egrave Eacute Ecircumflex Ediaeresis */
199 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
201 /* Igrave Iacute Icircumflex Idiaeresis */
202 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
204 /* ETH Ntilde Ograve Oacute */
205 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
207 /* Ocircumflex Otilde Odiaeresis multiply */
208 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, 0,
210 /* Ooblique Ugrave Uacute Ucircumflex */
211 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_UP
,
213 /* Udiaeresis Yacute THORN ssharp */
214 _LET
|_UP
, _LET
|_UP
, _LET
|_UP
, _LET
|_LOW
,
216 /* agrave aacute acircumflex atilde */
217 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
219 /* adiaeresis aring ae ccedilla */
220 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
222 /* egrave eacute ecircumflex ediaeresis */
223 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
225 /* igrave iacute icircumflex idiaeresis */
226 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
228 /* eth ntilde ograve oacute */
229 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
231 /* ocircumflex otilde odiaeresis division */
232 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, 0,
234 /* oslash ugrave uacute ucircumflex */
235 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
237 /* udiaeresis yacute thorn ydiaeresis */
238 _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
, _LET
|_LOW
,
239 #endif /* SHORT_STRINGS && !KANJI */
243 /* _cmap_lower, _cmap_upper for ISO 8859/1 */
245 unsigned char _cmap_lower
[256] = {
246 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
247 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
248 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
249 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
250 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
251 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
252 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
253 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
254 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
255 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
256 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
257 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137,
258 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
259 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
260 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
261 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177,
262 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
263 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
264 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
265 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
266 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
267 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
268 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
269 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
270 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
271 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
272 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0327,
273 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0337,
274 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
275 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
276 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
277 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377,
280 unsigned char _cmap_upper
[256] = {
281 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
282 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
283 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
284 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
285 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
286 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
287 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
288 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
289 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
290 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
291 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
292 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
293 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
294 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
295 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
296 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
297 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
298 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
299 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
300 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
301 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
302 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
303 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
304 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
305 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
306 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
307 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
308 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
309 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
310 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
311 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0367,
312 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0377,