<> <> <> <> DIRECTORY CD, Rope, SymTab; CDGenerate: CEDAR DEFINITIONS = BEGIN <> Table: TYPE = REF READONLY TableRep; TableRep: TYPE = RECORD [rep: PRIVATE REF, case: BOOL, cache: BOOL]; GeneratorProc: TYPE = PROC [design: CD.Design, key: Rope.ROPE, table: Table, data: REF] RETURNS [ob: CD.Object_NIL]; Create: PROC [case: BOOL _ TRUE, cache: BOOL _ TRUE] RETURNS [Table]; <<--creates a new, empty table>> Clear: PROC [table: Table]; <<--undo all registrations>> Register: PROC[table: Table, key: Rope.ROPE, generator: GeneratorProc, cache: BOOL_TRUE, data: REF_NIL] RETURNS [first: BOOL]; <<--first if key did not already exist>> <<--cache: tries to cache the result>> <<--data: passed through to FetchNCall calling generator>> <<>> <> <> <> <<>> FetchRegistration: PROC[table: Table, key: Rope.ROPE] RETURNS [generator: GeneratorProc, cache: BOOL, data: REF]; <<--fetch the registration of a generator key>> <<--generator NIL if not found>> FetchCached: PROC[table: Table, design: CD.Design, key: Rope.ROPE] RETURNS [CD.Object]; <<--fetch a generated object if it is cached.>> <<--returns NIL if not found, not cached or looks different>> FetchNCall: PROC[table: Table, design: CD.Design, key: Rope.ROPE, cache: BOOL_TRUE] RETURNS [CD.Object]; <<--fetch a generator and invoke it>> <<--returns NIL if not found or generated>> <<--caching only if generator and this call want caching>> Flush: PROC [table: Table, design: CD.Design, key: Rope.ROPE]; <<--Removes this entry from the cache>> FlushAll: PROC [table: Table, design: CD.Design]; <<--Removes all entries from the cache>> <<>> <<--convenient procedures>> SelectOneOf: PROC[table: Table, label: Rope.ROPE] RETURNS [key: Rope.ROPE]; <<--Interactive selection>> <<--NIL if discarded>> AssertTable: PROC [project: Rope.ROPE] RETURNS [Table]; <<--Fetches a table; if not done then create one and store it for next call of AssertTable.>> <<--This table can be imported by lots of unknown applications...>> publicTables: PRIVATE SymTab.Ref; <<--space for tables to be returned or created using AssertTable>> END.