1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- ADA.WIDE_WIDE_TEXT_IO.WIDE_WIDE_BOUNDED_IO --
9 -- Copyright (C) 1997-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.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;
33 with Ada.Unchecked_Deallocation;
35 package body Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO is
37 type Wide_Wide_String_Access is access all Wide_Wide_String;
39 procedure Free (WWSA : in out Wide_Wide_String_Access);
40 -- Perform an unchecked deallocation of a non-null string
46 procedure Free (WWSA : in out Wide_Wide_String_Access) is
47 Null_Wide_Wide_String : constant Wide_Wide_String := "";
49 procedure Deallocate is
50 new Ada.Unchecked_Deallocation (
51 Wide_Wide_String, Wide_Wide_String_Access);
54 -- Do not try to free statically allocated null string
56 if WWSA.all /= Null_Wide_Wide_String then
65 function Get_Line return Wide_Wide_Bounded.Bounded_Wide_Wide_String is
67 return Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Get_Line);
75 (File : File_Type) return Wide_Wide_Bounded.Bounded_Wide_Wide_String
78 return Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Get_Line (File));
86 (Item : out Wide_Wide_Bounded.Bounded_Wide_Wide_String)
88 Buffer : Wide_Wide_String (1 .. 1000);
90 Str1 : Wide_Wide_String_Access;
91 Str2 : Wide_Wide_String_Access;
94 Get_Line (Buffer, Last);
95 Str1 := new Wide_Wide_String'(Buffer (1 .. Last));
97 while Last = Buffer'Last loop
98 Get_Line (Buffer, Last);
99 Str2 := new Wide_Wide_String'(Str1.all & Buffer (1 .. Last));
104 Item := Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Str1.all);
113 Item : out Wide_Wide_Bounded.Bounded_Wide_Wide_String)
115 Buffer : Wide_Wide_String (1 .. 1000);
117 Str1 : Wide_Wide_String_Access;
118 Str2 : Wide_Wide_String_Access;
121 Get_Line (File, Buffer, Last);
122 Str1 := new Wide_Wide_String'(Buffer (1 .. Last));
124 while Last = Buffer'Last loop
125 Get_Line (File, Buffer, Last);
126 Str2 := new Wide_Wide_String'(Str1.all & Buffer (1 .. Last));
131 Item := Wide_Wide_Bounded.To_Bounded_Wide_Wide_String (Str1.all);
139 (Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
142 Put (Wide_Wide_Bounded.To_Wide_Wide_String (Item));
151 Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
154 Put (File, Wide_Wide_Bounded.To_Wide_Wide_String (Item));
162 (Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
165 Put_Line (Wide_Wide_Bounded.To_Wide_Wide_String (Item));
174 Item : Wide_Wide_Bounded.Bounded_Wide_Wide_String)
177 Put_Line (File, Wide_Wide_Bounded.To_Wide_Wide_String (Item));
180 end Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO;