2015-05-05 Yvan Roux <yvan.roux@linaro.org>
[official-gcc.git] / gcc / ada / s-ststop.ads
blob8a58356e0bd345701c75681463d4169de83b642d
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . S T R I N G S . S T R E A M _ O P S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2009-2013, 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 ------------------------------------------------------------------------------
32 -- This package provides subprogram implementations of stream attributes for
33 -- the following types using a "block IO" approach in which the entire data
34 -- item is written in one operation, instead of writing individual characters.
36 -- Ada.Stream_Element_Array
37 -- Ada.String
38 -- Ada.Wide_String
39 -- Ada.Wide_Wide_String
40 -- System.Storage_Array
42 -- Note: this routine is in Ada.Strings because historically it handled only
43 -- the string types. It is not worth moving it at this stage.
45 -- The compiler will generate references to the subprograms in this package
46 -- when expanding stream attributes for the above mentioned types. Example:
48 -- String'Output (Some_Stream, Some_String);
50 -- will be expanded into:
52 -- String_Output (Some_Stream, Some_String);
53 -- or
54 -- String_Output_Blk_IO (Some_Stream, Some_String);
56 -- String_Output form is used if pragma Restrictions (No_String_Optimziations)
57 -- is active, which requires element by element operations. The BLK_IO form
58 -- is used if this restriction is not set, allowing block optimization.
60 -- Note that if System.Stream_Attributes.Block_IO_OK is False, then the BLK_IO
61 -- form is treated as equivalent to the normal case, so that the optimization
62 -- is inhibited anyway, regardless of the setting of the restriction. This
63 -- handles versions of System.Stream_Attributes (in particular the XDR version
64 -- found in s-stratt-xdr) which do not permit block io optimization.
66 pragma Compiler_Unit_Warning;
68 with Ada.Streams;
70 with System.Storage_Elements;
72 package System.Strings.Stream_Ops is
74 -------------------------------------
75 -- Storage_Array stream operations --
76 -------------------------------------
78 function Storage_Array_Input
79 (Strm : access Ada.Streams.Root_Stream_Type'Class)
80 return System.Storage_Elements.Storage_Array;
82 function Storage_Array_Input_Blk_IO
83 (Strm : access Ada.Streams.Root_Stream_Type'Class)
84 return System.Storage_Elements.Storage_Array;
86 procedure Storage_Array_Output
87 (Strm : access Ada.Streams.Root_Stream_Type'Class;
88 Item : System.Storage_Elements.Storage_Array);
90 procedure Storage_Array_Output_Blk_IO
91 (Strm : access Ada.Streams.Root_Stream_Type'Class;
92 Item : System.Storage_Elements.Storage_Array);
94 procedure Storage_Array_Read
95 (Strm : access Ada.Streams.Root_Stream_Type'Class;
96 Item : out System.Storage_Elements.Storage_Array);
98 procedure Storage_Array_Read_Blk_IO
99 (Strm : access Ada.Streams.Root_Stream_Type'Class;
100 Item : out System.Storage_Elements.Storage_Array);
102 procedure Storage_Array_Write
103 (Strm : access Ada.Streams.Root_Stream_Type'Class;
104 Item : System.Storage_Elements.Storage_Array);
106 procedure Storage_Array_Write_Blk_IO
107 (Strm : access Ada.Streams.Root_Stream_Type'Class;
108 Item : System.Storage_Elements.Storage_Array);
110 --------------------------------------------
111 -- Stream_Element_Array stream operations --
112 --------------------------------------------
114 function Stream_Element_Array_Input
115 (Strm : access Ada.Streams.Root_Stream_Type'Class)
116 return Ada.Streams.Stream_Element_Array;
118 function Stream_Element_Array_Input_Blk_IO
119 (Strm : access Ada.Streams.Root_Stream_Type'Class)
120 return Ada.Streams.Stream_Element_Array;
122 procedure Stream_Element_Array_Output
123 (Strm : access Ada.Streams.Root_Stream_Type'Class;
124 Item : Ada.Streams.Stream_Element_Array);
126 procedure Stream_Element_Array_Output_Blk_IO
127 (Strm : access Ada.Streams.Root_Stream_Type'Class;
128 Item : Ada.Streams.Stream_Element_Array);
130 procedure Stream_Element_Array_Read
131 (Strm : access Ada.Streams.Root_Stream_Type'Class;
132 Item : out Ada.Streams.Stream_Element_Array);
134 procedure Stream_Element_Array_Read_Blk_IO
135 (Strm : access Ada.Streams.Root_Stream_Type'Class;
136 Item : out Ada.Streams.Stream_Element_Array);
138 procedure Stream_Element_Array_Write
139 (Strm : access Ada.Streams.Root_Stream_Type'Class;
140 Item : Ada.Streams.Stream_Element_Array);
142 procedure Stream_Element_Array_Write_Blk_IO
143 (Strm : access Ada.Streams.Root_Stream_Type'Class;
144 Item : Ada.Streams.Stream_Element_Array);
146 ------------------------------
147 -- String stream operations --
148 ------------------------------
150 function String_Input
151 (Strm : access Ada.Streams.Root_Stream_Type'Class)
152 return String;
154 function String_Input_Blk_IO
155 (Strm : access Ada.Streams.Root_Stream_Type'Class)
156 return String;
158 procedure String_Output
159 (Strm : access Ada.Streams.Root_Stream_Type'Class;
160 Item : String);
162 procedure String_Output_Blk_IO
163 (Strm : access Ada.Streams.Root_Stream_Type'Class;
164 Item : String);
166 procedure String_Read
167 (Strm : access Ada.Streams.Root_Stream_Type'Class;
168 Item : out String);
170 procedure String_Read_Blk_IO
171 (Strm : access Ada.Streams.Root_Stream_Type'Class;
172 Item : out String);
174 procedure String_Write
175 (Strm : access Ada.Streams.Root_Stream_Type'Class;
176 Item : String);
178 procedure String_Write_Blk_IO
179 (Strm : access Ada.Streams.Root_Stream_Type'Class;
180 Item : String);
182 -----------------------------------
183 -- Wide_String stream operations --
184 -----------------------------------
186 function Wide_String_Input
187 (Strm : access Ada.Streams.Root_Stream_Type'Class)
188 return Wide_String;
190 function Wide_String_Input_Blk_IO
191 (Strm : access Ada.Streams.Root_Stream_Type'Class)
192 return Wide_String;
194 procedure Wide_String_Output
195 (Strm : access Ada.Streams.Root_Stream_Type'Class;
196 Item : Wide_String);
198 procedure Wide_String_Output_Blk_IO
199 (Strm : access Ada.Streams.Root_Stream_Type'Class;
200 Item : Wide_String);
202 procedure Wide_String_Read
203 (Strm : access Ada.Streams.Root_Stream_Type'Class;
204 Item : out Wide_String);
206 procedure Wide_String_Read_Blk_IO
207 (Strm : access Ada.Streams.Root_Stream_Type'Class;
208 Item : out Wide_String);
210 procedure Wide_String_Write
211 (Strm : access Ada.Streams.Root_Stream_Type'Class;
212 Item : Wide_String);
214 procedure Wide_String_Write_Blk_IO
215 (Strm : access Ada.Streams.Root_Stream_Type'Class;
216 Item : Wide_String);
218 ----------------------------------------
219 -- Wide_Wide_String stream operations --
220 ----------------------------------------
222 function Wide_Wide_String_Input
223 (Strm : access Ada.Streams.Root_Stream_Type'Class)
224 return Wide_Wide_String;
226 function Wide_Wide_String_Input_Blk_IO
227 (Strm : access Ada.Streams.Root_Stream_Type'Class)
228 return Wide_Wide_String;
230 procedure Wide_Wide_String_Output
231 (Strm : access Ada.Streams.Root_Stream_Type'Class;
232 Item : Wide_Wide_String);
234 procedure Wide_Wide_String_Output_Blk_IO
235 (Strm : access Ada.Streams.Root_Stream_Type'Class;
236 Item : Wide_Wide_String);
238 procedure Wide_Wide_String_Read
239 (Strm : access Ada.Streams.Root_Stream_Type'Class;
240 Item : out Wide_Wide_String);
242 procedure Wide_Wide_String_Read_Blk_IO
243 (Strm : access Ada.Streams.Root_Stream_Type'Class;
244 Item : out Wide_Wide_String);
246 procedure Wide_Wide_String_Write
247 (Strm : access Ada.Streams.Root_Stream_Type'Class;
248 Item : Wide_Wide_String);
250 procedure Wide_Wide_String_Write_Blk_IO
251 (Strm : access Ada.Streams.Root_Stream_Type'Class;
252 Item : Wide_Wide_String);
254 end System.Strings.Stream_Ops;