Commit | Line | Data |
---|---|---|
b79f4fa9 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
6 | * @(#)char.h 5.1 (Berkeley) %G% | |
7 | */ | |
13a4113c EW |
8 | |
9 | /* | |
10 | * Table for spotting special characters quickly | |
11 | * | |
12 | * Makes for very obscure but efficient coding. | |
13 | */ | |
14 | ||
15 | extern char _cmap[]; | |
16 | ||
17 | #define _Q 0x01 /* '" */ | |
18 | #define _Q1 0x02 /* ` */ | |
19 | #define _SP 0x04 /* space and tab */ | |
20 | #define _NL 0x08 /* \n */ | |
21 | #define _META 0x10 /* lex meta characters, sp #'`";&<>()|\t\n */ | |
22 | #define _GLOB 0x20 /* glob characters, *?{[` */ | |
23 | #define _ESC 0x40 /* \ */ | |
24 | #define _DOL 0x80 /* $ */ | |
25 | ||
26 | #define cmap(c, bits) (_cmap[(unsigned char)(c)] & (bits)) | |
27 | ||
28 | #define isglob(c) cmap(c, _GLOB) | |
29 | #define isspace(c) cmap(c, _SP) | |
30 | #define isspnl(c) cmap(c, _SP|_NL) | |
31 | #define ismeta(c) cmap(c, _META) |