1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- S Y S T E M . W W D _ E N U M --
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 -- This package contains routines used for Enumeration_Type'Wide_[Wide_]Width
36 package System
.WWd_Enum
is
39 function Wide_Width_Enumeration_8
41 Indexes
: System
.Address
;
43 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
44 -- Used to compute Enum'Wide_Width where Enum is an enumeration subtype
45 -- other than those defined in package Standard. Names is a string with
46 -- a lower bound of 1 containing the characters of all the enumeration
47 -- literals concatenated together in sequence. Indexes is the address
48 -- of an array of type array (0 .. N) of Natural_8, where N is the
49 -- number of enumeration literals in the type. The Indexes values are
50 -- the starting subscript of each enumeration literal, indexed by Pos
51 -- values, with an extra entry at the end containing Names'Length + 1.
52 -- The reason that Indexes is passed by address is that the actual type
53 -- is created on the fly by the expander.
55 -- Lo and Hi are the Pos values of the lower and upper bounds of the
56 -- subtype. The result is the value of Width, i.e. the maximum value
57 -- of the length of any enumeration literal in the given range. The
58 -- fifth parameter, EM, is the wide character encoding method used in
61 function Wide_Width_Enumeration_16
63 Indexes
: System
.Address
;
65 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
66 -- Identical to Wide_Width_Enumeration_8 except that it handles types
67 -- using array (0 .. Num) of Natural_16 for the Indexes table.
69 function Wide_Width_Enumeration_32
71 Indexes
: System
.Address
;
73 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
74 -- Identical to Wide_Width_Enumeration_8 except that it handles types
75 -- using array (0 .. Num) of Natural_32 for the Indexes table.
77 function Wide_Wide_Width_Enumeration_8
79 Indexes
: System
.Address
;
81 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
82 -- Same function for Wide_Wide_Width attribute
84 function Wide_Wide_Width_Enumeration_16
86 Indexes
: System
.Address
;
88 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
89 -- Same function for Wide_Wide_Width attribute
91 function Wide_Wide_Width_Enumeration_32
93 Indexes
: System
.Address
;
95 EM
: System
.WCh_Con
.WC_Encoding_Method
) return Natural;
96 -- Same function for Wide_Wide_Width attribute