Dictionaries, definitions, and compilers all use "hash" tables. Hash tables are setup for storing and retrieving Dictionaries, Keywords, Primetypes, definitions (for each dictinary, DDS_DICT), and symbols (for each binary DDS_BIN). When practical, all related data is kept in the same table. Page management is more efficient than general heap support.
A hash table is summarized by a DDS_TABLE structure. Storage for DDS_ITEMs in DDS_TABLE is described by DDS_PAGE. Pages also contain name strings and other non-DDS_ITEM data. Data can be appended to the active DDS_PAGE in DDS_TABLE. When the active page overflows, a new page is allocated. Previous pages are chained together via their initial entry. Only the last DDS_ITEM in the active page can be deleted.
Each entry in a hash table begins with a DDS_ITEM_CLASS struct. It keeps the basic description for an individual entry. Extended entries must inherit DDS_ITEM_CLASS (first member). Additional attributes are appended to the structure as needed. Examples include DDS_DEFN, DDS_DICT, and DDS_KEYWORD.
Support functions operate on DDS_TABLE, DDS_ITEM and DDS_PAGE. Data in a hash page may be "named", "anonymous", or "un-linked".
Structures: defined in dds_table.h DDS_TABLE - hash table descriptor (see DDS_STACK and DDS_ITEM) DDS_PAGE - page descriptor for hash table items DDS_ITEM - generic item descriptor for hash table entries Globals: DDS_TABLE dds_prime_table; /* prime type symbol table */ DDS_TABLE *dds_symbol; /* generic global symbol table */ Files: tableinit.c - Initialize hash table descriptor tablepush.c - Push "size" bytes ("align" offset) onto table tablepushstr.c - Push string onto table tablepushchar.c - Push one char for contigous array onto table tablepushitem.c - Create and zero "named" item onto hash table tablelookup.c - Lookup "named" hash table entry tablerehash.c - Rehash "named" hash table entries tableunhash.c - Unhash "indexed" hash table entry Unlink item from hash table "chain" and overflow "chain". Retain item on hash table list "newer" and "older". tableterm.c - Terminate "named" hash table hash.c - Compute hash key, given name string primeup.c - Return prime number >= num