TextBuf.def 929 B

1234567891011121314151617181920212223242526272829303132
  1. DEFINITION MODULE TextBuf ;
  2. (* Shared TP3-style text buffer: an array of characters in which lines
  3. are terminated by CR ($0D). Used by the shell (load/save) and by the
  4. editor. The buffer never stores a trailing ^Z. *)
  5. CONST
  6. TextLimit = 62903 ;
  7. PROCEDURE Clear ;
  8. (* reset the buffer to empty *)
  9. PROCEDURE Length () : CARDINAL ;
  10. (* number of characters currently stored *)
  11. PROCEDURE CharAt (i : CARDINAL) : CHAR ;
  12. (* character at offset i; 0 <= i < Length *)
  13. PROCEDURE InsertCh (i : CARDINAL ; ch : CHAR) ;
  14. (* insert one character at offset i, shifting text right.
  15. Does nothing if the buffer is full. *)
  16. PROCEDURE OverwriteCh (i : CARDINAL ; ch : CHAR) ;
  17. (* replace the character at offset i (no insertion) *)
  18. PROCEDURE DeleteAt (i : CARDINAL) ;
  19. (* delete one character at offset i, shifting text left *)
  20. PROCEDURE DeleteFromTo (i, n : CARDINAL) ;
  21. (* delete n characters starting at offset i *)
  22. END TextBuf.