| 1 |
(* Terminal.def provides a Logitech 3.0 compatible and PIM [234] compatible. |
| 2 |
|
| 3 |
Copyright (C) 2004-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 5 |
|
| 6 |
This file is part of GNU Modula-2. |
| 7 |
|
| 8 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
General Public License for more details. |
| 17 |
|
| 18 |
Under Section 7 of GPL version 3, you are granted additional |
| 19 |
permissions described in the GCC Runtime Library Exception, version |
| 20 |
3.1, as published by the Free Software Foundation. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License and |
| 23 |
a copy of the GCC Runtime Library Exception along with this program; |
| 24 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 25 |
<http://www.gnu.org/licenses/>. *) |
| 26 |
|
| 27 |
DEFINITION MODULE Terminal ; |
| 28 |
|
| 29 |
(* |
| 30 |
It provides simple terminal input output |
| 31 |
routines which all utilize the TermBase module. |
| 32 |
*) |
| 33 |
|
| 34 |
EXPORT QUALIFIED Read, KeyPressed, ReadAgain, ReadString, Write, |
| 35 |
WriteString, WriteLn ; |
| 36 |
|
| 37 |
|
| 38 |
(* |
| 39 |
Read - reads a single character. |
| 40 |
*) |
| 41 |
|
| 42 |
PROCEDURE Read (VAR ch: CHAR) ; |
| 43 |
|
| 44 |
|
| 45 |
(* |
| 46 |
KeyPressed - returns TRUE if a character can be read without blocking |
| 47 |
the caller. |
| 48 |
*) |
| 49 |
|
| 50 |
PROCEDURE KeyPressed () : BOOLEAN ; |
| 51 |
|
| 52 |
|
| 53 |
(* |
| 54 |
ReadString - reads a sequence of characters. |
| 55 |
Tabs are expanded into 8 spaces and <cr> or <lf> terminates |
| 56 |
the string. |
| 57 |
*) |
| 58 |
|
| 59 |
PROCEDURE ReadString (VAR s: ARRAY OF CHAR) ; |
| 60 |
|
| 61 |
|
| 62 |
(* |
| 63 |
ReadAgain - makes the last character readable again. |
| 64 |
*) |
| 65 |
|
| 66 |
PROCEDURE ReadAgain ; |
| 67 |
|
| 68 |
|
| 69 |
(* |
| 70 |
Write - writes a single character to the Termbase module. |
| 71 |
*) |
| 72 |
|
| 73 |
PROCEDURE Write (ch: CHAR) ; |
| 74 |
|
| 75 |
|
| 76 |
(* |
| 77 |
WriteString - writes out a string which is terminated by a <nul> |
| 78 |
character or the end of string HIGH(s). |
| 79 |
*) |
| 80 |
|
| 81 |
PROCEDURE WriteString (s: ARRAY OF CHAR) ; |
| 82 |
|
| 83 |
|
| 84 |
(* |
| 85 |
WriteLn - writes a lf character. |
| 86 |
*) |
| 87 |
|
| 88 |
PROCEDURE WriteLn ; |
| 89 |
|
| 90 |
|
| 91 |
END Terminal. |