xref: /titanic_51/usr/src/cmd/sh/ctype.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.10.1.1	*/
27 /*
28  *	UNIX shell
29  */
30 
31 
32 /* table 1 */
33 #define T_SUB	01
34 #define T_MET	02
35 #define	T_SPC	04
36 #define T_DIP	010
37 #define T_EOF	020
38 #define T_EOR	040
39 #define T_QOT	0100
40 #define T_ESC	0200
41 
42 /* table 2 */
43 #define T_BRC	01
44 #define T_DEF	02
45 #define T_AST	04
46 #define	T_DIG	010
47 #define T_SHN	040
48 #define	T_IDC	0100
49 #define T_SET	0200
50 
51 /* for single chars */
52 #define _TAB	(T_SPC)
53 #define _SPC	(T_SPC)
54 #define _UPC	(T_IDC)
55 #define _LPC	(T_IDC)
56 #define _DIG	(T_DIG)
57 #define _EOF	(T_EOF)
58 #define _EOR	(T_EOR)
59 #define _BAR	(T_DIP)
60 #define _HAT	(T_MET)
61 #define _BRA	(T_MET)
62 #define _KET	(T_MET)
63 #define _AMP	(T_DIP)
64 #define _SEM	(T_DIP)
65 #define _LT	(T_DIP)
66 #define _GT	(T_DIP)
67 #define _LQU	(T_QOT|T_ESC)
68 #define _BSL	(T_ESC)
69 #define _DQU	(T_QOT|T_ESC)
70 #define _DOL1	(T_SUB|T_ESC)
71 
72 #define _CBR	T_BRC
73 #define _CKT	T_DEF
74 #define _AST	(T_AST)
75 #define _EQ	(T_DEF)
76 #define _MIN	(T_DEF|T_SHN)
77 #define _PCS	(T_SHN)
78 #define _NUM	(T_SHN)
79 #define _DOL2	(T_SHN)
80 #define _PLS	(T_DEF|T_SET)
81 #define _AT	(T_AST)
82 #define _QU	(T_DEF|T_SHN)
83 
84 /* abbreviations for tests */
85 #define _IDCH	(T_IDC|T_DIG)
86 #define _META	(T_SPC|T_DIP|T_MET|T_EOR)
87 
88 extern
89 #ifdef __STDC__
90 const
91 #endif
92 unsigned char	_ctype1[];
93 
94 /* nb these args are not call by value !!!! */
95 #define	space(c)	((c<QUOTE) && _ctype1[c]&(T_SPC))
96 #define eofmeta(c)	((c<QUOTE) && _ctype1[c]&(_META|T_EOF))
97 #define qotchar(c)	((c<QUOTE) && _ctype1[c]&(T_QOT))
98 #define eolchar(c)	((c<QUOTE) && _ctype1[c]&(T_EOR|T_EOF))
99 #define dipchar(c)	((c<QUOTE) && _ctype1[c]&(T_DIP))
100 #define subchar(c)	((c<QUOTE) && _ctype1[c]&(T_SUB|T_QOT))
101 #define escchar(c)	((c<QUOTE) && _ctype1[c]&(T_ESC))
102 
103 extern
104 #ifdef __STDC__
105 const
106 #endif
107 unsigned char   _ctype2[];
108 
109 #define	digit(c)	((c<QUOTE) && _ctype2[c]&(T_DIG))
110 #define dolchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN))
111 #define defchar(c)	((c<QUOTE) && _ctype2[c]&(T_DEF))
112 #define setchar(c)	((c<QUOTE) && _ctype2[c]&(T_SET))
113 #define digchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST|T_DIG))
114 #define	letter(c)	((c<QUOTE) && _ctype2[c]&(T_IDC))
115 #define alphanum(c)	((c<QUOTE) && _ctype2[c]&(_IDCH))
116 #define astchar(c)	((c<QUOTE) && _ctype2[c]&(T_AST))
117