DIRECTORY File, RopeEdit, IO, TextNode; PutGet: CEDAR DEFINITIONS = BEGIN Ref: TYPE = TextNode.Ref; ROPE: TYPE = RopeEdit.ROPE; Offset: TYPE = TextNode.Offset; MaxLen: Offset = LAST[Offset]; ToFile: PROC [fileName: ROPE, node: Ref, start: Offset _ 0, flatten, textOnly: BOOLEAN _ FALSE] RETURNS [dataLen, count: Offset]; ToFileC: PROC [file: File.Capability, node: Ref, start: Offset _ 0, flatten, textOnly: BOOLEAN _ FALSE] RETURNS [dataLen, count: Offset]; FromFile: PROC [fileName: ROPE, start: Offset _ 0, len: Offset _ MaxLen, okToMapFile: BOOLEAN _ FALSE] RETURNS [Ref]; FromFileC: PROC [file: File.Capability, start: Offset _ 0, len: Offset _ MaxLen, okToMapFile: BOOLEAN _ FALSE] RETURNS [Ref]; FromFileError: ERROR; WriteMesaFilePlain: PROC [fileName: ROPE, root: Ref]; WriteFilePlain: PROC [fileName: ROPE, root: Ref]; WriteFileCPlain: PROC [file: File.Capability, root: Ref]; ToRope: PROC [node: Ref, flatten, textOnly: BOOLEAN _ FALSE] RETURNS [dataLen, count: Offset, output: ROPE]; FromRope: PROC [rope: ROPE, start: Offset _ 0, len: Offset _ MaxLen] RETURNS [Ref]; WriteRopePlain: PROC [root: Ref] RETURNS [output: ROPE]; ToStream: PROC [stream: IO.Handle, node: Ref, flatten, textOnly: BOOLEAN _ FALSE] RETURNS [dataLen, count: Offset]; FromStream: PROC [stream: IO.Handle, len: Offset _ MaxLen] RETURNS [Ref]; END. -- PutGet.mesa -- written by Bill Paxton, May 1981 -- last edit by Paxton. October 21, 1982 1:55 pm -- **** 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 -- set okToMapFile to TRUE if you will not want to overwrite the contents later This is like WriteFilePlain, but adds initial dashes to comments if necessary. -- gives text of file with CR after each node and TABs before according to nesting -- **** 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 ʺ˜JšÏc™Jš#™#Jš0™0J˜J˜JšÏk ˜ J˜J˜ Jšžœ˜J˜ J˜Jšœžœ˜Jšž˜J˜Jšœžœ˜Jšžœžœ žœ˜Jšœžœ˜Jšœžœ ˜J˜J˜Jš™J˜š Ïnœžœ žœ3žœžœ˜_Jšžœ˜!—šŸœžœ#˜0Jšœ&žœžœ˜6Jšžœ˜!Jš'™'Jš*™*š;™;Jš0™0J˜——šŸœžœ žœ*˜HJšœ žœžœžœ˜,—šŸ œžœA˜PJšœ žœžœžœ˜,Jš*™*Jš0™0Jš1™1šA™AJš=™=—JšO™OJ˜—Jšœžœ˜J˜šŸœžœ žœ ˜5Jšœ Ÿœ3™N—JšŸœžœ žœ ˜1šŸœžœ$˜9JšR™RJ˜—Jš1™1J˜šŸœžœ žœžœ˜