OSDN Git Service

2004-04-08 Joel Sherrill <joel@oarcorp.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-com.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              P R J . C O M                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 2000-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 --  The following package declares data types for GNAT project.
28 --  These data types are used in the bodies of the Prj hierarchy.
29
30 with GNAT.HTable;
31 with Osint;
32 with Table;
33 with Types; use Types;
34
35 package Prj.Com is
36
37    --  At one point, this package was private.
38    --  It cannot be private, because it is used outside of
39    --  the Prj hierarchy.
40
41    type Fail_Proc is access procedure
42      (S1 : String; S2 : String := ""; S3 : String := "");
43
44    Fail : Fail_Proc := Osint.Fail'Access;
45    --  This procedure is used in the project facility, instead of
46    --  directly calling Osint.Fail.
47    --  It may be specified by tools to do clean up before calling
48    --  Osint.Fail, or to simply report an error and return.
49
50    Tool_Name : Name_Id := No_Name;
51
52    Current_Verbosity : Verbosity := Default;
53
54    type Spec_Or_Body is
55      (Specification, Body_Part);
56
57    type File_Name_Data is record
58       Name         : Name_Id := No_Name;
59       Display_Name : Name_Id := No_Name;
60       Path         : Name_Id := No_Name;
61       Display_Path : Name_Id := No_Name;
62       Project      : Project_Id := No_Project;
63       Needs_Pragma : Boolean := False;
64    end record;
65    --  File and Path name of a spec or body.
66
67    type File_Names_Data is array (Spec_Or_Body) of File_Name_Data;
68
69    type Unit_Id is new Nat;
70    No_Unit : constant Unit_Id := 0;
71    type Unit_Data is record
72       Name       : Name_Id    := No_Name;
73       File_Names : File_Names_Data;
74    end record;
75    --  File and Path names of a unit, with a reference to its
76    --  GNAT Project File.
77
78    package Units is new Table.Table
79      (Table_Component_Type => Unit_Data,
80       Table_Index_Type     => Unit_Id,
81       Table_Low_Bound      => 1,
82       Table_Initial        => 100,
83       Table_Increment      => 100,
84       Table_Name           => "Prj.Com.Units");
85
86    type Header_Num is range 0 .. 2047;
87
88    function Hash is new GNAT.HTable.Hash (Header_Num => Header_Num);
89
90    function Hash (Name : Name_Id) return Header_Num;
91
92    function Hash (Name : String_Id) return Header_Num;
93
94    package Units_Htable is new GNAT.HTable.Simple_HTable
95      (Header_Num => Header_Num,
96       Element    => Unit_Id,
97       No_Element => No_Unit,
98       Key        => Name_Id,
99       Hash       => Hash,
100       Equal      => "=");
101    --  Mapping of unit names to indexes in the Units table
102
103    type Unit_Project is record
104       Unit    : Unit_Id    := No_Unit;
105       Project : Project_Id := No_Project;
106    end record;
107
108    No_Unit_Project : constant Unit_Project := (No_Unit, No_Project);
109
110    package Files_Htable is new GNAT.HTable.Simple_HTable
111      (Header_Num => Header_Num,
112       Element    => Unit_Project,
113       No_Element => No_Unit_Project,
114       Key        => Name_Id,
115       Hash       => Hash,
116       Equal      => "=");
117    --  Mapping of file names to indexes in the Units table
118
119 end Prj.Com;