1: /* Copyright (c) 1981 Regents of the University of California */
2: /* sccs id: @(#)ex_re.h 7.2 7/26/81 */
3: /*
4: * Regular expression definitions.
5: * The regular expressions in ex are similar to those in ed,
6: * with the addition of the word boundaries from Toronto ed
7: * and allowing character classes to have [a-b] as in the shell.
8: * The numbers for the nodes below are spaced further apart then
9: * necessary because I at one time partially put in + and | (one or
10: * more and alternation.)
11: */
12: struct regexp {
13: char Expbuf[ESIZE + 2];
14: bool Circfl;
15: short Nbra;
16: };
17:
18: /*
19: * There are three regular expressions here, the previous (in re),
20: * the previous substitute (in subre) and the previous scanning (in scanre).
21: * It would be possible to get rid of "re" by making it a stack parameter
22: * to the appropriate routines.
23: */
24: var struct regexp re; /* Last re */
25: var struct regexp scanre; /* Last scanning re */
26: var struct regexp subre; /* Last substitute re */
27:
28: /*
29: * Defining circfl and expbuf like this saves us from having to change
30: * old code in the ex_re.c stuff.
31: */
32: #define expbuf re.Expbuf
33: #define circfl re.Circfl
34: #define nbra re.Nbra
35:
36: /*
37: * Since the phototypesetter v7-epsilon
38: * C compiler doesn't have structure assignment...
39: */
40: #define savere(a) copy(&a, &re, sizeof (struct regexp))
41: #define resre(a) copy(&re, &a, sizeof (struct regexp))
42:
43: /*
44: * Definitions for substitute
45: */
46: var char *braslist[NBRA]; /* Starts of \(\)'ed text in lhs */
47: var char *braelist[NBRA]; /* Ends... */
48: var char rhsbuf[RHSSIZE]; /* Rhs of last substitute */
49:
50: /*
51: * Definitions of codes for the compiled re's.
52: * The re algorithm is described in a paper
53: * by K. Thompson in the CACM about 10 years ago
54: * and is the same as in ed.
55: */
56: #define STAR 1
57:
58: #define CBRA 1
59: #define CDOT 4
60: #define CCL 8
61: #define NCCL 12
62: #define CDOL 16
63: #define CEOFC 17
64: #define CKET 18
65: #define CCHR 20
66: #define CBRC 24
67: #define CLET 25
Defined variables
re
defined in line
24; used 6 times
subre
defined in line
26; used 5 times
Defined struct's
Defined macros
CBRA
defined in line
58; used 2 times
CBRC
defined in line
66; used 1 times
CCHR
defined in line
65; used 6 times
CCL
defined in line
60; used 3 times
CDOL
defined in line
62; used 1 times
CDOT
defined in line
59; used 2 times
CEOFC
defined in line
63; used 2 times
CKET
defined in line
64; used 2 times
CLET
defined in line
67; used 1 times
NCCL
defined in line
61; used 2 times
STAR
defined in line
56; used 2 times
expbuf
defined in line
32; used 10 times
nbra
defined in line
34; used 5 times
resre
defined in line
41; used 3 times
Usage of this include