1 (* RTfio.def provide 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)
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 DEFINITION MODULE RTfio
;
33 Date : Wed Sep 24 11:54:58 2008
35 Description: provides default FIO based methods for the RTgenif
36 procedures. These will be used by StreamFile,
37 SeqFile, StdChans, TermFile and RndFile.
40 FROM SYSTEM
IMPORT ADDRESS
;
41 FROM IOLink
IMPORT DeviceTablePtr
;
42 FROM RTgenif
IMPORT GenDevIF
;
46 doreadchar - returns a CHAR from the file associated with, g.
49 PROCEDURE doreadchar (g
: GenDevIF
; d
: DeviceTablePtr
) : CHAR ;
53 dounreadchar - pushes a CHAR back onto the file associated
57 PROCEDURE dounreadchar (g
: GenDevIF
; d
: DeviceTablePtr
; ch
: CHAR) : CHAR ;
61 dogeterrno - returns the errno relating to the generic device.
64 PROCEDURE dogeterrno (g
: GenDevIF
; d
: DeviceTablePtr
) : INTEGER ;
68 dorbytes - reads upto, max, bytes setting, actual, and
69 returning FALSE if an error (not due to eof)
73 PROCEDURE dorbytes (g
: GenDevIF
;
77 VAR actual
: CARDINAL) : BOOLEAN ;
80 dowbytes - writes up to, nBytes. It returns FALSE
81 if an error occurred and it sets actual
82 to the amount of data written.
85 PROCEDURE dowbytes (g
: GenDevIF
;
89 VAR actual
: CARDINAL) : BOOLEAN ;
93 dowriteln - attempt to write an end of line marker to the
94 file and returns TRUE if successful.
97 PROCEDURE dowriteln (g
: GenDevIF
; d
: DeviceTablePtr
) : BOOLEAN ;
101 iseof - returns TRUE if end of file has been seen.
104 PROCEDURE iseof (g
: GenDevIF
; d
: DeviceTablePtr
) : BOOLEAN ;
108 iseoln - returns TRUE if end of line has been seen.
111 PROCEDURE iseoln (g
: GenDevIF
; d
: DeviceTablePtr
) : BOOLEAN ;
115 iserror - returns TRUE if an error was seen on the device.
116 Note that reaching EOF is not classified as an
120 PROCEDURE iserror (g
: GenDevIF
; d
: DeviceTablePtr
) : BOOLEAN ;