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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [ada/] [a-zchuni.ads] - Blame information for rev 826

Details | Compare with Previous | View Log

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