xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / gcc / m2 / gm2-libs-iso / RTfio.mod
blob55f74bb408c2b9469329ca81844a6f4affca94b7
1 (* RTfio.mod implement default FIO based methods.
3 Copyright (C) 2008-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
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.
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.
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.
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/>. *)
27 IMPLEMENTATION MODULE RTfio ;
29 FROM RTio IMPORT GetFile ;
30 FROM errno IMPORT geterrno ;
32 FROM FIO IMPORT File, ReadChar, UnReadChar, WriteChar, ReadNBytes,
33 WriteNBytes, IsActive,
34 WriteLine, EOF, WasEOLN, IsNoError ;
38 doreadchar - returns a CHAR from the file associated with, g.
41 PROCEDURE doreadchar (g: GenDevIF; d: DeviceTablePtr) : CHAR ;
42 VAR
43 f: File ;
44 BEGIN
45 WITH d^ DO
46 f := GetFile(cid) ;
47 RETURN( ReadChar(f) )
48 END
49 END doreadchar ;
53 dounreadchar - pushes a CHAR back onto the file associated with, g.
56 PROCEDURE dounreadchar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ;
57 VAR
58 f: File ;
59 BEGIN
60 WITH d^ DO
61 f := GetFile(cid) ;
62 UnReadChar(f, ch) ;
63 RETURN( ch )
64 END
65 END dounreadchar ;
69 dogeterrno - returns the errno relating to the generic device.
72 PROCEDURE dogeterrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ;
73 BEGIN
74 RETURN geterrno()
75 END dogeterrno ;
79 dorbytes - reads upto, max, bytes setting, actual, and
80 returning FALSE if an error (not due to eof)
81 occurred.
84 PROCEDURE dorbytes (g: GenDevIF; d: DeviceTablePtr;
85 to: ADDRESS;
86 max: CARDINAL;
87 VAR actual: CARDINAL) : BOOLEAN ;
88 VAR
89 f: File ;
90 BEGIN
91 WITH d^ DO
92 f := GetFile(cid) ;
93 actual := ReadNBytes(f, max, to) ;
94 RETURN( IsNoError(f) )
95 END
96 END dorbytes ;
100 dowbytes -
103 PROCEDURE dowbytes (g: GenDevIF; d: DeviceTablePtr;
104 from: ADDRESS;
105 nBytes: CARDINAL;
106 VAR actual: CARDINAL) : BOOLEAN ;
108 f: File ;
109 BEGIN
110 WITH d^ DO
111 f := GetFile(cid) ;
112 actual := WriteNBytes(f, nBytes, from) ;
113 RETURN( IsNoError(f) )
115 END dowbytes ;
119 dowriteln - attempt to write an end of line marker to the
120 file and returns TRUE if successful.
123 PROCEDURE dowriteln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
125 f: File ;
126 BEGIN
127 f := GetFile(d^.cid) ;
128 WriteLine(f) ;
129 RETURN( IsNoError(f) )
130 END dowriteln ;
134 iseof - returns TRUE if end of file has been seen.
137 PROCEDURE iseof (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
139 f: File ;
140 BEGIN
141 WITH d^ DO
142 f := GetFile(cid) ;
143 RETURN( EOF(f) )
145 END iseof ;
149 iseoln - returns TRUE if end of line is seen.
152 PROCEDURE iseoln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
154 f: File ;
155 BEGIN
156 WITH d^ DO
157 f := GetFile(cid) ;
158 RETURN( WasEOLN(f) )
160 END iseoln ;
164 iserror - returns TRUE if an error was seen on the device.
167 PROCEDURE iserror (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ;
169 f: File ;
170 BEGIN
171 WITH d^ DO
172 f := GetFile(cid) ;
173 RETURN( IsActive(f) AND (NOT IsNoError(f)) )
175 END iserror ;
178 END RTfio.