<<>> <> <> <> DIRECTORY Addresses, CCTypes USING [CCError, CCErrorCase, CCTypeProcs, CreateCedarType, LR, ConformanceCheck, GetGroundTypeClass, Operator], CirioTypes USING [Type, TypedCode, CompilerContext, Node], CedarCode USING [Code, CreateCedarNode, OperationsBody, GetDataFromNode, Operator], IO USING [PutFR, card], Rope USING[ROPE]; AddressesImpl: CEDAR PROGRAM IMPORTS CCTypes, CedarCode, IO EXPORTS Addresses = BEGIN OPEN CCTypes; CC: TYPE = CirioTypes.CompilerContext; Code: TYPE = CedarCode.Code; Type: TYPE = CirioTypes.Type; TypedCode: TYPE = CirioTypes.TypedCode; Node: TYPE = CirioTypes.Node; CCE: ERROR[case: CCTypes.CCErrorCase, msg: Rope.ROPE _ NIL] _ CCTypes.CCError; Operator: TYPE = CedarCode.Operator; <> CreateAddressType: PUBLIC PROC [cc: CC] RETURNS [Type] = BEGIN RETURN [CCTypes.CreateCedarType[$address, AddressTypeCCTypeProcs, NIL, cc]]; END; AddressTypeCCTypeProcs: REF CCTypes.CCTypeProcs _ NEW[CCTypes.CCTypeProcs _[ checkConformance: AddressCCTypesCheckConformance, printType: AddressCCTypesPrintType]]; AddressCCTypesCheckConformance: PROC[valType, varType: Type, cc: CC, procData: REF ANY] RETURNS[CCTypes.ConformanceCheck] = BEGIN IF CCTypes.GetGroundTypeClass[varType, cc] = $address THEN RETURN[yes] ELSE RETURN[no]; END; AddressCCTypesPrintType: PROC [type: Type, printDepth: INT, printWidth: INT, cc: CC, procData: REF ANY] RETURNS [Rope.ROPE] = { RETURN ["ADDRESS"]; }; <> <<>> CreateAddressNode: PUBLIC PROC [type: Type, info: REF ANY, cc: CC] RETURNS [Node] = { RETURN [CedarCode.CreateCedarNode[AddressOps, type, info]]; }; AddressOps: REF CedarCode.OperationsBody _ NEW[CedarCode.OperationsBody _[ show: AddressShow ]]; AddressShow: PROC [node: Node, depth: INT, width: INT, cc: CC] RETURNS [Rope.ROPE] = { info: Addresses.AddressNodeInfo _ NARROW[CedarCode.GetDataFromNode[node]]; addressValue: CARD _ info.getAddressValue[info.data]; addressValueRope: Rope.ROPE _ IO.PutFR["%bB&", IO.card[addressValue]]; RETURN [addressValueRope]; }; END.