DIRECTORY Rope USING [ROPE]; SymTab: CEDAR DEFINITIONS = BEGIN Ref: TYPE = REF SymTabRep; SymTabRep: TYPE = MONITORED RECORD [ mod: CARDINAL, size: INT, case: BOOL, data: REF Seq]; Seq: TYPE = RECORD[nodes: SEQUENCE max: CARDINAL OF Node]; SeqIndex: TYPE = CARDINAL[0..4000); NodeRep: TYPE = RECORD [key: Key, val: Val, next: Node]; Node: TYPE = REF NodeRep; Key: TYPE = Rope.ROPE; TextKey: TYPE = REF READONLY TEXT; Val: TYPE = REF; EachPairAction: TYPE = PROC [key: Key, val: Val] RETURNS [quit: BOOL]; Create: PROC [mod: SeqIndex _ 17, case: BOOL _ TRUE] RETURNS [Ref]; GetSize: PROC [x: Ref] RETURNS [INT]; Fetch: PROC [x: Ref, key: Key] RETURNS [found: BOOL, val: Val]; FetchText: PROC [x: Ref, key: TextKey] RETURNS [found: BOOL, val: Val]; Store: PROC [x: Ref, key: Key, val: Val] RETURNS [BOOL]; Insert: PROC [x: Ref, key: Key, val: Val] RETURNS [BOOL]; Delete: PROC [x: Ref, key: Key] RETURNS [BOOL]; Pairs: PROC [x: Ref, action: EachPairAction] RETURNS [BOOL]; END. ΞSymTab.mesa - definitions for symbol table abstraction Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson, February 5, 1985 2:03:26 pm PST The type of procedure called for each pair in Pairs ... creates new table with suggested hash size; if case is TRUE, keys are compared exactly; if case is FALSE, case is ignored in comparing keys. ... returns number of key-value pairs in table (use this to properly deal with monitored data in preference to using the size field) ... looks up key in table, returns associated value (if any); if found = TRUE, val = value associated with given key; if found = FALSE, val = NIL ... looks up key in table, returns associated value (if any); if found = TRUE, val = value associated with given key; if found = FALSE, val = NIL; the key MUST NOT BE ALTERED during a call of this procedure ... stores new key-value pair, overwriting previous value for given key; returns TRUE if new value, FALSE if previous value overwritten ... inserts new key-value pair, except if previous value for given key; returns TRUE if inserted, FALSE if previous value for key ... deletes key-value pair associated with given key; returns TRUE if deletion actually occurred, FALSE if no such key ... enumerates pairs currently in symbol table in unspecified order; pairs inserted/deleted during enumeration may or may not be seen; applies action to each pair until action returns TRUE or no more pairs; returns TRUE if some action returns TRUE ΚΈ˜codešœ6™6Kšœ Οmœ1™žœ žœ™vK˜—šŸœžœ"žœžœ˜