<<>> <> <> <> <> <> <> <<>> DIRECTORY CCTypes USING [CCTypeProcs, CreateCedarType, PrintType], CirioTypes USING[CompilerContext, Type, Node], CedarCode USING [CreateCedarNode, OperationsBody, GetDataFromNode, GetTypeOfNode], IO, Rope USING[ROPE], Types USING [TypeIndirectNodeInfo]; TypesImpl: CEDAR PROGRAM IMPORTS CCTypes, CedarCode, IO EXPORTS Types = BEGIN OPEN CCTypes; CC: TYPE = CirioTypes.CompilerContext; Type: TYPE = CirioTypes.Type; Node: TYPE = CirioTypes.Node; <> <> <> <> <> CreateTypeType: PUBLIC PROC [cc: CC] RETURNS [Type] = { type: Type _ CCTypes.CreateCedarType[$type, TypeTypeCCTypeProcs, IndirectTypeTypeCCTypeProcs, cc]; RETURN [type]; }; TypeTypeCCTypeProcs: REF CCTypes.CCTypeProcs _ NEW[CCTypes.CCTypeProcs _[ printType: TypeCCTypesPrintType]]; IndirectTypeTypeCCTypeProcs: REF CCTypes.CCTypeProcs _ NEW[CCTypes.CCTypeProcs _[ printType: TypeCCTypesPrintType]]; TypeCCTypesPrintType: PROC [to: IO.STREAM, type: Type, printDepth: INT, printWidth: INT, cc: CC, procData: REF ANY] = {to.PutRope["TYPE"]}; <> <<>> CreateTypeIndirectNode: PUBLIC PROC [type: Type, info: REF ANY] RETURNS [Node] = { RETURN [CedarCode.CreateCedarNode[TypeIndirectOps, type, info]]; }; TypeIndirectOps: REF CedarCode.OperationsBody _ NEW[CedarCode.OperationsBody _[ load: TypeIndirectLoad, show: TypeShow ]]; TypeIndirectLoad: PROC [indirectType: Type, indirectNode: Node, cc: CC] RETURNS [Node] = { RETURN [indirectNode]; }; TypeShow: PROC [to: IO.STREAM, node: Node, depth: INT, width: INT, cc: CC] = { info: Types.TypeIndirectNodeInfo _ NARROW[CedarCode.GetDataFromNode[node]]; defType: CirioTypes.Type _ info.getDefinitionType[info.data]; IF depth = 0 THEN { defType: CirioTypes.Type _ CedarCode.GetTypeOfNode[node]; CCTypes.PrintType[to, defType, depth, width, cc]; } ELSE { CCTypes.PrintType[to, defType, depth, width, cc]; }; }; <<>> END.