DIRECTORY Atom USING [PropList], FS USING [ErrorGroup, OpenFile], Rope USING [ROPE], ViewerClasses USING [Viewer]; TiogaAccess: CEDAR DEFINITIONS ~ BEGIN Looks: TYPE ~ PACKED ARRAY CHAR['a..'a+32) OF BOOLEAN; CharWithLooks: TYPE ~ RECORD [char: CHAR, endOfNode: BOOLEAN, looks: Looks]; NodeInfo: TYPE ~ RECORD [ format: Rope.ROPE, comment: BOOLEAN, level: INT, props: Atom.PropList ]; GetExternalProp: PROC [key: REF, value: REF] RETURNS [Rope.ROPE]; GetInternalProp: PROC [key: REF, value: Rope.ROPE] RETURNS [REF]; Buffer: TYPE ~ REF BufferRep; BufferRep: TYPE ~ RECORD [length: NAT, next: Buffer, seq: SEQUENCE maxLength: NAT OF CharWithLooks]; ObtainBuffer: PROC [pieceSize: NAT _ 180] RETURNS [Buffer]; ReleaseBuffer: PROC [buffer: Buffer]; BufferSize: PROC [buffer: Buffer] RETURNS [INT]; SetBufferSize: PROC [buffer: Buffer, newSize: INT]; Append: PROC [buffer: Buffer, value: CharWithLooks]; Store: PROC [buffer: Buffer, index: INT, value: CharWithLooks]; Fetch: PROC [buffer: Buffer, index: INT] RETURNS [CharWithLooks]; Error: ERROR [group: FS.ErrorGroup, expl: Rope.ROPE]; Reader: TYPE ~ REF ReaderRep; ReaderRep: TYPE; FromNothing: PROC RETURNS [Reader]; FromFile: PROC [fileName: Rope.ROPE] RETURNS [Reader]; FromOpenFile: PROC [openFile: FS.OpenFile] RETURNS [Reader]; FromSelection: PROC RETURNS [Reader]; FromViewer: PROC [viewer: ViewerClasses.Viewer] RETURNS [Reader]; EndOf: PROC [reader: Reader] RETURNS [BOOLEAN]; GetNodeInfo: PROC [reader: Reader] RETURNS [NodeInfo]; Get: PROC [reader: Reader] RETURNS [CharWithLooks]; Writer: TYPE ~ REF WriterRep; WriterRep: TYPE; Create: PROC RETURNS [Writer]; Put: PROC [writer: Writer, charWithLooks: CharWithLooks]; PutNodeInfo: PROC [writer: Writer, nodeInfo: NodeInfo]; PutBuffer: PROC [writer: Writer, buffer: Buffer, start: INT _ 0, maxLength: INT _ INT.LAST]; WriteFile: PROC [writer: Writer, fileName: Rope.ROPE]; WriteOpenFile: PROC [writer: Writer, openFile: FS.OpenFile]; WriteSelection: PROC [writer: Writer]; WriteViewer: PROC [writer: Writer, viewer: ViewerClasses.Viewer]; WriteReader: PROC [writer: Writer] RETURNS [Reader]; Reset: PROC [writer: Writer]; DoneWith: PROC [reader: Reader]; GetBuffer: PROC [reader: Reader, buffer: Buffer, start: INT _ 0, maxLength: INT _ INT.LAST] RETURNS [endOfNode: BOOLEAN]; Peek: PROC [reader: Reader] RETURNS [CharWithLooks]; PeekRope: PROC [reader: Reader] RETURNS [Rope.ROPE]; SkipToNextNode: PROC [reader: Reader]; CopyNode: PROC [writer: Writer, reader: Reader, maxLength: INT _ INT.LAST, copyInfo: BOOLEAN _ TRUE] RETURNS [endOfNode: BOOLEAN]; GetNodeRefs: PROC [reader: Reader] RETURNS [root, current: REF, offset: INT]; GetIndex: PROC [reader: Reader] RETURNS [index: INT]; GetLength: PROC [reader: Reader] RETURNS [INT]; GetPosition: PROC [reader: Reader] RETURNS [position: INT]; SetIndex: PROC [reader: Reader, index: INT]; SetPosition: PROC [reader: Reader, position: INT]; PutBack: PROC [reader: Reader, charWithLooks: CharWithLooks]; PutBackBuffer: PROC [reader: Reader, buffer: Buffer, start: INT _ 0, maxLength: INT _ INT.LAST]; END. ¨TiogaAccess.mesa Copyright (C) 1985, Xerox Corporation. All rights reserved. Michael Plass, February 4, 1985 1:22:46 pm PST Provides for sequential processing of Tioga documents, including looks and formatting information. Basic types if endOfNode, char should be CR Node information The property list has ATOMs for keys and ROPEs for values, the values being in their external representation. Use GetExternalProp and GetInternalProp to translate between the internal REF ANY form and the external ROPE form. The format and comment properties are not replicated in the property list. Buffers Handy for passing around collections of elements; don't bother to use these to gain speed, but just where it makes sense to the logic of your program. May be chained to represent sequences longer than can be represented in one buffer. Extends buffer if necessary. Error if index >= BufferSize[buffer] Errors Clients may get errors from FS or IO from the file-oriented operations. The Reader type and its basic operations Not good for much except PutBack. The OpenFile is closed by this call. Makes a reader on a copy of the contents of the primary selection. Must be a text or typescript viewer. Makes a reader on a copy of the viewer contents. The Writer type and its operations Sets the format and property information for the current node. In case this is called more than once per node, the last one wins. The write operations do the write, and reset the writer to a clean state. Closes the OpenFile after writing it. Replaces the primary selection. Clients should use TiogaOps.CallWithLocks or equivalent to avoid race conditions with the user. Must be a text or typescript viewer. Replaces the contents of the viewer. Good for processing the whole document again. Throws the currently accumulated contents away. Subsidiary Reader operations Optional; frees up storage and locks sooner than garbage collector. BufferSize[buffer] is set to start + (number of chars read). Stops with end-of-node marker or when maxLength characters have been read. Returns TRUE if last thing in buffer is an end-of-node marker. Returns the contents of the remainder of the node as a rope. Discards data until the end of the current node. Copies data until the end of the current node, or until maxLength chars have been copied. Returns TRUE if current node was copied all the way to its end. If copyInfo, the NodeInfo of the node is copied as well. Returns the root and current node of the document, and the offset into the current node. Each REF may be narrowed into a TextNode.Ref Provided for clients that need access to Tioga's style machinery. Counts one per character, plus one per node; ignores anything created by PutBack. Value of GetIndex[reader] when EndOf[reader] is TRUE. Like GetIndex, but doesn't count comment nodes. Corresponds to Tioga's Position button. Discards anything created by PutBack before setting index. Contents may differ from what was originally read. Êÿ˜code™K™K™BK˜—š   œœ)œœœœ˜\K˜—š  œœ!œ˜6K™I—š  œœœ ˜K™—š œœœ˜4K˜—š œœœœ˜4K™