Reverting merge from trunk
[official-gcc.git] / gcc / ada / a-wichha.adb
blob6692cbf445ffe932a2e1c63d1b009c8d27636a80
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 . H A N D L I N G --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2010-2013, 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 with Ada.Wide_Characters.Unicode; use Ada.Wide_Characters.Unicode;
34 package body Ada.Wide_Characters.Handling is
36 function Character_Set_Version return String is
37 begin
38 return "Unicode 6.2";
39 end Character_Set_Version;
41 ---------------------
42 -- Is_Alphanumeric --
43 ---------------------
45 function Is_Alphanumeric (Item : Wide_Character) return Boolean is
46 begin
47 return Is_Letter (Item) or else Is_Digit (Item);
48 end Is_Alphanumeric;
50 ----------------
51 -- Is_Control --
52 ----------------
54 function Is_Control (Item : Wide_Character) return Boolean is
55 begin
56 return Get_Category (Item) = Cc;
57 end Is_Control;
59 --------------
60 -- Is_Digit --
61 --------------
63 function Is_Digit (Item : Wide_Character) return Boolean
64 renames Ada.Wide_Characters.Unicode.Is_Digit;
66 ----------------
67 -- Is_Graphic --
68 ----------------
70 function Is_Graphic (Item : Wide_Character) return Boolean is
71 begin
72 return not Is_Non_Graphic (Item);
73 end Is_Graphic;
75 --------------------------
76 -- Is_Hexadecimal_Digit --
77 --------------------------
79 function Is_Hexadecimal_Digit (Item : Wide_Character) return Boolean is
80 begin
81 return Is_Digit (Item)
82 or else Item in 'A' .. 'F'
83 or else Item in 'a' .. 'f';
84 end Is_Hexadecimal_Digit;
86 ---------------
87 -- Is_Letter --
88 ---------------
90 function Is_Letter (Item : Wide_Character) return Boolean
91 renames Ada.Wide_Characters.Unicode.Is_Letter;
93 ------------------------
94 -- Is_Line_Terminator --
95 ------------------------
97 function Is_Line_Terminator (Item : Wide_Character) return Boolean
98 renames Ada.Wide_Characters.Unicode.Is_Line_Terminator;
100 --------------
101 -- Is_Lower --
102 --------------
104 function Is_Lower (Item : Wide_Character) return Boolean is
105 begin
106 return Get_Category (Item) = Ll;
107 end Is_Lower;
109 -------------
110 -- Is_Mark --
111 -------------
113 function Is_Mark (Item : Wide_Character) return Boolean
114 renames Ada.Wide_Characters.Unicode.Is_Mark;
116 ---------------------
117 -- Is_Other_Format --
118 ---------------------
120 function Is_Other_Format (Item : Wide_Character) return Boolean
121 renames Ada.Wide_Characters.Unicode.Is_Other;
123 ------------------------------
124 -- Is_Punctuation_Connector --
125 ------------------------------
127 function Is_Punctuation_Connector (Item : Wide_Character) return Boolean
128 renames Ada.Wide_Characters.Unicode.Is_Punctuation;
130 --------------
131 -- Is_Space --
132 --------------
134 function Is_Space (Item : Wide_Character) return Boolean
135 renames Ada.Wide_Characters.Unicode.Is_Space;
137 ----------------
138 -- Is_Special --
139 ----------------
141 function Is_Special (Item : Wide_Character) return Boolean is
142 begin
143 return Is_Graphic (Item) and then not Is_Alphanumeric (Item);
144 end Is_Special;
146 --------------
147 -- Is_Upper --
148 --------------
150 function Is_Upper (Item : Wide_Character) return Boolean is
151 begin
152 return Get_Category (Item) = Lu;
153 end Is_Upper;
155 --------------
156 -- To_Lower --
157 --------------
159 function To_Lower (Item : Wide_Character) return Wide_Character
160 renames Ada.Wide_Characters.Unicode.To_Lower_Case;
162 function To_Lower (Item : Wide_String) return Wide_String is
163 Result : Wide_String (Item'Range);
165 begin
166 for J in Result'Range loop
167 Result (J) := To_Lower (Item (J));
168 end loop;
170 return Result;
171 end To_Lower;
173 --------------
174 -- To_Upper --
175 --------------
177 function To_Upper (Item : Wide_Character) return Wide_Character
178 renames Ada.Wide_Characters.Unicode.To_Upper_Case;
180 function To_Upper (Item : Wide_String) return Wide_String is
181 Result : Wide_String (Item'Range);
183 begin
184 for J in Result'Range loop
185 Result (J) := To_Upper (Item (J));
186 end loop;
188 return Result;
189 end To_Upper;
191 end Ada.Wide_Characters.Handling;