<<>> <> <> <> <> <> <> <> <> <> <> <> <<>> <> <<>> RefTab: CEDAR DEFINITIONS = BEGIN Ref: TYPE = REF RefTabRep; RefTabRep: TYPE = MONITORED RECORD [impl: REF RefTabImplRep]; RefTabImplRep: TYPE; Key: TYPE = REF; Val: TYPE = REF; EqualProc: TYPE = PROC [key1, key2: Key] RETURNS [BOOL]; HashProc: TYPE = PROC [key: Key] RETURNS [CARDINAL]; Create: PROC [mod: NAT ¬ 17, equal: EqualProc ¬ NIL, hash: HashProc ¬ NIL] RETURNS [Ref]; <> <> <> < hash[k1]=hash[k2]>> <<>> GetSize: PROC [x: Ref] RETURNS [INT]; <> Fetch: PROC [x: Ref, key: Key] 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]; <<... 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>> 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]; <<... 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.>> Copy: PROC [x: Ref] RETURNS [Ref]; <<... atomically copies the table.>> <> EqualRope: EqualProc; HashRope: HashProc; <<... for ROPE keys, case significant (Rope.Equal and RopeHash.FromRope with case~TRUE)>> EqualRopeCaseless: EqualProc; HashRopeCaseless: HashProc; <<... for ROPE keys, case ignored (Rope.Equal and RopeHash.FromRope with case~FALSE)>> END.