Annotation of researchv10no/cmd/upas/libc/regprog.h, revision 1.1.1.1

1.1       root        1: #include <regexp.h>
                      2: 
                      3: /* useful constants */
                      4: #define NULL 0
                      5: #define        TRUE    1
                      6: #define        FALSE   0
                      7: #define        HAT     '\177'          /* character to mark real beg. of line */
                      8: 
                      9: /*
                     10:  *     Sub expression matches
                     11:  */
                     12: #define NSUBEXP 10
                     13: typedef struct {
                     14:        regsubexp m[NSUBEXP];
                     15: }Subexp;
                     16: 
                     17: /*
                     18:  *     character class
                     19:  */
                     20: typedef struct {
                     21:        char    map[16];        /* 16 bytes == 128 bits, one bit per char */
                     22: }Class;
                     23: 
                     24: /*
                     25:  *     Machine instructions
                     26:  */
                     27: typedef struct Inst{
                     28:        int     type;                   /* < 0200 ==> literal, otherwise action */
                     29:        union   {
                     30:                int sid;                /* sub-expression id for RBRA and LBRA */
                     31:                struct Inst *other;     /* instructions pointer */
                     32:        } u;
                     33:        struct Inst *left;
                     34: }Inst;
                     35: #define        next    left    /* Left branch is usually just next ptr */
                     36: #define        subid   u.sid
                     37: #define right  u.other
                     38: 
                     39: /*
                     40:  *     Program definition
                     41:  */
                     42: #define        NCLASS  16
                     43: typedef struct Program{
                     44:        Inst    *startinst;     /* start pc */
                     45:        Class   class[NCLASS];  /* .data */
                     46:        Inst    firstinst[5];   /* .text */
                     47: }Prog;
                     48: 
                     49: /*
                     50:  * Actions and Tokens
                     51:  *
                     52:  *     02xx are operators, value == precedence
                     53:  *     03xx are tokens, i.e. operands for operators
                     54:  */
                     55: #define        OPERATOR        0200    /* Bitmask of all operators */
                     56: #define        START           0200    /* Start, used for marker on stack */
                     57: #define        RBRA            0201    /* Right bracket, ) */
                     58: #define        LBRA            0202    /* Left bracket, ( */
                     59: #define        OR              0203    /* Alternation, | */
                     60: #define        CAT             0204    /* Concatentation, implicit operator */
                     61: #define        STAR            0205    /* Closure, * */
                     62: #define        PLUS            0206    /* a+ == aa* */
                     63: #define        QUEST           0207    /* a? == a|nothing, i.e. 0 or 1 a's */
                     64: #define        ANY             0300    /* Any character, . */
                     65: #define        NOP             0301    /* No operation, internal use only */
                     66: #define        BOL             0302    /* Beginning of line, ^ */
                     67: #define        EOL             0303    /* End of line, $ */
                     68: #define        CCLASS          0304    /* Character class, [] */
                     69: #define        END             0377    /* Terminate: match found */

unix.superglobalmegacorp.com

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