Debian Codegraph @

gcc/m2/gm2-libs-iso/SShortWholeIO.mod

raw
1 (* SShortWholeIO.mod implements input/output of SHORTINT/SHORTCARD over channels.
2
3 Copyright (C) 2013-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
5
6 This file is part of GNU Modula-2.
7
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)
11 any later version.
12
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.
17
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.
21
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/>. *)
26
27 IMPLEMENTATION MODULE SShortWholeIO;
28
29 IMPORT StdChans, ShortWholeIO ;
30
31 (* Input and output of whole numbers in decimal text form over
32 default channels. The read result is of the type
33 IOConsts.ReadResults.
34 *)
35
36 PROCEDURE ReadInt (VAR int: SHORTINT);
37 (* Skips leading spaces, and removes any remaining characters
38 from the default input stream that form part of a signed
39 whole number. The value of this number is assigned to int.
40 The read result is set to the value allRight, outOfRange,
41 wrongFormat, endOfLine, or endOfInput.
42 *)
43 BEGIN
44 ShortWholeIO.ReadInt(StdChans.StdInChan(), int)
45 END ReadInt ;
46
47
48 PROCEDURE ReadCard (VAR card: SHORTCARD);
49 (* Skips leading spaces, and removes any remaining characters
50 from the default input stream that form part of an unsigned
51 whole number. The value of this number is assigned to card.
52 The read result is set to the value allRight, outOfRange,
53 wrongFormat, endOfLine, or endOfInput.
54 *)
55 BEGIN
56 ShortWholeIO.ReadCard(StdChans.StdInChan(), card)
57 END ReadCard ;
58
59
60 (* Output procedures *)
61
62 PROCEDURE WriteInt (int: SHORTINT; width: CARDINAL);
63 (* Writes the value of int to the default output stream in
64 text form, in a field of the given minimum width. *)
65 BEGIN
66 ShortWholeIO.WriteInt(StdChans.StdOutChan(), int, width)
67 END WriteInt ;
68
69
70 PROCEDURE WriteCard (card: SHORTCARD; width: CARDINAL);
71 (* Writes the value of card to the default output stream in
72 text form, in a field of the given minimum width. *)
73 BEGIN
74 ShortWholeIO.WriteCard(StdChans.StdOutChan(), card, width)
75 END WriteCard ;
76
77
78 END SShortWholeIO.