]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/makeutl.ads
make.adb (Collect_Arguments): Call Test_If_Relative_Path with Including_Non_Switch...
[thirdparty/gcc.git] / gcc / ada / makeutl.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- M A K E U T L --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2004-2007, 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, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, 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 with Namet; use Namet;
28 with Osint;
29 with Prj; use Prj;
30 with Types; use Types;
31
32 with GNAT.OS_Lib; use GNAT.OS_Lib;
33
34 package Makeutl is
35
36 type Fail_Proc is access procedure
37 (S1 : String;
38 S2 : String := "";
39 S3 : String := "");
40 Do_Fail : Fail_Proc := Osint.Fail'Access;
41 -- Failing procedure called from procedure Test_If_Relative_Path below.
42 -- May be redirected.
43
44 Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data;
45 -- The project tree
46
47 Main_Config_Project : Project_Id;
48 -- The project id of the main configuration project
49
50 procedure Add
51 (Option : String_Access;
52 To : in out String_List_Access;
53 Last : in out Natural);
54 procedure Add
55 (Option : String;
56 To : in out String_List_Access;
57 Last : in out Natural);
58 -- Add a string to a list of strings
59
60 function Create_Name (Name : String) return File_Name_Type;
61 function Create_Name (Name : String) return Name_Id;
62 function Create_Name (Name : String) return Path_Name_Type;
63 -- Get the Name_Id of a name
64
65 function Executable_Prefix_Path return String;
66 -- Return the absolute path parent directory of the directory where the
67 -- current executable resides, if its directory is named "bin", otherwise
68 -- return an empty string.
69
70 procedure Inform (N : Name_Id := No_Name; Msg : String);
71 procedure Inform (N : File_Name_Type; Msg : String);
72 -- Prints out the program name followed by a colon, N and S
73
74 function Is_External_Assignment (Argv : String) return Boolean;
75 -- Verify that an external assignment switch is syntactically correct
76 --
77 -- Correct forms are:
78 --
79 -- -Xname=value
80 -- -X"name=other value"
81 --
82 -- Assumptions: 'First = 1, Argv (1 .. 2) = "-X"
83 -- When this function returns True, the external assignment has
84 -- been entered by a call to Prj.Ext.Add, so that in a project
85 -- file, External ("name") will return "value".
86
87 function Linker_Options_Switches
88 (Project : Project_Id;
89 In_Tree : Project_Tree_Ref) return String_List;
90 -- Collect the options specified in the Linker'Linker_Options attributes
91 -- of project Project, in project tree In_Tree, and in the projects that
92 -- it imports directly or indirectly, and returns the result.
93
94 -- Package Mains is used to store the mains specified on the command line
95 -- and to retrieve them when a project file is used, to verify that the
96 -- files exist and that they belong to a project file.
97
98 function Unit_Index_Of (ALI_File : File_Name_Type) return Int;
99 -- Find the index of a unit in a source file. Return zero if the file
100 -- is not a multi-unit source file.
101
102 package Mains is
103
104 -- Mains are stored in a table. An index is used to retrieve the mains
105 -- from the table.
106
107 procedure Add_Main (Name : String);
108 -- Add one main to the table
109
110 procedure Delete;
111 -- Empty the table
112
113 procedure Reset;
114 -- Reset the index to the beginning of the table
115
116 function Next_Main return String;
117 -- Increase the index and return the next main.
118 -- If table is exhausted, return an empty string.
119
120 function Number_Of_Mains return Natural;
121 -- Returns the number of mains added with Add_Main since the last call
122 -- to Delete.
123
124 end Mains;
125
126 procedure Test_If_Relative_Path
127 (Switch : in out String_Access;
128 Parent : String_Access;
129 Including_L_Switch : Boolean := True;
130 Including_Non_Switch : Boolean := True);
131 -- Test if Switch is a relative search path switch.
132 -- If it is, fail if Parent is null, otherwise prepend the path with
133 -- Parent. This subprogram is only called when using project files.
134 -- For gnatbind switches, Including_L_Switch is False, because the
135 -- argument of the -L switch is not a path.
136
137 ----------------------
138 -- Marking Routines --
139 ----------------------
140
141 procedure Mark (Source_File : File_Name_Type; Index : Int := 0);
142 -- Mark a unit, identified by its source file and, when Index is not 0,
143 -- the index of the unit in the source file. Marking is used to signal
144 -- that the unit has already been inserted in the Q.
145
146 function Is_Marked
147 (Source_File : File_Name_Type;
148 Index : Int := 0) return Boolean;
149 -- Returns True if the unit was previously marked
150
151 procedure Delete_All_Marks;
152 -- Remove all file/index couples marked
153
154 end Makeutl;