1 /* 2 3 * Copyright (c) 1984, 1985, 1986 AT&T 4 * All Rights Reserved 5 6 * THIS IS UNPUBLISHED PROPRIETARY SOURCE 7 * CODE OF AT&T. 8 * The copyright notice above does not 9 * evidence any actual or intended 10 * publication of such source code. 11 12 */ 13 /* @(#)shtype.h 1.1 */ 14 15 /* 16 * UNIX shell 17 * 18 * S. R. Bourne 19 * AT&T Bell Laboratories 20 * 21 */ 22 23 #define const 24 25 /* table 1 */ 26 #define QUOTE (~0177) 27 #define T_SUB 01 28 #define T_MET 02 29 #define T_SPC 04 30 #define T_DIP 010 31 #define T_EXP 020 /* characters which require expansion or substitution */ 32 #define T_EOR 040 33 #define T_QOT 0100 34 #define T_ESC 0200 35 36 /* table 2 */ 37 #define T_ALP 01 /* alpha, but not upper or lower */ 38 #define T_DEF 02 39 #define T_AST 04 /* * or @ */ 40 #define T_DIG 010 /* digit */ 41 #define T_UPC 020 /* uppercase only */ 42 #define T_SHN 040 /* legal parameter characters */ 43 #define T_LPC 0100 /* lowercase only */ 44 #define T_SET 0200 45 46 /* for single chars */ 47 #define _TAB (T_SPC) 48 #define _SPC (T_SPC) 49 #define _ALP (T_ALP) 50 #define _UPC (T_UPC) 51 #define _LPC (T_LPC) 52 #define _DIG (T_DIG) 53 #define _EOF (T_EOR) 54 #define _EOR (T_EOR) 55 #define _BAR (T_DIP) 56 #define _BRA (T_MET|T_DIP) 57 #define _KET (T_MET) 58 #define _AMP (T_DIP) 59 #define _SEM (T_DIP) 60 #define _LT (T_DIP) 61 #define _GT (T_DIP) 62 #define _LQU (T_QOT|T_ESC|T_EXP) 63 #define _QU1 T_EXP 64 #define _AST1 T_EXP 65 #define _BSL (T_ESC) 66 #define _DQU (T_QOT) 67 #define _DOL1 (T_SUB|T_ESC|T_EXP) 68 69 #define _CBR T_SHN 70 #define _CKT T_DEF 71 #define _AST (T_AST) 72 #define _EQ (T_DEF) 73 #define _MIN (T_DEF|T_SHN) 74 #define _PCS (T_DEF|T_SHN|T_SET) 75 #define _NUM (T_DEF|T_SHN|T_SET) 76 #define _DOL2 (T_SHN) 77 #define _PLS (T_DEF|T_SET) 78 #define _AT (T_AST) 79 #define _QU (T_DEF|T_SHN) 80 #define _LPAR T_SHN 81 #define _SS2 T_ALP 82 #define _SS3 T_ALP 83 84 /* abbreviations for tests */ 85 #define _IDCH (T_UPC|T_LPC|T_DIG|T_ALP) 86 #define _META (T_SPC|T_DIP|T_MET|T_EOR) 87 88 extern char _ctype1[]; 89 90 /* these args are not call by value !!!! */ 91 #define isspace(c) (_ctype1[c]&(T_SPC)) 92 #define ismeta(c) (_ctype1[c]&(_META)) 93 #define isqmeta(c) (_ctype1[c]&(_META|T_QOT)) 94 #define qotchar(c) (_ctype1[c]&(T_QOT)) 95 #define eolchar(c) (_ctype1[c]&(T_EOR)) 96 #define dipchar(c) (_ctype1[c]&(T_DIP)) 97 #define subchar(c) (_ctype1[c]&(T_SUB|T_QOT)) 98 #define escchar(c) (_ctype1[c]&(T_ESC)) 99 #define expchar(c) (_ctype1[c]&(T_EXP|T_SPC)) 100 #define isexp(c) (_ctype1[c]&T_EXP) 101 102 extern char _ctype2[]; 103 104 #define isprint(c) (((c)&0340) && ((c)!=0177)) 105 #define isdigit(c) (_ctype2[c]&(T_DIG)) 106 #define dolchar(c) (_ctype2[c]&(T_AST|_IDCH|T_SHN)) 107 #define defchar(c) (_ctype2[c]&(T_DEF)) 108 #define setchar(c) (_ctype2[c]&(T_SET)) 109 #define digchar(c) (_ctype2[c]&(T_AST|T_DIG)) 110 #define isalpha(c) (_ctype2[c]&(T_UPC|T_LPC|T_ALP)) 111 #define isalnum(c) (_ctype2[c]&(_IDCH)) 112 #define isupper(c) (_ctype2[c]&(T_UPC)) 113 #define islower(c) (_ctype2[c]&(T_LPC)) 114 #define astchar(c) (_ctype2[c]&(T_AST)) 115 #define toupper(c) ((c) + 'A' - 'a') 116 #define tolower(c) ((c) + 'a' - 'A') 117