<> <> <> <> DIRECTORY IO, Rope; Hash: CEDAR DEFINITIONS = BEGIN NewTable: PROC[nBuckets: INT _ 16] RETURNS [table: Table]; <> Find: PROC[table: Table, name: Rope.ROPE] RETURNS [entry: Entry]; <> Enumerate: PROC[table: Table, pattern: Rope.ROPE, proc: EnumProc, clientData: REF ANY _ NIL, errorStream: IO.STREAM _ NIL]; <> <<1. "*x": matches all elements of the table whose names contain the substring x. Since this involves a complete search of the entire hash table, it may be slow.>> <<2. "ab": matches names of the form acb where c gets successive numerical values between x and y, inclusive. Each string will be looked up in the hash table. This is relatively fast. Use backslash as a quote character to get < and > characters in the string without special interpretation.>> <<3. Strings not in the above categories: they are just looked up as they are.>> < forms may be combined. Note: a pattern of "*" will enumerate all of the entries in the table. TRUE is returned if the pattern was correct, FALSE if it didn't make sense.>> Stats: PUBLIC PROC[table: Table, stream: IO.STREAM]; <> Entry: TYPE = REF EntryRec; EntryRec: TYPE = RECORD [ <> name: Rope.ROPE, clientData: REF ANY, nextInBucket: Entry, nextOverall: Entry ]; EnumProc: TYPE = PROC[entry: Entry, clientData: REF ANY]; <> Table: TYPE = REF TableRec; TableRec: TYPE = RECORD [ <> buckets: REF Buckets, nEntries: CARDINAL, hashDivide: INT, hashMask: CARDINAL, firstEntry: Entry ]; Buckets: TYPE = RECORD [ s: SEQUENCE length: CARDINAL OF Entry ]; END.