11.2 Dictionary

The dictionary consists of a prime number of 512-byte blocks, each having the following form:

DictionaryBlock STRUC
    dbBuckets   db 37 dup(0)
    dbFreeSpace db ?
    dbEntries   db (512-37) dup(0)
DictionaryBlock ENDS

Following are the descriptions of the entries in a dictionary block:

dbBuckets

Specifies a 37-byte array in which each byte contains either zero, indicating a free bucket, or an offset to one of the dictionary entries in the block.

dbFreeSpace

Specifies the next free byte in the block or contains 0FFh to indicate a full block.

dbEntries

Contains the dictionary entries for the block. Each entry includes a character string defining the symbol and the page number for the start of the object module containing the symbol.

The dictionary is a hashed index of public symbols in the library. A symbol is hashed twice, generating both a block index and a bucket index. The block index specifies which block contains a given symbol, and the bucket index specifies which bucket contains the given symbol's block offset.

The bucket value, multiplied by 2, specifies the offset from the beginning of the block to the beginning of the dictionary entry containing the symbol. Since this offset is a multiple of 2, all dictionary entries start on word boundaries. Furthermore, since the dbBuckets member occupies bytes 0 through 36 (decimal) of each dictionary block and the dbFreeSpace member occupies another byte, the first dictionary entry starts at byte 38. For a complete description of the DictionaryEntry record, see Section 11.3, “Record Reference.”

A dictionary block can be full even though one or more buckets in the block are free. This can happen, for example, if the character strings defining the symbols are longer on average than 9 characters each.