OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-strfix.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --                    A D A . S T R I N G S . F I X E D                     --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision: 1.10 $                             --
10 --                                                                          --
11 --          Copyright (C) 1992-1997 Free Software Foundation, Inc.          --
12 --                                                                          --
13 -- This specification is derived from the Ada Reference Manual for use with --
14 -- GNAT. The copyright notice above, and the license provisions that follow --
15 -- apply solely to the  contents of the part following the private keyword. --
16 --                                                                          --
17 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
18 -- terms of the  GNU General Public License as published  by the Free Soft- --
19 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
20 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
21 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
22 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
23 -- for  more details.  You should have  received  a copy of the GNU General --
24 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
25 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
26 -- MA 02111-1307, USA.                                                      --
27 --                                                                          --
28 -- As a special exception,  if other files  instantiate  generics from this --
29 -- unit, or you link  this unit with other files  to produce an executable, --
30 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
31 -- covered  by the  GNU  General  Public  License.  This exception does not --
32 -- however invalidate  any other reasons why  the executable file  might be --
33 -- covered by the  GNU Public License.                                      --
34 --                                                                          --
35 -- GNAT was originally developed  by the GNAT team at  New York University. --
36 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
37 --                                                                          --
38 ------------------------------------------------------------------------------
39
40
41 with Ada.Strings.Maps;
42
43 package Ada.Strings.Fixed is
44 pragma Preelaborate (Fixed);
45
46    --------------------------------------------------------------
47    -- Copy Procedure for Strings of Possibly Different Lengths --
48    --------------------------------------------------------------
49
50    procedure Move
51      (Source  : in  String;
52       Target  : out String;
53       Drop    : in  Truncation := Error;
54       Justify : in  Alignment  := Left;
55       Pad     : in  Character  := Space);
56
57    ------------------------
58    -- Search Subprograms --
59    ------------------------
60
61    function Index
62      (Source   : in String;
63       Pattern  : in String;
64       Going    : in Direction := Forward;
65       Mapping  : in Maps.Character_Mapping := Maps.Identity)
66       return     Natural;
67
68    function Index
69      (Source   : in String;
70       Pattern  : in String;
71       Going    : in Direction := Forward;
72       Mapping  : in Maps.Character_Mapping_Function)
73       return     Natural;
74
75    function Index
76      (Source : in String;
77       Set    : in Maps.Character_Set;
78       Test   : in Membership := Inside;
79       Going  : in Direction  := Forward)
80       return   Natural;
81
82    function Index_Non_Blank
83      (Source : in String;
84       Going  : in Direction := Forward)
85       return   Natural;
86
87    function Count
88      (Source   : in String;
89       Pattern  : in String;
90       Mapping  : in Maps.Character_Mapping := Maps.Identity)
91       return     Natural;
92
93    function Count
94      (Source   : in String;
95       Pattern  : in String;
96       Mapping  : in Maps.Character_Mapping_Function)
97       return     Natural;
98
99    function Count
100      (Source   : in String;
101       Set      : in Maps.Character_Set)
102       return     Natural;
103
104    procedure Find_Token
105      (Source : in String;
106       Set    : in Maps.Character_Set;
107       Test   : in Membership;
108       First  : out Positive;
109       Last   : out Natural);
110
111    ------------------------------------
112    -- String Translation Subprograms --
113    ------------------------------------
114
115    function Translate
116      (Source  : in String;
117       Mapping : in Maps.Character_Mapping)
118       return    String;
119
120    procedure Translate
121      (Source  : in out String;
122       Mapping : in Maps.Character_Mapping);
123
124    function Translate
125      (Source  : in String;
126       Mapping : in Maps.Character_Mapping_Function)
127       return    String;
128
129    procedure Translate
130      (Source  : in out String;
131       Mapping : in Maps.Character_Mapping_Function);
132
133    ---------------------------------------
134    -- String Transformation Subprograms --
135    ---------------------------------------
136
137    function Replace_Slice
138      (Source : in String;
139       Low    : in Positive;
140       High   : in Natural;
141       By     : in String)
142       return   String;
143
144    procedure Replace_Slice
145      (Source  : in out String;
146       Low     : in Positive;
147       High    : in Natural;
148       By      : in String;
149       Drop    : in Truncation := Error;
150       Justify : in Alignment  := Left;
151       Pad     : in Character  := Space);
152
153    function Insert
154      (Source   : in String;
155       Before   : in Positive;
156       New_Item : in String)
157       return     String;
158
159    procedure Insert
160      (Source   : in out String;
161       Before   : in Positive;
162       New_Item : in String;
163       Drop     : in Truncation := Error);
164
165    function Overwrite
166      (Source   : in String;
167       Position : in Positive;
168       New_Item : in String)
169       return     String;
170
171    procedure Overwrite
172      (Source   : in out String;
173       Position : in Positive;
174       New_Item : in String;
175       Drop     : in Truncation := Right);
176
177    function Delete
178      (Source  : in String;
179       From    : in Positive;
180       Through : in Natural)
181       return    String;
182
183    procedure Delete
184      (Source  : in out String;
185       From    : in Positive;
186       Through : in Natural;
187       Justify : in Alignment := Left;
188       Pad     : in Character := Space);
189
190    ---------------------------------
191    -- String Selector Subprograms --
192    ---------------------------------
193
194    function Trim
195      (Source : in String;
196       Side   : in Trim_End)
197       return   String;
198
199    procedure Trim
200      (Source  : in out String;
201       Side    : in Trim_End;
202       Justify : in Alignment := Left;
203       Pad     : in Character := Space);
204
205    function Trim
206      (Source : in String;
207       Left   : in Maps.Character_Set;
208       Right  : in Maps.Character_Set)
209       return   String;
210
211    procedure Trim
212      (Source  : in out String;
213       Left    : in Maps.Character_Set;
214       Right   : in Maps.Character_Set;
215       Justify : in Alignment := Strings.Left;
216       Pad     : in Character := Space);
217
218    function Head
219      (Source : in String;
220       Count  : in Natural;
221       Pad    : in Character := Space)
222       return   String;
223
224    procedure Head
225      (Source  : in out String;
226       Count   : in Natural;
227       Justify : in Alignment := Left;
228       Pad     : in Character := Space);
229
230    function Tail
231      (Source : in String;
232       Count  : in Natural;
233       Pad    : in Character := Space)
234       return   String;
235
236    procedure Tail
237      (Source  : in out String;
238       Count   : in Natural;
239       Justify : in Alignment := Left;
240       Pad     : in Character := Space);
241
242    ----------------------------------
243    -- String Constructor Functions --
244    ----------------------------------
245
246    function "*"
247      (Left  : in Natural;
248       Right : in Character)
249       return  String;
250
251    function "*"
252      (Left  : in Natural;
253       Right : in String)
254       return  String;
255
256 end Ada.Strings.Fixed;