1: /* Ascii control table. There are 129 entries. To find the class
2: of a character, mask out the parity bit (if raw I/O is being
3: used) and use it as an index the the ascii array. With "cooked"
4: I/O, EOF is -1. EOF with "parity" masked out is 7f, which is also
5: coded as an eof. With "raw" I/O, EOT acts as an eof. */
6:
7: /* Each entry in the table has the following bits:
8: 1 End of line
9: 2 End of file
10: 4 Alpha
11: 8 Upper case
12: 16 Number
13: 32 Special character
14: 64 White space
15: */
16: /* Codes for loading table */
17:
18: #define UD 0 /* Undefined--assorted control characters */
19: #define EL 1 /* End of line */
20: #define EF 3 /* End of File (and line) */
21: #define LA 4 /* Lower case alpha */
22: #define UA 12 /* Upper case alpha */
23: #define NU 16 /* Numeric */
24: #define SC 32 /* Special character */
25: #define WS 64 /* White space */
26:
27:
28: /* Ascii acts like an array indexed from -1 to 128 */
29:
30: extern char charclass [];
31: #define ascii (charclass + 1)
32:
33: /* Usefull macro functions */
34:
35: #define WHITESPACE(arg) (ascii [arg] == WS)
36: #define NUMERIC(arg) (ascii [arg] == NU)
37: #define ENDLINE(arg) (ascii [arg] & EL)
38:
39: #define TONUM(arg) (arg - '0')
40:
41: /* This reads a line from stdin and returns the first word */
42: #define getword(arg) xgetword (arg, sizeof arg)
43:
44: /* Read a line from stdin */
45: #define getline(arg) xgetline (stdin, arg, sizeof arg)
46:
47: /* Read a line from any stream */
48: #define fgetline(arg1,arg2) xgetline (arg1, arg2, sizeof arg2)
Defined macros
EF
defined in line
20; used 6 times
EL
defined in line
19; used 4 times
LA
defined in line
21; used 26 times
NU
defined in line
23; used 11 times
SC
defined in line
24; used 32 times
TONUM
defined in line
39; used 1 times
UA
defined in line
22; used 26 times
UD
defined in line
18; used 25 times
WS
defined in line
25; used 4 times
ascii
defined in line
31; used 5 times
Usage of this include