CoreTypeCacheImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by: Barth, July 24, 1985 4:56:24 pm PDT
DIRECTORY
Core, CoreTypeCache;
CoreTypeCacheImpl:
CEDAR
PROGRAM
IMPORTS
EXPORTS CoreTypeCache =
BEGIN OPEN Core, CoreTypeCache;
ConcreteTypeCache: TYPE = REF TypeCacheRec;
TypeCacheRec:
PUBLIC
TYPE =
RECORD[
make: MakeProc,
compare: CompareProc,
values: REF];
Narrow: PUBLIC PROC [asAny: REF ANY] RETURNS [typeCache: ConcreteTypeCache] = {typeCache ← NARROW[asAny]};
CreateCache:
PUBLIC PROC [make: MakeProc, compare: CompareProc]
RETURNS [typeCache: ConcreteTypeCache] = {
typeCache ←
NEW[TypeCacheRec ← [
make: make,
compare: compare,
values: NIL]];
};
Ensure:
PUBLIC PROC [design: Design, typeCache: ConcreteTypeCache, args:
REF
ANY]
RETURNS [cellType: CellType] = {
cellType ← NIL;
IF cellType=NIL THEN cellType ← typeCache.make[design: design, args: args];
};
END.