| 1 |
(* IO.def provides Read, Write, Errors procedures mapping onto 0, 1 and 2. |
| 2 |
|
| 3 |
Copyright (C) 2001-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 IO ; |
| 28 |
|
| 29 |
(* |
| 30 |
Author : Gaius Mulley |
| 31 |
Title : IO |
| 32 |
Date : 3/4/86 [$Date: 2010/10/03 19:01:10 $] |
| 33 |
SYSTEM : GNU Modula-2 |
| 34 |
Description: provides Read, Write, Errors procedures that map onto UNIX |
| 35 |
file descriptors 0, 1 and 2. This is achieved by using |
| 36 |
FIO if we are in buffered mode and using libc.write |
| 37 |
if not. |
| 38 |
Version : $Revision: 1.6 $ |
| 39 |
*) |
| 40 |
|
| 41 |
EXPORT QUALIFIED Read, Write, Error, |
| 42 |
UnBufferedMode, BufferedMode, |
| 43 |
EchoOn, EchoOff ; |
| 44 |
|
| 45 |
|
| 46 |
PROCEDURE Read (VAR ch: CHAR) ; |
| 47 |
PROCEDURE Write (ch: CHAR) ; |
| 48 |
PROCEDURE Error (ch: CHAR) ; |
| 49 |
|
| 50 |
|
| 51 |
(* |
| 52 |
UnBufferedMode - places file descriptor, fd, into an unbuffered mode. |
| 53 |
*) |
| 54 |
|
| 55 |
PROCEDURE UnBufferedMode (fd: INTEGER; input: BOOLEAN) ; |
| 56 |
|
| 57 |
|
| 58 |
(* |
| 59 |
BufferedMode - places file descriptor, fd, into a buffered mode. |
| 60 |
*) |
| 61 |
|
| 62 |
PROCEDURE BufferedMode (fd: INTEGER; input: BOOLEAN) ; |
| 63 |
|
| 64 |
|
| 65 |
(* |
| 66 |
EchoOn - turns on echoing for file descriptor, fd. This |
| 67 |
only really makes sence for a file descriptor opened |
| 68 |
for terminal input or maybe some specific file descriptor |
| 69 |
which is attached to a particular piece of hardware. |
| 70 |
*) |
| 71 |
|
| 72 |
PROCEDURE EchoOn (fd: INTEGER; input: BOOLEAN) ; |
| 73 |
|
| 74 |
|
| 75 |
(* |
| 76 |
EchoOff - turns off echoing for file descriptor, fd. This |
| 77 |
only really makes sence for a file descriptor opened |
| 78 |
for terminal input or maybe some specific file descriptor |
| 79 |
which is attached to a particular piece of hardware. |
| 80 |
*) |
| 81 |
|
| 82 |
PROCEDURE EchoOff (fd: INTEGER; input: BOOLEAN) ; |
| 83 |
|
| 84 |
|
| 85 |
END IO. |