| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- S Y S T E M . I M A G E _ R -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-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 contains routines for the Image attribute of real types, and |
| 33 |
-- is also for Float_IO/Fixed_IO output. |
| 34 |
|
| 35 |
generic |
| 36 |
|
| 37 |
type Num is digits <>; |
| 38 |
|
| 39 |
Maxpow : Positive; |
| 40 |
|
| 41 |
Powten_Address : System.Address; |
| 42 |
|
| 43 |
type Uns is mod <>; |
| 44 |
|
| 45 |
with procedure Set_Image_Unsigned |
| 46 |
(V : Uns; |
| 47 |
S : in out String; |
| 48 |
P : in out Natural); |
| 49 |
|
| 50 |
package System.Image_R is |
| 51 |
|
| 52 |
procedure Image_Fixed_Point |
| 53 |
(V : Num; |
| 54 |
S : in out String; |
| 55 |
P : out Natural; |
| 56 |
Aft : Natural); |
| 57 |
-- Computes fixed_type'Image (V) and returns the result in S (1 .. P) |
| 58 |
-- updating P on return. The result is computed according to the rules for |
| 59 |
-- image for fixed-point types (RM 4.10(14)), where Aft is the value of the |
| 60 |
-- Aft attribute for the fixed-point type. The caller guarantees that S is |
| 61 |
-- long enough to hold the result and has a lower bound of 1. |
| 62 |
-- |
| 63 |
-- Note: this procedure should NOT be called with V = -0.0 or V = +/-Inf. |
| 64 |
|
| 65 |
procedure Image_Floating_Point |
| 66 |
(V : Num; |
| 67 |
S : in out String; |
| 68 |
P : out Natural; |
| 69 |
Digs : Natural); |
| 70 |
-- Computes Uns'Image (V) and returns the result in S (1 .. P) updating P |
| 71 |
-- on return. The result is computed according to the rules for image for |
| 72 |
-- floating-point types (RM 4.10(13)), where Digs is the value of the |
| 73 |
-- Digits attribute for the floating-point type. The caller guarantees that |
| 74 |
-- S is long enough to hold the result and has a lower bound of 1. |
| 75 |
|
| 76 |
procedure Set_Image_Real |
| 77 |
(V : Num; |
| 78 |
S : in out String; |
| 79 |
P : in out Natural; |
| 80 |
Fore : Natural; |
| 81 |
Aft : Natural; |
| 82 |
Exp : Natural); |
| 83 |
-- Sets the image of V starting at S (P + 1), updating P to point to the |
| 84 |
-- last character stored, the caller promises that the buffer is large |
| 85 |
-- enough and no check is made for this. Constraint_Error will not |
| 86 |
-- necessarily be raised if this is violated, since it is perfectly valid |
| 87 |
-- to compile this unit with checks off). The Fore, Aft and Exp values |
| 88 |
-- can be set to any valid values for the case of use from Text_IO. Note |
| 89 |
-- that no space is stored at the start for non-negative values. |
| 90 |
|
| 91 |
end System.Image_R; |