More changes for gcc2 to use lib.
[unix-history] / bin / csh / char.c
CommitLineData
15637ed4
RG
1/*-
2 * Copyright (c) 1980, 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35static char sccsid[] = "@(#)char.c 5.6 (Berkeley) 6/7/91";
36#endif /* not lint */
37
38#include "char.h"
39
40unsigned short _cmap[256] = {
41/* nul soh stx etx */
42 _CTR, _CTR, _CTR, _CTR,
43
44/* eot enq ack bel */
45 _CTR, _CTR, _CTR, _CTR,
46
47/* bs ht nl vt */
48 _CTR, _CTR|_SP|_META, _CTR|_NL|_META, _CTR,
49
50/* np cr so si */
51 _CTR, _CTR, _CTR, _CTR,
52
53/* dle dc1 dc2 dc3 */
54 _CTR, _CTR, _CTR, _CTR,
55
56/* dc4 nak syn etb */
57 _CTR, _CTR, _CTR, _CTR,
58
59/* can em sub esc */
60 _CTR, _CTR, _CTR, _CTR,
61
62/* fs gs rs us */
63 _CTR, _CTR, _CTR, _CTR,
64
65/* sp ! " # */
66 _SP|_META, 0, _Q, _META,
67
68/* $ % & ' */
69 _DOL, 0, _META|_CMD, _Q,
70
71/* ( ) * + */
72 _META|_CMD, _META, _GLOB, 0,
73
74/* , - . / */
75 0, 0, 0, 0,
76
77/* 0 1 2 3 */
78 _DIG|_XD, _DIG|_XD, _DIG|_XD, _DIG|_XD,
79
80/* 4 5 6 7 */
81 _DIG|_XD, _DIG|_XD, _DIG|_XD, _DIG|_XD,
82
83/* 8 9 : ; */
84 _DIG|_XD, _DIG|_XD, 0, _META|_CMD,
85
86/* < = > ? */
87 _META, 0, _META, _GLOB,
88
89/* @ A B C */
90 0, _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP|_XD,
91
92/* D E F G */
93 _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP|_XD, _LET|_UP,
94
95/* H I J K */
96 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
97
98/* L M N O */
99 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
100
101/* P Q R S */
102 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
103
104/* T U V W */
105 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
106
107/* X Y Z [ */
108 _LET|_UP, _LET|_UP, _LET|_UP, _GLOB,
109
110/* \ ] ^ _ */
111 _ESC, 0, 0, 0,
112
113/* ` a b c */
114 _Q1|_GLOB|_CMD|_META, _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW|_XD,
115
116/* d e f g */
117 _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW|_XD, _LET|_LOW,
118
119/* h i j k */
120 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
121
122/* l m n o */
123 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
124
125/* p q r s */
126 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
127
128/* t u v w */
129 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
130
131/* x y z { */
132 _LET|_LOW, _LET|_LOW, _LET|_LOW, _GLOB,
133
134/* | } ~ del */
135 _META|_CMD, 0, 0, _CTR,
136
137#if defined(SHORT_STRINGS) && !defined(KANJI)
138/****************************************************************/
139/* 128 - 255 The below is supposedly ISO 8859/1 */
140/****************************************************************/
141/* (undef) (undef) (undef) (undef) */
142 _CTR, _CTR, _CTR, _CTR,
143
144/* (undef) (undef) (undef) (undef) */
145 _CTR, _CTR, _CTR, _CTR,
146
147/* (undef) (undef) (undef) (undef) */
148 _CTR, _CTR, _CTR, _CTR,
149
150/* (undef) (undef) (undef) (undef) */
151 _CTR, _CTR, _CTR, _CTR,
152
153/* (undef) (undef) (undef) (undef) */
154 _CTR, _CTR, _CTR, _CTR,
155
156/* (undef) (undef) (undef) (undef) */
157 _CTR, _CTR, _CTR, _CTR,
158
159/* (undef) (undef) (undef) (undef) */
160 _CTR, _CTR, _CTR, _CTR,
161
162/* (undef) (undef) (undef) (undef) */
163 _CTR, _CTR, _CTR, _CTR,
164
165/* nobreakspace exclamdown cent sterling */
166 _SP, 0, 0, 0,
167
168/* currency yen brokenbar section */
169 0, 0, 0, 0,
170
171/* diaeresis copyright ordfeminine guillemotleft */
172 0, 0, 0, 0,
173
174/* notsign hyphen registered macron */
175 0, 0, 0, 0,
176
177/* degree plusminus twosuperior threesuperior */
178 0, 0, 0, 0,
179
180/* acute mu paragraph periodcentered */
181 0, 0, 0, 0,
182
183/* cedilla onesuperior masculine guillemotright */
184 0, 0, 0, 0,
185
186/* onequarter onehalf threequarters questiondown */
187 0, 0, 0, 0,
188
189/* Agrave Aacute Acircumflex Atilde */
190 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
191
192/* Adiaeresis Aring AE Ccedilla */
193 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
194
195/* Egrave Eacute Ecircumflex Ediaeresis */
196 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
197
198/* Igrave Iacute Icircumflex Idiaeresis */
199 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
200
201/* ETH Ntilde Ograve Oacute */
202 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
203
204/* Ocircumflex Otilde Odiaeresis multiply */
205 _LET|_UP, _LET|_UP, _LET|_UP, 0,
206
207/* Ooblique Ugrave Uacute Ucircumflex */
208 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
209
210/* Udiaeresis Yacute THORN ssharp */
211 _LET|_UP, _LET|_UP, _LET|_UP, _LET|_LOW,
212
213/* agrave aacute acircumflex atilde */
214 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
215
216/* adiaeresis aring ae ccedilla */
217 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
218
219/* egrave eacute ecircumflex ediaeresis */
220 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
221
222/* igrave iacute icircumflex idiaeresis */
223 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
224
225/* eth ntilde ograve oacute */
226 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
227
228/* ocircumflex otilde odiaeresis division */
229 _LET|_LOW, _LET|_LOW, _LET|_LOW, 0,
230
231/* oslash ugrave uacute ucircumflex */
232 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
233
234/* udiaeresis yacute thorn ydiaeresis */
235 _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
236#endif /* SHORT_STRINGS && !KANJI */
237};
238
239#ifndef NLS
240/* _cmap_lower, _cmap_upper for ISO 8859/1 */
241
242unsigned char _cmap_lower[256] = {
243 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
244 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
245 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
246 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
247 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
248 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
249 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
250 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
251 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
252 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
253 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
254 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137,
255 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
256 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
257 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
258 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177,
259 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
260 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
261 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
262 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
263 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
264 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
265 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
266 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
267 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
268 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
269 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0327,
270 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0337,
271 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
272 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
273 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
274 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377,
275};
276
277unsigned char _cmap_upper[256] = {
278 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
279 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
280 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
281 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
282 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
283 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
284 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
285 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
286 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
287 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
288 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
289 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
290 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
291 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
292 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
293 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
294 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
295 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
296 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
297 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
298 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
299 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
300 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
301 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
302 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
303 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
304 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
305 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
306 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
307 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
308 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0367,
309 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0377,
310};
311#endif /* NLS */