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