]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* Termbase.def provides GNU Modula-2 with a PIM 234 compatible Termbase. |
2 | ||
83ffe9cd | 3 | Copyright (C) 2004-2023 Free Software Foundation, Inc. |
1eee94d3 GM |
4 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
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 Termbase ; | |
28 | ||
29 | (* | |
30 | Initially the read routines from Keyboard and the | |
31 | write routine from Display is assigned to the Read, | |
32 | KeyPressed and Write procedures. | |
33 | *) | |
34 | ||
35 | EXPORT QUALIFIED ReadProcedure, StatusProcedure, WriteProcedure, | |
36 | AssignRead, AssignWrite, UnAssignRead, UnAssignWrite, | |
37 | Read, KeyPressed, Write ; | |
38 | ||
39 | TYPE | |
40 | ReadProcedure = PROCEDURE (VAR CHAR) ; | |
41 | WriteProcedure = PROCEDURE (CHAR) ; | |
42 | StatusProcedure = PROCEDURE () : BOOLEAN ; | |
43 | ||
44 | ||
45 | (* | |
46 | AssignRead - assigns a read procedure and status procedure for terminal | |
47 | input. Done is set to TRUE if successful. Subsequent | |
48 | Read and KeyPressed calls are mapped onto the user supplied | |
49 | procedures. The previous read and status procedures are | |
50 | uncovered and reused after UnAssignRead is called. | |
51 | *) | |
52 | ||
53 | PROCEDURE AssignRead (rp: ReadProcedure; sp: StatusProcedure; | |
54 | VAR Done: BOOLEAN) ; | |
55 | ||
56 | ||
57 | (* | |
58 | UnAssignRead - undo the last call to AssignRead and set Done to TRUE | |
59 | on success. | |
60 | *) | |
61 | ||
62 | PROCEDURE UnAssignRead (VAR Done: BOOLEAN) ; | |
63 | ||
64 | ||
65 | (* | |
66 | Read - reads a single character using the currently active read | |
67 | procedure. | |
68 | *) | |
69 | ||
70 | PROCEDURE Read (VAR ch: CHAR) ; | |
71 | ||
72 | ||
73 | (* | |
74 | KeyPressed - returns TRUE if a character is available to be read. | |
75 | *) | |
76 | ||
77 | PROCEDURE KeyPressed () : BOOLEAN ; | |
78 | ||
79 | ||
80 | (* | |
81 | AssignWrite - assigns a write procedure for terminal output. | |
82 | Done is set to TRUE if successful. Subsequent | |
83 | Write calls are mapped onto the user supplied | |
84 | procedure. The previous write procedure is | |
85 | uncovered and reused after UnAssignWrite is called. | |
86 | *) | |
87 | ||
88 | PROCEDURE AssignWrite (wp: WriteProcedure; VAR Done: BOOLEAN) ; | |
89 | ||
90 | ||
91 | (* | |
92 | UnAssignWrite - undo the last call to AssignWrite and set Done to TRUE | |
93 | on success. | |
94 | *) | |
95 | ||
96 | PROCEDURE UnAssignWrite (VAR Done: BOOLEAN) ; | |
97 | ||
98 | ||
99 | (* | |
100 | Write - writes a single character using the currently active write | |
101 | procedure. | |
102 | *) | |
103 | ||
104 | PROCEDURE Write (VAR ch: CHAR) ; | |
105 | ||
106 | ||
107 | END Termbase. |