1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . T E X T _ I O . F L O A T _ I O --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Ada
.Text_IO
.Float_Aux
;
34 package body Ada
.Text_IO
.Float_IO
is
36 package Aux
renames Ada
.Text_IO
.Float_Aux
;
47 pragma Unsuppress
(Range_Check
);
50 Aux
.Get
(File
, Long_Long_Float (Item
), Width
);
52 -- In the case where the type is unconstrained (e.g. Standard'Float),
53 -- the above conversion may result in an infinite value, which is
54 -- normally fine for a conversion, but in this case, we want to treat
55 -- that as a data error.
57 if not Item
'Valid then
62 when Constraint_Error
=> raise Data_Error
;
69 pragma Unsuppress
(Range_Check
);
72 Aux
.Get
(Current_In
, Long_Long_Float (Item
), Width
);
74 -- In the case where the type is unconstrained (e.g. Standard'Float),
75 -- the above conversion may result in an infinite value, which is
76 -- normally fine for a conversion, but in this case, we want to treat
77 -- that as a data error.
79 if not Item
'Valid then
84 when Constraint_Error
=> raise Data_Error
;
92 pragma Unsuppress
(Range_Check
);
95 Aux
.Gets
(From
, Long_Long_Float (Item
), Last
);
97 -- In the case where the type is unconstrained (e.g. Standard'Float),
98 -- the above conversion may result in an infinite value, which is
99 -- normally fine for a conversion, but in this case, we want to treat
100 -- that as a data error.
102 if not Item
'Valid then
107 when Constraint_Error
=> raise Data_Error
;
117 Fore
: Field
:= Default_Fore
;
118 Aft
: Field
:= Default_Aft
;
119 Exp
: Field
:= Default_Exp
)
122 Aux
.Put
(File
, Long_Long_Float (Item
), Fore
, Aft
, Exp
);
127 Fore
: Field
:= Default_Fore
;
128 Aft
: Field
:= Default_Aft
;
129 Exp
: Field
:= Default_Exp
)
132 Aux
.Put
(Current_Out
, Long_Long_Float (Item
), Fore
, Aft
, Exp
);
138 Aft
: Field
:= Default_Aft
;
139 Exp
: Field
:= Default_Exp
)
142 Aux
.Puts
(To
, Long_Long_Float (Item
), Aft
, Exp
);
145 end Ada
.Text_IO
.Float_IO
;