DIRECTORY IntHashTableThreaded, IO, Rope, StructuralComparisonDataStructure, StructuralComparisonOps, ViewerIO; StructuralComparisonLog: CEDAR PROGRAM IMPORTS IntHashTableThreaded, IO, Rope, StructuralComparisonDataStructure, ViewerIO EXPORTS StructuralComparisonOps SHARES StructuralComparisonDataStructure = BEGIN OPEN StructuralComparisonDataStructure; log: IO.STREAM _ ViewerIO.CreateViewerStreams["Structural Comparison Debug Log"].out; Log: PUBLIC PROC [format: ROPE, v1, v2, v3, v4, v5: IO.Value _ [null[]]] = {log.PutF[format, v1, v2, v3, v4, v5]}; FlushLog: PUBLIC PROC = {log.Flush[]}; WriteAll: PUBLIC PROC [when: ROPE, a, b: CellType, oldColorData, curColorData: ColorTable] = BEGIN Log["\n%g\n", IO.rope[when]]; WriteColorTable[curColorData]; WriteParts["A", a]; WriteParts["B", b]; Log["\nDone %g\n", IO.rope[when]]; END; WriteColorTable: PUBLIC PROC [colorTable: ColorTable] = BEGIN WriteColor: PROC [key: INT, value: REF ANY] RETURNS [quit: BOOL _ FALSE] --IntHashTableThreaded.EachPairAction-- = { color: Color = key; ccd: ColorData = NARROW[value]; Log["%011d %4g %4g", IO.int[color], IO.card[ccd.count[A]], IO.card[ccd.count[B]]]; Log[" %5g", IO.bool[ccd.suspect]]; FOR v: Vertex _ ccd.firstVertex, GetColorNext[v] WHILE v # NIL DO Log[" %g.%g", IO.rope[graphIDToRope[GetGraph[v]]], IO.rope[VerboseVName[v]]]; ENDLOOP; Log["\n"]; }; Log["\nColorTable:\n"]; [] _ colorTable.Pairs[WriteColor]; Log["\n"]; END; WriteParts: PROC [graphID: ROPE, ct: CellType] = BEGIN WriteVertex: PROC [v: Vertex] = { Log["%011d)\t%011d\t%5g\t%5g\t%12g", IO.int[OldColor[v]], IO.int[CurColor[v]], IO.bool[GetUnique[v]], IO.bool[GetSuspect[v]], IO.rope[VerboseVName[v]]]; IF GetEquiv[v] # NIL THEN Log["\t%g\n", IO.rope[VerboseVName[GetEquiv[v]]]] ELSE Log["\n"]; }; Log["\nGraph %g vertices:\n", IO.rope[graphID]]; EnumerateParts[ct, WriteVertex, TRUE]; END; VerboseVName: PUBLIC PROC [v: Vertex] RETURNS [name: ROPE] = { name _ IF VName[v].Length[] # 0 THEN VName[v] ELSE IO.PutFR["%bB^", [cardinal[LOOPHOLE[v]]]]; }; PrintCellType: PROC [to: IO.STREAM, ct: CellType] = { PrintIfNet: PROC [v: Vertex] = { SELECT v.class FROM net => {to.PutChar[' ]; to.PutRope[VerboseVName[v]]}; cell => NULL; ENDCASE => ERROR; }; PrintIfCI: PROC [v: Vertex] = { SELECT v.class FROM net => NULL; cell => PrintCI[to, v]; ENDCASE => ERROR; }; to.PutF["%g: CellType\n\tNets:", [rope[ct.name]]]; EnumerateParts[ct, PrintIfNet, FALSE]; to.PutRope["\n\tChildren:"]; EnumerateParts[ct, PrintIfCI, TRUE]; to.PutRope["\n\tEndCellType\n"]; }; PrintCI: PROC [to: IO.STREAM, v: Vertex] = { first: BOOL _ TRUE; pi: PortIndex _ 0; to.PutF["\n\t\t%g: %g[", [rope[VerboseVName[v]]], [rope[v.type.name]]]; FOR e: Edge _ v.firstEdge, e.sides[cell].next WHILE e # NIL DO portName: ROPE = v.type.ports[pi].name; netName: ROPE = VerboseVName[e.sides[net].v]; IF NOT portName.Equal[netName] THEN { IF first THEN first _ FALSE ELSE to.PutRope[", "]; to.PutF["%g: %g", [rope[portName]], [rope[netName]]]; }; pi _ pi + 1; ENDLOOP; to.PutF["]"]; }; END. †StructuralComparisonLog.Mesa Last Edited by: Spreitzer, May 7, 1986 4:18:02 pm PDT Bertrand Serlet June 4, 1986 4:16:24 pm PDT Κ – "cedar" style˜code™J™5K™+—K˜KšΟk œœM˜oK˜šΡbnxœœ˜&Kšœœ3˜SKšœ˜Kšœ"˜(Kšœ˜K˜Kšœœ#˜-K˜KšœœœG˜UK˜š Οnœœœ œœ˜JK˜'—K˜KšŸœœœ˜&K˜šŸœœœœ;˜\Kš˜Kšœœ ˜Kšœ˜Kšœ˜Kšœ˜Kšœœ ˜"Kšœ˜—K˜šŸœœœ˜7Kš˜šŸ œœœ œœœœœΟc'œ˜tK˜Kšœœ˜Kšœœ œœ˜RKšœ œ˜"šœ.œœ˜AKšœœ#œ˜MKšœ˜—K˜ K˜—K˜Kšœ"˜"K˜ Kšœ˜—K˜šŸ œœ œ˜0Kš˜šŸ œœ˜!Kš œ%œœœœœ˜˜Kš œœœœ"œ ˜[Kšœ˜—Kšœœ˜0Kšœ œ˜&Kšœ˜—K˜š Ÿ œœœ œœ˜>Kš œœœ œœœ˜]K˜—K˜šŸ œœœœ˜5šŸ œœ˜ šœ ˜Kšœ5˜5Kšœœ˜ Kšœœ˜—K˜—šŸ œœ˜šœ ˜Kšœœ˜ Kšœ˜Kšœœ˜—K˜—K˜2Kšœœ˜&K˜Kšœœ˜$K˜ K˜—K˜šŸœœœœ˜,Kšœœœ˜K˜KšœG˜Gšœ+œœ˜>Kšœ œ˜'Kšœ œ ˜-šœœœ˜%Kšœœ œœ˜2Kšœ5˜5K˜—K˜ Kšœ˜—K˜ K˜—K˜Kšœ˜——…— Π_