<> <> <> <> <> <<>> DIRECTORY Core, CoreOps, CoreProperties, CoreRecordCellClass, IO; CoreRecordCellClassImpl: CEDAR PROGRAM IMPORTS CoreOps, CoreProperties, IO EXPORTS CoreRecordCellClass = BEGIN OPEN Core, CoreRecordCellClass; recordCellClass: PUBLIC CellClass _ NEW[CellClassRec _ [name: "Record", recast: NIL, write: WriteRecord, read: ReadRecord]]; Start: PROC = { CoreOps.RegisterCellClass[recordCellClass]; recordCellClass.properties _ CoreProperties.PutProp[on: recordCellClass.properties, prop: CoreOps.printClassProcProp, value: NEW[CoreOps.PrintClassProc _ PropPrintRecordCellType]]; }; WriteRecord: WriteProc = { }; ReadRecord: ReadProc = { }; PropPrintRecordCellType: CoreOps.PrintClassProc = { PrintRecordCellType[NARROW[data], out]; }; PrintRecordCellType: PUBLIC PROC [recordCellType: RecordCellType, out: STREAM] = { InternalName: CoreOps.EachWireProc = { internal: ROPE _ NIL; FormInternalName: PROC [context: Wire] RETURNS [quit: BOOL _ FALSE] = { IF (quit _ notSubWires _ wire=context) THEN internal _ NARROW[CoreProperties.GetProp[from: context.properties, prop: $FullName]] ELSE IF context.elements#NIL THEN { FOR i:NAT IN [0..context.elements.size) DO quit _ FormInternalName[context: context.elements[i]]; IF quit THEN EXIT; ENDLOOP; }; }; [] _ FormInternalName[context: recordCellType.internalWire]; IF notSubWires THEN IO.PutF[out, " %g", IO.rope[internal]]; }; IO.PutRope[out, "\nInternal wire:"]; CoreOps.PrintWire[recordCellType.internalWire, out]; CoreOps.NameWire[wire: recordCellType.internalWire, name: NIL]; FOR instList: LIST OF Instance _ recordCellType.instances, instList.rest UNTIL instList=NIL DO IO.PutF[out, "\n\nInstance: %g, type: %g", IO.rope[instList.first.name], IO.rope[instList.first.type.name]]; CoreProperties.PrintProperties[instList.first.properties, out]; IO.PutRope[out, "\nActual wire:"]; CoreOps.VisitWire[wire: instList.first.actualWire, eachWire: InternalName]; ENDLOOP; }; Start[]; END.