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