OSDN Git Service

optimize
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-attr.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             P R J . A T T R                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --             Copyright (C) 2001-2004 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package defines allowed packages and attributes in GNAT project files
28
29 with Types; use Types;
30 with Table;
31
32 package Prj.Attr is
33
34    --  Define the allowed attributes
35
36    --  All these declarations are uncommented, they all need comments ???
37
38    Attributes_Initial   : constant := 50;
39    Attributes_Increment : constant := 50;
40
41    Attribute_Node_Low_Bound  : constant := 0;
42    Attribute_Node_High_Bound : constant := 099_999_999;
43
44    type Attribute_Node_Id is
45      range Attribute_Node_Low_Bound .. Attribute_Node_High_Bound;
46
47    First_Attribute_Node_Id : constant Attribute_Node_Id :=
48                                Attribute_Node_Low_Bound + 1;
49
50    Empty_Attribute : constant Attribute_Node_Id :=
51                        Attribute_Node_Low_Bound;
52
53    type Attribute_Kind is
54      (Single,
55       Associative_Array,
56       Optional_Index_Associative_Array,
57       Case_Insensitive_Associative_Array,
58       Optional_Index_Case_Insensitive_Associative_Array);
59
60    type Attribute_Record is record
61       Name           : Name_Id;
62       Kind_1         : Variable_Kind;
63       Optional_Index : Boolean;
64       Kind_2         : Attribute_Kind;
65       Next           : Attribute_Node_Id;
66    end record;
67
68    package Attributes is
69       new Table.Table (Table_Component_Type => Attribute_Record,
70                        Table_Index_Type     => Attribute_Node_Id,
71                        Table_Low_Bound      => First_Attribute_Node_Id,
72                        Table_Initial        => Attributes_Initial,
73                        Table_Increment      => Attributes_Increment,
74                        Table_Name           => "Prj.Attr.Attributes");
75
76    Attribute_First : constant Attribute_Node_Id := First_Attribute_Node_Id;
77
78    --  Define the allowed packages
79
80    Packages_Initial   : constant := 10;
81    Packages_Increment : constant := 50;
82
83    Package_Node_Low_Bound  : constant := 0;
84    Package_Node_High_Bound : constant := 099_999_999;
85
86    type Package_Node_Id is
87      range Package_Node_Low_Bound .. Package_Node_High_Bound;
88
89    First_Package_Node_Id : constant Package_Node_Id :=
90                              Package_Node_Low_Bound + 1;
91
92    Empty_Package : constant Package_Node_Id := Package_Node_Low_Bound;
93
94    type Package_Record is record
95       Name            : Name_Id;
96       First_Attribute : Attribute_Node_Id;
97    end record;
98
99    package Package_Attributes is
100       new Table.Table (Table_Component_Type => Package_Record,
101                        Table_Index_Type     => Package_Node_Id,
102                        Table_Low_Bound      => First_Package_Node_Id,
103                        Table_Initial        => Packages_Initial,
104                        Table_Increment      => Packages_Increment,
105                        Table_Name           => "Prj.Attr.Packages");
106
107    Package_First : constant Package_Node_Id := First_Package_Node_Id;
108
109    procedure Initialize;
110    --  Initialize the two tables above (Attributes and Package_Attributes).
111    --  This procedure should be called by Prj.Initialize.
112
113 end Prj.Attr;