RopeIO.mesa
written by Bill Paxton, August 1982
last edit by Paxton, September 13, 1982 9:42 am
This module provides efficient filing operations for ropes.
For reading, the files are mapped in and block copied to large buffers.
For writing, the characters from the ropes are block copied into large buffers for output.
Last Edited by: Maxwell, January 5, 1983 8:36 am
DIRECTORY
Rope,
File,
IO;
RopeIO: CEDAR DEFINITIONS =
BEGIN
ToFile: PROC [fileName, rope: Rope.ROPE, start: INT ← 0];
write the rope on the specified file
starts writing at given address in file
truncates file to end of rope
ToFileC: PROC [capability: File.Capability, rope: Rope.ROPE, start: INT ← 0];
like ToFile but uses capability instead of file name
FromFile: PROC [fileName: Rope.ROPE, start: INT ← 0, len: INTLAST[INT]]
RETURNS [Rope.ROPE];
create rope from the contents of a file
starts reading at given start address in file
pretends that start+len is the end of the file
FromFileC: PROC [capability: File.Capability, start: INT ← 0, len: INTLAST[INT]]
RETURNS [Rope.ROPE];
like FromFile but uses capability instead of file name
**** IO Stream Operations ****
PutRope: PROC [stream: IO.Handle, rope: Rope.ROPE];
does a series of IO.PutBlock's
GetRope: PROC [stream: IO.Handle, len: INTLAST[INT]]
RETURNS [rope: Rope.ROPE];
reads up to len chars from stream (via GetBlock's) and makes a rope
END.