OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [a-strsup.ads] - Blame information for rev 707

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT RUN-TIME COMPONENTS                         --
4
--                                                                          --
5
--             A D A . S T R I N G S . S U P E R B O U N D E D              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 2003-2010, 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 3,  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  This non generic package contains most of the implementation of the
33
--  generic package Ada.Strings.Bounded.Generic_Bounded_Length.
34
 
35
--  It defines type Super_String as a discriminated record with the maximum
36
--  length as the discriminant. Individual instantiations of Strings.Bounded
37
--  use this type with an appropriate discriminant value set.
38
 
39
with Ada.Strings.Maps;
40
 
41
package Ada.Strings.Superbounded is
42
   pragma Preelaborate;
43
 
44
   type Super_String (Max_Length : Positive) is record
45
      Current_Length : Natural := 0;
46
      Data           : String (1 .. Max_Length) := (others => ASCII.NUL);
47
   end record;
48
   --  Type Bounded_String in Ada.Strings.Bounded.Generic_Bounded_Length is
49
   --  derived from this type, with the constraint of the maximum length.
50
 
51
   --  The subprograms defined for Super_String are similar to those
52
   --  defined for Bounded_String, except that they have different names, so
53
   --  that they can be renamed in Ada.Strings.Bounded.Generic_Bounded_Length.
54
 
55
   function Super_Length (Source : Super_String) return Natural;
56
 
57
   --------------------------------------------------------
58
   -- Conversion, Concatenation, and Selection Functions --
59
   --------------------------------------------------------
60
 
61
   function To_Super_String
62
     (Source     : String;
63
      Max_Length : Natural;
64
      Drop       : Truncation := Error) return Super_String;
65
   --  Note the additional parameter Max_Length, which specifies the maximum
66
   --  length setting of the resulting Super_String value.
67
 
68
   --  The following procedures have declarations (and semantics) that are
69
   --  exactly analogous to those declared in Ada.Strings.Bounded.
70
 
71
   function Super_To_String (Source : Super_String) return String;
72
 
73
   procedure Set_Super_String
74
     (Target : out Super_String;
75
      Source : String;
76
      Drop   : Truncation := Error);
77
 
78
   function Super_Append
79
     (Left  : Super_String;
80
      Right : Super_String;
81
      Drop  : Truncation  := Error) return Super_String;
82
 
83
   function Super_Append
84
     (Left  : Super_String;
85
      Right : String;
86
      Drop  : Truncation := Error) return Super_String;
87
 
88
   function Super_Append
89
     (Left  : String;
90
      Right : Super_String;
91
      Drop  : Truncation := Error) return Super_String;
92
 
93
   function Super_Append
94
     (Left  : Super_String;
95
      Right : Character;
96
      Drop  : Truncation := Error) return Super_String;
97
 
98
   function Super_Append
99
     (Left  : Character;
100
      Right : Super_String;
101
      Drop  : Truncation := Error) return Super_String;
102
 
103
   procedure Super_Append
104
     (Source   : in out Super_String;
105
      New_Item : Super_String;
106
      Drop     : Truncation  := Error);
107
 
108
   procedure Super_Append
109
     (Source   : in out Super_String;
110
      New_Item : String;
111
      Drop     : Truncation  := Error);
112
 
113
   procedure Super_Append
114
     (Source   : in out Super_String;
115
      New_Item : Character;
116
      Drop     : Truncation  := Error);
117
 
118
   function Concat
119
     (Left  : Super_String;
120
      Right : Super_String) return Super_String;
121
 
122
   function Concat
123
     (Left  : Super_String;
124
      Right : String) return Super_String;
125
 
126
   function Concat
127
     (Left  : String;
128
      Right : Super_String) return Super_String;
129
 
130
   function Concat
131
     (Left  : Super_String;
132
      Right : Character) return Super_String;
133
 
134
   function Concat
135
     (Left  : Character;
136
      Right : Super_String) return Super_String;
137
 
138
   function Super_Element
139
     (Source : Super_String;
140
      Index  : Positive) return Character;
141
 
142
   procedure Super_Replace_Element
143
     (Source : in out Super_String;
144
      Index  : Positive;
145
      By     : Character);
146
 
147
   function Super_Slice
148
     (Source : Super_String;
149
      Low    : Positive;
150
      High   : Natural) return String;
151
 
152
   function Super_Slice
153
     (Source : Super_String;
154
      Low    : Positive;
155
      High   : Natural) return Super_String;
156
 
157
   procedure Super_Slice
158
     (Source : Super_String;
159
      Target : out Super_String;
160
      Low    : Positive;
161
      High   : Natural);
162
 
163
   function "="
164
     (Left  : Super_String;
165
      Right : Super_String) return Boolean;
166
 
167
   function Equal
168
     (Left  : Super_String;
169
      Right : Super_String) return Boolean renames "=";
170
 
171
   function Equal
172
     (Left  : Super_String;
173
      Right : String) return Boolean;
