| 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 SWholeIO; |
| 13 |
|
| 14 |
(* Input and output of whole numbers in decimal text form over |
| 15 |
default channels. The read result is of the type |
| 16 |
IOConsts.ReadResults. |
| 17 |
*) |
| 18 |
|
| 19 |
(* The text form of a signed whole number is |
| 20 |
["+" | "-"], decimal digit, {decimal digit} |
| 21 |
|
| 22 |
The text form of an unsigned whole number is |
| 23 |
decimal digit, {decimal digit} |
| 24 |
*) |
| 25 |
|
| 26 |
PROCEDURE ReadInt (VAR int: INTEGER); |
| 27 |
(* Skips leading spaces, and removes any remaining characters |
| 28 |
from the default input channel that form part of a signed |
| 29 |
whole number. The value of this number is assigned |
| 30 |
to int. The read result is set to the value allRight, |
| 31 |
outOfRange, wrongFormat, endOfLine, or endOfInput. |
| 32 |
*) |
| 33 |
|
| 34 |
PROCEDURE WriteInt (int: INTEGER; width: CARDINAL); |
| 35 |
(* Writes the value of int to the default output channel in |
| 36 |
text form, in a field of the given minimum width. |
| 37 |
*) |
| 38 |
|
| 39 |
PROCEDURE ReadCard (VAR card: CARDINAL); |
| 40 |
(* Skips leading spaces, and removes any remaining characters |
| 41 |
from the default input channel that form part of an |
| 42 |
unsigned whole number. The value of this number is |
| 43 |
assigned to card. The read result is set to the value |
| 44 |
allRight, outOfRange, wrongFormat, endOfLine, or endOfInput. |
| 45 |
*) |
| 46 |
|
| 47 |
PROCEDURE WriteCard (card: CARDINAL; width: CARDINAL); |
| 48 |
(* Writes the value of card to the default output channel in |
| 49 |
text form, in a field of the given minimum width. |
| 50 |
*) |
| 51 |
|
| 52 |
END SWholeIO. |