[PATCH 03/11] Handle typedefs for CodeView
[official-gcc.git] / gcc / ada / libgnat / s-valrea.ads
blob861b6206d271836d6c359db95f294ab7c5cabd5a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . V A L _ R E A L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2024, 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 ------------------------------------------------------------------------------
32 -- This package contains routines for scanning real values for use in
33 -- Text_IO.Float_IO and the Value attribute.
35 generic
37 type Num is digits <>;
39 Maxpow : Positive;
41 Powfive_Address : System.Address;
43 Powfive_100_Address : System.Address;
45 Powfive_200_Address : System.Address;
47 Powfive_300_Address : System.Address;
49 type Uns is mod <>;
51 package System.Val_Real is
52 pragma Preelaborate;
54 function Scan_Real
55 (Str : String;
56 Ptr : not null access Integer;
57 Max : Integer) return Num;
58 -- This function scans the string starting at Str (Ptr.all) for a valid
59 -- real literal according to the syntax described in (RM 3.5(43)). The
60 -- substring scanned extends no further than Str (Max). There are three
61 -- cases for the return:
63 -- If a valid real is found after scanning past any initial spaces, then
64 -- Ptr.all is updated past the last character of the real (but trailing
65 -- spaces are not scanned out).
67 -- If no valid real is found, then Ptr.all points either to an initial
68 -- non-blank character, or to Max + 1 if the field is all spaces and the
69 -- exception Constraint_Error is raised.
71 -- If a syntactically valid real is scanned, but the value is out of
72 -- range, or, in the based case, the base value is out of range or there
73 -- is an out of range digit, then Ptr.all points past the real literal,
74 -- and Constraint_Error is raised.
76 -- Note: these rules correspond to the requirements for leaving the
77 -- pointer positioned in Text_Io.Get
79 -- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
80 -- special case of an all-blank string, and Ptr is unchanged, and hence
81 -- is greater than Max as required in this case.
83 -- Note: this routine should not be called with Str'Last = Positive'Last.
84 -- If this occurs Program_Error is raised with a message noting that this
85 -- case is not supported. Most such cases are eliminated by the caller.
87 function Value_Real (Str : String) return Num;
88 -- Used in computing X'Value (Str) where X is a floating-point type or an
89 -- ordinary fixed-point type. Str is the string argument of the attribute.
90 -- Constraint_Error is raised if the string is malformed, or if the value
91 -- out of range of Num.
93 end System.Val_Real;