with Ada.Strings.Unbounded.Aux; use Ada.Strings.Unbounded.Aux;
with Ada.Text_IO; use Ada.Text_IO;
package body Ada.Strings.Unbounded.Text_IO is
function Get_Line return Unbounded_String is
Buffer : String (1 .. 1000);
Last : Natural;
Str1 : String_Access;
Str2 : String_Access;
Result : Unbounded_String;
begin
Get_Line (Buffer, Last);
Str1 := new String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (Buffer, Last);
Str2 := new String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Set_String (Result, Str1);
return Result;
end Get_Line;
function Get_Line (File : Ada.Text_IO.File_Type) return Unbounded_String is
Buffer : String (1 .. 1000);
Last : Natural;
Str1 : String_Access;
Str2 : String_Access;
Result : Unbounded_String;
begin
Get_Line (File, Buffer, Last);
Str1 := new String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (File, Buffer, Last);
Str2 := new String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Set_String (Result, Str1);
return Result;
end Get_Line;
procedure Get_Line (Item : out Unbounded_String) is
Buffer : String (1 .. 1000);
Last : Natural;
Str1 : String_Access;
Str2 : String_Access;
begin
Get_Line (Buffer, Last);
Str1 := new String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (Buffer, Last);
Str2 := new String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Set_String (Item, Str1);
end Get_Line;
procedure Get_Line
(File : Ada.Text_IO.File_Type;
Item : out Unbounded_String)
is
Buffer : String (1 .. 1000);
Last : Natural;
Str1 : String_Access;
Str2 : String_Access;
begin
Get_Line (File, Buffer, Last);
Str1 := new String'(Buffer (1 .. Last));
while Last = Buffer'Last loop
Get_Line (Buffer, Last);
Str2 := new String'(Str1.all & Buffer (1 .. Last));
Free (Str1);
Str1 := Str2;
end loop;
Set_String (Item, Str1);
end Get_Line;
procedure Put (U : Unbounded_String) is
begin
Put (Get_String (U).all);
end Put;
procedure Put (File : File_Type; U : Unbounded_String) is
begin
Put (File, Get_String (U).all);
end Put;
procedure Put_Line (U : Unbounded_String) is
begin
Put_Line (Get_String (U).all);
end Put_Line;
procedure Put_Line (File : File_Type; U : Unbounded_String) is
begin
Put_Line (File, Get_String (U).all);
end Put_Line;
end Ada.Strings.Unbounded.Text_IO;