| 1 |
(* Library module defined by the International Standard |
| 2 |
Information technology - programming languages |
| 3 |
BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language. |
| 4 |
|
| 5 |
Copyright ISO/IEC (International Organization for Standardization |
| 6 |
and International Electrotechnical Commission) 1996-2021. |
| 7 |
|
| 8 |
It may be freely copied for the purpose of implementation (see page |
| 9 |
707 of the Information technology - Programming languages Part 1: |
| 10 |
Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *) |
| 11 |
|
| 12 |
DEFINITION MODULE StdChans; |
| 13 |
|
| 14 |
(* Access to standard and default channels *) |
| 15 |
|
| 16 |
IMPORT IOChan; |
| 17 |
|
| 18 |
TYPE |
| 19 |
ChanId = IOChan.ChanId; |
| 20 |
(* Values of this type are used to identify channels *) |
| 21 |
|
| 22 |
(* The following functions return the standard channel values. |
| 23 |
These channels cannot be closed. |
| 24 |
*) |
| 25 |
|
| 26 |
PROCEDURE StdInChan (): ChanId; |
| 27 |
(* Returns the identity of the implementation-defined standard source for |
| 28 |
program |
| 29 |
input. |
| 30 |
*) |
| 31 |
|
| 32 |
PROCEDURE StdOutChan (): ChanId; |
| 33 |
(* Returns the identity of the implementation-defined standard source for program |
| 34 |
output. |
| 35 |
*) |
| 36 |
|
| 37 |
PROCEDURE StdErrChan (): ChanId; |
| 38 |
(* Returns the identity of the implementation-defined standard destination for program |
| 39 |
error messages. |
| 40 |
*) |
| 41 |
|
| 42 |
PROCEDURE NullChan (): ChanId; |
| 43 |
(* Returns the identity of a channel open to the null device. *) |
| 44 |
|
| 45 |
(* The following functions return the default channel values *) |
| 46 |
|
| 47 |
PROCEDURE InChan (): ChanId; |
| 48 |
(* Returns the identity of the current default input channel. *) |
| 49 |
|
| 50 |
PROCEDURE OutChan (): ChanId; |
| 51 |
(* Returns the identity of the current default output channel. *) |
| 52 |
|
| 53 |
PROCEDURE ErrChan (): ChanId; |
| 54 |
(* Returns the identity of the current default error message channel. *) |
| 55 |
|
| 56 |
(* The following procedures allow for redirection of the default channels *) |
| 57 |
|
| 58 |
PROCEDURE SetInChan (cid: ChanId); |
| 59 |
(* Sets the current default input channel to that identified by cid. *) |
| 60 |
|
| 61 |
PROCEDURE SetOutChan (cid: ChanId); |
| 62 |
(* Sets the current default output channel to that identified by cid. *) |
| 63 |
|
| 64 |
PROCEDURE SetErrChan (cid: ChanId); |
| 65 |
(* Sets the current default error channel to that identified by cid. *) |
| 66 |
|
| 67 |
END StdChans. |