date and time created 80/07/31 23:00:22 by mark
authorMark Horton <mark@ucbvax.Berkeley.EDU>
Fri, 1 Aug 1980 14:00:22 +0000 (06:00 -0800)
committerMark Horton <mark@ucbvax.Berkeley.EDU>
Fri, 1 Aug 1980 14:00:22 +0000 (06:00 -0800)
SCCS-vsn: usr.bin/ex/ex_re.h 1.1

usr/src/usr.bin/ex/ex_re.h [new file with mode: 0644]

diff --git a/usr/src/usr.bin/ex/ex_re.h b/usr/src/usr.bin/ex/ex_re.h
new file mode 100644 (file)
index 0000000..500d5d5
--- /dev/null
@@ -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