174
 
175
   function Equal
176
     (Left  : String;
177
      Right : Super_String) return Boolean;
178
 
179
   function Less
180
     (Left  : Super_String;
181
      Right : Super_String) return Boolean;
182
 
183
   function Less
184
     (Left  : Super_String;
185
      Right : String) return Boolean;
186
 
187
   function Less
188
     (Left  : String;
189
      Right : Super_String) return Boolean;
190
 
191
   function Less_Or_Equal
192
     (Left  : Super_String;
193
      Right : Super_String) return Boolean;
194
 
195
   function Less_Or_Equal
196
     (Left  : Super_String;
197
      Right : String) return Boolean;
198
 
199
   function Less_Or_Equal
200
     (Left  : String;
201
      Right : Super_String) return Boolean;
202
 
203
   function Greater
204
     (Left  : Super_String;
205
      Right : Super_String) return Boolean;
206
 
207
   function Greater
208
     (Left  : Super_String;
209
      Right : String) return Boolean;
210
 
211
   function Greater
212
     (Left  : String;
213
      Right : Super_String) return Boolean;
214
 
215
   function Greater_Or_Equal
216
     (Left  : Super_String;
217
      Right : Super_String) return Boolean;
218
 
219
   function Greater_Or_Equal
220
     (Left  : Super_String;
221
      Right : String) return Boolean;
222
 
223
   function Greater_Or_Equal
224
     (Left  : String;
225
      Right : Super_String) return Boolean;
226
 
227
   ----------------------
228
   -- Search Functions --
229
   ----------------------
230
 
231
   function Super_Index
