1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . W I D E _ W I D E _ T E X T _ I O . I N T E G E R _ A U X --
9 -- Copyright (C) 1992-2024, 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
.Wide_Wide_Text_IO
.Generic_Aux
; use Ada
.Wide_Wide_Text_IO
.Generic_Aux
;
34 package body Ada
.Wide_Wide_Text_IO
.Integer_Aux
is
45 Buf
: String (1 .. Field
'Last);
46 Ptr
: aliased Integer := 1;
51 Load_Width
(File
, Width
, Buf
, Stop
);
52 String_Skip
(Buf
, Ptr
);
54 Load_Integer
(File
, Buf
, Stop
);
57 Scan
(Buf
, Ptr
'Access, Stop
, Item
);
58 Check_End_Of_Field
(Buf
, Stop
, Ptr
, Width
);
70 Pos
: aliased Integer;
73 String_Skip
(From
, Pos
);
74 Scan
(From
, Pos
'Access, From
'Last, Item
);
78 when Constraint_Error
=>
92 Buf
: String (1 .. Integer'Max (Field
'Last, Width
));
96 if Base
= 10 and then Width
= 0 then
97 Set_Image
(Item
, Buf
, Ptr
);
99 Set_Image_Width
(Item
, Width
, Buf
, Ptr
);
101 Set_Image_Based
(Item
, Base
, Width
, Buf
, Ptr
);
104 Put_Item
(File
, Buf
(1 .. Ptr
));
116 Buf
: String (1 .. Integer'Max (Field
'Last, To
'Length));
121 Set_Image_Width
(Item
, To
'Length, Buf
, Ptr
);
123 Set_Image_Based
(Item
, Base
, To
'Length, Buf
, Ptr
);
126 if Ptr
> To
'Length then
129 To
(To
'First .. To
'First + Ptr
- 1) := Buf
(1 .. Ptr
);
133 end Ada
.Wide_Wide_Text_IO
.Integer_Aux
;