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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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