]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs-iso/SShortIO.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-iso / SShortIO.def
1 (* SShortIO.def provides input/output of SHORTREAL over channels.
2
3 Copyright (C) 2013-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
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 DEFINITION MODULE SShortIO;
28
29 (* Input and output of short real numbers in decimal text form
30 using default channels. The read result is of the type
31 IOConsts.ReadResults.
32 *)
33
34 (* The text form of a signed fixed-point real number is
35 ["+" | "-"], decimal digit, {decimal digit},
36 [".", {decimal digit}]
37
38 The text form of a signed floating-point real number is
39 signed fixed-point real number,
40 "E", ["+" | "-"], decimal digit, {decimal digit}
41 *)
42
43 PROCEDURE ReadReal (VAR real: SHORTREAL);
44 (* Skips leading spaces, and removes any remaining characters
45 from the default input channel that form part of a signed
46 fixed or floating point number. The value of this number
47 is assigned to real. The read result is set to the value
48 allRight, outOfRange, wrongFormat, endOfLine, or endOfInput.
49 *)
50
51 PROCEDURE WriteFloat (real: SHORTREAL; sigFigs: CARDINAL;
52 width: CARDINAL);
53 (* Writes the value of real to the default output channel in
54 floating-point text form, with sigFigs significant figures,
55 in a field of the given minimum width.
56 *)
57
58 PROCEDURE WriteEng (real: SHORTREAL; sigFigs: CARDINAL;
59 width: CARDINAL);
60 (* As for WriteFloat, except that the number is scaled with
61 one to three digits in the whole number part, and with an
62 exponent that is a multiple of three.
63 *)
64
65 PROCEDURE WriteFixed (real: SHORTREAL; place: INTEGER;
66 width: CARDINAL);
67 (* Writes the value of real to the default output channel in
68 fixed-point text form, rounded to the given place relative
69 to the decimal point, in a field of the given minimum width.
70 *)
71
72 PROCEDURE WriteReal (real: SHORTREAL; width: CARDINAL);
73 (* Writes the value of real to the default output channel, as
74 WriteFixed if the sign and magnitude can be shown in the
75 given width, or otherwise as WriteFloat. The number of
76 places or significant digits depends on the given width.
77 *)
78
79 END SShortIO.
80