Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/a-swuwti__shared.adb @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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-2017, 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 | |
32 with Ada.Wide_Text_IO; use Ada.Wide_Text_IO; | |
33 | |
34 package body Ada.Strings.Wide_Unbounded.Wide_Text_IO is | |
35 | |
36 -------------- | |
37 -- Get_Line -- | |
38 -------------- | |
39 | |
40 function Get_Line return Unbounded_Wide_String is | |
41 Buffer : Wide_String (1 .. 1000); | |
42 Last : Natural; | |
43 Result : Unbounded_Wide_String; | |
44 | |
45 begin | |
46 Get_Line (Buffer, Last); | |
47 Set_Unbounded_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_Text_IO.File_Type) return Unbounded_Wide_String | |
59 is | |
60 Buffer : Wide_String (1 .. 1000); | |
61 Last : Natural; | |
62 Result : Unbounded_Wide_String; | |
63 | |
64 begin | |
65 Get_Line (File, Buffer, Last); | |
66 Set_Unbounded_Wide_String (Result, Buffer (1 .. Last)); | |
67 | |
68 while Last = Buffer'Last loop | |
69 Get_Line (File, Buffer, Last); | |
70 Append (Result, Buffer (1 .. Last)); | |
71 end loop; | |
72 | |
73 return Result; | |
74 end Get_Line; | |
75 | |
76 procedure Get_Line (Item : out Unbounded_Wide_String) is | |
77 begin | |
78 Get_Line (Current_Input, Item); | |
79 end Get_Line; | |
80 | |
81 procedure Get_Line | |
82 (File : Ada.Wide_Text_IO.File_Type; | |
83 Item : out Unbounded_Wide_String) | |
84 is | |
85 Buffer : Wide_String (1 .. 1000); | |
86 Last : Natural; | |
87 | |
88 begin | |
89 Get_Line (File, Buffer, Last); | |
90 Set_Unbounded_Wide_String (Item, Buffer (1 .. Last)); | |
91 | |
92 while Last = Buffer'Last loop | |
93 Get_Line (File, Buffer, Last); | |
94 Append (Item, Buffer (1 .. Last)); | |
95 end loop; | |
96 end Get_Line; | |
97 | |
98 --------- | |
99 -- Put -- | |
100 --------- | |
101 | |
102 procedure Put (U : Unbounded_Wide_String) is | |
103 UR : constant Shared_Wide_String_Access := U.Reference; | |
104 | |
105 begin | |
106 Put (UR.Data (1 .. UR.Last)); | |
107 end Put; | |
108 | |
109 procedure Put (File : File_Type; U : Unbounded_Wide_String) is | |
110 UR : constant Shared_Wide_String_Access := U.Reference; | |
111 | |
112 begin | |
113 Put (File, UR.Data (1 .. UR.Last)); | |
114 end Put; | |
115 | |
116 -------------- | |
117 -- Put_Line -- | |
118 -------------- | |
119 | |
120 procedure Put_Line (U : Unbounded_Wide_String) is | |
121 UR : constant Shared_Wide_String_Access := U.Reference; | |
122 | |
123 begin | |
124 Put_Line (UR.Data (1 .. UR.Last)); | |
125 end Put_Line; | |
126 | |
127 procedure Put_Line (File : File_Type; U : Unbounded_Wide_String) is | |
128 UR : constant Shared_Wide_String_Access := U.Reference; | |
129 | |
130 begin | |
131 Put_Line (File, UR.Data (1 .. UR.Last)); | |
132 end Put_Line; | |
133 | |
134 end Ada.Strings.Wide_Unbounded.Wide_Text_IO; |