DEFINITION MODULE Term ; (* Screen/keyboard layer for the TP3 shell. Implements raw keyboard input via POSIX termios and paints the character screen using ANSI escape sequences. *) PROCEDURE Open ; (* switch terminal to raw mode, clear screen *) PROCEDURE Close ; (* restore terminal state *) PROCEDURE ClrScr ; (* home cursor and clear the whole screen *) PROCEDURE GotoXY (row, col : CARDINAL) ; (* position the cursor, 1-based (row, col) *) PROCEDURE PutCh (ch : CHAR) ; PROCEDURE PutStr (s : ARRAY OF CHAR) ; PROCEDURE PutCard (n : CARDINAL) ; (* decimal, no leading zeros (0 -> "0") *) PROCEDURE PutLongCard (n : LONGCARD) ; PROCEDURE ScrnWide (n : CARDINAL) ; (* write n spaces *) PROCEDURE Marked ; (* switch to highlighted attribute (command letters) *) PROCEDURE Normal ; (* back to normal attribute *) PROCEDURE GetCh (VAR ch : CHAR) ; (* blocking read of a single raw key *) PROCEDURE Avail () : BOOLEAN ; (* true if a key is already waiting (non-blocking) *) PROCEDURE GetKey (VAR ch : CHAR) ; (* read one byte if available, else ch := 0C *) PROCEDURE Beep ; END Term.