DIRECTORY IO, Rope, TextNode, TiogaFileOps; TiogaStreams: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; CreateInput: PROC [from: TextNode.Ref, commentHandling: CommentHandling _ discard, levelPrefix: ROPE _ NIL] RETURNS [in: IO.STREAM]; CommentHandling: TYPE = {discard, useDirectly, prefixWithDashDash}; CurInNode: PROC [s: IO.STREAM] RETURNS [n: TextNode.Ref]; SkipChildren: PROC [s: IO.STREAM]; CreateOutput: PROC [to: TiogaFileOps.Ref, breakAtNewline: BOOL _ FALSE, levelPrefix, defaultFormat: ROPE _ NIL] RETURNS [out: IO.STREAM]; CurOutNode: PROC [s: IO.STREAM] RETURNS [n: TiogaFileOps.Ref]; EndNode: PROC [s: IO.STREAM, depthOp: DepthOp _ reset, idempotently: BOOLEAN _ FALSE]; DepthOp: TYPE = {same, reset}; SetFormat: PROC [of: IO.STREAM, format: ROPE]; ChangeDepth: PROC [s: IO.STREAM, deltaDepth: INTEGER _ 0, autoEndNode: BOOL _ TRUE, idempotently: BOOL _ FALSE]; NotNow: ERROR [s: IO.STREAM]; BadDepth: ERROR [s: IO.STREAM, depth: INT]; IsATS: PROC [s: IO.STREAM] RETURNS [is: BOOLEAN]; CopyChildren: PROC [from: TextNode.Ref, to: TiogaFileOps.Ref]; END. fTiogaStreams.Mesa Last Edited by: Spreitzer, September 18, 1985 9:41:47 pm PDT Input Create a Tioga Input Stream on descendents of from. Each subnode's chars are prefixed by levelPrefix * (-1 + its depth realtive to from), then maybe "--" for comment nodes. What to do about comment nodes. Returns the one just after the "carat", which is, of course, between characters. Skips children of CurInNode[s]. Output Creates children of to. IF breakAtNewline, THEN s.PutChar['\n] gets translated to s.EndNode[reset, FALSE]. IF levelPrefix # NIL, THEN every node that begins with N repetitions of levelPrefix will be indented N levels deeper than it otherwise would be. Each child node will have format=defaultFormat, unless explicitly overridden by SetFormat. Returns the one just before the "carat", which is, of course, between characters. depthOp says whether new node should have same depth as previous, or revert to initial (direct child of CreateOutput's to). May be further modified by ChangeDepth or receiving levelPrefixes. Applies to CurOutNode only. IF autoEndNode, THEN first EndNode[same, idempotently]. Must be called "between" nodes (autoEndNode trivializes that). Changes depth of following node from what it would otherwise be. Raised by ChangeDepth when called before node ended. Raised when depth (relative to CreateOutput's to) goes negative --- usually from IO operations (like PutChar) that put the first character on a node. When depth jumps deeper than Tioga will (i.e., more than one level per jump), the difference is made up by prefixing with copies of levelPrefix. Other Accepts either input or output streams. Κ©˜J™J™Kšœ> œ ™Q—K˜š Ÿœœœœ*œœ˜VKšœw œE™Ύ—K˜Kšœ œ˜K˜š Ÿ œœœœ œ˜.Kšœ™—K˜šŸ œœœœœœœœœ˜pKšœ7™7Kšœ>™>K™@—K˜šΠblœœœœ˜Kšœ4™4—K˜š ‘œœœœ œ˜+Kšœ. œe™•K™——™š Ÿœœœœœœ˜1K™'—K˜KšŸ œœ,˜>—K˜Kšœ˜—…—B Q