DIRECTORY Rope USING [ROPE]; SymTab: CEDAR DEFINITIONS = BEGIN Ref: TYPE = REF SymTabRep; SymTabRep: TYPE = MONITORED RECORD [impl: REF SymTabImplRep]; SymTabImplRep: TYPE; Key: TYPE = Rope.ROPE; Val: TYPE = REF; Create: PROC [mod: NAT ¬ 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: REF READONLY TEXT] RETURNS [found: BOOL, val: Val]; Replace: PROC [x: Ref, key: Key, val: Val] RETURNS [BOOL]; 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]; Erase: PROC [x: Ref]; EachPairAction: TYPE = PROC [key: Key, val: Val] RETURNS [quit: BOOL ¬ FALSE]; Pairs: PROC [x: Ref, action: EachPairAction] RETURNS [BOOL]; UpdateOperation: TYPE = {none, store, delete}; UpdateAction: TYPE = PROC [found: BOOL, val: Val] RETURNS [op: UpdateOperation ¬ none, new: Val ¬ NIL]; Update: PROC [x: Ref, key: Key, action: UpdateAction]; Copy: PROC [x: Ref] RETURNS [Ref]; END.  SymTab.mesa - definitions for symbol table abstraction Copyright Σ 1985, 1986, 1987, 1991 by Xerox Corporation. All rights reserved. Russ Atkinson, February 5, 1985 2:03:26 pm PST Doug Wyatt, January 15, 1987 4:14:24 pm PST A SymTab is hash table which associates ROPE keys with REF values. SymTab is like RefTab except for the Key type. ... 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 ... replaces value for existing key; returns TRUE if previous value overwritten; if no previous value for key, returns FALSE without inserting new pair ... 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 ... deletes all key-value pairs in the table ... 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 ... atomically performs an update action; looks up key and calls action, which returns the desired operation. If op=none, the table is not changed; if op=store, the new value is stored; if op=delete, key is removed from the table. ... atomically copies the table. ΚM•NewlineDelimiter –(cedarcode) style™codešœ6™6Kšœ ΟeœC™NKšœ.™.K™+—K˜Kšœ(Οkœ žœ8™rK™šž ˜ Kšœžœžœ˜K˜—K™šΟnœžœž œž˜!K˜Kšœžœžœ ˜Kš œ žœž œžœžœ˜=Kšœžœ˜K˜Kšœžœžœ˜Kšœžœžœ˜K˜š Ÿœžœžœ žœžœžœ˜>Kšœ;žœ(žœ$™K˜—K˜šŸœžœ žœžœ˜%Kšœ„™„K˜—šŸœžœžœ žœ ˜?KšœIžœ4žœž™‘K˜—šŸ œžœžœžœžœžœ žœ ˜QKšœIžœ4žœžœ žœžœžœžœ ™ΞK˜—šŸœžœžœžœ˜:Kšœ-žœFžœ™—K˜—šŸœžœžœžœ˜8KšœQžœžœ™‡K˜—šŸœžœžœžœ˜9KšœPžœžœ™K˜—šŸœžœžœžœ˜/Kšœ>žœ žœ™vK˜—šŸœžœ ˜Kšœ,™,K™—K˜š œžœžœžœžœžœ˜NK™—šŸœžœ"žœžœ˜