* gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
[official-gcc.git] / gcc / ada / libgnat / a-wichha.adb
blobcd124f056976dec44f672eacd505e866eaa3a660
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-2017, 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 ---------------------------
37 -- Character_Set_Version --
38 ---------------------------
40 function Character_Set_Version return String is
41 begin
42 return "Unicode 4.0";
43 end Character_Set_Version;
45 ---------------------
46 -- Is_Alphanumeric --
47 ---------------------
49 function Is_Alphanumeric (Item : Wide_Character) return Boolean is
50 begin
51 return Is_Letter (Item) or else Is_Digit (Item);
52 end Is_Alphanumeric;
54 ----------------
55 -- Is_Control --
56 ----------------
58 function Is_Control (Item : Wide_Character) return Boolean is
59 begin
60 return Get_Category (Item) = Cc;
61 end Is_Control;
63 --------------
64 -- Is_Digit --
65 --------------
67 function Is_Digit (Item : Wide_Character) return Boolean
68 renames Ada.Wide_Characters.Unicode.Is_Digit;
70 ----------------
71 -- Is_Graphic --
72 ----------------
74 function Is_Graphic (Item : Wide_Character) return Boolean is
75 begin
76 return not Is_Non_Graphic (Item);
77 end Is_Graphic;
79 --------------------------
80 -- Is_Hexadecimal_Digit --
81 --------------------------
83 function Is_Hexadecimal_Digit (Item : Wide_Character) return Boolean is
84 begin
85 return Is_Digit (Item)
86 or else Item in 'A' .. 'F'
87 or else Item in 'a' .. 'f';
88 end Is_Hexadecimal_Digit;
90 ---------------
91 -- Is_Letter --
92 ---------------
94 function Is_Letter (Item : Wide_Character) return Boolean
95 renames Ada.Wide_Characters.Unicode.Is_Letter;
97 ------------------------
98 -- Is_Line_Terminator --
99 ------------------------
101 function Is_Line_Terminator (Item : Wide_Character) return Boolean
102 renames Ada.Wide_Characters.Unicode.Is_Line_Terminator;
104 --------------
105 -- Is_Lower --
106 --------------
108 function Is_Lower (Item : Wide_Character) return Boolean is
109 begin
110 return Get_Category (Item) = Ll;
111 end Is_Lower;
113 -------------
114 -- Is_Mark --
115 -------------
117 function Is_Mark (Item : Wide_Character) return Boolean
118 renames Ada.Wide_Characters.Unicode.Is_Mark;
120 ---------------------
121 -- Is_Other_Format --
122 ---------------------
124 function Is_Other_Format (Item : Wide_Character) return Boolean
125 renames Ada.Wide_Characters.Unicode.Is_Other;
127 ------------------------------
128 -- Is_Punctuation_Connector --
129 ------------------------------
131 function Is_Punctuation_Connector (Item : Wide_Character) return Boolean
132 renames Ada.Wide_Characters.Unicode.Is_Punctuation;
134 --------------
135 -- Is_Space --
136 --------------
138 function Is_Space (Item : Wide_Character) return Boolean
139 renames Ada.Wide_Characters.Unicode.Is_Space;
141 ----------------
142 -- Is_Special --
143 ----------------
145 function Is_Special (Item : Wide_Character) return Boolean is
146 begin
147 return Is_Graphic (Item) and then not Is_Alphanumeric (Item);
148 end Is_Special;
150 --------------
151 -- Is_Upper --
152 --------------
154 function Is_Upper (Item : Wide_Character) return Boolean is
155 begin
156 return Get_Category (Item) = Lu;
157 end Is_Upper;
159 --------------
160 -- To_Lower --
161 --------------
163 function To_Lower (Item : Wide_Character) return Wide_Character
164 renames Ada.Wide_Characters.Unicode.To_Lower_Case;
166 function To_Lower (Item : Wide_String) return Wide_String is
167 Result : Wide_String (Item'Range);
169 begin
170 for J in Result'Range loop
171 Result (J) := To_Lower (Item (J));
172 end loop;
174 return Result;
175 end To_Lower;
177 --------------
178 -- To_Upper --
179 --------------
181 function To_Upper (Item : Wide_Character) return Wide_Character
182 renames Ada.Wide_Characters.Unicode.To_Upper_Case;
184 function To_Upper (Item : Wide_String) return Wide_String is
185 Result : Wide_String (Item'Range);
187 begin
188 for J in Result'Range loop
189 Result (J) := To_Upper (Item (J));
190 end loop;
192 return Result;
193 end To_Upper;
195 end Ada.Wide_Characters.Handling;