1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . T E X T _ I O . D E C I M A L _ 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.Decimal_Aux;
34 package body Ada.Text_IO.Decimal_IO is
36 package Aux renames Ada.Text_IO.Decimal_Aux;
38 Scale : constant Integer := Num'Scale;
49 pragma Unsuppress (Range_Check);
52 if Num'Size > Integer'Size then
53 Item := Num'Fixed_Value (Aux.Get_LLD (File, Width, Scale));
56 Item := Num'Fixed_Value (Aux.Get_Dec (File, Width, Scale));
60 when Constraint_Error => raise Data_Error;
68 Get (Current_In, Item, Width);
76 pragma Unsuppress (Range_Check);
79 if Num'Size > Integer'Size then
80 Item := Num'Fixed_Value
81 (Aux.Gets_LLD (From, Last'Unrestricted_Access, Scale));
83 Item := Num'Fixed_Value
84 (Aux.Gets_Dec (From, Last'Unrestricted_Access, Scale));
88 when Constraint_Error => raise Data_Error;
98 Fore : Field := Default_Fore;
99 Aft : Field := Default_Aft;
100 Exp : Field := Default_Exp)
103 if Num'Size > Integer'Size then
105 (File, Long_Long_Integer'Integer_Value (Item),
106 Fore, Aft, Exp, Scale);
109 (File, Integer'Integer_Value (Item), Fore, Aft, Exp, Scale);
115 Fore : Field := Default_Fore;
116 Aft : Field := Default_Aft;
117 Exp : Field := Default_Exp)
120 Put (Current_Out, Item, Fore, Aft, Exp);
126 Aft : Field := Default_Aft;
127 Exp : Field := Default_Exp)
130 if Num'Size > Integer'Size then
132 (To, Long_Long_Integer'Integer_Value (Item), Aft, Exp, Scale);
134 Aux.Puts_Dec (To, Integer'Integer_Value (Item), Aft, Exp, Scale);
138 end Ada.Text_IO.Decimal_IO;