Debian Codegraph @

gcc/ada/libgnat/s-imguti.ads

raw
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . I M G _ U T I L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2020-2025, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 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 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package provides some common utilities used by the `System.Img_*`
33 -- packages. It contains subprograms to set the decimal digits for a string
34 -- and set the string for a floating-point invalid value.
35
36 package System.Img_Util is
37
38 Max_Real_Image_Length : constant := 5200;
39 -- If Exp is set to zero and Aft is set to Text_IO.Field'Last (i.e., 255)
40 -- then Long_Long_Float'Last generates an image whose length is slightly
41 -- less than 5200.
42
43 procedure Set_Decimal_Digits
44 (Digs : in out String;
45 NDigs : Natural;
46 S : out String;
47 P : in out Natural;
48 Scale : Integer;
49 Fore : Natural;
50 Aft : Natural;
51 Exp : Natural);
52 -- Sets the image of Digs (1 .. NDigs), which is a string of decimal digits
53 -- preceded by either a minus sign or a space, i.e. the integer image of
54 -- the value in units of delta if this is for a decimal fixed point type
55 -- with the given Scale, or the integer image of the value converted to an
56 -- implicit decimal fixed point type with the given Scale if this is for an
57 -- ordinary fixed point type, starting at S (P + 1), updating P to point to
58 -- the last character stored. The caller promises that the buffer is large
59 -- enough and therefore no check is made for it. Constraint_Error will not
60 -- necessarily be raised if the requirement is violated since it is valid
61 -- to compile this unit with checks off. The Fore, Aft and Exp values can
62 -- be set to any valid values for the case of use by Text_IO.Decimal_IO or
63 -- Text_IO.Fixed_IO. Note that there is no leading space stored. The call
64 -- may destroy the value in Digs, which is why Digs is in-out (this happens
65 -- if rounding is required).
66
67 type Floating_Invalid_Value is (Minus_Infinity, Infinity, Not_A_Number);
68
69 procedure Set_Floating_Invalid_Value
70 (V : Floating_Invalid_Value;
71 S : out String;
72 P : in out Natural;
73 Fore : Natural;
74 Aft : Natural;
75 Exp : Natural);
76 -- Sets the image of a floating-point invalid value, starting at S (P + 1),
77 -- updating P to point to the last character stored. The caller promises
78 -- that the buffer is large enough and therefore no check is made for it.
79 -- Constraint_Error will not necessarily be raised if the requirement is
80 -- violated since it is valid to compile this unit with checks off.
81
82 end System.Img_Util;