]>
Commit | Line | Data |
---|---|---|
6510f4c9 GB |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
5 | -- F M A P -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 2001-2020, Free Software Foundation, Inc. -- |
6510f4c9 GB |
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- -- | |
b5c84c3c | 13 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
6510f4c9 GB |
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 -- | |
b5c84c3c RD |
18 | -- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
19 | -- http://www.gnu.org/licenses for a complete copy of the license. -- | |
6510f4c9 GB |
20 | -- -- |
21 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
71ff80dc | 22 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
6510f4c9 GB |
23 | -- -- |
24 | ------------------------------------------------------------------------------ | |
25 | ||
26 | -- This package keeps two mappings: from unit names to file names, | |
27 | -- and from file names to path names. | |
9763f8c8 AC |
28 | -- |
29 | -- This mapping is used to communicate between the builder (gnatmake or | |
30 | -- gprbuild) and the compiler. The format of this mapping file is the | |
31 | -- following: | |
32 | -- For each source file, there are three lines in the mapping file: | |
33 | -- Unit name with %b or %s added depending on whether it is a body or a spec | |
1d24fc5e | 34 | -- This line is omitted for file-based languages |
9763f8c8 AC |
35 | -- File name |
36 | -- Path name (set to '/' if the file should be ignored in fact, ie for | |
37 | -- a Locally_Removed_File in a project) | |
6510f4c9 | 38 | |
39f4e199 | 39 | with Namet; use Namet; |
6510f4c9 GB |
40 | |
41 | package Fmap is | |
42 | ||
43 | procedure Initialize (File_Name : String); | |
44 | -- Initialize the mappings from the mapping file File_Name. | |
0f96fd14 | 45 | -- If the mapping file is incorrect (nonexistent file, truncated file, |
6510f4c9 | 46 | -- duplicate entries), output a warning and do not initialize the mappings. |
07fc65c4 GB |
47 | -- Record the state of the mapping tables in case Update is called |
48 | -- later on. | |
6510f4c9 | 49 | |
17c5c8a5 | 50 | function Mapped_Path_Name (File : File_Name_Type) return File_Name_Type; |
6510f4c9 GB |
51 | -- Return the path name mapped to the file name File. |
52 | -- Return No_File if File is not mapped. | |
53 | ||
17c5c8a5 | 54 | function Mapped_File_Name (Unit : Unit_Name_Type) return File_Name_Type; |
6510f4c9 GB |
55 | -- Return the file name mapped to the unit name Unit. |
56 | -- Return No_File if Unit is not mapped. | |
fbf5a39b | 57 | -- Return Error_Name if it is forbidden. |
6510f4c9 | 58 | |
17c5c8a5 | 59 | procedure Add_To_File_Map |
6510f4c9 GB |
60 | (Unit_Name : Unit_Name_Type; |
61 | File_Name : File_Name_Type; | |
62 | Path_Name : File_Name_Type); | |
63 | -- Add mapping of Unit_Name to File_Name and of File_Name to Path_Name | |
64 | ||
07fc65c4 GB |
65 | procedure Update_Mapping_File (File_Name : String); |
66 | -- If Add_To_File_Map has been called (after Initialize or any time | |
67 | -- if Initialize has not been called), append the new entries to the | |
fbf5a39b AC |
68 | -- mapping file whose file name is File_Name. |
69 | ||
70 | procedure Reset_Tables; | |
71 | -- Initialize all the internal data structures. This procedure is used | |
72 | -- when several compilations are performed by the same process (by GNSA | |
73 | -- for ASIS, for example) to remove any existing mappings from a previous | |
74 | -- compilation. | |
75 | ||
39f4e199 | 76 | procedure Add_Forbidden_File_Name (Name : File_Name_Type); |
5b900a45 AC |
77 | -- Indicate that a source file name is forbidden. This is used when there |
78 | -- are excluded sources in projects (attributes Excluded_Source_Files or | |
79 | -- Locally_Removed_Files). | |
07fc65c4 | 80 | |
6510f4c9 | 81 | end Fmap; |