* c-decl.c (duplicate_decls): Conditionalize DECL_SAVED_TREE copy.
[official-gcc.git] / gcc / ada / a-strunb.ads
blobd3d4ff93f491fc76da23319d2dbe875986cf3d2a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . U N B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.20 $ --
10 -- --
11 -- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
12 -- --
13 -- This specification is derived from the Ada Reference Manual for use with --
14 -- GNAT. The copyright notice above, and the license provisions that follow --
15 -- apply solely to the contents of the part following the private keyword. --
16 -- --
17 -- GNAT is free software; you can redistribute it and/or modify it under --
18 -- terms of the GNU General Public License as published by the Free Soft- --
19 -- ware Foundation; either version 2, or (at your option) any later ver- --
20 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
21 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
22 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
23 -- for more details. You should have received a copy of the GNU General --
24 -- Public License distributed with GNAT; see file COPYING. If not, write --
25 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
26 -- MA 02111-1307, USA. --
27 -- --
28 -- As a special exception, if other files instantiate generics from this --
29 -- unit, or you link this unit with other files to produce an executable, --
30 -- this unit does not by itself cause the resulting executable to be --
31 -- covered by the GNU General Public License. This exception does not --
32 -- however invalidate any other reasons why the executable file might be --
33 -- covered by the GNU Public License. --
34 -- --
35 -- GNAT was originally developed by the GNAT team at New York University. --
36 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
37 -- --
38 ------------------------------------------------------------------------------
40 with Ada.Strings.Maps;
41 with Ada.Finalization;
43 package Ada.Strings.Unbounded is
44 pragma Preelaborate (Unbounded);
46 type Unbounded_String is private;
48 Null_Unbounded_String : constant Unbounded_String;
50 function Length (Source : Unbounded_String) return Natural;
52 type String_Access is access all String;
54 procedure Free (X : in out String_Access);
56 --------------------------------------------------------
57 -- Conversion, Concatenation, and Selection Functions --
58 --------------------------------------------------------
60 function To_Unbounded_String (Source : String) return Unbounded_String;
61 function To_Unbounded_String (Length : in Natural) return Unbounded_String;
63 function To_String (Source : Unbounded_String) return String;
65 procedure Append
66 (Source : in out Unbounded_String;
67 New_Item : in Unbounded_String);
69 procedure Append
70 (Source : in out Unbounded_String;
71 New_Item : in String);
73 procedure Append
74 (Source : in out Unbounded_String;
75 New_Item : in Character);
77 function "&" (Left, Right : Unbounded_String) return Unbounded_String;
79 function "&"
80 (Left : in Unbounded_String;
81 Right : in String)
82 return Unbounded_String;
84 function "&"
85 (Left : in String;
86 Right : in Unbounded_String)
87 return Unbounded_String;
89 function "&"
90 (Left : in Unbounded_String;
91 Right : in Character)
92 return Unbounded_String;
94 function "&"
95 (Left : in Character;
96 Right : in Unbounded_String)
97 return Unbounded_String;
99 function Element
100 (Source : in Unbounded_String;
101 Index : in Positive)
102 return Character;
104 procedure Replace_Element
105 (Source : in out Unbounded_String;
106 Index : in Positive;
107 By : Character);
109 function Slice
110 (Source : in Unbounded_String;
111 Low : in Positive;
112 High : in Natural)
113 return String;
115 function "=" (Left, Right : in Unbounded_String) return Boolean;
117 function "="
118 (Left : in Unbounded_String;
119 Right : in String)
120 return Boolean;
122 function "="
123 (Left : in String;
124 Right : in Unbounded_String)
125 return Boolean;
127 function "<" (Left, Right : in Unbounded_String) return Boolean;
129 function "<"
130 (Left : in Unbounded_String;
131 Right : in String)
132 return Boolean;
134 function "<"
135 (Left : in String;
136 Right : in Unbounded_String)
137 return Boolean;
139 function "<=" (Left, Right : in Unbounded_String) return Boolean;
141 function "<="
142 (Left : in Unbounded_String;
143 Right : in String)
144 return Boolean;
146 function "<="
147 (Left : in String;
148 Right : in Unbounded_String)
149 return Boolean;
151 function ">" (Left, Right : in Unbounded_String) return Boolean;
153 function ">"
154 (Left : in Unbounded_String;
155 Right : in String)
156 return Boolean;
158 function ">"
159 (Left : in String;
160 Right : in Unbounded_String)
161 return Boolean;
163 function ">=" (Left, Right : in Unbounded_String) return Boolean;
165 function ">="
166 (Left : in Unbounded_String;
167 Right : in String)
168 return Boolean;
170 function ">="
171 (Left : in String;
172 Right : in Unbounded_String)
173 return Boolean;
175 ------------------------
176 -- Search Subprograms --
177 ------------------------
179 function Index
180 (Source : in Unbounded_String;
181 Pattern : in String;
182 Going : in Direction := Forward;
183 Mapping : in Maps.Character_Mapping := Maps.Identity)
184 return Natural;
186 function Index
187 (Source : in Unbounded_String;
188 Pattern : in String;
189 Going : in Direction := Forward;
190 Mapping : in Maps.Character_Mapping_Function)
191 return Natural;
193 function Index
194 (Source : in Unbounded_String;
195 Set : in Maps.Character_Set;
196 Test : in Membership := Inside;
197 Going : in Direction := Forward)
198 return Natural;
200 function Index_Non_Blank
201 (Source : in Unbounded_String;
202 Going : in Direction := Forward)
203 return Natural;
205 function Count
206 (Source : in Unbounded_String;
207 Pattern : in String;
208 Mapping : in Maps.Character_Mapping := Maps.Identity)
209 return Natural;
211 function Count
212 (Source : in Unbounded_String;
213 Pattern : in String;
214 Mapping : in Maps.Character_Mapping_Function)
215 return Natural;
217 function Count
218 (Source : in Unbounded_String;
219 Set : in Maps.Character_Set)
220 return Natural;
222 procedure Find_Token
223 (Source : in Unbounded_String;
224 Set : in Maps.Character_Set;
225 Test : in Membership;
226 First : out Positive;
227 Last : out Natural);
229 ------------------------------------
230 -- String Translation Subprograms --
231 ------------------------------------
233 function Translate
234 (Source : in Unbounded_String;
235 Mapping : in Maps.Character_Mapping)
236 return Unbounded_String;
238 procedure Translate
239 (Source : in out Unbounded_String;
240 Mapping : Maps.Character_Mapping);
242 function Translate
243 (Source : in Unbounded_String;
244 Mapping : in Maps.Character_Mapping_Function)
245 return Unbounded_String;
247 procedure Translate
248 (Source : in out Unbounded_String;
249 Mapping : in Maps.Character_Mapping_Function);
251 ---------------------------------------
252 -- String Transformation Subprograms --
253 ---------------------------------------
255 function Replace_Slice
256 (Source : in Unbounded_String;
257 Low : in Positive;
258 High : in Natural;
259 By : in String)
260 return Unbounded_String;
262 procedure Replace_Slice
263 (Source : in out Unbounded_String;
264 Low : in Positive;
265 High : in Natural;
266 By : in String);
268 function Insert
269 (Source : in Unbounded_String;
270 Before : in Positive;
271 New_Item : in String)
272 return Unbounded_String;
274 procedure Insert
275 (Source : in out Unbounded_String;
276 Before : in Positive;
277 New_Item : in String);
279 function Overwrite
280 (Source : in Unbounded_String;
281 Position : in Positive;
282 New_Item : in String)
283 return Unbounded_String;
285 procedure Overwrite
286 (Source : in out Unbounded_String;
287 Position : in Positive;
288 New_Item : in String);
290 function Delete
291 (Source : in Unbounded_String;
292 From : in Positive;
293 Through : in Natural)
294 return Unbounded_String;
296 procedure Delete
297 (Source : in out Unbounded_String;
298 From : in Positive;
299 Through : in Natural);
301 function Trim
302 (Source : in Unbounded_String;
303 Side : in Trim_End)
304 return Unbounded_String;
306 procedure Trim
307 (Source : in out Unbounded_String;
308 Side : in Trim_End);
310 function Trim
311 (Source : in Unbounded_String;
312 Left : in Maps.Character_Set;
313 Right : in Maps.Character_Set)
314 return Unbounded_String;
316 procedure Trim
317 (Source : in out Unbounded_String;
318 Left : in Maps.Character_Set;
319 Right : in Maps.Character_Set);
321 function Head
322 (Source : in Unbounded_String;
323 Count : in Natural;
324 Pad : in Character := Space)
325 return Unbounded_String;
327 procedure Head
328 (Source : in out Unbounded_String;
329 Count : in Natural;
330 Pad : in Character := Space);
332 function Tail
333 (Source : in Unbounded_String;
334 Count : in Natural;
335 Pad : in Character := Space)
336 return Unbounded_String;
338 procedure Tail
339 (Source : in out Unbounded_String;
340 Count : in Natural;
341 Pad : in Character := Space);
343 function "*"
344 (Left : in Natural;
345 Right : in Character)
346 return Unbounded_String;
348 function "*"
349 (Left : in Natural;
350 Right : in String)
351 return Unbounded_String;
353 function "*"
354 (Left : in Natural;
355 Right : in Unbounded_String)
356 return Unbounded_String;
358 private
359 pragma Inline (Length);
361 package AF renames Ada.Finalization;
363 Null_String : aliased String := "";
365 function To_Unbounded (S : String) return Unbounded_String
366 renames To_Unbounded_String;
368 type Unbounded_String is new AF.Controlled with record
369 Reference : String_Access := Null_String'Access;
370 end record;
372 pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
374 pragma Finalize_Storage_Only (Unbounded_String);
376 procedure Initialize (Object : in out Unbounded_String);
377 procedure Adjust (Object : in out Unbounded_String);
378 procedure Finalize (Object : in out Unbounded_String);
380 Null_Unbounded_String : constant Unbounded_String :=
381 (AF.Controlled with Reference => Null_String'Access);
383 end Ada.Strings.Unbounded;