* builtins.def (BUILT_IN_STACK_ALLOC): Remove.
[official-gcc.git] / gcc / ada / a-stwisu.ads
blob8ea068642f8fa5e1f30a505398fbefc56c3d314a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . W I D E _ S U P E R B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2003 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This non generic package contains most of the implementation of the
35 -- generic package Ada.Strings.Wide_Bounded.Generic_Bounded_Length.
37 -- It defines type Super_String as a discriminated record with the maximum
38 -- length as the discriminant. Individual instantiations of
39 -- Strings.Wide_Bounded.Generic_Bounded_Length use this type with
40 -- an appropriate discriminant value set.
42 with Ada.Strings.Wide_Maps;
44 package Ada.Strings.Wide_Superbounded is
45 pragma Preelaborate (Wide_Superbounded);
47 Wide_NUL : constant Wide_Character := Wide_Character'Val (0);
49 type Super_String (Max_Length : Positive) is record
50 Current_Length : Natural := 0;
51 Data : Wide_String (1 .. Max_Length) := (others => Wide_NUL);
52 end record;
53 -- Type Wide_Bounded_String in
54 -- Ada.Strings.Wide_Bounded.Generic_Bounded_Length is derived from this
55 -- type, with the constraint of the maximum length.
57 -- The subprograms defined for Super_String are similar to those
58 -- defined for Wide_Bounded_String, except that they have different names,
59 -- so that they can be renamed in
60 -- Ada.Strings.Wide_Bounded.Generic_Bounded_Length.
62 function Super_Length (Source : Super_String) return Natural;
64 --------------------------------------------------------
65 -- Conversion, Concatenation, and Selection Functions --
66 --------------------------------------------------------
68 function To_Super_String
69 (Source : Wide_String;
70 Max_Length : Natural;
71 Drop : Truncation := Error)
72 return Super_String;
73 -- Note the additional parameter Max_Length, which specifies the maximum
74 -- length setting of the resulting Super_String value.
76 -- The following procedures have declarations (and semantics) that are
77 -- exactly analogous to those declared in Ada.Strings.Bounded.
79 function Super_To_String (Source : Super_String) return Wide_String;
81 function Super_Append
82 (Left, Right : Super_String;
83 Drop : Truncation := Error)
84 return Super_String;
86 function Super_Append
87 (Left : Super_String;
88 Right : Wide_String;
89 Drop : Truncation := Error)
90 return Super_String;
92 function Super_Append
93 (Left : Wide_String;
94 Right : Super_String;
95 Drop : Truncation := Error)
96 return Super_String;
98 function Super_Append
99 (Left : Super_String;
100 Right : Wide_Character;
101 Drop : Truncation := Error)
102 return Super_String;
104 function Super_Append
105 (Left : Wide_Character;
106 Right : Super_String;
107 Drop : Truncation := Error)
108 return Super_String;
110 procedure Super_Append
111 (Source : in out Super_String;
112 New_Item : Super_String;
113 Drop : Truncation := Error);
115 procedure Super_Append
116 (Source : in out Super_String;
117 New_Item : Wide_String;
118 Drop : Truncation := Error);
120 procedure Super_Append
121 (Source : in out Super_String;
122 New_Item : Wide_Character;
123 Drop : Truncation := Error);
125 function Concat
126 (Left, Right : Super_String)
127 return Super_String;
129 function Concat
130 (Left : Super_String;
131 Right : Wide_String)
132 return Super_String;
134 function Concat
135 (Left : Wide_String;
136 Right : Super_String)
137 return Super_String;
139 function Concat
140 (Left : Super_String;
141 Right : Wide_Character)
142 return Super_String;
144 function Concat
145 (Left : Wide_Character;
146 Right : Super_String)
147 return Super_String;
149 function Super_Element
150 (Source : Super_String;
151 Index : Positive)
152 return Wide_Character;
154 procedure Super_Replace_Element
155 (Source : in out Super_String;
156 Index : Positive;
157 By : Wide_Character);
159 function Super_Slice
160 (Source : Super_String;
161 Low : Positive;
162 High : Natural)
163 return Wide_String;
165 function "=" (Left, Right : Super_String) return Boolean;
167 function Equal (Left, Right : Super_String) return Boolean renames "=";
169 function Equal
170 (Left : Super_String;
171 Right : Wide_String)
172 return Boolean;
174 function Equal
175 (Left : Wide_String;
176 Right : Super_String)
177 return Boolean;
179 function Less (Left, Right : Super_String) return Boolean;
181 function Less
182 (Left : Super_String;
183 Right : Wide_String)
184 return Boolean;
186 function Less
187 (Left : Wide_String;
188 Right : Super_String)
189 return Boolean;
191 function Less_Or_Equal (Left, Right : Super_String) return Boolean;
193 function Less_Or_Equal
194 (Left : Super_String;
195 Right : Wide_String)
196 return Boolean;
198 function Less_Or_Equal
199 (Left : Wide_String;
200 Right : Super_String)
201 return Boolean;
203 function Greater (Left, Right : Super_String) return Boolean;
205 function Greater
206 (Left : Super_String;
207 Right : Wide_String)
208 return Boolean;
210 function Greater
211 (Left : Wide_String;
212 Right : Super_String)
213 return Boolean;
215 function Greater_Or_Equal (Left, Right : Super_String) return Boolean;
217 function Greater_Or_Equal
218 (Left : Super_String;
219 Right : Wide_String)
220 return Boolean;
222 function Greater_Or_Equal
223 (Left : Wide_String;
224 Right : Super_String)
225 return Boolean;
227 ----------------------
228 -- Search Functions --
229 ----------------------
231 function Super_Index
232 (Source : Super_String;
233 Pattern : Wide_String;
234 Going : Direction := Forward;
235 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
236 return Natural;
238 function Super_Index
239 (Source : Super_String;
240 Pattern : Wide_String;
241 Going : Direction := Forward;
242 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
243 return Natural;
245 function Super_Index
246 (Source : Super_String;
247 Set : Wide_Maps.Wide_Character_Set;
248 Test : Membership := Inside;
249 Going : Direction := Forward)
250 return Natural;
252 function Super_Index_Non_Blank
253 (Source : Super_String;
254 Going : Direction := Forward)
255 return Natural;
257 function Super_Count
258 (Source : Super_String;
259 Pattern : Wide_String;
260 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
261 return Natural;
263 function Super_Count
264 (Source : Super_String;
265 Pattern : Wide_String;
266 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
267 return Natural;
269 function Super_Count
270 (Source : Super_String;
271 Set : Wide_Maps.Wide_Character_Set)
272 return Natural;
274 procedure Super_Find_Token
275 (Source : Super_String;
276 Set : Wide_Maps.Wide_Character_Set;
277 Test : Membership;
278 First : out Positive;
279 Last : out Natural);
281 -----------------------------------------
282 -- Wide_String Translation Subprograms --
283 -----------------------------------------
285 function Super_Translate
286 (Source : Super_String;
287 Mapping : Wide_Maps.Wide_Character_Mapping)
288 return Super_String;
290 procedure Super_Translate
291 (Source : in out Super_String;
292 Mapping : Wide_Maps.Wide_Character_Mapping);
294 function Super_Translate
295 (Source : Super_String;
296 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
297 return Super_String;
299 procedure Super_Translate
300 (Source : in out Super_String;
301 Mapping : Wide_Maps.Wide_Character_Mapping_Function);
303 --------------------------------------------
304 -- Wide_String Transformation Subprograms --
305 --------------------------------------------
307 function Super_Replace_Slice
308 (Source : Super_String;
309 Low : Positive;
310 High : Natural;
311 By : Wide_String;
312 Drop : Truncation := Error)
313 return Super_String;
315 procedure Super_Replace_Slice
316 (Source : in out Super_String;
317 Low : Positive;
318 High : Natural;
319 By : Wide_String;
320 Drop : Truncation := Error);
322 function Super_Insert
323 (Source : Super_String;
324 Before : Positive;
325 New_Item : Wide_String;
326 Drop : Truncation := Error)
327 return Super_String;
329 procedure Super_Insert
330 (Source : in out Super_String;
331 Before : Positive;
332 New_Item : Wide_String;
333 Drop : Truncation := Error);
335 function Super_Overwrite
336 (Source : Super_String;
337 Position : Positive;
338 New_Item : Wide_String;
339 Drop : Truncation := Error)
340 return Super_String;
342 procedure Super_Overwrite
343 (Source : in out Super_String;
344 Position : Positive;
345 New_Item : Wide_String;
346 Drop : Truncation := Error);
348 function Super_Delete
349 (Source : Super_String;
350 From : Positive;
351 Through : Natural)
352 return Super_String;
354 procedure Super_Delete
355 (Source : in out Super_String;
356 From : Positive;
357 Through : Natural);
359 --------------------------------------
360 -- Wide_String Selector Subprograms --
361 --------------------------------------
363 function Super_Trim
364 (Source : Super_String;
365 Side : Trim_End)
366 return Super_String;
368 procedure Super_Trim
369 (Source : in out Super_String;
370 Side : Trim_End);
372 function Super_Trim
373 (Source : Super_String;
374 Left : Wide_Maps.Wide_Character_Set;
375 Right : Wide_Maps.Wide_Character_Set)
376 return Super_String;
378 procedure Super_Trim
379 (Source : in out Super_String;
380 Left : Wide_Maps.Wide_Character_Set;
381 Right : Wide_Maps.Wide_Character_Set);
383 function Super_Head
384 (Source : Super_String;
385 Count : Natural;
386 Pad : Wide_Character := Wide_Space;
387 Drop : Truncation := Error)
388 return Super_String;
390 procedure Super_Head
391 (Source : in out Super_String;
392 Count : Natural;
393 Pad : Wide_Character := Wide_Space;
394 Drop : Truncation := Error);
396 function Super_Tail
397 (Source : Super_String;
398 Count : Natural;
399 Pad : Wide_Character := Wide_Space;
400 Drop : Truncation := Error)
401 return Super_String;
403 procedure Super_Tail
404 (Source : in out Super_String;
405 Count : Natural;
406 Pad : Wide_Character := Wide_Space;
407 Drop : Truncation := Error);
409 ------------------------------------
410 -- Wide_String Constructor Subprograms --
411 ------------------------------------
413 -- Note: in some of the following routines, there is an extra parameter
414 -- Max_Length which specifies the value of the maximum length for the
415 -- resulting Super_String value.
417 function Times
418 (Left : Natural;
419 Right : Wide_Character;
420 Max_Length : Positive)
421 return Super_String;
422 -- Note the additional parameter Max_Length
424 function Times
425 (Left : Natural;
426 Right : Wide_String;
427 Max_Length : Positive)
428 return Super_String;
429 -- Note the additional parameter Max_Length
431 function Times
432 (Left : Natural;
433 Right : Super_String)
434 return Super_String;
436 function Super_Replicate
437 (Count : Natural;
438 Item : Wide_Character;
439 Drop : Truncation := Error;
440 Max_Length : Positive)
441 return Super_String;
442 -- Note the additional parameter Max_Length
444 function Super_Replicate
445 (Count : Natural;
446 Item : Wide_String;
447 Drop : Truncation := Error;
448 Max_Length : Positive)
449 return Super_String;
450 -- Note the additional parameter Max_Length
452 function Super_Replicate
453 (Count : Natural;
454 Item : Super_String;
455 Drop : Truncation := Error)
456 return Super_String;
458 private
460 -- Pragma Inline declarations
462 pragma Inline ("=");
463 pragma Inline (Less);
464 pragma Inline (Less_Or_Equal);
465 pragma Inline (Greater);
466 pragma Inline (Greater_Or_Equal);
467 pragma Inline (Concat);
468 pragma Inline (Super_Count);
469 pragma Inline (Super_Element);
470 pragma Inline (Super_Find_Token);
471 pragma Inline (Super_Index);
472 pragma Inline (Super_Index_Non_Blank);
473 pragma Inline (Super_Length);
474 pragma Inline (Super_Replace_Element);
475 pragma Inline (Super_Slice);
476 pragma Inline (Super_To_String);
478 end Ada.Strings.Wide_Superbounded;