Term.def 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. DEFINITION MODULE Term ;
  2. (* Screen/keyboard layer for the TP3 shell.
  3. Implements raw keyboard input via POSIX termios and paints the
  4. character screen using ANSI escape sequences. *)
  5. PROCEDURE Open ;
  6. (* switch terminal to raw mode, clear screen *)
  7. PROCEDURE Close ;
  8. (* restore terminal state *)
  9. PROCEDURE ClrScr ;
  10. (* home cursor and clear the whole screen *)
  11. PROCEDURE GotoXY (row, col : CARDINAL) ;
  12. (* position the cursor, 1-based (row, col) *)
  13. PROCEDURE PutCh (ch : CHAR) ;
  14. PROCEDURE PutStr (s : ARRAY OF CHAR) ;
  15. PROCEDURE PutCard (n : CARDINAL) ;
  16. (* decimal, no leading zeros (0 -> "0") *)
  17. PROCEDURE PutLongCard (n : LONGCARD) ;
  18. PROCEDURE ScrnWide (n : CARDINAL) ;
  19. (* write n spaces *)
  20. PROCEDURE Marked ; (* switch to highlighted attribute (command letters) *)
  21. PROCEDURE Normal ; (* back to normal attribute *)
  22. PROCEDURE GetCh (VAR ch : CHAR) ;
  23. (* blocking read of a single raw key *)
  24. PROCEDURE Avail () : BOOLEAN ;
  25. (* true if a key is already waiting (non-blocking) *)
  26. PROCEDURE GetKey (VAR ch : CHAR) ;
  27. (* read one byte if available, else ch := 0C *)
  28. PROCEDURE Beep ;
  29. END Term.