1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- S Y S T E M . W W D _ W C H A R --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Interfaces; use Interfaces;
36 package body System.Wwd_WChar is
38 ------------------------------------
39 -- Wide_Wide_Width_Wide_Character --
40 ------------------------------------
42 -- This is the case where we are talking about the Wide_Wide_Image of
43 -- a Wide_Character, which is always the same character sequence as the
44 -- Wide_Image of the same Wide_Character.
46 function Wide_Wide_Width_Wide_Character
47 (Lo, Hi : Wide_Character) return Natural
50 return Wide_Width_Wide_Character (Lo, Hi);
51 end Wide_Wide_Width_Wide_Character;
53 ------------------------------------
54 -- Wide_Wide_Width_Wide_Wide_Char --
55 ------------------------------------
57 function Wide_Wide_Width_Wide_Wide_Char
58 (Lo, Hi : Wide_Wide_Character) return Natural
60 LV : constant Unsigned_32 := Wide_Wide_Character'Pos (Lo);
61 HV : constant Unsigned_32 := Wide_Wide_Character'Pos (Hi);
64 -- Return zero if empty range
69 -- Return max value (12) for wide character (Hex_hhhhhhhh)
74 -- If any characters in normal character range, then use normal
75 -- Wide_Wide_Width attribute on this range to find out a starting point.
76 -- Otherwise start with zero.
80 System.WWd_Char.Wide_Wide_Width_Character
81 (Lo => Character'Val (LV),
82 Hi => Character'Val (Unsigned_32'Min (255, HV)));
84 end Wide_Wide_Width_Wide_Wide_Char;
86 -------------------------------
87 -- Wide_Width_Wide_Character --
88 -------------------------------
90 function Wide_Width_Wide_Character
91 (Lo, Hi : Wide_Character) return Natural
93 LV : constant Unsigned_32 := Wide_Character'Pos (Lo);
94 HV : constant Unsigned_32 := Wide_Character'Pos (Hi);
97 -- Return zero if empty range
102 -- Return max value (12) for wide character (Hex_hhhhhhhh)
107 -- If any characters in normal character range, then use normal
108 -- Wide_Wide_Width attribute on this range to find out a starting point.
109 -- Otherwise start with zero.
113 System.WWd_Char.Wide_Width_Character
114 (Lo => Character'Val (LV),
115 Hi => Character'Val (Unsigned_32'Min (255, HV)));
117 end Wide_Width_Wide_Character;
119 ------------------------------------
120 -- Wide_Width_Wide_Wide_Character --
121 ------------------------------------
123 function Wide_Width_Wide_Wide_Character
124 (Lo, Hi : Wide_Wide_Character) return Natural
127 return Wide_Wide_Width_Wide_Wide_Char (Lo, Hi);
128 end Wide_Width_Wide_Wide_Character;
130 end System.Wwd_WChar;