1 ------------------------------------------------------------------------------
3 -- GNAT RUNTIME COMPONENTS --
5 -- A D A . T E X T _ I O . D E C I M A L _ I O --
11 -- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 with Ada.Text_IO.Decimal_Aux;
38 package body Ada.Text_IO.Decimal_IO is
40 package Aux renames Ada.Text_IO.Decimal_Aux;
42 Scale : constant Integer := Num'Scale;
51 Width : in Field := 0)
53 pragma Unsuppress (Range_Check);
56 if Num'Size > Integer'Size then
57 Item := Num'Fixed_Value (Aux.Get_LLD (File, Width, Scale));
60 Item := Num'Fixed_Value (Aux.Get_Dec (File, Width, Scale));
64 when Constraint_Error => raise Data_Error;
69 Width : in Field := 0)
72 Get (Current_In, Item, Width);
80 pragma Unsuppress (Range_Check);
83 if Num'Size > Integer'Size then
84 Item := Num'Fixed_Value
85 (Aux.Gets_LLD (From, Last'Unrestricted_Access, Scale));
87 Item := Num'Fixed_Value
88 (Aux.Gets_Dec (From, Last'Unrestricted_Access, Scale));
92 when Constraint_Error => raise Data_Error;
100 (File : in File_Type;
102 Fore : in Field := Default_Fore;
103 Aft : in Field := Default_Aft;
104 Exp : in Field := Default_Exp)
107 if Num'Size > Integer'Size then
109 (File, Long_Long_Integer'Integer_Value (Item),
110 Fore, Aft, Exp, Scale);
113 (File, Integer'Integer_Value (Item), Fore, Aft, Exp, Scale);
119 Fore : in Field := Default_Fore;
120 Aft : in Field := Default_Aft;
121 Exp : in Field := Default_Exp)
124 Put (Current_Out, Item, Fore, Aft, Exp);
130 Aft : in Field := Default_Aft;
131 Exp : in Field := Default_Exp)
134 if Num'Size > Integer'Size then
136 (To, Long_Long_Integer'Integer_Value (Item), Aft, Exp, Scale);
138 Aux.Puts_Dec (To, Integer'Integer_Value (Item), Aft, Exp, Scale);
142 end Ada.Text_IO.Decimal_IO;