DIRECTORY Convert, IO, Rope, StructuredStreams, UnparserBuffer; LORAPrinting: CEDAR PROGRAM IMPORTS Convert, IO, StructuredStreams, UnparserBuffer = {OPEN SS: StructuredStreams, UB: UnparserBuffer; LORA: TYPE = LIST OF REF ANY; ROPE: TYPE = Rope.ROPE; breakLast: BOOL _ TRUE; lastOffset: INT _ 0; PrettyPrintREF: PROC [to: IO.STREAM, ra: REF ANY] = { IF ra = NIL THEN to.PutRope["()"] ELSE WITH ra SELECT FROM lora: LORA => { to.PutChar['(]; SS.Begin[to]; {ENABLE UNWIND => SS.End[to]; FOR l: LORA _ lora, l.rest WHILE l # NIL DO PrettyPrintREF[to, l.first]; IF l.rest # NIL THEN {to.PutChar[' ]; SS.Bp[to, FALSE, 0]} ELSE IF breakLast THEN SS.Bp[to, FALSE, lastOffset]; ENDLOOP; to.PutChar[')]; }; SS.End[to]; }; ri: REF INT => { to.PutF["%g", [integer[ri^]]]; }; r: ROPE => { to.PutRope[Convert.RopeFromRope[r]]; }; a: ATOM => { to.PutF["%g", [atom[a]]]; }; ENDCASE => to.PutF["%g", [refAny[ra]]]; }; Print: PROC [to: IO.STREAM, ra: REF ANY] = { ubh: UB.Handle = UB.NewHandle[[stream[to]]]; ss: IO.STREAM = SS.Create[ubh]; PrettyPrintREF[ss, ra]; ss.PutRope["\n"]; ss.Close[]; }; }. €LORAPrinting.Mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Spreitzer, January 22, 1986 7:29:21 pm PST ΚM– "cedar" style˜code™Kšœ Οmœ1™