1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- ADA.STRINGS.WIDE_UNBOUNDED.WIDE_TEXT_IO -- 6-- -- 7-- B o d y -- 8-- -- 9-- Copyright (C) 1997-2010, Free Software Foundation, Inc. -- 10-- -- 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. -- 17-- -- 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. -- 21-- -- 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/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO; 33 34package body Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO is 35 36 -------------- 37 -- Get_Line -- 38 -------------- 39 40 function Get_Line return Unbounded_Wide_Wide_String is 41 Buffer : Wide_Wide_String (1 .. 1000); 42 Last : Natural; 43 Result : Unbounded_Wide_Wide_String; 44 45 begin 46 Get_Line (Buffer, Last); 47 Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last)); 48 49 while Last = Buffer'Last loop 50 Get_Line (Buffer, Last); 51 Append (Result, Buffer (1 .. Last)); 52 end loop; 53 54 return Result; 55 end Get_Line; 56 57 function Get_Line 58 (File : Ada.Wide_Wide_Text_IO.File_Type) 59 return Unbounded_Wide_Wide_String 60 is 61 Buffer : Wide_Wide_String (1 .. 1000); 62 Last : Natural; 63 Result : Unbounded_Wide_Wide_String; 64 65 begin 66 Get_Line (File, Buffer, Last); 67 Set_Unbounded_Wide_Wide_String (Result, Buffer (1 .. Last)); 68 69 while Last = Buffer'Last loop 70 Get_Line (File, Buffer, Last); 71 Append (Result, Buffer (1 .. Last)); 72 end loop; 73 74 return Result; 75 end Get_Line; 76 77 procedure Get_Line (Item : out Unbounded_Wide_Wide_String) is 78 begin 79 Get_Line (Current_Input, Item); 80 end Get_Line; 81 82 procedure Get_Line 83 (File : Ada.Wide_Wide_Text_IO.File_Type; 84 Item : out Unbounded_Wide_Wide_String) 85 is 86 Buffer : Wide_Wide_String (1 .. 1000); 87 Last : Natural; 88 89 begin 90 Get_Line (File, Buffer, Last); 91 Set_Unbounded_Wide_Wide_String (Item, Buffer (1 .. Last)); 92 93 while Last = Buffer'Last loop 94 Get_Line (File, Buffer, Last); 95 Append (Item, Buffer (1 .. Last)); 96 end loop; 97 end Get_Line; 98 99 --------- 100 -- Put -- 101 --------- 102 103 procedure Put (U : Unbounded_Wide_Wide_String) is 104 UR : constant Shared_Wide_Wide_String_Access := U.Reference; 105 106 begin 107 Put (UR.Data (1 .. UR.Last)); 108 end Put; 109 110 procedure Put (File : File_Type; U : Unbounded_Wide_Wide_String) is 111 UR : constant Shared_Wide_Wide_String_Access := U.Reference; 112 113 begin 114 Put (File, UR.Data (1 .. UR.Last)); 115 end Put; 116 117 -------------- 118 -- Put_Line -- 119 -------------- 120 121 procedure Put_Line (U : Unbounded_Wide_Wide_String) is 122 UR : constant Shared_Wide_Wide_String_Access := U.Reference; 123 124 begin 125 Put_Line (UR.Data (1 .. UR.Last)); 126 end Put_Line; 127 128 procedure Put_Line (File : File_Type; U : Unbounded_Wide_Wide_String) is 129 UR : constant Shared_Wide_Wide_String_Access := U.Reference; 130 131 begin 132 Put_Line (File, UR.Data (1 .. UR.Last)); 133 end Put_Line; 134 135end Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; 136