| 1 |
(* RTfio.def provide default FIO based methods. |
| 2 |
|
| 3 |
Copyright (C) 2008-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 RTfio ; |
| 28 |
|
| 29 |
(* |
| 30 |
Title : RTfio |
| 31 |
Author : Gaius Mulley |
| 32 |
System : GNU Modula-2 |
| 33 |
Date : Wed Sep 24 11:54:58 2008 |
| 34 |
Revision : $Version$ |
| 35 |
Description: provides default FIO based methods for the RTgenif |
| 36 |
procedures. These will be used by StreamFile, |
| 37 |
SeqFile, StdChans, TermFile and RndFile. |
| 38 |
*) |
| 39 |
|
| 40 |
FROM SYSTEM IMPORT ADDRESS ; |
| 41 |
FROM IOLink IMPORT DeviceTablePtr; |
| 42 |
FROM RTgenif IMPORT GenDevIF ; |
| 43 |
|
| 44 |
|
| 45 |
(* |
| 46 |
doreadchar - returns a CHAR from the file associated with, g. |
| 47 |
*) |
| 48 |
|
| 49 |
PROCEDURE doreadchar (g: GenDevIF; d: DeviceTablePtr) : CHAR ; |
| 50 |
|
| 51 |
|
| 52 |
(* |
| 53 |
dounreadchar - pushes a CHAR back onto the file associated |
| 54 |
with, g. |
| 55 |
*) |
| 56 |
|
| 57 |
PROCEDURE dounreadchar (g: GenDevIF; d: DeviceTablePtr; ch: CHAR) : CHAR ; |
| 58 |
|
| 59 |
|
| 60 |
(* |
| 61 |
dogeterrno - returns the errno relating to the generic device. |
| 62 |
*) |
| 63 |
|
| 64 |
PROCEDURE dogeterrno (g: GenDevIF; d: DeviceTablePtr) : INTEGER ; |
| 65 |
|
| 66 |
|
| 67 |
(* |
| 68 |
dorbytes - reads upto, max, bytes setting, actual, and |
| 69 |
returning FALSE if an error (not due to eof) |
| 70 |
occurred. |
| 71 |
*) |
| 72 |
|
| 73 |
PROCEDURE dorbytes (g: GenDevIF; |
| 74 |
d: DeviceTablePtr; |
| 75 |
to: ADDRESS; |
| 76 |
max: CARDINAL; |
| 77 |
VAR actual: CARDINAL) : BOOLEAN ; |
| 78 |
|
| 79 |
(* |
| 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. |
| 83 |
*) |
| 84 |
|
| 85 |
PROCEDURE dowbytes (g: GenDevIF; |
| 86 |
d: DeviceTablePtr; |
| 87 |
from: ADDRESS; |
| 88 |
nBytes: CARDINAL; |
| 89 |
VAR actual: CARDINAL) : BOOLEAN ; |
| 90 |
|
| 91 |
|
| 92 |
(* |
| 93 |
dowriteln - attempt to write an end of line marker to the |
| 94 |
file and returns TRUE if successful. |
| 95 |
*) |
| 96 |
|
| 97 |
PROCEDURE dowriteln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ; |
| 98 |
|
| 99 |
|
| 100 |
(* |
| 101 |
iseof - returns TRUE if end of file has been seen. |
| 102 |
*) |
| 103 |
|
| 104 |
PROCEDURE iseof (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ; |
| 105 |
|
| 106 |
|
| 107 |
(* |
| 108 |
iseoln - returns TRUE if end of line has been seen. |
| 109 |
*) |
| 110 |
|
| 111 |
PROCEDURE iseoln (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ; |
| 112 |
|
| 113 |
|
| 114 |
(* |
| 115 |
iserror - returns TRUE if an error was seen on the device. |
| 116 |
Note that reaching EOF is not classified as an |
| 117 |
error. |
| 118 |
*) |
| 119 |
|
| 120 |
PROCEDURE iserror (g: GenDevIF; d: DeviceTablePtr) : BOOLEAN ; |
| 121 |
|
| 122 |
|
| 123 |
END RTfio. |