OSDN Git Service

* config/vax/vax.h (target_flags, MASK_UNIX_ASM, MASK_VAXC_ALIGNMENT)
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-stwima.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --                A D A . S T R I N G S . W I D E _ M A P S                 --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2005 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,  59 Temple Place - Suite 330,  Boston, --
24 -- MA 02111-1307, 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 ------------------------------------------------------------------------------
37
38 with Ada.Finalization;
39
40 package Ada.Strings.Wide_Maps is
41    pragma Preelaborate (Wide_Maps);
42
43    -------------------------------------
44    -- Wide Character Set Declarations --
45    -------------------------------------
46
47    type Wide_Character_Set is private;
48    --  Representation for a set of Wide_Character values:
49
50    Null_Set : constant Wide_Character_Set;
51
52    ------------------------------------------
53    -- Constructors for Wide Character Sets --
54    ------------------------------------------
55
56    type Wide_Character_Range is record
57       Low  : Wide_Character;
58       High : Wide_Character;
59    end record;
60    --  Represents Wide_Character range Low .. High
61
62    type Wide_Character_Ranges is
63      array (Positive range <>) of Wide_Character_Range;
64
65    function To_Set
66      (Ranges : Wide_Character_Ranges) return Wide_Character_Set;
67
68    function To_Set
69      (Span : Wide_Character_Range) return Wide_Character_Set;
70
71    function To_Ranges
72      (Set :  in Wide_Character_Set) return Wide_Character_Ranges;
73
74    ---------------------------------------
75    -- Operations on Wide Character Sets --
76    ---------------------------------------
77
78    function "=" (Left, Right : in Wide_Character_Set) return Boolean;
79
80    function "not"
81      (Right : Wide_Character_Set) return Wide_Character_Set;
82
83    function "and"
84      (Left, Right : Wide_Character_Set) return Wide_Character_Set;
85
86    function "or"
87      (Left, Right : Wide_Character_Set) return Wide_Character_Set;
88
89    function "xor"
90      (Left, Right : Wide_Character_Set) return Wide_Character_Set;
91
92    function "-"
93      (Left, Right : Wide_Character_Set) return Wide_Character_Set;
94
95    function Is_In
96      (Element : Wide_Character;
97       Set     : Wide_Character_Set) return Boolean;
98
99    function Is_Subset
100      (Elements : Wide_Character_Set;
101       Set      : Wide_Character_Set) return Boolean;
102
103    function "<="
104      (Left  : Wide_Character_Set;
105       Right : Wide_Character_Set) return Boolean
106    renames Is_Subset;
107
108    subtype Wide_Character_Sequence is Wide_String;
109    --  Alternative representation for a set of character values
110
111    function To_Set
112      (Sequence : Wide_Character_Sequence) return Wide_Character_Set;
113
114    function To_Set
115      (Singleton : Wide_Character) return Wide_Character_Set;
116
117    function To_Sequence
118      (Set : Wide_Character_Set) return Wide_Character_Sequence;
119
120    -----------------------------------------
121    -- Wide Character Mapping Declarations --
122    -----------------------------------------
123
124    type Wide_Character_Mapping is private;
125    --  Representation for a wide character to wide character mapping:
126
127    function Value
128      (Map     : Wide_Character_Mapping;
129       Element : Wide_Character) return Wide_Character;
130
131    Identity : constant Wide_Character_Mapping;
132
133    ---------------------------------
134    -- Operations on Wide Mappings --
135    ---------------------------------
136
137    function To_Mapping
138      (From, To : Wide_Character_Sequence) return Wide_Character_Mapping;
139
140    function To_Domain
141      (Map : Wide_Character_Mapping) return Wide_Character_Sequence;
142
143    function To_Range
144      (Map : Wide_Character_Mapping) return Wide_Character_Sequence;
145
146    type Wide_Character_Mapping_Function is
147       access function (From : Wide_Character) return Wide_Character;
148
149 private
150    package AF renames Ada.Finalization;
151
152    ------------------------------------------
153    -- Representation of Wide_Character_Set --
154    ------------------------------------------
155
156    --  A wide character set is represented as a sequence of wide character
157    --  ranges (i.e. an object of type Wide_Character_Ranges) in which the
158    --  following hold:
159
160    --    The lower bound is 1
161    --    The ranges are in order by increasing Low values
162    --    The ranges are non-overlapping and discontigous
163
164    --  A character value is in the set if it is contained in one of the
165    --  ranges. The actual Wide_Character_Set value is a controlled pointer
166    --  to this Wide_Character_Ranges value. The use of a controlled type
167    --  is necessary to prevent storage leaks.
168
169    type Wide_Character_Ranges_Access is access all Wide_Character_Ranges;
170
171    type Wide_Character_Set is new AF.Controlled with record
172       Set : Wide_Character_Ranges_Access;
173    end record;
174
175    pragma Finalize_Storage_Only (Wide_Character_Set);
176    --  This avoids useless finalizations, and, more importantly avoids
177    --  incorrect attempts to finalize constants that are statically
178    --  declared here and in Ada.Strings.Wide_Maps, which is incorrect.
179
180    procedure Initialize (Object : in out Wide_Character_Set);
181    procedure Adjust     (Object : in out Wide_Character_Set);
182    procedure Finalize   (Object : in out Wide_Character_Set);
183
184    Null_Range : aliased constant Wide_Character_Ranges :=
185                   (1 .. 0 => (Low => ' ', High => ' '));
186
187    Null_Set : constant Wide_Character_Set :=
188                 (AF.Controlled with
189                  Set => Null_Range'Unrestricted_Access);
190
191    ----------------------------------------------
192    -- Representation of Wide_Character_Mapping --
193    ----------------------------------------------
194
195    --  A wide character mapping is represented as two strings of equal
196    --  length, where any character appearing in Domain is mapped to the
197    --  corresponding character in Rangev. A character not appearing in
198    --  Domain is mapped to itself. The characters in Domain are sorted
199    --  in ascending order.
200
201    --  The actual Wide_Character_Mapping value is a controlled record
202    --  that contains a pointer to a discriminated record containing the
203    --  range and domain values.
204
205    --  Note: this representation is canonical, and the values stored in
206    --  Domain and Rangev are exactly the values that are returned by the
207    --  functions To_Domain and To_Range. The use of a controlled type is
208    --  necessary to prevent storage leaks.
209
210    type Wide_Character_Mapping_Values (Length : Natural) is record
211       Domain : Wide_Character_Sequence (1 .. Length);
212       Rangev : Wide_Character_Sequence (1 .. Length);
213    end record;
214
215    type Wide_Character_Mapping_Values_Access is
216      access all Wide_Character_Mapping_Values;
217
218    type Wide_Character_Mapping is new AF.Controlled with record
219       Map : Wide_Character_Mapping_Values_Access;
220    end record;
221
222    pragma Finalize_Storage_Only (Wide_Character_Mapping);
223    --  This avoids useless finalizations, and, more importantly avoids
224    --  incorrect attempts to finalize constants that are statically
225    --  declared here and in Ada.Strings.Wide_Maps, which is incorrect.
226
227    procedure Initialize (Object : in out Wide_Character_Mapping);
228    procedure Adjust     (Object : in out Wide_Character_Mapping);
229    procedure Finalize   (Object : in out Wide_Character_Mapping);
230
231    Null_Map : aliased constant Wide_Character_Mapping_Values :=
232                  (Length => 0,
233                   Domain => "",
234                   Rangev => "");
235
236    Identity : constant Wide_Character_Mapping :=
237                 (AF.Controlled with
238                  Map => Null_Map'Unrestricted_Access);
239
240 end Ada.Strings.Wide_Maps;