Annotation of 40BSD/cmd/ex/ex_re.h, revision 1.1.1.1

1.1       root        1: /* Copyright (c) 1980 Regents of the University of California */
                      2: /* sccs id:    @(#)ex_re.h     6.1 10/18/80  */
                      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: struct regexp re;              /* Last re */
                     25: struct regexp scanre;          /* Last scanning re */
                     26: 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: char   *braslist[NBRA];        /* Starts of \(\)'ed text in lhs */
                     47: char   *braelist[NBRA];        /* Ends... */
                     48: 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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.