DIRECTORY CardHashTableThreaded, IO, Rope, LichenDataStructure, LichenComparisonOps, TiogaOps, ViewerClasses, ViewerForkers, ViewerIO; LichenComparisonLog: CEDAR PROGRAM IMPORTS CardHashTableThreaded, IO, Rope, LichenDataStructure, TiogaOps, ViewerForkers, ViewerIO EXPORTS LichenComparisonOps = BEGIN OPEN LichenDataStructure, LichenComparisonOps; log: IO.STREAM _ NIL; viewer: ViewerClasses.Viewer _ NIL; EnsureLog: PROC = { IF log = NIL OR viewer = NIL OR viewer.destroyed THEN { log _ ViewerIO.CreateViewerStreams["Structural Comparison Debug Log"].out; viewer _ ViewerIO.GetViewerFromStream[log]; IF viewer = NIL THEN ERROR; TiogaOps.SetNodeStyle["Ascii", TiogaOps.ViewerDoc[viewer]]; viewer.newVersion _ FALSE; ViewerForkers.ForkPaint[viewer: viewer, hint: caption, tryShortCuts: TRUE]; }; }; Log: PUBLIC PROC [format: ROPE, v1, v2, v3, v4, v5: IO.Value _ [null[]]] = { EnsureLog[]; log.PutF[format, v1, v2, v3, v4, v5]}; FlushLog: PUBLIC PROC = {EnsureLog[]; log.Flush[]}; WriteAll: PUBLIC PROC [when: ROPE, descriptions: RealGraphDescriptions, a, b: CellType, oldColorData, curColorData: ColorTable] = BEGIN Log["\n%g\n", IO.rope[when]]; WriteColorTable[curColorData, descriptions]; WriteParts[descriptions[A], a]; WriteParts[descriptions[B], b]; Log["\nDone %g\n", IO.rope[when]]; END; WriteColorTable: PUBLIC PROC [colorTable: ColorTable, descriptions: RealGraphDescriptions] = BEGIN WriteColor: PROC [key: CARD, value: REF ANY] RETURNS [quit: BOOL _ FALSE] --CardHashTableThreaded.EachPairAction-- = { color: Color = key; ccd: ColorData = NARROW[value]; Log["%08x %4g %4g", IO.card[color], IO.card[ccd.count[A]], IO.card[ccd.count[B]]]; Log[" %5g", IO.bool[ccd.suspect]]; FOR g: RealGraphID IN RealGraphID DO first: BOOL _ TRUE; FOR v: Vertex _ ccd.firstVertex, v.colorNext WHILE v # NIL DO IF v.graph=g THEN { Log[" "]; IF first THEN {Log["%g: {", [rope[descriptions[g]]]]; first _ FALSE}; Log[VerboseVName[v]]; }; ENDLOOP; IF NOT first THEN Log["}"]; ENDLOOP; Log["\n"]; }; Log["\nColorTable:\n"]; Log["Color, number of %g vertices, num %g, suspect, vertex list\n", [rope[descriptions[A]]], [rope[descriptions[B]]]]; [] _ colorTable.Pairs[WriteColor]; Log["\n"]; END; WriteParts: PROC [description: ROPE, ct: CellType] = BEGIN WriteVertex: PROC [v: Vertex] = { Log["%08x %08x %5g %5g %12g", IO.card[v.oldColor], IO.card[v.curColor], IO.bool[v.unique], IO.bool[v.suspect], IO.rope[VerboseVName[v]]]; IF v.equiv # NIL THEN Log["\t%g\n", IO.rope[VerboseVName[v.equiv]]] ELSE Log["\n"]; }; Log["\n%g vertices:\n", IO.rope[description]]; Log["OldColor CurColor Unique Suspect Name\t\tPartner\n"]; EnumerateParts[ct, WriteVertex, TRUE]; END; VerboseVName: PUBLIC PROC [v: Vertex] RETURNS [name: ROPE] = { name _ Describe[v, v.containingCT]; IF name.Length[]=0 THEN name _ IO.PutFR["%bB^", [cardinal[LOOPHOLE[v]]]]; }; END. ˆLichenComparisonLog.Mesa Bertrand Serlet June 4, 1986 4:16:24 pm PDT Last tweaked by Mike Spreitzer on May 4, 1987 2:43:52 pm PDT Κ1– "cedar" style˜codešœ™K™+K™<—K˜KšΟk œœc˜†K˜šΠbxœœ˜"Kšœœ>˜_Kšœ˜Kšœ˜—K˜Kšœœ*˜4K˜Kšœœœœ˜Kšœœ˜#K˜šΟn œœ˜š œœœ œœœ˜7KšœJ˜JKšœ+˜+Kšœ œœœ˜Kšœ;˜;Kšœœ˜K•StartOfExpansion{[viewer: ViewerClasses.Viewer, hint: ViewerClasses.PaintHint, clearClient: BOOL _ TRUE, whatChanged: REF ANY _ NIL]šœEœ˜KK˜—K˜—K˜š Ÿœœœ œœ˜LKšœ ˜ Kšœ&˜&—K˜KšŸœœœ˜3K˜šŸœœœœ`˜Kš˜Kšœœ ˜Kšœ,˜,Kšœ˜Kšœ˜Kšœœ ˜"Kšœ˜—K˜šŸœœœ@˜\Kš˜šŸ œœœ œœœœœΟc(œ˜vK˜Kšœœ˜Kšœœœœ˜RKšœ œ˜"šœœ ˜$Kšœœœ˜šœ*œœ˜=šœ œ˜Kšœ ˜ Kšœœ1œ˜EKšœ˜K˜—Kšœ˜—Kšœœœ ˜Kšœ˜—K˜ K˜—K˜Kšœv˜vKšœ"˜"K˜ Kšœ˜—K˜šŸ œœœ˜4Kš˜šŸ œœ˜!Kš œ#œœœœœ˜ŽKš œ œœœœ ˜SKšœ˜—Kšœœ˜.K˜K˜#Kšœœœœ˜IK˜—K˜Kšœ˜—…— "Ϋ