232
     (Source  : Super_String;
233
      Pattern : String;
234
      Going   : Direction := Forward;
235
      Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
236
 
237
   function Super_Index
238
     (Source  : Super_String;
239
      Pattern : String;
240
      Going   : Direction := Forward;
241
      Mapping : Maps.Character_Mapping_Function) return Natural;
242
 
243
   function Super_Index
244
     (Source : Super_String;
245
      Set    : Maps.Character_Set;
246
      Test   : Membership := Inside;
247
      Going  : Direction  := Forward) return Natural;
248
 
249
   function Super_Index
250
     (Source  : Super_String;
251
      Pattern : String;
252
      From    : Positive;
253
      Going   : Direction := Forward;
254
      Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
255
 
256
   function Super_Index
257
     (Source  : Super_String;
258
      Pattern : String;
259
      From    : Positive;
260
      Going   : Direction := Forward;
261
      Mapping : Maps.Character_Mapping_Function) return Natural;
262
 
263
   function Super_Index
264
     (Source : Super_String;
265
      Set    : Maps.Character_Set;
266
      From   : Positive;
267
      Test   : Membership := Inside;
268
      Going  : Direction := Forward) return Natural;
269
 
270
   function Super_Index_Non_Blank
271
     (Source : Super_String;
272
      Going  : Direction := Forward) return Natural;
273
 
274
   function Super_Index_Non_Blank
275
     (Source : Super_String;
276
      From   : Positive;
277
      Going  : Direction := Forward) return Natural;
278
 
279
   function Super_Count
280
     (Source  : Super_String;
281
      Pattern : String;
282
      Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
283
 
284
   function Super_Count
285
     (Source  : Super_String;
286
      Pattern : String;
287
      Mapping : Maps.Character_Mapping_Function) return Natural;
288
 
289
   function Super_Count
290
     (Source : Super_String;
291
      Set    : Maps.Character_Set) return Natural;
292
 
293
   procedure Super_Find_Token
294
     (Source : Super_String;
295
      Set    : Maps.Character_Set;
296
      From   : Positive;
297
      Test   : Membership;
298
      First  : out Positive;
299
      Last   : out Natural);
300
 
301
   procedure Super_Find_Token
302
     (Source : Super_String;
303
      Set    : Maps.Character_Set;
304
      Test   : Membership;
305
      First  : out Positive;
306
      Last   : out Natural);
307
 
308
   ------------------------------------
309
   -- String Translation Subprograms --
310
   ------------------------------------
311
 
312
   function Super_Translate
313
     (Source  : Super_String;
314
      Mapping : Maps.Character_Mapping) return Super_String;
315
 
316
   procedure Super_Translate
317
     (Source   : in out Super_String;
318
      Mapping  : Maps.Character_Mapping);
319
 
320
   function Super_Translate
321
     (Source  : Super_String;
322
      Mapping : Maps.Character_Mapping_Function) return Super_String;
323
 
324
   procedure Super_Translate
325
     (Source  : in out Super_String;
326
      Mapping : Maps.Character_Mapping_Function);
327
 
328
   ---------------------------------------
329
   -- String Transformation Subprograms --
330
   ---------------------------------------
331
 
332
   function Super_Replace_Slice
333
     (Source : Super_String;
334
      Low    : Positive;
335
      High   : Natural;
336
      By     : String;
337
      Drop   : Truncation := Error) return Super_String;
338
 
339
   procedure Super_Replace_Slice
340
     (Source  : in out Super_String;
341
      Low     : Positive;
342
      High    : Natural;
343
      By      : String;
344
      Drop    : Truncation := Error);
345
 
346
   function Super_Insert
347
     (Source   : Super_String;
348
      Before   : Positive;
349
      New_Item : String;
350
      Drop     : Truncation := Error) return Super_String;
351
 
352
   procedure Super_Insert
353
     (Source   : in out Super_String;
354
      Before   : Positive;
355
      New_Item : String;
356
      Drop     : Truncation := Error);
357
 
358
   function Super_Overwrite
359
     (Source   : Super_String;
360
      Position : Positive;
361
      New_Item : String;
362
      Drop     : Truncation := Error) return Super_String;
363
 
364
   procedure Super_Overwrite
365
     (Source    : in out Super_String;
366
      Position  : Positive;
367
      New_Item  : String;
368
      Drop      : Truncation := Error);
369
 
370
   function Super_Delete
371
     (Source  : Super_String;
372
      From    : Positive;
373
      Through : Natural) return Super_String;
374
 
375
   procedure Super_Delete
376
     (Source  : in out Super_String;
377
      From    : Positive;
378
      Through : Natural);
379
 
380
   ---------------------------------
381
   -- String Selector Subprograms --
382
   ---------------------------------
383
 
384
   function Super_Trim
385
     (Source : Super_String;
386
      Side   : Trim_End) return Super_String;
387
 
388
   procedure Super_Trim
389
     (Source : in out Super_String;
390
      Side   : Trim_End);
391
 
392
   function Super_Trim
393
     (Source : Super_String;
394
      Left   : Maps.Character_Set;
395
      Right  : Maps.Character_Set) return Super_String;
396
 
397
   procedure Super_Trim
398
     (Source : in out Super_String;
399
      Left   : Maps.Character_Set;
400
      Right  : Maps.Character_Set);
401
 
402
   function Super_Head
403
     (Source : Super_String;
404
      Count  : Natural;
405
      Pad    : Character := Space;
406
      Drop   : Truncation := Error) return Super_String;
407
 
408
   procedure Super_Head
409
     (Source : in out Super_String;
410
      Count  : Natural;
411
      Pad    : Character := Space;
412
      Drop   : Truncation := Error);
413
 
414
   function Super_Tail
415
     (Source : Super_String;
416
      Count  : Natural;
417
      Pad    : Character := Space;
418
      Drop   : Truncation := Error) return Super_String;
419
 
420
   procedure Super_Tail
421
     (Source : in out Super_String;
422
      Count  : Natural;
423
      Pad    : Character := Space;
424
      Drop   : Truncation := Error);
425
 
426
   ------------------------------------
427
   -- String Constructor Subprograms --
428
   ------------------------------------
429
 
430
   --  Note: in some of the following routines, there is an extra parameter
431
   --  Max_Length which specifies the value of the maximum length for the
432
   --  resulting Super_String value.
433
 
434
   function Times
435
     (Left       : Natural;
436
      Right      : Character;
437
      Max_Length : Positive) return Super_String;
438
   --  Note the additional parameter Max_Length
439
 
440
   function Times
441
     (Left       : Natural;
442
      Right      : String;
443
      Max_Length : Positive) return Super_String;
444
   --  Note the additional parameter Max_Length
445
 
446
   function Times
447
     (Left  : Natural;
448
      Right : Super_String) return Super_String;
449
 
450
   function Super_Replicate
451
     (Count      : Natural;
452
      Item       : Character;
453
      Drop       : Truncation := Error;
454
      Max_Length : Positive) return Super_String;
455
   --  Note the additional parameter Max_Length
456
 
457
   function Super_Replicate
458
     (Count      : Natural;
459
      Item       : String;
460
      Drop       : Truncation := Error;
461
      Max_Length : Positive) return Super_String;
462
   --  Note the additional parameter Max_Length
463
 
464
   function Super_Replicate
465
     (Count : Natural;
466
      Item  : Super_String;
467
      Drop  : Truncation := Error) return Super_String;
468
 
469
private
470
      --  Pragma Inline declarations
471
 
472
      pragma Inline ("=");
473
      pragma Inline (Less);
474
      pragma Inline (Less_Or_Equal);
475
      pragma Inline (Greater);
476
      pragma Inline (Greater_Or_Equal);
477
      pragma Inline (Concat);
478
      pragma Inline (Super_Count);
479
      pragma Inline (Super_Element);
480
      pragma Inline (Super_Find_Token);
481
      pragma Inline (Super_Index);
482
      pragma Inline (Super_Index_Non_Blank);
483
      pragma Inline (Super_Length);
484
      pragma Inline (Super_Replace_Element);
485
      pragma Inline (Super_Slice);
486
      pragma Inline (Super_To_String);
487
 
488
end Ada.Strings.Superbounded;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.