Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/s-valenu.ads @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 ------------------------------------------------------------------------------ | |
2 -- -- | |
3 -- GNAT COMPILER COMPONENTS -- | |
4 -- -- | |
5 -- S Y S T E M . V A L _ E N U M -- | |
6 -- -- | |
7 -- S p e c -- | |
8 -- -- | |
9 -- Copyright (C) 1992-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 ------------------------------------------------------------------------------ | |
31 | |
32 -- This package is used to compute the Value attribute for enumeration types | |
33 -- other than those in packages Standard and System. See unit Exp_Imgv for | |
34 -- details of the format of constructed image tables. | |
35 | |
36 package System.Val_Enum is | |
37 pragma Pure; | |
38 | |
39 function Value_Enumeration_8 | |
40 (Names : String; | |
41 Indexes : System.Address; | |
42 Num : Natural; | |
43 Str : String) | |
44 return Natural; | |
45 -- Used to compute Enum'Value (Str) where Enum is some enumeration type | |
46 -- other than those defined in package Standard. Names is a string with | |
47 -- a lower bound of 1 containing the characters of all the enumeration | |
48 -- literals concatenated together in sequence. Indexes is the address | |
49 -- of an array of type array (0 .. N) of Natural_8, where N is the | |
50 -- number of enumeration literals in the type. The Indexes values are | |
51 -- the starting subscript of each enumeration literal, indexed by Pos | |
52 -- values, with an extra entry at the end containing Names'Length + 1. | |
53 -- The parameter Num is the value N - 1 (i.e. Enum'Pos (Enum'Last)). | |
54 -- The reason that Indexes is passed by address is that the actual type | |
55 -- is created on the fly by the expander. | |
56 -- | |
57 -- Str is the argument of the attribute function, and may have leading | |
58 -- and trailing spaces, and letters can be upper or lower case or mixed. | |
59 -- If the image is found in Names, then the corresponding Pos value is | |
60 -- returned. If not, Constraint_Error is raised. | |
61 | |
62 function Value_Enumeration_16 | |
63 (Names : String; | |
64 Indexes : System.Address; | |
65 Num : Natural; | |
66 Str : String) | |
67 return Natural; | |
68 -- Identical to Value_Enumeration_8 except that it handles types | |
69 -- using array (0 .. Num) of Natural_16 for the Indexes table. | |
70 | |
71 function Value_Enumeration_32 | |
72 (Names : String; | |
73 Indexes : System.Address; | |
74 Num : Natural; | |
75 Str : String) | |
76 return Natural; | |
77 -- Identical to Value_Enumeration_8 except that it handles types | |
78 -- using array (0 .. Num) of Natural_32 for the Indexes table. | |
79 | |
80 end System.Val_Enum; |