Annotation of researchv10no/cmd/twig/sym.h, revision 1.1

1.1     ! root        1: /* symbol table definitions */
        !             2: extern int symbol_undefined;
        !             3: 
        !             4: /*
        !             5:  * A LabelData structures are associated with label symbols.  They
        !             6:  * indicate that a tree is labelled with the symbol
        !             7:  */
        !             8: typedef struct LabelData       LabelData;
        !             9: 
        !            10: struct LabelData {
        !            11:        Node *tree;
        !            12:        int treeIndex;
        !            13:        int lineno;
        !            14:        SymbolEntry *label;     /* back pointer */
        !            15:        LabelData *next;
        !            16: };
        !            17: 
        !            18: struct treeassoc {
        !            19:        int tree;
        !            20:        struct treeassoc *next;
        !            21: };
        !            22: 
        !            23: struct symbol_entry {
        !            24:        int hash;
        !            25:        char *name;
        !            26:        short attr;
        !            27: #              define  A_UNDEFINED             0
        !            28: #              define  A_NODE                  1
        !            29: #              define  A_LABEL                 2
        !            30: #              define  A_COST                  3
        !            31: #              define  A_ACTION                4
        !            32: #                                              define MAXCHAINS     A_CONST    
        !            33: #                                              define HAS_UNIQUE(x) (x<MAXCHAINS)
        !            34: #              define  A_CONST                 5
        !            35: #                                              define HAS_LIST(x) (x<=A_CONST)
        !            36: #              define  A_ERROR                 10
        !            37: #              define  A_KEYWORD               11
        !            38:        short unique;
        !            39:        struct symbol_entry *link;
        !            40:        struct symbol_entry *next;
        !            41:        union {
        !            42:                int keyword;
        !            43:                int cvalue;     /* a constant's value */
        !            44:                int arity;      /* information stored for A_NODE type */
        !            45:                LabelData *lp;
        !            46:                struct {
        !            47:                        int arity;
        !            48:                        Code *code;
        !            49:                } predData;
        !            50:                struct {
        !            51:                        struct treeassoc *assoc;
        !            52:                        Code *code;
        !            53:                } ca;                           /* data for cost/action symbols */
        !            54:        } sd;
        !            55: };
        !            56: 
        !            57: extern void SymbolInit();
        !            58: extern void SymbolEnter();
        !            59: extern SymbolEntry *SymbolLookup();
        !            60: extern SymbolEntry *SymbolAllocate();
        !            61: extern void SymbolFree();
        !            62: extern void SymbolEnterList();
        !            63: extern char *SymbolGenUnique();
        !            64: 
        !            65: extern SymbolEntry ErrorSymbol;
        !            66: 
        !            67: /*
        !            68:  * In order for the walker to access the labelled leaves of a pattern,
        !            69:  * a table (mistakenly) called the path table is generated (see sym.c).
        !            70:  * This table contains the following possible values:
        !            71:  *
        !            72:  * ePush       follow the children link in the walker skeleton.
        !            73:  * ePop                Pop up to parent.
        !            74:  * eNext       follow  the siblings link.
        !            75:  * eEval <arg> The current node is a labelled leaf whose label id
        !            76:  *             is the integer <arg>.
        !            77:  * eStop       All done. stop!
        !            78:  *
        !            79:  * The table is interpreted by the _getleaves routine in the walker.
        !            80:  */
        !            81: #define        eSTOP   0
        !            82: #define        ePOP    -1
        !            83: #define eEVAL  -2
        !            84: #define eNEXT  -3
        !            85: #define ePUSH  -4

unix.superglobalmegacorp.com

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