]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-libs-iso/RTgenif.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-iso / RTgenif.def
CommitLineData
1eee94d3
GM
1(* RTgenif.def provide a generic device interface mechanism used by RTgen.
2
a945c346 3Copyright (C) 2008-2024 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25<http://www.gnu.org/licenses/>. *)
26
27DEFINITION MODULE RTgenif ;
28
29(*
30 Title : RTgenif
31 Author : Gaius Mulley
32 System : GNU Modula-2
33 Date : Mon Sep 22 17:13:45 2008
34 Revision : $Version$
35 Description: provides a generic interface mechanism used
36 by RTgen. This is not an ISO module but rather
37 a runtime support module.
38*)
39
40FROM SYSTEM IMPORT ADDRESS ;
41FROM IOLink IMPORT DeviceId, DeviceTablePtr ;
42
43TYPE
44 GenDevIF ;
45 readchar = PROCEDURE (GenDevIF, DeviceTablePtr) : CHAR ;
46 unreadchar = PROCEDURE (GenDevIF, DeviceTablePtr, CHAR) : CHAR ;
47 geterrno = PROCEDURE (GenDevIF, DeviceTablePtr) : INTEGER ;
48 readbytes = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
49 writebytes = PROCEDURE (GenDevIF, DeviceTablePtr, ADDRESS, CARDINAL, VAR CARDINAL) : BOOLEAN ;
50 writeln = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
51 iseof = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
52 iseoln = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
53 iserror = PROCEDURE (GenDevIF, DeviceTablePtr) : BOOLEAN ;
54
55
56(*
57 InitGenDevIF - initializes a generic device.
58*)
59
60PROCEDURE InitGenDevIF (d : DeviceId;
61 rc : readchar;
62 urc : unreadchar;
63 geterr: geterrno;
64 rbytes: readbytes;
65 wbytes: writebytes;
66 wl : writeln;
67 eof : iseof;
68 eoln : iseoln;
69 iserr : iserror) : GenDevIF ;
70
71
72(*
73 getDID - returns the device id this generic interface.
74*)
75
76PROCEDURE getDID (g: GenDevIF) : DeviceId ;
77
78
79(*
80 doReadChar - returns the next character from the generic
81 device.
82*)
83
84PROCEDURE doReadChar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
85
86
87(*
88 doUnReadChar - pushes back a character to the generic device.
89*)
90
91PROCEDURE doUnReadChar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
92
93
94(*
95 doGetErrno - returns the errno relating to the generic device.
96*)
97
98PROCEDURE doGetErrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
99
100
101(*
102 doRBytes - attempts to read, n, bytes from the generic device.
103 It set the actual amount read and returns a boolean
104 to determine whether an error occurred.
105*)
106
107PROCEDURE doRBytes (g: GenDevIF; d: DeviceTablePtr;
108 to: ADDRESS; max: CARDINAL;
109 VAR actual: CARDINAL) : BOOLEAN ;
110
111
112(*
113 doWBytes - attempts to write, n, bytes to the generic device.
114 It sets the actual amount written and returns a
115 boolean to determine whether an error occurred.
116*)
117
118PROCEDURE doWBytes (g: GenDevIF; d: DeviceTablePtr;
119 from: ADDRESS; max: CARDINAL;
120 VAR actual: CARDINAL) : BOOLEAN ;
121
122
123(*
124 doWrLn - writes an end of line marker and returns
125 TRUE if successful.
126*)
127
128PROCEDURE doWrLn (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
129
130
131(*
132 isEOF - returns true if the end of file was reached.
133*)
134
135PROCEDURE isEOF (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
136
137
138(*
139 isEOLN - returns true if the end of line was reached.
140*)
141
142PROCEDURE isEOLN (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
143
144
145(*
146 isError - returns true if an error was seen in the device.
147*)
148
149PROCEDURE isError (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
150
151
152(*
153 KillGenDevIF - deallocates a generic device.
154*)
155
156PROCEDURE KillGenDevIF (g: GenDevIF) : GenDevIF ;
157
158
159END RTgenif.