char.c revision 1.5
1/*	$OpenBSD: char.c,v 1.5 2015/10/26 15:01:15 naddy Exp $	*/
2/*	$NetBSD: char.c,v 1.6 1995/03/21 09:02:26 cgd Exp $	*/
3
4/*-
5 * Copyright (c) 1980, 1991, 1993
6 *	The Regents of the University of California.  All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 *    may be used to endorse or promote products derived from this software
18 *    without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include "char.h"
34
35unsigned short _cmap[256] = {
36/*	nul		soh		stx		etx	*/
37	_CTR,		_CTR,		_CTR,		_CTR,
38
39/*	eot		enq		ack		bel	*/
40	_CTR,		_CTR,		_CTR,		_CTR,
41
42/*	bs		ht		nl		vt	*/
43	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
44
45/*	np		cr		so		si	*/
46	_CTR,		_CTR,		_CTR,		_CTR,
47
48/*	dle		dc1		dc2		dc3	*/
49	_CTR,		_CTR,		_CTR,		_CTR,
50
51/*	dc4		nak		syn		etb	*/
52	_CTR,		_CTR,		_CTR,		_CTR,
53
54/*	can		em		sub		esc	*/
55	_CTR,		_CTR,		_CTR,		_CTR,
56
57/*	fs		gs		rs		us	*/
58	_CTR,		_CTR,		_CTR,		_CTR,
59
60/*	sp		!		"		#	*/
61	_SP|_META,	0,		_QF,		_META,
62
63/*	$		%		&		'	*/
64	_DOL,		0,		_META|_CMD,	_QF,
65
66/*	(		)		*		+	*/
67	_META|_CMD,	_META,		_GLOB,		0,
68
69/*	,		-		.		/	*/
70	0,		0,		0,		0,
71
72/*	0		1		2		3	*/
73	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
74
75/*	4		5		6		7	*/
76	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
77
78/*	8		9		:		;	*/
79	_DIG|_XD,	_DIG|_XD,	0,		_META|_CMD,
80
81/*	<		=		>		?	*/
82	_META,		0,		_META,		_GLOB,
83
84/*	@		A		B		C	*/
85	0,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
86
87/*	D		E		F		G	*/
88	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
89
90/*	H		I		J		K	*/
91	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
92
93/*	L		M		N		O	*/
94	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
95
96/*	P		Q		R		S	*/
97	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
98
99/*	T		U		V		W	*/
100	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
101
102/*	X		Y		Z		[	*/
103	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB,
104
105/*	\		]		^		_	*/
106	_ESC,		0,		0,		0,
107
108/*	`		a		b		c	*/
109  _QB|_GLOB|_META,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
110
111/*	d		e		f		g	*/
112	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW,
113
114/*	h		i		j		k	*/
115	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
116
117/*	l		m		n		o	*/
118	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
119
120/*	p		q		r		s	*/
121	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
122
123/*	t		u		v		w	*/
124	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
125
126/*	x		y		z		{	*/
127	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB,
128
129/*	|		}		~		del	*/
130	_META|_CMD,	0,		0,		_CTR,
131
132/****************************************************************/
133/* 128 - 255 The below is supposedly ISO 8859/1			*/
134/****************************************************************/
135/*	(undef)		(undef)		(undef)		(undef)		*/
136	_CTR,		_CTR,		_CTR,		_CTR,
137
138/*	(undef)		(undef)		(undef)		(undef)		*/
139	_CTR,		_CTR,		_CTR,		_CTR,
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/*	nobreakspace	exclamdown	cent		sterling	*/
160	_SP,		0,		0,		0,
161
162/*	currency	yen		brokenbar	section		*/
163	0,		0,		0,		0,
164
165/*	diaeresis	copyright	ordfeminine	guillemotleft	*/
166	0,		0,		0,		0,
167
168/*	notsign		hyphen		registered	macron		*/
169	0,		0,		0,		0,
170
171/*	degree		plusminus	twosuperior	threesuperior	*/
172	0,		0,		0,		0,
173
174/*	acute		mu		paragraph	periodcentered	*/
175	0,		0,		0,		0,
176
177/*	cedilla		onesuperior	masculine	guillemotright	*/
178	0,		0,		0,		0,
179
180/*	onequarter	onehalf		threequarters	questiondown	*/
181	0,		0,		0,		0,
182
183/*	Agrave		Aacute		Acircumflex	Atilde		*/
184	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
185
186/*	Adiaeresis	Aring		AE		Ccedilla	*/
187	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
188
189/*	Egrave		Eacute		Ecircumflex	Ediaeresis	*/
190	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
191
192/*	Igrave		Iacute		Icircumflex	Idiaeresis	*/
193	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
194
195/*	ETH		Ntilde		Ograve		Oacute		*/
196	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
197
198/*	Ocircumflex	Otilde		Odiaeresis	multiply	*/
199	_LET|_UP,	_LET|_UP,	_LET|_UP,	0,
200
201/*	Ooblique	Ugrave		Uacute		Ucircumflex	*/
202	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
203
204/*	Udiaeresis	Yacute		THORN		ssharp		*/
205	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_LOW,
206
207/*	agrave		aacute		acircumflex	atilde		*/
208	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
209
210/*	adiaeresis	aring		ae		ccedilla	*/
211	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
212
213/*	egrave		eacute		ecircumflex	ediaeresis	*/
214	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
215
216/*	igrave		iacute		icircumflex	idiaeresis	*/
217	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
218
219/*	eth		ntilde		ograve		oacute		*/
220	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
221
222/*	ocircumflex	otilde		odiaeresis	division	*/
223	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	0,
224
225/*	oslash		ugrave		uacute		ucircumflex	*/
226	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
227
228/*	udiaeresis	yacute		thorn		ydiaeresis	*/
229	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
230};
231