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