| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- S Y S T E M . I M A G E _ D -- |
| 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 the subprograms supporting the ``Image`` attribute |
| 33 |
-- and ``Ada.Text_IO.Decimal_IO`` conversions routines for decimal fixed point |
| 34 |
-- types. |
| 35 |
|
| 36 |
generic |
| 37 |
|
| 38 |
type Int is range <>; |
| 39 |
type Uns is mod <>; |
| 40 |
|
| 41 |
package System.Image_D is |
| 42 |
|
| 43 |
procedure Image_Decimal |
| 44 |
(V : Int; |
| 45 |
S : in out String; |
| 46 |
P : out Natural; |
| 47 |
Scale : Integer); |
| 48 |
-- Computes fixed_type'Image (V), where V is the integer value (in units of |
| 49 |
-- delta) of a decimal type whose Scale is as given and stores the result |
| 50 |
-- S (1 .. P), updating P on return. The result is computed according to |
| 51 |
-- the rules for image for fixed-point types (RM 4.10(14)). The caller |
| 52 |
-- guarantees that S is long enough to hold the result and has a lower |
| 53 |
-- bound of 1. |
| 54 |
|
| 55 |
procedure Set_Image_Decimal |
| 56 |
(V : Int; |
| 57 |
S : in out String; |
| 58 |
P : in out Natural; |
| 59 |
Scale : Integer; |
| 60 |
Fore : Natural; |
| 61 |
Aft : Natural; |
| 62 |
Exp : Natural); |
| 63 |
-- Sets the image of V, where V is the integer value (in units of delta) |
| 64 |
-- of a decimal type with the specified Scale, starting at S (P + 1) and |
| 65 |
-- updating P to point to the last character stored, the caller promises |
| 66 |
-- that the buffer is large enough and no check is made. Constraint_Error |
| 67 |
-- will not necessarily be raised if this requirement is violated, since |
| 68 |
-- it is perfectly valid to compile this unit with checks off. The Fore, |
| 69 |
-- Aft and Exp values can be set to any valid values for the case of use |
| 70 |
-- by Text_IO.Decimal_IO. |
| 71 |
|
| 72 |
end System.Image_D; |