DEFINITION MODULE TextBuf ; (* Shared TP3-style text buffer: an array of characters in which lines are terminated by CR ($0D). Used by the shell (load/save) and by the editor. The buffer never stores a trailing ^Z. *) CONST TextLimit = 62903 ; PROCEDURE Clear ; (* reset the buffer to empty *) PROCEDURE Length () : CARDINAL ; (* number of characters currently stored *) PROCEDURE CharAt (i : CARDINAL) : CHAR ; (* character at offset i; 0 <= i < Length *) PROCEDURE InsertCh (i : CARDINAL ; ch : CHAR) ; (* insert one character at offset i, shifting text right. Does nothing if the buffer is full. *) PROCEDURE OverwriteCh (i : CARDINAL ; ch : CHAR) ; (* replace the character at offset i (no insertion) *) PROCEDURE DeleteAt (i : CARDINAL) ; (* delete one character at offset i, shifting text left *) PROCEDURE DeleteFromTo (i, n : CARDINAL) ; (* delete n characters starting at offset i *) END TextBuf.