111
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT COMPILER COMPONENTS --
|
|
4 -- --
|
|
5 -- F M A P --
|
|
6 -- --
|
|
7 -- S p e c --
|
|
8 -- --
|
131
|
9 -- Copyright (C) 2001-2018, Free Software Foundation, Inc. --
|
111
|
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 3, 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 COPYING3. If not, go to --
|
|
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
|
|
20 -- --
|
|
21 -- GNAT was originally developed by the GNAT team at New York University. --
|
|
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
23 -- --
|
|
24 ------------------------------------------------------------------------------
|
|
25
|
|
26 -- This package keeps two mappings: from unit names to file names,
|
|
27 -- and from file names to path names.
|
|
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
|
|
34 -- This line is omitted for file-based languages
|
|
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)
|
|
38
|
|
39 with Namet; use Namet;
|
|
40
|
|
41 package Fmap is
|
|
42
|
|
43 procedure Initialize (File_Name : String);
|
|
44 -- Initialize the mappings from the mapping file File_Name.
|
|
45 -- If the mapping file is incorrect (nonexistent file, truncated file,
|
|
46 -- duplicate entries), output a warning and do not initialize the mappings.
|
|
47 -- Record the state of the mapping tables in case Update is called
|
|
48 -- later on.
|
|
49
|
|
50 function Mapped_Path_Name (File : File_Name_Type) return File_Name_Type;
|
|
51 -- Return the path name mapped to the file name File.
|
|
52 -- Return No_File if File is not mapped.
|
|
53
|
|
54 function Mapped_File_Name (Unit : Unit_Name_Type) return File_Name_Type;
|
|
55 -- Return the file name mapped to the unit name Unit.
|
|
56 -- Return No_File if Unit is not mapped.
|
|
57 -- Return Error_Name if it is forbidden.
|
|
58
|
|
59 procedure Add_To_File_Map
|
|
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
|
|
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
|
|
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
|
|
76 procedure Add_Forbidden_File_Name (Name : File_Name_Type);
|
|
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).
|
|
80
|
|
81 end Fmap;
|