-- file PieceTable.mesa -- last edited by Sweet, 6-Nov-81 21:31:53 -- last edited by Satterthwaite, December 23, 1982 11:51 am DIRECTORY CIFS: TYPE USING [OpenFile], Stream: TYPE USING [Handle]; PieceTable: DEFINITIONS = BEGIN Piece: TYPE = RECORD [ -- carefully 8 words long ??? (now 9 words) prev: PieceIndex, length: CARDINAL, -- for this application, pieces are small position: LONG CARDINAL, next: PieceIndex, file: CIFS.OpenFile]; PieceIndex: TYPE = LONG POINTER TO Piece; Place: TYPE = RECORD [pi: PieceIndex, pos: Position, filePos: LONG CARDINAL]; PlacePtr: TYPE = POINTER TO Place; NullPiece: PieceIndex = NIL; PFS: TYPE = RECORD [ next: LONG POINTER TO PFS ← NIL, file: CIFS.OpenFile, stream: Stream.Handle]; Position: TYPE = LONG CARDINAL; PieceTableImpl: PROGRAM; PTError: PUBLIC SIGNAL; -- something went wrong Append: PROCEDURE RETURNS [Position]; -- go to EOF and return pos AppendWord: PROCEDURE RETURNS [Position]; -- round pos to word, Append AppendQuadWord: PROCEDURE RETURNS [Position]; -- round pos to Quadword AppendPage: PROCEDURE RETURNS [Position]; -- round pos to page, Append CopyFromFile: PROCEDURE [ file: CIFS.OpenFile, position: LONG CARDINAL, length: CARDINAL]; Delete: PROCEDURE [count: INTEGER]; Finalize: PROCEDURE; GetByte: PROCEDURE RETURNS [UNSPECIFIED [0..256)]; GetPlace: PROCEDURE RETURNS [Place]; -- of start of current piece GetWord: PROCEDURE RETURNS [UNSPECIFIED]; GetVPos: PROCEDURE RETURNS [Position]; Initialize: PROCEDURE; Length: PROCEDURE RETURNS [LONG CARDINAL]; Move: PROCEDURE [dist: LONG INTEGER]; PutByte: PROCEDURE [byte: UNSPECIFIED [0..256)]; PutWord: PROCEDURE [word: UNSPECIFIED]; PutZeros: PROCEDURE [count: CARDINAL]; SetVPos: PROCEDURE [pos: Position, near: PlacePtr ← NIL]; Store: PROCEDURE [outStream: Stream.Handle]; END.