| 1 |
(* Copyright (C) 2005-2025 Free Software Foundation, Inc. *) |
| 2 |
(* This file is part of GNU Modula-2. |
| 3 |
|
| 4 |
GNU Modula-2 is free software; you can redistribute it and/or modify it under |
| 5 |
the terms of the GNU General Public License as published by the Free |
| 6 |
Software Foundation; either version 2, or (at your option) any later |
| 7 |
version. |
| 8 |
|
| 9 |
GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY |
| 10 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 |
for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License along |
| 15 |
with gm2; see the file COPYING. If not, write to the Free Software |
| 16 |
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) |
| 17 |
DEFINITION MODULE ChanConsts; |
| 18 |
|
| 19 |
(* Common types and values for channel open requests and results *) |
| 20 |
|
| 21 |
TYPE |
| 22 |
ChanFlags = (* Request flags possibly given when a channel is opened *) |
| 23 |
( readFlag, (* input operations are requested/available *) |
| 24 |
writeFlag, (* output operations are requested/available *) |
| 25 |
oldFlag, (* a file may/must/did exist before the channel is opened *) |
| 26 |
textFlag, (* text operations are requested/available *) |
| 27 |
rawFlag, (* raw operations are requested/available *) |
| 28 |
interactiveFlag, (* interactive use is requested/applies *) |
| 29 |
echoFlag (* echoing by interactive device on removal of characters from input |
| 30 |
stream requested/applies *) |
| 31 |
); |
| 32 |
|
| 33 |
FlagSet = SET OF ChanFlags; |
| 34 |
|
| 35 |
(* Singleton values of FlagSet, to allow for example, read + write *) |
| 36 |
|
| 37 |
CONST |
| 38 |
read = FlagSet{readFlag}; (* input operations are requested/available *) |
| 39 |
write = FlagSet{writeFlag}; (* output operations are requested/available *) |
| 40 |
old = FlagSet{oldFlag}; (* a file may/must/did exist before the channel is opened *) |
| 41 |
text = FlagSet{textFlag}; (* text operations are requested/available *) |
| 42 |
raw = FlagSet{rawFlag}; (* raw operations are requested/available *) |
| 43 |
interactive = FlagSet{interactiveFlag}; (* interactive use is requested/applies *) |
| 44 |
echo = FlagSet{echoFlag}; (* echoing by interactive device on removal of characters from |
| 45 |
input stream requested/applies *) |
| 46 |
|
| 47 |
TYPE |
| 48 |
OpenResults = (* Possible results of open requests *) |
| 49 |
(opened, (* the open succeeded as requested *) |
| 50 |
wrongNameFormat, (* given name is in the wrong format for the implementation *) |
| 51 |
wrongFlags, (* given flags include a value that does not apply to the device *) |
| 52 |
tooManyOpen, (* this device cannot support any more open channels *) |
| 53 |
outOfChans, (* no more channels can be allocated *) |
| 54 |
wrongPermissions, (* file or directory permissions do not allow request *) |
| 55 |
noRoomOnDevice, (* storage limits on the device prevent the open *) |
| 56 |
noSuchFile, (* a needed file does not exist *) |
| 57 |
fileExists, (* a file of the given name already exists when a new one is required *) |
| 58 |
wrongFileType, (* the file is of the wrong type to support the required operations *) |
| 59 |
noTextOperations, (* text operations have been requested, but are not supported *) |
| 60 |
noRawOperations, (* raw operations have been requested, but are not supported *) |
| 61 |
noMixedOperations,(* text and raw operations have been requested, but they |
| 62 |
are not supported in combination *) |
| 63 |
alreadyOpen, (* the source/destination is already open for operations not supported |
| 64 |
in combination with the requested operations *) |
| 65 |
otherProblem (* open failed for some other reason *) |
| 66 |
); |
| 67 |
|
| 68 |
END ChanConsts. |
| 69 |
|