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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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