xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / gcc / m2 / gm2-libs-iso / SShortIO.mod
blobef1c89ec21415dc5da1d7170a1b6e24d16ec4ac3
1 (* SShortIO.mod implements input/output of SHORTREAL 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)
11 any later version.
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 IMPLEMENTATION MODULE SShortIO ;
29 IMPORT StdChans, ShortIO ;
31 (* Input and output of real numbers in decimal text form over
32 default channels. The read result is of the type
33 IOConsts.ReadResults.
36 (* The text form of a signed fixed-point real number is
37 ["+" | "-"], decimal digit, {decimal digit},
38 [".", {decimal digit}]
40 The text form of a signed floating-point real number is
41 signed fixed-point real number,
42 "E", ["+" | "-"], decimal digit, {decimal digit}
45 PROCEDURE ReadReal (VAR real: SHORTREAL);
46 (* Skips leading spaces, and removes any remaining characters
47 from the default input channel that form part of a signed
48 fixed or floating point number. The value of this number
49 is assigned to real. The read result is set to the value
50 allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
52 BEGIN
53 ShortIO.ReadReal(StdChans.StdInChan(), real)
54 END ReadReal ;
56 PROCEDURE WriteFloat (real: SHORTREAL; sigFigs: CARDINAL; width: CARDINAL);
57 (* Writes the value of real to the default output channel in
58 floating-point text form, with sigFigs significant figures,
59 in a field of the given minimum width.
61 BEGIN
62 ShortIO.WriteFloat(StdChans.StdOutChan(), real, sigFigs, width)
63 END WriteFloat ;
65 PROCEDURE WriteEng (real: SHORTREAL; sigFigs: CARDINAL; width: CARDINAL);
66 (* As for WriteFloat, except that the number is scaled with one to
67 three digits in the whole number part, and with an exponent that
68 is a multiple of three.
70 BEGIN
71 ShortIO.WriteFloat(StdChans.StdOutChan(), real, sigFigs, width)
72 END WriteEng ;
74 PROCEDURE WriteFixed (real: SHORTREAL; place: INTEGER; width: CARDINAL);
75 (* Writes the value of real to the default output channel in
76 fixed-point text form, rounded to the given place relative
77 to the decimal point, in a field of the given minimum width.
79 BEGIN
80 ShortIO.WriteFixed(StdChans.StdOutChan(), real, place, width)
81 END WriteFixed ;
83 PROCEDURE WriteReal (real: SHORTREAL; width: CARDINAL);
84 (* Writes the value of real to the default output channel, as
85 WriteFixed if the sign and magnitude can be shown in the
86 given width, or otherwise as WriteFloat. The number of
87 places or significant digits depends on the given width.
89 BEGIN
90 ShortIO.WriteReal(StdChans.StdOutChan(), real, width)
91 END WriteReal ;
93 END SShortIO.