| 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 ProgramArgs; |
| 13 |
|
| 14 |
(* Access to program arguments *) |
| 15 |
|
| 16 |
IMPORT IOChan; |
| 17 |
|
| 18 |
TYPE |
| 19 |
ChanId = IOChan.ChanId; |
| 20 |
|
| 21 |
PROCEDURE ArgChan (): ChanId; |
| 22 |
(* Returns a value that identifies a channel for reading |
| 23 |
program arguments *) |
| 24 |
|
| 25 |
PROCEDURE IsArgPresent (): BOOLEAN; |
| 26 |
(* Tests if there is a current argument to read from. If not, |
| 27 |
read <= IOChan.CurrentFlags() will be FALSE, and attempting |
| 28 |
to read from the argument channel will raise the exception |
| 29 |
notAvailable. |
| 30 |
*) |
| 31 |
|
| 32 |
PROCEDURE NextArg (); |
| 33 |
(* If there is another argument, causes subsequent input from the |
| 34 |
argument device to come from the start of the next argument. |
| 35 |
Otherwise there is no argument to read from, and a call of |
| 36 |
IsArgPresent will return FALSE. |
| 37 |
*) |
| 38 |
|
| 39 |
END ProgramArgs. |