1 /* ctype.h 4.1 82/05/07 */ 2 3 # 4 /* 5 * UNIX shell 6 * 7 * S. R. Bourne 8 * Bell Telephone Laboratories 9 * 10 */ 11 12 13 /* table 1 */ 14 #define T_SUB 01 15 #define T_MET 02 16 #define T_SPC 04 17 #define T_DIP 010 18 #define T_EOF 020 19 #define T_EOR 040 20 #define T_QOT 0100 21 #define T_ESC 0200 22 23 /* table 2 */ 24 #define T_BRC 01 25 #define T_DEF 02 26 #define T_AST 04 27 #define T_DIG 010 28 #define T_FNG 020 29 #define T_SHN 040 30 #define T_IDC 0100 31 #define T_SET 0200 32 33 /* for single chars */ 34 #define _TAB (T_SPC) 35 #define _SPC (T_SPC) 36 #define _UPC (T_IDC) 37 #define _LPC (T_IDC) 38 #define _DIG (T_DIG) 39 #define _EOF (T_EOF) 40 #define _EOR (T_EOR) 41 #define _BAR (T_DIP) 42 #define _HAT (T_MET) 43 #define _BRA (T_MET) 44 #define _KET (T_MET) 45 #define _SQB (T_FNG) 46 #define _AMP (T_DIP) 47 #define _SEM (T_DIP) 48 #define _LT (T_DIP) 49 #define _GT (T_DIP) 50 #define _LQU (T_QOT|T_ESC) 51 #define _BSL (T_ESC) 52 #define _DQU (T_QOT) 53 #define _DOL1 (T_SUB|T_ESC) 54 55 #define _CBR T_BRC 56 #define _CKT T_DEF 57 #define _AST (T_AST|T_FNG) 58 #define _EQ (T_DEF) 59 #define _MIN (T_DEF|T_SHN) 60 #define _PCS (T_SHN) 61 #define _NUM (T_SHN) 62 #define _DOL2 (T_SHN) 63 #define _PLS (T_DEF|T_SET) 64 #define _AT (T_AST) 65 #define _QU (T_DEF|T_FNG|T_SHN) 66 67 /* abbreviations for tests */ 68 #define _IDCH (T_IDC|T_DIG) 69 #define _META (T_SPC|T_DIP|T_MET|T_EOR) 70 71 char _ctype1[]; 72 73 /* nb these args are not call by value !!!! */ 74 #define space(c) (((c)"E)==0 ANDF _ctype1[c]&(T_SPC)) 75 #define eofmeta(c) (((c)"E)==0 ANDF _ctype1[c]&(_META|T_EOF)) 76 #define qotchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_QOT)) 77 #define eolchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_EOR|T_EOF)) 78 #define dipchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_DIP)) 79 #define subchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_SUB|T_QOT)) 80 #define escchar(c) (((c)"E)==0 ANDF _ctype1[c]&(T_ESC)) 81 82 char _ctype2[]; 83 84 #define digit(c) (((c)"E)==0 ANDF _ctype2[c]&(T_DIG)) 85 #define fngchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_FNG)) 86 #define dolchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN)) 87 #define defchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_DEF)) 88 #define setchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_SET)) 89 #define digchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST|T_DIG)) 90 #define letter(c) (((c)"E)==0 ANDF _ctype2[c]&(T_IDC)) 91 #define alphanum(c) (((c)"E)==0 ANDF _ctype2[c]&(_IDCH)) 92 #define astchar(c) (((c)"E)==0 ANDF _ctype2[c]&(T_AST)) 93