PR ada/18819
[official-gcc.git] / gcc / ada / a-wichun.adb
blobf0ca9e093fe09f02b4ea7aa916ad56900f2059cb
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 T S . U N I C O D E --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2005, 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 package body Ada.Wide_Characters.Unicode is
36 package G renames GNAT.UTF_32;
38 ------------------
39 -- Get_Category --
40 ------------------
42 function Get_Category (U : Wide_Character) return Category is
43 begin
44 return Category (G.Get_Category (Wide_Character'Pos (U)));
45 end Get_Category;
47 --------------
48 -- Is_Digit --
49 --------------
51 function Is_Digit (U : Wide_Character) return Boolean is
52 begin
53 return G.Is_UTF_32_Digit (Wide_Character'Pos (U));
54 end Is_Digit;
56 function Is_Digit (C : Category) return Boolean is
57 begin
58 return G.Is_UTF_32_Digit (G.Category (C));
59 end Is_Digit;
61 ---------------
62 -- Is_Letter --
63 ---------------
65 function Is_Letter (U : Wide_Character) return Boolean is
66 begin
67 return G.Is_UTF_32_Letter (Wide_Character'Pos (U));
68 end Is_Letter;
70 function Is_Letter (C : Category) return Boolean is
71 begin
72 return G.Is_UTF_32_Letter (G.Category (C));
73 end Is_Letter;
75 ------------------------
76 -- Is_Line_Terminator --
77 ------------------------
79 function Is_Line_Terminator (U : Wide_Character) return Boolean is
80 begin
81 return G.Is_UTF_32_Line_Terminator (Wide_Character'Pos (U));
82 end Is_Line_Terminator;
84 -------------
85 -- Is_Mark --
86 -------------
88 function Is_Mark (U : Wide_Character) return Boolean is
89 begin
90 return G.Is_UTF_32_Mark (Wide_Character'Pos (U));
91 end Is_Mark;
93 function Is_Mark (C : Category) return Boolean is
94 begin
95 return G.Is_UTF_32_Mark (G.Category (C));
96 end Is_Mark;
98 --------------------
99 -- Is_Non_Graphic --
100 --------------------
102 function Is_Non_Graphic (U : Wide_Character) return Boolean is
103 begin
104 return G.Is_UTF_32_Non_Graphic (Wide_Character'Pos (U));
105 end Is_Non_Graphic;
107 function Is_Non_Graphic (C : Category) return Boolean is
108 begin
109 return G.Is_UTF_32_Non_Graphic (G.Category (C));
110 end Is_Non_Graphic;
112 --------------
113 -- Is_Other --
114 --------------
116 function Is_Other (U : Wide_Character) return Boolean is
117 begin
118 return G.Is_UTF_32_Other (Wide_Character'Pos (U));
119 end Is_Other;
121 function Is_Other (C : Category) return Boolean is
122 begin
123 return G.Is_UTF_32_Other (G.Category (C));
124 end Is_Other;
126 --------------------
127 -- Is_Punctuation --
128 --------------------
130 function Is_Punctuation (U : Wide_Character) return Boolean is
131 begin
132 return G.Is_UTF_32_Punctuation (Wide_Character'Pos (U));
133 end Is_Punctuation;
135 function Is_Punctuation (C : Category) return Boolean is
136 begin
137 return G.Is_UTF_32_Punctuation (G.Category (C));
138 end Is_Punctuation;
140 --------------
141 -- Is_Space --
142 --------------
144 function Is_Space (U : Wide_Character) return Boolean is
145 begin
146 return G.Is_UTF_32_Space (Wide_Character'Pos (U));
147 end Is_Space;
149 function Is_Space (C : Category) return Boolean is
150 begin
151 return G.Is_UTF_32_Space (G.Category (C));
152 end Is_Space;
154 -------------------
155 -- To_Upper_Case --
156 -------------------
158 function To_Upper_Case
159 (U : Wide_Character) return Wide_Character
161 begin
162 return
163 Wide_Character'Val
164 (G.UTF_32_To_Upper_Case (Wide_Character'Pos (U)));
165 end To_Upper_Case;
167 end Ada.Wide_Characters.Unicode;