1------------------------------------------------------------------------------ 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-2020, 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 34package 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 -- Remark: This procedure should NOT be called with V = -0.0 or V = +/-Inf, 51 -- The result is irrelevant. 52 53 procedure Image_Floating_Point 54 (V : Long_Long_Float; 55 S : in out String; 56 P : out Natural; 57 Digs : Natural); 58 -- Computes float_type'Image (V) and returns the result in S (1 .. P) 59 -- updating P on return. The result is computed according to the rules for 60 -- image for floating-point types (RM 3.5(33)), where Digs is the value of 61 -- the Digits attribute for the floating-point type. The caller guarantees 62 -- that S is long enough to hold the result and has a lower bound of 1. 63 64 procedure Set_Image_Real 65 (V : Long_Long_Float; 66 S : out String; 67 P : in out Natural; 68 Fore : Natural; 69 Aft : Natural; 70 Exp : Natural); 71 -- Sets the image of V starting at S (P + 1), updating P to point to the 72 -- last character stored, the caller promises that the buffer is large 73 -- enough and no check is made for this. Constraint_Error will not 74 -- necessarily be raised if this is violated, since it is perfectly valid 75 -- to compile this unit with checks off). The Fore, Aft and Exp values 76 -- can be set to any valid values for the case of use from Text_IO. Note 77 -- that no space is stored at the start for non-negative values. 78 79 Max_Real_Image_Length : constant := 5200; 80 -- If Exp is set to zero and Aft is set to Text_IO.Field'Last (i.e., 255) 81 -- then Long_Long_Float'Last generates an image whose length is 82 -- slightly less than 5200. 83 84end System.Img_Real; 85