1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2000-2004 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 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. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- The following package declares data types for GNAT project.
28 -- These data types are used in the bodies of the Prj hierarchy.
33 with Types
; use Types
;
37 -- At one point, this package was private.
38 -- It cannot be private, because it is used outside of
41 type Fail_Proc
is access procedure
42 (S1
: String; S2
: String := ""; S3
: String := "");
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.
50 Tool_Name
: Name_Id
:= No_Name
;
52 Current_Verbosity
: Verbosity
:= Default
;
55 (Specification
, Body_Part
);
57 type File_Name_Data
is record
58 Name
: Name_Id
:= No_Name
;
60 Display_Name
: Name_Id
:= No_Name
;
61 Path
: Name_Id
:= No_Name
;
62 Display_Path
: Name_Id
:= No_Name
;
63 Project
: Project_Id
:= No_Project
;
64 Needs_Pragma
: Boolean := False;
66 -- File and Path name of a spec or body.
68 type File_Names_Data
is array (Spec_Or_Body
) of File_Name_Data
;
70 type Unit_Id
is new Nat
;
71 No_Unit
: constant Unit_Id
:= 0;
72 type Unit_Data
is record
73 Name
: Name_Id
:= No_Name
;
74 File_Names
: File_Names_Data
;
76 -- File and Path names of a unit, with a reference to its
79 package Units
is new Table
.Table
80 (Table_Component_Type
=> Unit_Data
,
81 Table_Index_Type
=> Unit_Id
,
84 Table_Increment
=> 100,
85 Table_Name
=> "Prj.Com.Units");
87 type Header_Num
is range 0 .. 2047;
89 function Hash
is new GNAT
.HTable
.Hash
(Header_Num
=> Header_Num
);
91 function Hash
(Name
: Name_Id
) return Header_Num
;
93 function Hash
(Name
: String_Id
) return Header_Num
;
95 package Units_Htable
is new GNAT
.HTable
.Simple_HTable
96 (Header_Num
=> Header_Num
,
98 No_Element
=> No_Unit
,
102 -- Mapping of unit names to indexes in the Units table
104 type Unit_Project
is record
105 Unit
: Unit_Id
:= No_Unit
;
106 Project
: Project_Id
:= No_Project
;
109 No_Unit_Project
: constant Unit_Project
:= (No_Unit
, No_Project
);
111 package Files_Htable
is new GNAT
.HTable
.Simple_HTable
112 (Header_Num
=> Header_Num
,
113 Element
=> Unit_Project
,
114 No_Element
=> No_Unit_Project
,
118 -- Mapping of file names to indexes in the Units table