1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- S Y S T E M . I M G _ D E C --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
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. --
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. --
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 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- Image for decimal fixed types where the size of the corresponding integer
33 -- type does not exceed Integer'Size (also used for Text_IO.Decimal_IO output)
35 package System
.Img_Dec
is
38 procedure Image_Decimal
43 -- Computes fixed_type'Image (V), where V is the integer value (in units of
44 -- delta) of a decimal type whose Scale is as given and stores the result
45 -- S (1 .. P), updating P to the value of L. The image is given by the
46 -- rules in RM 3.5(34) for fixed-point type image functions. The caller
47 -- guarantees that S is long enough to hold the result. S need not have a
50 procedure Set_Image_Decimal
58 -- Sets the image of V, where V is the integer value (in units of delta)
59 -- of a decimal type with the given Scale, starting at S (P + 1), updating
60 -- P to point to the last character stored, the caller promises that the
61 -- buffer is large enough and no check is made for this. Constraint_Error
62 -- will not necessarily be raised if this requirement is violated, since
63 -- it is perfectly valid to compile this unit with checks off. The Fore,
64 -- Aft and Exp values can be set to any valid values for the case of use
65 -- by Text_IO.Decimal_IO. Note that there is no leading space stored.
67 procedure Set_Decimal_Digits
68 (Digs
: in out String;
76 -- This procedure has the same semantics as Set_Image_Decimal, except that
77 -- the value in Digs (1 .. NDigs) is given as a string of decimal digits
78 -- preceded by either a minus sign or a space (i.e. the integer image of
79 -- the value in units of delta). The call may destroy the value in Digs,
80 -- which is why Digs is in-out (this happens if rounding is required).
81 -- Set_Decimal_Digits is shared by all the decimal image routines.