-- JaMDict.mesa
-- Last edit by Doug Wyatt,  1-Oct-81 14:51:34

DIRECTORY
  JaMBasic USING [DictBody, Object, Tuple, TuplePtr];

JaMDict: DEFINITIONS = {
OPEN JaMBasic;

-- Types and Constants

DD: TYPE = DictBody; -- dictionary descriptor
Slot: TYPE = TuplePtr; -- location of tuple in dictionary
slotNIL: Slot = NIL; -- Slot returned if no room
Loc: TYPE = CARDINAL; -- location of tuple in cache
locNIL: Loc = LAST[Loc]; -- Loc returned if no room

-- Hashing

freeHash: CARDINAL = LAST[CARDINAL]; -- never returned by Hash

Hash: PROC[key: Object] RETURNS[CARDINAL] = INLINE {
  WITH key:key SELECT FROM name => RETURN[key.id.index];
    ENDCASE => RETURN[HashObject[key]] };
    
HashObject: PROC[Object] RETURNS[CARDINAL];
HashString: PROC[string Object] RETURNS[CARDINAL];
HashText: PROC[LONG STRING] RETURNS[CARDINAL];

-- Low level dictionary operations

LookUpDict: PROC[dd: POINTER TO READONLY DD,
  hash: CARDINAL, key: Object] RETURNS[BOOLEAN,Slot];

InsertInDict: PROC[dd: POINTER TO DD,
  hash: CARDINAL, tuple: Tuple, slot: Slot];

}.