| 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 ChanConsts; |
| 13 |
|
| 14 |
(* Common types and values for channel open requests and results *) |
| 15 |
|
| 16 |
TYPE |
| 17 |
ChanFlags = (* Request flags possibly given when a channel is opened *) |
| 18 |
( readFlag, (* input operations are requested/available *) |
| 19 |
writeFlag, (* output operations are requested/available *) |
| 20 |
oldFlag, (* a file may/must/did exist before the channel is opened *) |
| 21 |
textFlag, (* text operations are requested/available *) |
| 22 |
rawFlag, (* raw operations are requested/available *) |
| 23 |
interactiveFlag, (* interactive use is requested/applies *) |
| 24 |
echoFlag (* echoing by interactive device on removal of characters from input |
| 25 |
stream requested/applies *) |
| 26 |
); |
| 27 |
|
| 28 |
FlagSet = SET OF ChanFlags; |
| 29 |
|
| 30 |
(* Singleton values of FlagSet, to allow for example, read + write *) |
| 31 |
|
| 32 |
CONST |
| 33 |
read = FlagSet{readFlag}; (* input operations are requested/available *) |
| 34 |
write = FlagSet{writeFlag}; (* output operations are requested/available *) |
| 35 |
old = FlagSet{oldFlag}; (* a file may/must/did exist before the channel is opened *) |
| 36 |
text = FlagSet{textFlag}; (* text operations are requested/available *) |
| 37 |
raw = FlagSet{rawFlag}; (* raw operations are requested/available *) |
| 38 |
interactive = FlagSet{interactiveFlag}; (* interactive use is requested/applies *) |
| 39 |
echo = FlagSet{echoFlag}; (* echoing by interactive device on removal of characters from |
| 40 |
input stream requested/applies *) |
| 41 |
|
| 42 |
TYPE |
| 43 |
OpenResults = (* Possible results of open requests *) |
| 44 |
(opened, (* the open succeeded as requested *) |
| 45 |
wrongNameFormat, (* given name is in the wrong format for the implementation *) |
| 46 |
wrongFlags, (* given flags include a value that does not apply to the device *) |
| 47 |
tooManyOpen, (* this device cannot support any more open channels *) |
| 48 |
outOfChans, (* no more channels can be allocated *) |
| 49 |
wrongPermissions, (* file or directory permissions do not allow request *) |
| 50 |
noRoomOnDevice, (* storage limits on the device prevent the open *) |
| 51 |
noSuchFile, (* a needed file does not exist *) |
| 52 |
fileExists, (* a file of the given name already exists when a new one is required *) |
| 53 |
wrongFileType, (* the file is of the wrong type to support the required operations *) |
| 54 |
noTextOperations, (* text operations have been requested, but are not supported *) |
| 55 |
noRawOperations, (* raw operations have been requested, but are not supported *) |
| 56 |
noMixedOperations,(* text and raw operations have been requested, but they |
| 57 |
are not supported in combination *) |
| 58 |
alreadyOpen, (* the source/destination is already open for operations not supported |
| 59 |
in combination with the requested operations *) |
| 60 |
otherProblem (* open failed for some other reason *) |
| 61 |
); |
| 62 |
|
| 63 |
END ChanConsts. |
| 64 |
|