1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2003 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 -- This package implements services for Project-aware tools, related
28 -- to the environment (gnat.adc, ADA_INCLUDE_PATH, ADA_OBJECTS_PATH)
30 with GNAT.OS_Lib; use GNAT.OS_Lib;
35 -- Put Standard_Naming_Data into Namings table (called by Prj.Initialize)
37 procedure Print_Sources;
38 -- Output the list of sources, after Project files have been scanned
40 procedure Create_Mapping_File
41 (Project : Project_Id;
43 -- Create a temporary mapping file for project Project. For each unit
44 -- in the closure of immediate sources of Project, put the mapping of
45 -- its spec and or body to its file name and path name in this file.
47 procedure Set_Mapping_File_Initial_State_To_Empty;
48 -- When creating a mapping file, create an empty map. This case occurs
49 -- when run time source files are found in the project files.
51 procedure Create_Config_Pragmas_File
52 (For_Project : Project_Id;
53 Main_Project : Project_Id;
54 Include_Config_Files : Boolean := True);
55 -- If there needs to have SFN pragmas, either for non standard naming
56 -- schemes or for individual units, or (when Include_Config_Files is True)
57 -- if Global_Configuration_Pragmas has been specified in package gnatmake
58 -- of the main project, or if Local_Configuration_Pragmas has been
59 -- specified in package Compiler of the main project, build (if needed)
60 -- a temporary file that contains all configuration pragmas, and specify
61 -- the configuration pragmas file in the project data.
63 function Ada_Include_Path (Project : Project_Id) return String_Access;
64 -- Get the ADA_INCLUDE_PATH of a Project file. For the first call, compute
67 function Ada_Include_Path
68 (Project : Project_Id;
71 -- Get the ADA_INCLUDE_PATH of a Project file. If Recursive it True,
72 -- get all the source directories of the imported and modified project
73 -- files (recursively). If Recursive is False, just get the path for the
74 -- source directories of Project. Note: the resulting String may be empty
75 -- if there is no source directory in the project file.
77 function Ada_Objects_Path
78 (Project : Project_Id;
79 Including_Libraries : Boolean := True)
81 -- Get the ADA_OBJECTS_PATH of a Project file. For the first call, compute
82 -- it and cache it. When Including_Libraries is False, do not include the
83 -- object directories of the library projects, and do not cache the result.
85 procedure Set_Ada_Paths
86 (Project : Project_Id;
87 Including_Libraries : Boolean);
88 -- Set the env vars for additional project path files, after
89 -- creating if necessary the path files.
91 procedure Delete_All_Path_Files;
92 -- Delete all temporary path files that have been created by
93 -- calls to Set_Ada_Paths.
95 function Path_Name_Of_Library_Unit_Body
99 -- Returns the Path of a library unit.
101 function File_Name_Of_Library_Unit_Body
103 Project : Project_Id;
104 Main_Project_Only : Boolean := True)
106 -- Returns the file name of a library unit, in canonical case. Name may or
107 -- may not have an extension (corresponding to the naming scheme of the
108 -- project). If there is no body with this name, but there is a spec, the
109 -- name of the spec is returned. If neither a body or a spec can be found,
110 -- return an empty string.
111 -- If Main_Project_Only is True, the unit must be an immediate source of
112 -- Project. If it is False, it may be a source of one of its imported
115 procedure Get_Reference
116 (Source_File_Name : String;
117 Project : out Project_Id;
119 -- Returns the project of a source and its path in displayable form
122 with procedure Action (Path : String);
123 procedure For_All_Source_Dirs (Project : Project_Id);
124 -- Iterate through all the source directories of a project,
125 -- including those of imported or modified projects.
128 with procedure Action (Path : String);
129 procedure For_All_Object_Dirs (Project : Project_Id);
130 -- Iterate through all the object directories of a project,
131 -- including those of imported or modified projects.