* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
[official-gcc.git] / gcc / ada / a-strbou.ads
blob2f414f6e0eb3faef2aadd8e83175a9c7cd483547
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
38 with Ada.Strings.Maps;
40 package Ada.Strings.Bounded is
41 pragma Preelaborate (Bounded);
43 generic
44 Max : Positive;
45 -- Maximum length of a Bounded_String
47 package Generic_Bounded_Length is
49 Max_Length : constant Positive := Max;
51 type Bounded_String is private;
53 Null_Bounded_String : constant Bounded_String;
55 subtype Length_Range is Natural range 0 .. Max_Length;
57 function Length (Source : in Bounded_String) return Length_Range;
59 --------------------------------------------------------
60 -- Conversion, Concatenation, and Selection Functions --
61 --------------------------------------------------------
63 function To_Bounded_String
64 (Source : in String;
65 Drop : in Truncation := Error)
66 return Bounded_String;
68 function To_String (Source : in Bounded_String) return String;
70 function Append
71 (Left, Right : in Bounded_String;
72 Drop : in Truncation := Error)
73 return Bounded_String;
75 function Append
76 (Left : in Bounded_String;
77 Right : in String;
78 Drop : in Truncation := Error)
79 return Bounded_String;
81 function Append
82 (Left : in String;
83 Right : in Bounded_String;
84 Drop : in Truncation := Error)
85 return Bounded_String;
87 function Append
88 (Left : in Bounded_String;
89 Right : in Character;
90 Drop : in Truncation := Error)
91 return Bounded_String;
93 function Append
94 (Left : in Character;
95 Right : in Bounded_String;
96 Drop : in Truncation := Error)
97 return Bounded_String;
99 procedure Append
100 (Source : in out Bounded_String;
101 New_Item : in Bounded_String;
102 Drop : in Truncation := Error);
104 procedure Append
105 (Source : in out Bounded_String;
106 New_Item : in String;
107 Drop : in Truncation := Error);
109 procedure Append
110 (Source : in out Bounded_String;
111 New_Item : in Character;
112 Drop : in Truncation := Error);
114 function "&"
115 (Left, Right : in Bounded_String)
116 return Bounded_String;
118 function "&"
119 (Left : in Bounded_String;
120 Right : in String)
121 return Bounded_String;
123 function "&"
124 (Left : in String;
125 Right : in Bounded_String)
126 return Bounded_String;
128 function "&"
129 (Left : in Bounded_String;
130 Right : in Character)
131 return Bounded_String;
133 function "&"
134 (Left : in Character;
135 Right : in Bounded_String)
136 return Bounded_String;
138 function Element
139 (Source : in Bounded_String;
140 Index : in Positive)
141 return Character;
143 procedure Replace_Element
144 (Source : in out Bounded_String;
145 Index : in Positive;
146 By : in Character);
148 function Slice
149 (Source : in Bounded_String;
150 Low : in Positive;
151 High : in Natural)
152 return String;
154 function "=" (Left, Right : in Bounded_String) return Boolean;
156 function "="
157 (Left : in Bounded_String;
158 Right : in String)
159 return Boolean;
161 function "="
162 (Left : in String;
163 Right : in Bounded_String)
164 return Boolean;
166 function "<" (Left, Right : in Bounded_String) return Boolean;
168 function "<"
169 (Left : in Bounded_String;
170 Right : in String)
171 return Boolean;
173 function "<"
174 (Left : in String;
175 Right : in Bounded_String)
176 return Boolean;
178 function "<=" (Left, Right : in Bounded_String) return Boolean;
180 function "<="
181 (Left : in Bounded_String;
182 Right : in String)
183 return Boolean;
185 function "<="
186 (Left : in String;
187 Right : in Bounded_String)
188 return Boolean;
190 function ">" (Left, Right : in Bounded_String) return Boolean;
192 function ">"
193 (Left : in Bounded_String;
194 Right : in String)
195 return Boolean;
197 function ">"
198 (Left : in String;
199 Right : in Bounded_String)
200 return Boolean;
202 function ">=" (Left, Right : in Bounded_String) return Boolean;
204 function ">="
205 (Left : in Bounded_String;
206 Right : in String)
207 return Boolean;
209 function ">="
210 (Left : in String;
211 Right : in Bounded_String)
212 return Boolean;
214 ----------------------
215 -- Search Functions --
216 ----------------------
218 function Index
219 (Source : in Bounded_String;
220 Pattern : in String;
221 Going : in Direction := Forward;
222 Mapping : in Maps.Character_Mapping := Maps.Identity)
223 return Natural;
225 function Index
226 (Source : in Bounded_String;
227 Pattern : in String;
228 Going : in Direction := Forward;
229 Mapping : in Maps.Character_Mapping_Function)
230 return Natural;
232 function Index
233 (Source : in Bounded_String;
234 Set : in Maps.Character_Set;
235 Test : in Membership := Inside;
236 Going : in Direction := Forward)
237 return Natural;
239 function Index_Non_Blank
240 (Source : in Bounded_String;
241 Going : in Direction := Forward)
242 return Natural;
244 function Count
245 (Source : in Bounded_String;
246 Pattern : in String;
247 Mapping : in Maps.Character_Mapping := Maps.Identity)
248 return Natural;
250 function Count
251 (Source : in Bounded_String;
252 Pattern : in String;
253 Mapping : in Maps.Character_Mapping_Function)
254 return Natural;
256 function Count
257 (Source : in Bounded_String;
258 Set : in Maps.Character_Set)
259 return Natural;
261 procedure Find_Token
262 (Source : in Bounded_String;
263 Set : in Maps.Character_Set;
264 Test : in Membership;
265 First : out Positive;
266 Last : out Natural);
268 ------------------------------------
269 -- String Translation Subprograms --
270 ------------------------------------
272 function Translate
273 (Source : in Bounded_String;
274 Mapping : in Maps.Character_Mapping)
275 return Bounded_String;
277 procedure Translate
278 (Source : in out Bounded_String;
279 Mapping : in Maps.Character_Mapping);
281 function Translate
282 (Source : in Bounded_String;
283 Mapping : in Maps.Character_Mapping_Function)
284 return Bounded_String;
286 procedure Translate
287 (Source : in out Bounded_String;
288 Mapping : in Maps.Character_Mapping_Function);
290 ---------------------------------------
291 -- String Transformation Subprograms --
292 ---------------------------------------
294 function Replace_Slice
295 (Source : in Bounded_String;
296 Low : in Positive;
297 High : in Natural;
298 By : in String;
299 Drop : in Truncation := Error)
300 return Bounded_String;
302 procedure Replace_Slice
303 (Source : in out Bounded_String;
304 Low : in Positive;
305 High : in Natural;
306 By : in String;
307 Drop : in Truncation := Error);
309 function Insert
310 (Source : in Bounded_String;
311 Before : in Positive;
312 New_Item : in String;
313 Drop : in Truncation := Error)
314 return Bounded_String;
316 procedure Insert
317 (Source : in out Bounded_String;
318 Before : in Positive;
319 New_Item : in String;
320 Drop : in Truncation := Error);
322 function Overwrite
323 (Source : in Bounded_String;
324 Position : in Positive;
325 New_Item : in String;
326 Drop : in Truncation := Error)
327 return Bounded_String;
329 procedure Overwrite
330 (Source : in out Bounded_String;
331 Position : in Positive;
332 New_Item : in String;
333 Drop : in Truncation := Error);
335 function Delete
336 (Source : in Bounded_String;
337 From : in Positive;
338 Through : in Natural)
339 return Bounded_String;
341 procedure Delete
342 (Source : in out Bounded_String;
343 From : in Positive;
344 Through : in Natural);
346 ---------------------------------
347 -- String Selector Subprograms --
348 ---------------------------------
350 function Trim
351 (Source : in Bounded_String;
352 Side : in Trim_End)
353 return Bounded_String;
355 procedure Trim
356 (Source : in out Bounded_String;
357 Side : in Trim_End);
359 function Trim
360 (Source : in Bounded_String;
361 Left : in Maps.Character_Set;
362 Right : in Maps.Character_Set)
363 return Bounded_String;
365 procedure Trim
366 (Source : in out Bounded_String;
367 Left : in Maps.Character_Set;
368 Right : in Maps.Character_Set);
370 function Head
371 (Source : in Bounded_String;
372 Count : in Natural;
373 Pad : in Character := Space;
374 Drop : in Truncation := Error)
375 return Bounded_String;
377 procedure Head
378 (Source : in out Bounded_String;
379 Count : in Natural;
380 Pad : in Character := Space;
381 Drop : in Truncation := Error);
383 function Tail
384 (Source : in Bounded_String;
385 Count : in Natural;
386 Pad : in Character := Space;
387 Drop : in Truncation := Error)
388 return Bounded_String;
390 procedure Tail
391 (Source : in out Bounded_String;
392 Count : in Natural;
393 Pad : in Character := Space;
394 Drop : in Truncation := Error);
396 ------------------------------------
397 -- String Constructor Subprograms --
398 ------------------------------------
400 function "*"
401 (Left : in Natural;
402 Right : in Character)
403 return Bounded_String;
405 function "*"
406 (Left : in Natural;
407 Right : in String)
408 return Bounded_String;
410 function "*"
411 (Left : in Natural;
412 Right : in Bounded_String)
413 return Bounded_String;
415 function Replicate
416 (Count : in Natural;
417 Item : in Character;
418 Drop : in Truncation := Error)
419 return Bounded_String;
421 function Replicate
422 (Count : in Natural;
423 Item : in String;
424 Drop : in Truncation := Error)
425 return Bounded_String;
427 function Replicate
428 (Count : in Natural;
429 Item : in Bounded_String;
430 Drop : in Truncation := Error)
431 return Bounded_String;
433 private
435 type Bounded_String is record
436 Length : Length_Range := 0;
437 Data : String (1 .. Max_Length) := (1 .. Max_Length => ASCII.NUL);
438 end record;
440 Null_Bounded_String : constant Bounded_String :=
441 (Length => 0, Data => (1 .. Max_Length => ASCII.NUL));
444 -- Pragma Inline declarations (GNAT specific additions)
446 pragma Inline ("=");
447 pragma Inline ("<");
448 pragma Inline ("<=");
449 pragma Inline (">");
450 pragma Inline (">=");
451 pragma Inline ("&");
452 pragma Inline (Count);
453 pragma Inline (Element);
454 pragma Inline (Find_Token);
455 pragma Inline (Index);
456 pragma Inline (Index_Non_Blank);
457 pragma Inline (Length);
458 pragma Inline (Replace_Element);
459 pragma Inline (Slice);
460 pragma Inline (To_Bounded_String);
461 pragma Inline (To_String);
463 end Generic_Bounded_Length;
465 end Ada.Strings.Bounded;