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