Annotation of 42BSD/bin/as/assyms.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Copyright (c) 1982 Regents of the University of California
                      3:  *     @(#)assyms.h 4.5 6/30/83
                      4:  */
                      5: /*
                      6:  *     To speed up walks through symbols defined in a particular
                      7:  *     segment, we buil up a table of pointers into the symbol table
                      8:  *     and a table of delimiters for each segment.  The delimiter for
                      9:  *     the particular segment points to the first word in that segment.
                     10:  */
                     11: 
                     12: extern struct  symtab  **symptrs;              /*dynamically allocated*/
                     13: extern struct  symtab  **symdelim[NLOC + NLOC + 1];
                     14: extern struct  symtab  **symptrub;
                     15: extern int     nsyms;                  /*number in the symbol table*/
                     16: extern int     njxxx;                  /*the number of jxxx entries in the table*/
                     17: extern int     nforgotten;             /*how many entries erroneously entered*/
                     18: extern int     nlabels;                /*how many labels in the symbol table*/
                     19: extern int     hshused;                /*how many hash slots used*/
                     20: 
                     21: #define SEGITERATE(segno, start, end, copointer, walkpointer, ubpointer, direction) \
                     22:        for(copointer = start == 0? symdelim[segno]:start,\
                     23:            ubpointer = end == 0 ? *symdelim[segno+1] : *(symdelim[segno]-1),\
                     24:            walkpointer = *copointer;\
                     25:            walkpointer != ubpointer;\
                     26:            walkpointer = * direction copointer)
                     27: 
                     28: #define SYMITERATE(copointer, walkpointer) \
                     29:        for(copointer = symptrs, \
                     30:            walkpointer = *copointer; \
                     31:            copointer < symptrub; \
                     32:            walkpointer = * ++ copointer)
                     33: /*
                     34:  *     Symbols are allocated in non contiguous chunks by extending
                     35:  *     the data area.
                     36:  */
                     37: 
                     38: #define SYMDALLOP      200
                     39: struct         allocbox{
                     40:        struct          allocbox        *nextalloc;
                     41:        struct          symtab          symslots[SYMDALLOP];
                     42: };
                     43: 
                     44: /*
                     45:  *     Names are allocated in a dynamically extensible string pool.
                     46:  */
                     47: struct strpool{
                     48:        struct  strpool *str_next;
                     49:        int             str_nalloc;
                     50:        char            str_names[STRPOOLDALLOP];
                     51: };
                     52: 
                     53: extern struct  strpool *strplhead;
                     54: 
                     55: extern struct  allocbox        *allochead;
                     56: extern struct  allocbox        *alloctail;
                     57: extern struct  symtab          *nextsym;
                     58: extern struct  allocbox        *newbox;
                     59: extern char                    *namebuffer;
                     60: extern int                     symsleft;
                     61: 
                     62: #define ALLOCQTY       sizeof (struct allocbox)
                     63: /*
                     64:  *     Iterate through all symbols in the symbol table in declaration
                     65:  *     order
                     66:  */
                     67: #define DECLITERATE(allocwalk, walkpointer, ubpointer) \
                     68:        for(allocwalk = allochead; \
                     69:            allocwalk != 0; \
                     70:            allocwalk = allocwalk->nextalloc) \
                     71:                for (walkpointer = &allocwalk->symslots[0],\
                     72:                        ubpointer = &allocwalk->symslots[SYMDALLOP], \
                     73:                        ubpointer = ubpointer > ( (struct symtab *)alloctail) \
                     74:                                 ? nextsym : ubpointer ;\
                     75:                     walkpointer < ubpointer; \
                     76:                     walkpointer++ )
                     77: /*
                     78:  *     The hash table is segmented, and dynamically extendable.
                     79:  *     We have a linked list of hash table segments; within each
                     80:  *     segment we use a quadratic rehash that touches no more than 1/2
                     81:  *     of the buckets in the hash table when probing.
                     82:  *     If the probe does not find the desired symbol, it moves to the
                     83:  *     next segment, or allocates a new segment.
                     84:  *
                     85:  *     Hash table segments are kept on the linked list with the first
                     86:  *     segment always first (that contains the reserved words) and
                     87:  *     the last added segment immediately after the first segment
                     88:  *     to hopefully gain something by locality of reference.
                     89:  */
                     90: struct hashdallop {
                     91:        int     h_nused;
                     92:        struct  hashdallop      *h_next;
                     93:        struct  symtab          *h_htab[NHASH];
                     94: };

unix.superglobalmegacorp.com

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