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