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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc3/] [gcc/] [ada/] [a-stwisu.ads] - Blame information for rev 516

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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