1 (* ShortWholeIO.def provides input/output of SHORTINT/SHORTCARD over channels.
3 Copyright (C) 2013-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
27 DEFINITION MODULE ShortWholeIO
;
29 (* Input and output of whole numbers in decimal text form
30 over specified channels. The read result is of the
31 type IOConsts.ReadResults.
36 (* The text form of a signed whole number is
37 ["+" | "-"], decimal digit, {decimal digit}
39 The text form of an unsigned whole number is
40 decimal digit, {decimal digit}
43 PROCEDURE ReadInt (cid
: IOChan.ChanId
; VAR int
: SHORTINT
);
44 (* Skips leading spaces, and removes any remaining characters
45 from cid that form part of a signed whole number. The
46 value of this number is assigned to int. The read result
47 is set to the value allRight, outOfRange, wrongFormat,
48 endOfLine, or endOfInput.
51 PROCEDURE WriteInt (cid
: IOChan.ChanId
; int
: SHORTINT
;
53 (* Writes the value of int to cid in text form, in a field of
54 the given minimum width. *)
56 PROCEDURE ReadCard (cid
: IOChan.ChanId
; VAR card
: SHORTCARD
);
57 (* Skips leading spaces, and removes any remaining characters
58 from cid that form part of an unsigned whole number. The
59 value of this number is assigned to card. The read result
60 is set to the value allRight, outOfRange, wrongFormat,
61 endOfLine, or endOfInput.
64 PROCEDURE WriteCard (cid
: IOChan.ChanId
; card
: SHORTCARD
;
66 (* Writes the value of card to cid in text form, in a field
67 of the given minimum width. *)