From a4bbed3a55c7c754363e185dc73a2bda2beef8a2 Mon Sep 17 00:00:00 2001 From: Mark Horton Date: Fri, 1 Aug 1980 06:00:22 -0800 Subject: [PATCH] date and time created 80/07/31 23:00:22 by mark SCCS-vsn: usr.bin/ex/ex_re.h 1.1 --- usr/src/usr.bin/ex/ex_re.h | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 usr/src/usr.bin/ex/ex_re.h diff --git a/usr/src/usr.bin/ex/ex_re.h b/usr/src/usr.bin/ex/ex_re.h new file mode 100644 index 0000000000..500d5d5a96 --- /dev/null +++ b/usr/src/usr.bin/ex/ex_re.h @@ -0,0 +1,66 @@ +/* Copyright (c) 1979 Regents of the University of California */ +/* + * Regular expression definitions. + * The regular expressions in ex are similar to those in ed, + * with the addition of the word boundaries from Toronto ed + * and allowing character classes to have [a-b] as in the shell. + * The numbers for the nodes below are spaced further apart then + * necessary because I at one time partially put in + and | (one or + * more and alternation.) + */ +struct regexp { + char Expbuf[ESIZE + 2]; + bool Circfl; + short Nbra; +}; + +/* + * There are three regular expressions here, the previous (in re), + * the previous substitute (in subre) and the previous scanning (in scanre). + * It would be possible to get rid of "re" by making it a stack parameter + * to the appropriate routines. + */ +struct regexp re; /* Last re */ +struct regexp scanre; /* Last scanning re */ +struct regexp subre; /* Last substitute re */ + +/* + * Defining circfl and expbuf like this saves us from having to change + * old code in the ex_re.c stuff. + */ +#define expbuf re.Expbuf +#define circfl re.Circfl +#define nbra re.Nbra + +/* + * Since the phototypesetter v7-epsilon + * C compiler doesn't have structure assignment... + */ +#define savere(a) copy(&a, &re, sizeof (struct regexp)) +#define resre(a) copy(&re, &a, sizeof (struct regexp)) + +/* + * Definitions for substitute + */ +char *braslist[NBRA]; /* Starts of \(\)'ed text in lhs */ +char *braelist[NBRA]; /* Ends... */ +char rhsbuf[RHSSIZE]; /* Rhs of last substitute */ + +/* + * Definitions of codes for the compiled re's. + * The re algorithm is described in a paper + * by K. Thompson in the CACM about 10 years ago + * and is the same as in ed. + */ +#define STAR 1 + +#define CBRA 1 +#define CDOT 4 +#define CCL 8 +#define NCCL 12 +#define CDOL 16 +#define CEOF 17 +#define CKET 18 +#define CCHR 20 +#define CBRC 24 +#define CLET 25 -- 2.20.1