1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . I M G _ R E A L --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2009, 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 |
|
|
-- Image for fixed and float types (also used for Float_IO/Fixed_IO output)
|
33 |
|
|
|
34 |
|
|
package System.Img_Real is
|
35 |
|
|
pragma Pure;
|
36 |
|
|
|
37 |
|
|
procedure Image_Ordinary_Fixed_Point
|
38 |
|
|
(V : Long_Long_Float;
|
39 |
|
|
S : in out String;
|
40 |
|
|
P : out Natural;
|
41 |
|
|
Aft : Natural);
|
42 |
|
|
-- Computes fixed_type'Image (V) and returns the result in S (1 .. P)
|
43 |
|
|
-- updating P on return. The result is computed according to the rules for
|
44 |
|
|
-- image for fixed-point types (RM 3.5(34)), where Aft is the value of the
|
45 |
|
|
-- Aft attribute for the fixed-point type. This function is used only for
|
46 |
|
|
-- ordinary fixed point (see package System.Img_Dec for handling of decimal
|
47 |
|
|
-- fixed-point). The caller guarantees that S is long enough to hold the
|
48 |
|
|
-- result and has a lower bound of 1.
|
49 |
|
|
|
50 |
|
|
procedure Image_Floating_Point
|
51 |
|
|
(V : Long_Long_Float;
|
52 |
|
|
S : in out String;
|
53 |
|
|
P : out Natural;
|
54 |
|
|
Digs : Natural);
|
55 |
|
|
-- Computes fixed_type'Image (V) and returns the result in S (1 .. P)
|
56 |
|
|
-- updating P on return. The result is computed according to the rules for
|
57 |
|
|
-- image for floating-point types (RM 3.5(33)), where Digs is the value of
|
58 |
|
|
-- the Digits attribute for the floating-point type. The caller guarantees
|
59 |
|
|
-- that S is long enough to hold the result and has a lower bound of 1.
|
60 |
|
|
|
61 |
|
|
procedure Set_Image_Real
|
62 |
|
|
(V : Long_Long_Float;
|
63 |
|
|
S : out String;
|
64 |
|
|
P : in out Natural;
|
65 |
|
|
Fore : Natural;
|
66 |
|
|
Aft : Natural;
|
67 |
|
|
Exp : Natural);
|
68 |
|
|
-- Sets the image of V starting at S (P + 1), updating P to point to the
|
69 |
|
|
-- last character stored, the caller promises that the buffer is large
|
70 |
|
|
-- enough and no check is made for this. Constraint_Error will not
|
71 |
|
|
-- necessarily be raised if this is violated, since it is perfectly valid
|
72 |
|
|
-- to compile this unit with checks off). The Fore, Aft and Exp values
|
73 |
|
|
-- can be set to any valid values for the case of use from Text_IO. Note
|
74 |
|
|
-- that no space is stored at the start for non-negative values.
|
75 |
|
|
|
76 |
|
|
end System.Img_Real;
|