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