Fix DealII type problems.
[official-gcc/Ramakrishna.git] / gcc / ada / a-wichun.ads
blobaf61453806778a26743f95703e0b0537a25b5c7b
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . W I D E _ C H A R A C T E R S . U N I C O D E --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2005-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 ------------------------------------------------------------------------------
32 -- Unicode categorization routines for Wide_Character. Note that this
33 -- package is strictly speaking Ada 2005 (since it is a child of an
34 -- Ada 2005 unit), but we make it available in Ada 95 mode, since it
35 -- only deals with wide characters.
37 with System.UTF_32;
39 package Ada.Wide_Characters.Unicode is
41 -- The following type defines the categories from the unicode definitions.
42 -- The one addition we make is Fe, which represents the characters FFFE
43 -- and FFFF in any of the planes.
45 type Category is new System.UTF_32.Category;
46 -- Cc Other, Control
47 -- Cf Other, Format
48 -- Cn Other, Not Assigned
49 -- Co Other, Private Use
50 -- Cs Other, Surrogate
51 -- Ll Letter, Lowercase
52 -- Lm Letter, Modifier
53 -- Lo Letter, Other
54 -- Lt Letter, Titlecase
55 -- Lu Letter, Uppercase
56 -- Mc Mark, Spacing Combining
57 -- Me Mark, Enclosing
58 -- Mn Mark, Nonspacing
59 -- Nd Number, Decimal Digit
60 -- Nl Number, Letter
61 -- No Number, Other
62 -- Pc Punctuation, Connector
63 -- Pd Punctuation, Dash
64 -- Pe Punctuation, Close
65 -- Pf Punctuation, Final quote
66 -- Pi Punctuation, Initial quote
67 -- Po Punctuation, Other
68 -- Ps Punctuation, Open
69 -- Sc Symbol, Currency
70 -- Sk Symbol, Modifier
71 -- Sm Symbol, Math
72 -- So Symbol, Other
73 -- Zl Separator, Line
74 -- Zp Separator, Paragraph
75 -- Zs Separator, Space
76 -- Fe relative position FFFE/FFFF in plane
78 function Get_Category (U : Wide_Character) return Category;
79 pragma Inline (Get_Category);
80 -- Given a Wide_Character, returns corresponding Category, or Cn if the
81 -- code does not have an assigned unicode category.
83 -- The following functions perform category tests corresponding to lexical
84 -- classes defined in the Ada standard. There are two interfaces for each
85 -- function. The second takes a Category (e.g. returned by Get_Category).
86 -- The first takes a Wide_Character. The form taking the Wide_Character is
87 -- typically more efficient than calling Get_Category, but if several
88 -- different tests are to be performed on the same code, it is more
89 -- efficient to use Get_Category to get the category, then test the
90 -- resulting category.
92 function Is_Letter (U : Wide_Character) return Boolean;
93 function Is_Letter (C : Category) return Boolean;
94 pragma Inline (Is_Letter);
95 -- Returns true iff U is a letter that can be used to start an identifier,
96 -- or if C is one of the corresponding categories, which are the following:
97 -- Letter, Uppercase (Lu)
98 -- Letter, Lowercase (Ll)
99 -- Letter, Titlecase (Lt)
100 -- Letter, Modifier (Lm)
101 -- Letter, Other (Lo)
102 -- Number, Letter (Nl)
104 function Is_Digit (U : Wide_Character) return Boolean;
105 function Is_Digit (C : Category) return Boolean;
106 pragma Inline (Is_Digit);
107 -- Returns true iff U is a digit that can be used to extend an identifer,
108 -- or if C is one of the corresponding categories, which are the following:
109 -- Number, Decimal_Digit (Nd)
111 function Is_Line_Terminator (U : Wide_Character) return Boolean;
112 pragma Inline (Is_Line_Terminator);
113 -- Returns true iff U is an allowed line terminator for source programs,
114 -- if U is in the category Zp (Separator, Paragaph), or Zs (Separator,
115 -- Line), or if U is a conventional line terminator (CR, LF, VT, FF).
116 -- There is no category version for this function, since the set of
117 -- characters does not correspond to a set of Unicode categories.
119 function Is_Mark (U : Wide_Character) return Boolean;
120 function Is_Mark (C : Category) return Boolean;
121 pragma Inline (Is_Mark);
122 -- Returns true iff U is a mark character which can be used to extend an
123 -- identifier, or if C is one of the corresponding categories, which are
124 -- the following:
125 -- Mark, Non-Spacing (Mn)
126 -- Mark, Spacing Combining (Mc)
128 function Is_Other (U : Wide_Character) return Boolean;
129 function Is_Other (C : Category) return Boolean;
130 pragma Inline (Is_Other);
131 -- Returns true iff U is an other format character, which means that it
132 -- can be used to extend an identifier, but is ignored for the purposes of
133 -- matching of identiers, or if C is one of the corresponding categories,
134 -- which are the following:
135 -- Other, Format (Cf)
137 function Is_Punctuation (U : Wide_Character) return Boolean;
138 function Is_Punctuation (C : Category) return Boolean;
139 pragma Inline (Is_Punctuation);
140 -- Returns true iff U is a punctuation character that can be used to
141 -- separate pices of an identifier, or if C is one of the corresponding
142 -- categories, which are the following:
143 -- Punctuation, Connector (Pc)
145 function Is_Space (U : Wide_Character) return Boolean;
146 function Is_Space (C : Category) return Boolean;
147 pragma Inline (Is_Space);
148 -- Returns true iff U is considered a space to be ignored, or if C is one
149 -- of the corresponding categories, which are the following:
150 -- Separator, Space (Zs)
152 function Is_Non_Graphic (U : Wide_Character) return Boolean;
153 function Is_Non_Graphic (C : Category) return Boolean;
154 pragma Inline (Is_Non_Graphic);
155 -- Returns true iff U is considered to be a non-graphic character, or if C
156 -- is one of the corresponding categories, which are the following:
157 -- Other, Control (Cc)
158 -- Other, Private Use (Co)
159 -- Other, Surrogate (Cs)
160 -- Separator, Line (Zl)
161 -- Separator, Paragraph (Zp)
162 -- FFFE or FFFF positions in any plane (Fe)
164 -- Note that the Ada category format effector is subsumed by the above
165 -- list of Unicode categories.
167 -- Note that Other, Unassiged (Cn) is quite deliberately not included
168 -- in the list of categories above. This means that should any of these
169 -- code positions be defined in future with graphic characters they will
170 -- be allowed without a need to change implementations or the standard.
172 -- Note that Other, Format (Cf) is also quite deliberately not included
173 -- in the list of categories above. This means that these characters can
174 -- be included in character and string literals.
176 -- The following function is used to fold to upper case, as required by
177 -- the Ada 2005 standard rules for identifier case folding. Two
178 -- identifiers are equivalent if they are identical after folding all
179 -- letters to upper case using this routine.
181 function To_Upper_Case (U : Wide_Character) return Wide_Character;
182 pragma Inline (To_Upper_Case);
183 -- If U represents a lower case letter, returns the corresponding upper
184 -- case letter, otherwise U is returned unchanged. The folding is locale
185 -- independent as defined by documents referenced in the note in section
186 -- 1 of ISO/IEC 10646:2003
188 end Ada.Wide_Characters.Unicode;