]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-libs-iso/SShortWholeIO.mod
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-iso / SShortWholeIO.mod
CommitLineData
1eee94d3
GM
1(* SShortWholeIO.mod implements input/output of SHORTINT/SHORTCARD over channels.
2
83ffe9cd 3Copyright (C) 2013-2023 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25<http://www.gnu.org/licenses/>. *)
26
27IMPLEMENTATION MODULE SShortWholeIO;
28
29IMPORT 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
36PROCEDURE 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 *)
43BEGIN
44 ShortWholeIO.ReadInt(StdChans.StdInChan(), int)
45END ReadInt ;
46
47
48PROCEDURE 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 *)
55BEGIN
56 ShortWholeIO.ReadCard(StdChans.StdInChan(), card)
57END ReadCard ;
58
59
60 (* Output procedures *)
61
62PROCEDURE 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. *)
65BEGIN
66 ShortWholeIO.WriteInt(StdChans.StdOutChan(), int, width)
67END WriteInt ;
68
69
70PROCEDURE 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. *)
73BEGIN
74 ShortWholeIO.WriteCard(StdChans.StdOutChan(), card, width)
75END WriteCard ;
76
77
78END SShortWholeIO.