DIRECTORY FS USING [OpenFile], IO USING [STREAM], Rope USING [ROPE], TextNode USING [Node]; PutGet: CEDAR DEFINITIONS = BEGIN Node: TYPE = TextNode.Node; ROPE: TYPE = Rope.ROPE; MaxLen: INT = LAST[INT]; ToFile: PROC [fileName: ROPE, node: Node, start: INT _ 0, flatten, textOnly: BOOL _ FALSE] RETURNS [dataLen, count: INT]; ToFileC: PROC [file: FS.OpenFile, node: Node, start: INT _ 0, flatten, textOnly: BOOL _ FALSE] RETURNS [dataLen, count: INT]; FromFile: PROC [fileName: ROPE, start: INT _ 0, len: INT _ MaxLen] RETURNS [Node]; FromFileC: PROC [file: FS.OpenFile, start: INT _ 0, len: INT _ MaxLen] RETURNS [Node]; FromFileError: ERROR; WritePlain: PROC[h: IO.STREAM, root: Node, restoreDashes: BOOL _ FALSE]; WriteFilePlain: PROC [fileName: ROPE, root: Node]; WriteFileCPlain: PROC [file: FS.OpenFile, root: Node]; WriteMesaFilePlain: PROC [fileName: ROPE, root: Node]; ToRope: PROC [node: Node, flatten, textOnly: BOOL _ FALSE] RETURNS [dataLen, count: INT, output: ROPE]; FromRope: PROC [rope: ROPE, start: INT _ 0, len: INT _ MaxLen] RETURNS [Node]; WriteRopePlain: PROC [root: Node, restoreDashes: BOOL _ FALSE] RETURNS [output: ROPE]; ToStream: PROC [stream: IO.STREAM, node: Node, flatten, textOnly: BOOL _ FALSE] RETURNS [dataLen, count: INT]; FromStream: PROC [stream: IO.STREAM, len: INT _ MaxLen] RETURNS [Node]; END. zPutGet.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. written by Bill Paxton, May 1981 last edit by Paxton. October 21, 1982 1:55 pm Russ Atkinson, July 22, 1983 10:24 am Doug Wyatt, August 28, 1986 5:16:53 pm PDT File Input/Output write the node on the specified file starts writing at given address in file returns dataLen = number of data bytes at start of file, and count = the total number of bytes written create node from the contents of a file starts reading at given start address in file pretends that start+len is the end of the file if file was not created by ToFile (i.e., password not correct) then returns a single node containing contents of the file gives text of file with CR after each node and TABs before according to nesting like WriteFilePlain, but adds initial dashes to comments if necessary. Input/Output using ropes instead of files resulting rope contains same representation of node as would be put on file reads rope to construct node IO Operations does a series of IO.PutBlock's returns number of bytes written reads up to len chars from stream (via GetBlock's) to construct a node Κ$˜codešœ ™ Kšœ Οmœ7™BKšœ ™ Kšœ-™-Kšœ%™%K™*—K˜šΟk ˜ Kšžœžœ ˜Kšžœžœžœ˜Kšœžœžœ˜Kšœ žœ˜—K˜KšΠblœžœž ˜šœž˜K˜Kšœžœ˜Kšžœžœžœ˜Kšœžœžœžœ˜—headšœ™KšΟnœžœ žœžœžœžœžœžœ˜zš œžœžœžœžœžœžœžœ˜~Kšœ$™$Kšœ'™'šœ8™8Kšœ-™-—K˜—K˜Kš  œžœ žœ žœ žœ žœ˜Rš   œžœžœžœ žœ žœ˜VKšœ'™'Kšœ-™-Kšœ.™.šœ>™>Kšœ:™:—K˜—šœžœ˜K˜—K˜Jš   œžœžœžœžœžœ˜HKš œžœ žœ˜2š œžœžœ˜6KšœO™OK˜—š œžœ žœ˜6KšœF™FK™——šœ)™)š œžœ!žœžœžœžœ žœ˜hKšœK™KK˜—š  œžœžœ žœ žœ žœ˜NKšœ™K˜—š  œžœžœžœžœ žœ˜VK˜——šœ ™ š œžœ žœžœ!žœžœžœžœ˜oKšœ™Kšœ™K˜—š   œžœ žœžœžœ žœ˜GKšœF™FK˜——K˜Kšžœ˜—…—L κ