<> <> DIRECTORY Ascii, IO, Rope, TTOutput; TTOutputImpl: PROGRAM IMPORTS IO EXPORTS TTOutput = BEGIN maxSpacesInCurrentLine: NAT _ 10; Create: PUBLIC PROCEDURE [stream: IO.STREAM] RETURNS [self: TTOutput.Ref] = { self _ NEW[TTOutput.Rep]; self.stream _ stream; }; Space: PUBLIC PROCEDURE [self: TTOutput.Ref] = { IF self.spacesInCurrentLine >= maxSpacesInCurrentLine THEN EndLine[self]; self.stream.PutChar[Ascii.SP]; self.spacesInCurrentLine _ self.spacesInCurrentLine + 1; self.lastThingWasControlSequence _ FALSE; }; EndLine: PUBLIC PROCEDURE [self: TTOutput.Ref] = { self.stream.PutChar[Ascii.CR]; THROUGH [0..self.level] DO self.stream.PutChar[Ascii.TAB] ENDLOOP; self.spacesInCurrentLine _ 0; }; ControlSeq: PUBLIC PROCEDURE [self: TTOutput.Ref, name: Rope.ROPE] = { self.stream.PutChar['\\]; self.stream.PutRope[name]; }; BeginGroup: PUBLIC PROCEDURE [self: TTOutput.Ref] = { self.stream.PutChar['{]; self.level _ self.level + 1; self.lastThingWasControlSequence _ FALSE; }; EndGroup: PUBLIC PROCEDURE [self: TTOutput.Ref] = { self.stream.PutChar['}]; self.level _ self.level - 1; self.lastThingWasControlSequence _ FALSE; }; Close: PUBLIC PROCEDURE [self: TTOutput.Ref] = { }; END. Michael Plass, December 9, 1982 9:28 am. Created.