xref: /openbsd-src/bin/csh/char.c (revision 9abb453fef52149f4b7fb9f2eab78f7ae735f4dc)
1 /*	$OpenBSD: char.c,v 1.6 2015/10/26 16:27:04 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 
35 unsigned 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							*/
134 /****************************************************************/
135 /*	(undef)		...					*/
136 	0,
137 };
138