OSDN Git Service

2005-06-15 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-env.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              P R J . E N V                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --             Copyright (C) 2001-2005 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 implements services for Project-aware tools, mostly related
28 --  to the environment (configuration pragma files, path files, mapping files).
29
30 with GNAT.OS_Lib; use GNAT.OS_Lib;
31
32 package Prj.Env is
33
34    procedure Initialize;
35    --  Called by Prj.Initialize to perform required initialization steps for
36    --  this package.
37
38    procedure Print_Sources (In_Tree : Project_Tree_Ref);
39    --  Output the list of sources, after Project files have been scanned
40
41    procedure Create_Mapping_File
42      (Project : Project_Id;
43       In_Tree : Project_Tree_Ref;
44       Name    : out Name_Id);
45    --  Create a temporary mapping file for project Project. For each unit
46    --  in the closure of immediate sources of Project, put the mapping of
47    --  its spec and or body to its file name and path name in this file.
48
49    procedure Set_Mapping_File_Initial_State_To_Empty;
50    --  When creating a mapping file, create an empty map. This case occurs
51    --  when run time source files are found in the project files.
52
53    procedure Create_Config_Pragmas_File
54      (For_Project          : Project_Id;
55       Main_Project         : Project_Id;
56       In_Tree              : Project_Tree_Ref;
57       Include_Config_Files : Boolean := True);
58    --  If there needs to have SFN pragmas, either for non standard naming
59    --  schemes or for individual units, or (when Include_Config_Files is True)
60    --  if Global_Configuration_Pragmas has been specified in package gnatmake
61    --  of the main project, or if Local_Configuration_Pragmas has been
62    --  specified in package Compiler of the main project, build (if needed)
63    --  a temporary file that contains all configuration pragmas, and specify
64    --  the configuration pragmas file in the project data.
65
66    function Ada_Include_Path
67      (Project : Project_Id;
68       In_Tree : Project_Tree_Ref) return String_Access;
69    --  Get the ADA_INCLUDE_PATH of a Project file. For the first call, compute
70    --  it and cache it.
71
72    function Ada_Include_Path
73      (Project   : Project_Id;
74       In_Tree   : Project_Tree_Ref;
75       Recursive : Boolean) return String;
76    --  Get the ADA_INCLUDE_PATH of a Project file. If Recursive it True,
77    --  get all the source directories of the imported and modified project
78    --  files (recursively). If Recursive is False, just get the path for the
79    --  source directories of Project. Note: the resulting String may be empty
80    --  if there is no source directory in the project file.
81
82    function Ada_Objects_Path
83      (Project             : Project_Id;
84       In_Tree             : Project_Tree_Ref;
85       Including_Libraries : Boolean := True) return String_Access;
86    --  Get the ADA_OBJECTS_PATH of a Project file. For the first call, compute
87    --  it and cache it. When Including_Libraries is False, do not include the
88    --  object directories of the library projects, and do not cache the result.
89
90    procedure Set_Ada_Paths
91      (Project             : Project_Id;
92       In_Tree             : Project_Tree_Ref;
93       Including_Libraries : Boolean);
94    --  Set the env vars for additional project path files, after
95    --  creating the path files if necessary.
96
97    procedure Delete_All_Path_Files (In_Tree : Project_Tree_Ref);
98    --  Delete all temporary path files that have been created by
99    --  calls to Set_Ada_Paths.
100
101    function Path_Name_Of_Library_Unit_Body
102      (Name    : String;
103       Project : Project_Id;
104       In_Tree : Project_Tree_Ref) return String;
105    --  Returns the Path of a library unit
106
107    function File_Name_Of_Library_Unit_Body
108      (Name              : String;
109       Project           : Project_Id;
110       In_Tree           : Project_Tree_Ref;
111       Main_Project_Only : Boolean := True;
112       Full_Path         : Boolean := False) return String;
113    --  Returns the file name of a library unit, in canonical case. Name may or
114    --  may not have an extension (corresponding to the naming scheme of the
115    --  project). If there is no body with this name, but there is a spec, the
116    --  name of the spec is returned.
117    --
118    --  If Full_Path is False (the default), the simple file name is returned.
119    --
120    --  If Full_Path is True, the absolute path name is returned.
121    --
122    --  If neither a body nor a spec can be found, an empty string is returned.
123    --  If Main_Project_Only is True, the unit must be an immediate source of
124    --  Project. If it is False, it may be a source of one of its imported
125    --  projects.
126
127    function Project_Of
128      (Name         : String;
129       Main_Project : Project_Id;
130       In_Tree      : Project_Tree_Ref) return Project_Id;
131    --  Get the project of a source. The source file name may be truncated
132    --  (".adb" or ".ads" may be missing). If the source is in a project being
133    --  extended, return the ultimate extending project. If it is not a source
134    --  of any project, return No_Project.
135
136    procedure Get_Reference
137      (Source_File_Name : String;
138       In_Tree          : Project_Tree_Ref;
139       Project          : out Project_Id;
140       Path             : out Name_Id);
141    --  Returns the project of a source and its path in displayable form
142
143    generic
144       with procedure Action (Path : String);
145    procedure For_All_Source_Dirs
146      (Project : Project_Id;
147       In_Tree : Project_Tree_Ref);
148    --  Iterate through all the source directories of a project, including
149    --  those of imported or modified projects.
150
151    generic
152       with procedure Action (Path : String);
153    procedure For_All_Object_Dirs
154      (Project : Project_Id;
155       In_Tree : Project_Tree_Ref);
156    --  Iterate through all the object directories of a project, including
157    --  those of imported or modified projects.
158
159 end Prj.Env;