OSDN Git Service

Delete all lines containing "$Revision:".
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-stwibo.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --             A D A . S T R I N G S . W I D E _ B O U N D E D              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-1997 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the  contents of the part following the private keyword. --
15 --                                                                          --
16 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
17 -- terms of the  GNU General Public License as published  by the Free Soft- --
18 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
19 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
22 -- for  more details.  You should have  received  a copy of the GNU General --
23 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
24 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
25 -- MA 02111-1307, USA.                                                      --
26 --                                                                          --
27 -- As a special exception,  if other files  instantiate  generics from this --
28 -- unit, or you link  this unit with other files  to produce an executable, --
29 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
30 -- covered  by the  GNU  General  Public  License.  This exception does not --
31 -- however invalidate  any other reasons why  the executable file  might be --
32 -- covered by the  GNU Public License.                                      --
33 --                                                                          --
34 -- GNAT was originally developed  by the GNAT team at  New York University. --
35 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
36 --                                                                          --
37 ------------------------------------------------------------------------------
38
39 with Ada.Strings.Wide_Maps;
40
41 package Ada.Strings.Wide_Bounded is
42 pragma Preelaborate (Wide_Bounded);
43
44    generic
45       Max : Positive;
46       --  Maximum length of a Bounded_Wide_String
47
48    package Generic_Bounded_Length is
49
50       Max_Length : constant Positive := Max;
51
52       type Bounded_Wide_String is private;
53
54       Null_Bounded_Wide_String : constant Bounded_Wide_String;
55
56       subtype Length_Range is Natural range 0 .. Max_Length;
57
58       function Length (Source : in Bounded_Wide_String) return Length_Range;
59
60       --------------------------------------------------------
61       -- Conversion, Concatenation, and Selection Functions --
62       --------------------------------------------------------
63
64       function To_Bounded_Wide_String
65         (Source : in Wide_String;
66          Drop   : in Truncation := Error)
67          return   Bounded_Wide_String;
68
69       function To_Wide_String
70         (Source : in Bounded_Wide_String)
71          return   Wide_String;
72
73       function Append
74         (Left, Right : in Bounded_Wide_String;
75          Drop        : in Truncation  := Error)
76          return        Bounded_Wide_String;
77
78       function Append
79         (Left  : in Bounded_Wide_String;
80          Right : in Wide_String;
81          Drop  : in Truncation := Error)
82          return  Bounded_Wide_String;
83
84       function Append
85         (Left  : in Wide_String;
86          Right : in Bounded_Wide_String;
87          Drop  : in Truncation := Error)
88          return  Bounded_Wide_String;
89
90       function Append
91         (Left  : in Bounded_Wide_String;
92          Right : in Wide_Character;
93          Drop  : in Truncation := Error)
94          return  Bounded_Wide_String;
95
96       function Append
97         (Left  : in Wide_Character;
98          Right : in Bounded_Wide_String;
99          Drop  : in Truncation := Error)
100          return  Bounded_Wide_String;
101
102       procedure Append
103         (Source   : in out Bounded_Wide_String;
104          New_Item : in Bounded_Wide_String;
105          Drop     : in Truncation  := Error);
106
107       procedure Append
108         (Source   : in out Bounded_Wide_String;
109          New_Item : in Wide_String;
110          Drop     : in Truncation  := Error);
111
112       procedure Append
113         (Source   : in out Bounded_Wide_String;
114          New_Item : in Wide_Character;
115          Drop     : in Truncation  := Error);
116
117       function "&"
118         (Left, Right : in Bounded_Wide_String)
119          return        Bounded_Wide_String;
120
121       function "&"
122         (Left  : in Bounded_Wide_String;
123          Right : in Wide_String)
124          return  Bounded_Wide_String;
125
126       function "&"
127         (Left  : in Wide_String;
128          Right : in Bounded_Wide_String)
129          return  Bounded_Wide_String;
130
131       function "&"
132         (Left  : in Bounded_Wide_String;
133          Right : in Wide_Character)
134          return  Bounded_Wide_String;
135
136       function "&"
137         (Left  : in Wide_Character;
138          Right : in Bounded_Wide_String)
139          return  Bounded_Wide_String;
140
141       function Element
142         (Source : in Bounded_Wide_String;
143          Index  : in Positive)
144          return   Wide_Character;
145
146       procedure Replace_Element
147         (Source : in out Bounded_Wide_String;
148          Index  : in Positive;
149          By     : in Wide_Character);
150
151       function Slice
152         (Source : in Bounded_Wide_String;
153          Low    : in Positive;
154          High   : in Natural)
155          return   Wide_String;
156
157       function "="
158         (Left  : in Bounded_Wide_String;
159          Right : in Bounded_Wide_String)
160          return  Boolean;
161
162       function "="
163         (Left  : in Bounded_Wide_String;
164          Right : in Wide_String)
165          return  Boolean;
166
167       function "="
168         (Left  : in Wide_String;
169          Right : in Bounded_Wide_String)
170          return  Boolean;
171
172       function "<"
173         (Left  : in Bounded_Wide_String;
174          Right : in Bounded_Wide_String)
175          return  Boolean;
176
177       function "<"
178         (Left  : in Bounded_Wide_String;
179          Right : in Wide_String)
180          return  Boolean;
181
182       function "<"
183         (Left  : in Wide_String;
184          Right : in Bounded_Wide_String)
185          return  Boolean;
186
187       function "<="
188         (Left  : in Bounded_Wide_String;
189          Right : in Bounded_Wide_String)
190          return  Boolean;
191
192       function "<="
193         (Left  : in Bounded_Wide_String;
194          Right : in Wide_String)
195          return  Boolean;
196
197       function "<="
198         (Left  : in Wide_String;
199          Right : in Bounded_Wide_String)
200          return  Boolean;
201
202       function ">"
203         (Left  : in Bounded_Wide_String;
204          Right : in Bounded_Wide_String)
205          return  Boolean;
206
207       function ">"
208         (Left  : in Bounded_Wide_String;
209          Right : in Wide_String)
210          return  Boolean;
211
212       function ">"
213         (Left  : in Wide_String;
214          Right : in Bounded_Wide_String)
215          return  Boolean;
216
217       function ">="
218         (Left  : in Bounded_Wide_String;
219          Right : in Bounded_Wide_String)
220          return  Boolean;
221
222       function ">="
223         (Left  : in Bounded_Wide_String;
224          Right : in Wide_String)
225          return  Boolean;
226
227       function ">="
228         (Left  : in Wide_String;
229          Right : in Bounded_Wide_String)
230          return  Boolean;
231
232       ----------------------
233       -- Search Functions --
234       ----------------------
235
236       function Index
237         (Source  : in Bounded_Wide_String;
238          Pattern : in Wide_String;
239          Going   : in Direction := Forward;
240          Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
241          return    Natural;
242
243       function Index
244         (Source  : in Bounded_Wide_String;
245          Pattern : in Wide_String;
246          Going   : in Direction := Forward;
247          Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
248          return    Natural;
249
250       function Index
251         (Source : in Bounded_Wide_String;
252          Set    : in Wide_Maps.Wide_Character_Set;
253          Test   : in Membership := Inside;
254          Going  : in Direction  := Forward)
255          return   Natural;
256
257       function Index_Non_Blank
258         (Source : in Bounded_Wide_String;
259          Going  : in Direction := Forward)
260          return   Natural;
261
262       function Count
263         (Source  : in Bounded_Wide_String;
264          Pattern : in Wide_String;
265          Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
266          return    Natural;
267
268       function Count
269         (Source  : in Bounded_Wide_String;
270          Pattern : in Wide_String;
271          Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
272          return    Natural;
273
274       function Count
275         (Source : in Bounded_Wide_String;
276          Set    : in Wide_Maps.Wide_Character_Set)
277          return   Natural;
278
279       procedure Find_Token
280         (Source : in Bounded_Wide_String;
281          Set    : in Wide_Maps.Wide_Character_Set;
282          Test   : in Membership;
283          First  : out Positive;
284          Last   : out Natural);
285
286       ------------------------------------
287       -- Wide_String Translation Subprograms --
288       ------------------------------------
289
290       function Translate
291         (Source   : in Bounded_Wide_String;
292          Mapping  : in Wide_Maps.Wide_Character_Mapping)
293          return     Bounded_Wide_String;
294
295       procedure Translate
296         (Source   : in out Bounded_Wide_String;
297          Mapping  : in Wide_Maps.Wide_Character_Mapping);
298
299       function Translate
300         (Source  : in Bounded_Wide_String;
301          Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
302          return    Bounded_Wide_String;
303
304       procedure Translate
305         (Source  : in out Bounded_Wide_String;
306          Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
307
308       ---------------------------------------
309       -- Wide_String Transformation Subprograms --
310       ---------------------------------------
311
312       function Replace_Slice
313         (Source   : in Bounded_Wide_String;
314          Low      : in Positive;
315          High     : in Natural;
316          By       : in Wide_String;
317          Drop     : in Truncation := Error)
318          return     Bounded_Wide_String;
319
320       procedure Replace_Slice
321         (Source   : in out Bounded_Wide_String;
322          Low      : in Positive;
323          High     : in Natural;
324          By       : in Wide_String;
325          Drop     : in Truncation := Error);
326
327       function Insert
328         (Source   : in Bounded_Wide_String;
329          Before   : in Positive;
330          New_Item : in Wide_String;
331          Drop     : in Truncation := Error)
332          return     Bounded_Wide_String;
333
334       procedure Insert
335         (Source   : in out Bounded_Wide_String;
336          Before   : in Positive;
337          New_Item : in Wide_String;
338          Drop     : in Truncation := Error);
339
340       function Overwrite
341         (Source    : in Bounded_Wide_String;
342          Position  : in Positive;
343          New_Item  : in Wide_String;
344          Drop      : in Truncation := Error)
345          return      Bounded_Wide_String;
346
347       procedure Overwrite
348         (Source    : in out Bounded_Wide_String;
349          Position  : in Positive;
350          New_Item  : in Wide_String;
351          Drop      : in Truncation := Error);
352
353       function Delete
354         (Source  : in Bounded_Wide_String;
355          From    : in Positive;
356          Through : in Natural)
357          return    Bounded_Wide_String;
358
359       procedure Delete
360         (Source  : in out Bounded_Wide_String;
361          From    : in Positive;
362          Through : in Natural);
363
364       ---------------------------------
365       -- Wide_String Selector Subprograms --
366       ---------------------------------
367
368       function Trim
369         (Source : in Bounded_Wide_String;
370          Side   : in Trim_End)
371          return   Bounded_Wide_String;
372
373       procedure Trim
374         (Source : in out Bounded_Wide_String;
375          Side   : in Trim_End);
376
377       function Trim
378         (Source  : in Bounded_Wide_String;
379           Left   : in Wide_Maps.Wide_Character_Set;
380           Right  : in Wide_Maps.Wide_Character_Set)
381           return   Bounded_Wide_String;
382
383       procedure Trim
384         (Source : in out Bounded_Wide_String;
385          Left   : in Wide_Maps.Wide_Character_Set;
386          Right  : in Wide_Maps.Wide_Character_Set);
387
388       function Head
389         (Source : in Bounded_Wide_String;
390          Count  : in Natural;
391          Pad    : in Wide_Character := Wide_Space;
392          Drop   : in Truncation := Error)
393          return   Bounded_Wide_String;
394
395       procedure Head
396         (Source : in out Bounded_Wide_String;
397          Count  : in Natural;
398          Pad    : in Wide_Character  := Wide_Space;
399          Drop   : in Truncation := Error);
400
401       function Tail
402         (Source : in Bounded_Wide_String;
403          Count  : in Natural;
404          Pad    : in Wide_Character  := Wide_Space;
405          Drop   : in Truncation := Error)
406          return Bounded_Wide_String;
407
408       procedure Tail
409         (Source : in out Bounded_Wide_String;
410          Count  : in Natural;
411          Pad    : in Wide_Character  := Wide_Space;
412          Drop   : in Truncation := Error);
413
414       ------------------------------------
415       -- Wide_String Constructor Subprograms --
416       ------------------------------------
417
418       function "*"
419         (Left  : in Natural;
420          Right : in Wide_Character)
421          return  Bounded_Wide_String;
422
423       function "*"
424         (Left  : in Natural;
425          Right : in Wide_String)
426          return  Bounded_Wide_String;
427
428       function "*"
429         (Left  : in Natural;
430          Right : in Bounded_Wide_String)
431          return  Bounded_Wide_String;
432
433       function Replicate
434         (Count : in Natural;
435          Item  : in Wide_Character;
436          Drop  : in Truncation := Error)
437          return  Bounded_Wide_String;
438
439       function Replicate
440         (Count : in Natural;
441          Item  : in Wide_String;
442          Drop  : in Truncation := Error)
443          return  Bounded_Wide_String;
444
445       function Replicate
446         (Count : in Natural;
447          Item  : in Bounded_Wide_String;
448          Drop  : in Truncation := Error)
449          return  Bounded_Wide_String;
450
451    private
452       Wide_NUL : constant Wide_Character := Wide_Character'Val (0);
453
454       type Bounded_Wide_String is record
455          Length : Length_Range := 0;
456          Data   : Wide_String (1 .. Max_Length);
457       end record;
458
459       Null_Bounded_Wide_String : constant Bounded_Wide_String :=
460                (Length => 0, Data => (1 .. Max_Length => Wide_NUL));
461
462       --  Pragma Inline declarations (GNAT specific additions)
463
464       pragma Inline ("=");
465       pragma Inline ("<");
466       pragma Inline ("<=");
467       pragma Inline (">");
468       pragma Inline (">=");
469       pragma Inline ("&");
470       pragma Inline (Count);
471       pragma Inline (Element);
472       pragma Inline (Find_Token);
473       pragma Inline (Index);
474       pragma Inline (Index_Non_Blank);
475       pragma Inline (Length);
476       pragma Inline (Replace_Element);
477       pragma Inline (Slice);
478       pragma Inline (To_Bounded_Wide_String);
479       pragma Inline (To_Wide_String);
480
481    end Generic_Bounded_Length;
482
483 end Ada.Strings.Wide_Bounded;