|
|
1.1 ! root 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 CEOF 17 ! 63: #define CKET 18 ! 64: #define CCHR 20 ! 65: #define CBRC 24 ! 66: #define CLET 25
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.