* jump.c: Remove prototypes for delete_computation and
[official-gcc.git] / gcc / ada / a-stwiun.ads
bloba7a967f1d35b8e307ac078dee2da1fc67e6ecc4b
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2006, 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, 51 Franklin Street, Fifth Floor, --
24 -- Boston, MA 02110-1301, 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.Wide_Maps;
39 with Ada.Finalization;
41 package Ada.Strings.Wide_Unbounded is
42 pragma Preelaborate;
44 type Unbounded_Wide_String is private;
45 pragma Preelaborable_Initialization (Unbounded_Wide_String);
47 Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
49 function Length (Source : Unbounded_Wide_String) return Natural;
51 type Wide_String_Access is access all Wide_String;
53 procedure Free (X : in out Wide_String_Access);
55 --------------------------------------------------------
56 -- Conversion, Concatenation, and Selection Functions --
57 --------------------------------------------------------
59 function To_Unbounded_Wide_String
60 (Source : Wide_String) return Unbounded_Wide_String;
62 function To_Unbounded_Wide_String
63 (Length : Natural) return Unbounded_Wide_String;
65 function To_Wide_String
66 (Source : Unbounded_Wide_String)
67 return Wide_String;
69 procedure Set_Unbounded_Wide_String
70 (Target : out Unbounded_Wide_String;
71 Source : Wide_String);
72 pragma Ada_05 (Set_Unbounded_Wide_String);
74 procedure Append
75 (Source : in out Unbounded_Wide_String;
76 New_Item : Unbounded_Wide_String);
78 procedure Append
79 (Source : in out Unbounded_Wide_String;
80 New_Item : Wide_String);
82 procedure Append
83 (Source : in out Unbounded_Wide_String;
84 New_Item : Wide_Character);
86 function "&"
87 (Left : Unbounded_Wide_String;
88 Right : Unbounded_Wide_String) return Unbounded_Wide_String;
90 function "&"
91 (Left : Unbounded_Wide_String;
92 Right : Wide_String) return Unbounded_Wide_String;
94 function "&"
95 (Left : Wide_String;
96 Right : Unbounded_Wide_String) return Unbounded_Wide_String;
98 function "&"
99 (Left : Unbounded_Wide_String;
100 Right : Wide_Character) return Unbounded_Wide_String;
102 function "&"
103 (Left : Wide_Character;
104 Right : Unbounded_Wide_String) return Unbounded_Wide_String;
106 function Element
107 (Source : Unbounded_Wide_String;
108 Index : Positive) return Wide_Character;
110 procedure Replace_Element
111 (Source : in out Unbounded_Wide_String;
112 Index : Positive;
113 By : Wide_Character);
115 function Slice
116 (Source : Unbounded_Wide_String;
117 Low : Positive;
118 High : Natural) return Wide_String;
120 function Unbounded_Slice
121 (Source : Unbounded_Wide_String;
122 Low : Positive;
123 High : Natural) return Unbounded_Wide_String;
124 pragma Ada_05 (Unbounded_Slice);
126 procedure Unbounded_Slice
127 (Source : Unbounded_Wide_String;
128 Target : out Unbounded_Wide_String;
129 Low : Positive;
130 High : Natural);
131 pragma Ada_05 (Unbounded_Slice);
133 function "="
134 (Left : Unbounded_Wide_String;
135 Right : Unbounded_Wide_String) return Boolean;
137 function "="
138 (Left : Unbounded_Wide_String;
139 Right : Wide_String) return Boolean;
141 function "="
142 (Left : Wide_String;
143 Right : Unbounded_Wide_String) return Boolean;
145 function "<"
146 (Left : Unbounded_Wide_String;
147 Right : Unbounded_Wide_String) return Boolean;
149 function "<"
150 (Left : Unbounded_Wide_String;
151 Right : Wide_String) return Boolean;
153 function "<"
154 (Left : Wide_String;
155 Right : Unbounded_Wide_String) return Boolean;
157 function "<="
158 (Left : Unbounded_Wide_String;
159 Right : Unbounded_Wide_String) return Boolean;
161 function "<="
162 (Left : Unbounded_Wide_String;
163 Right : Wide_String) return Boolean;
165 function "<="
166 (Left : Wide_String;
167 Right : Unbounded_Wide_String) return Boolean;
169 function ">"
170 (Left : Unbounded_Wide_String;
171 Right : Unbounded_Wide_String) return Boolean;
173 function ">"
174 (Left : Unbounded_Wide_String;
175 Right : Wide_String) return Boolean;
177 function ">"
178 (Left : Wide_String;
179 Right : Unbounded_Wide_String) return Boolean;
181 function ">="
182 (Left : Unbounded_Wide_String;
183 Right : Unbounded_Wide_String) return Boolean;
185 function ">="
186 (Left : Unbounded_Wide_String;
187 Right : Wide_String) return Boolean;
189 function ">="
190 (Left : Wide_String;
191 Right : Unbounded_Wide_String) return Boolean;
193 ------------------------
194 -- Search Subprograms --
195 ------------------------
197 function Index
198 (Source : Unbounded_Wide_String;
199 Pattern : Wide_String;
200 Going : Direction := Forward;
201 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
202 return Natural;
204 function Index
205 (Source : Unbounded_Wide_String;
206 Pattern : Wide_String;
207 Going : Direction := Forward;
208 Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
210 function Index
211 (Source : Unbounded_Wide_String;
212 Set : Wide_Maps.Wide_Character_Set;
213 Test : Membership := Inside;
214 Going : Direction := Forward) return Natural;
216 function Index
217 (Source : Unbounded_Wide_String;
218 Pattern : Wide_String;
219 From : Positive;
220 Going : Direction := Forward;
221 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
222 return Natural;
223 pragma Ada_05 (Index);
225 function Index
226 (Source : Unbounded_Wide_String;
227 Pattern : Wide_String;
228 From : Positive;
229 Going : Direction := Forward;
230 Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
231 pragma Ada_05 (Index);
233 function Index
234 (Source : Unbounded_Wide_String;
235 Set : Wide_Maps.Wide_Character_Set;
236 From : Positive;
237 Test : Membership := Inside;
238 Going : Direction := Forward) return Natural;
239 pragma Ada_05 (Index);
241 function Index_Non_Blank
242 (Source : Unbounded_Wide_String;
243 Going : Direction := Forward) return Natural;
245 function Index_Non_Blank
246 (Source : Unbounded_Wide_String;
247 From : Positive;
248 Going : Direction := Forward) return Natural;
249 pragma Ada_05 (Index_Non_Blank);
251 function Count
252 (Source : Unbounded_Wide_String;
253 Pattern : Wide_String;
254 Mapping : Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
255 return Natural;
257 function Count
258 (Source : Unbounded_Wide_String;
259 Pattern : Wide_String;
260 Mapping : Wide_Maps.Wide_Character_Mapping_Function) return Natural;
262 function Count
263 (Source : Unbounded_Wide_String;
264 Set : Wide_Maps.Wide_Character_Set) return Natural;
266 procedure Find_Token
267 (Source : Unbounded_Wide_String;
268 Set : Wide_Maps.Wide_Character_Set;
269 Test : Membership;
270 First : out Positive;
271 Last : out Natural);
273 ------------------------------------
274 -- String Translation Subprograms --
275 ------------------------------------
277 function Translate
278 (Source : Unbounded_Wide_String;
279 Mapping : Wide_Maps.Wide_Character_Mapping)
280 return Unbounded_Wide_String;
282 procedure Translate
283 (Source : in out Unbounded_Wide_String;
284 Mapping : Wide_Maps.Wide_Character_Mapping);
286 function Translate
287 (Source : Unbounded_Wide_String;
288 Mapping : Wide_Maps.Wide_Character_Mapping_Function)
289 return Unbounded_Wide_String;
291 procedure Translate
292 (Source : in out Unbounded_Wide_String;
293 Mapping : Wide_Maps.Wide_Character_Mapping_Function);
295 ---------------------------------------
296 -- String Transformation Subprograms --
297 ---------------------------------------
299 function Replace_Slice
300 (Source : Unbounded_Wide_String;
301 Low : Positive;
302 High : Natural;
303 By : Wide_String) return Unbounded_Wide_String;
305 procedure Replace_Slice
306 (Source : in out Unbounded_Wide_String;
307 Low : Positive;
308 High : Natural;
309 By : Wide_String);
311 function Insert
312 (Source : Unbounded_Wide_String;
313 Before : Positive;
314 New_Item : Wide_String) return Unbounded_Wide_String;
316 procedure Insert
317 (Source : in out Unbounded_Wide_String;
318 Before : Positive;
319 New_Item : Wide_String);
321 function Overwrite
322 (Source : Unbounded_Wide_String;
323 Position : Positive;
324 New_Item : Wide_String) return Unbounded_Wide_String;
326 procedure Overwrite
327 (Source : in out Unbounded_Wide_String;
328 Position : Positive;
329 New_Item : Wide_String);
331 function Delete
332 (Source : Unbounded_Wide_String;
333 From : Positive;
334 Through : Natural) return Unbounded_Wide_String;
336 procedure Delete
337 (Source : in out Unbounded_Wide_String;
338 From : Positive;
339 Through : Natural);
341 function Trim
342 (Source : Unbounded_Wide_String;
343 Side : Trim_End) return Unbounded_Wide_String;
345 procedure Trim
346 (Source : in out Unbounded_Wide_String;
347 Side : Trim_End);
349 function Trim
350 (Source : Unbounded_Wide_String;
351 Left : Wide_Maps.Wide_Character_Set;
352 Right : Wide_Maps.Wide_Character_Set) return Unbounded_Wide_String;
354 procedure Trim
355 (Source : in out Unbounded_Wide_String;
356 Left : Wide_Maps.Wide_Character_Set;
357 Right : Wide_Maps.Wide_Character_Set);
359 function Head
360 (Source : Unbounded_Wide_String;
361 Count : Natural;
362 Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String;
364 procedure Head
365 (Source : in out Unbounded_Wide_String;
366 Count : Natural;
367 Pad : Wide_Character := Wide_Space);
369 function Tail
370 (Source : Unbounded_Wide_String;
371 Count : Natural;
372 Pad : Wide_Character := Wide_Space) return Unbounded_Wide_String;
374 procedure Tail
375 (Source : in out Unbounded_Wide_String;
376 Count : Natural;
377 Pad : Wide_Character := Wide_Space);
379 function "*"
380 (Left : Natural;
381 Right : Wide_Character) return Unbounded_Wide_String;
383 function "*"
384 (Left : Natural;
385 Right : Wide_String) return Unbounded_Wide_String;
387 function "*"
388 (Left : Natural;
389 Right : Unbounded_Wide_String) return Unbounded_Wide_String;
391 private
392 pragma Inline (Length);
394 package AF renames Ada.Finalization;
396 Null_Wide_String : aliased Wide_String := "";
398 function To_Unbounded_Wide (S : Wide_String) return Unbounded_Wide_String
399 renames To_Unbounded_Wide_String;
401 type Unbounded_Wide_String is new AF.Controlled with record
402 Reference : Wide_String_Access := Null_Wide_String'Access;
403 Last : Natural := 0;
404 end record;
406 -- The Unbounded_Wide_String is using a buffered implementation to increase
407 -- speed of the Append/Delete/Insert procedures. The Reference string
408 -- pointer above contains the current string value and extra room at the
409 -- end to be used by the next Append routine. Last is the index of the
410 -- string ending character. So the current string value is really
411 -- Reference (1 .. Last).
413 pragma Stream_Convert
414 (Unbounded_Wide_String, To_Unbounded_Wide, To_Wide_String);
416 pragma Finalize_Storage_Only (Unbounded_Wide_String);
417 -- Finalization is required only for freeing storage
419 procedure Initialize (Object : in out Unbounded_Wide_String);
420 procedure Adjust (Object : in out Unbounded_Wide_String);
421 procedure Finalize (Object : in out Unbounded_Wide_String);
423 procedure Realloc_For_Chunk
424 (Source : in out Unbounded_Wide_String;
425 Chunk_Size : Natural);
426 -- Adjust the size allocated for the string. Add at least Chunk_Size so it
427 -- is safe to add a string of this size at the end of the current content.
428 -- The real size allocated for the string is Chunk_Size + x of the current
429 -- string size. This buffered handling makes the Append unbounded string
430 -- routines very fast.
432 Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
433 (AF.Controlled with
434 Reference => Null_Wide_String'Access,
435 Last => 0);
436 end Ada.Strings.Wide_Unbounded;