OSDN Git Service

2007-04-06 Vincent Celier <celier@adacore.com>
[pf3gnuchains/gcc-fork.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-2006 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 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
36      (S1 : String;
37       S2 : String := "";
38       S3 : String := "");
39    Do_Fail : Fail_Proc := Osint.Fail'Access;
40    --  Comment required ???
41
42    function Unit_Index_Of (ALI_File : File_Name_Type) return Int;
43    --  Find the index of a unit in a source file. Return zero if the file
44    --  is not a multi-unit source file.
45
46    function Executable_Prefix_Path return String;
47    --  Return the absolute path parent directory of the directory where the
48    --  current executable resides, if its directory is named "bin", otherwise
49    --  return an empty string.
50
51    function Is_External_Assignment (Argv : String) return Boolean;
52    --  Verify that an external assignment switch is syntactically correct
53    --
54    --  Correct forms are:
55    --
56    --      -Xname=value
57    --      -X"name=other value"
58    --
59    --  Assumptions: 'First = 1, Argv (1 .. 2) = "-X"
60    --  When this function returns True, the external assignment has
61    --  been entered by a call to Prj.Ext.Add, so that in a project
62    --  file, External ("name") will return "value".
63
64    function Linker_Options_Switches
65      (Project  : Project_Id;
66       In_Tree  : Project_Tree_Ref) return String_List;
67    --  Collect the options specified in the Linker'Linker_Options attributes
68    --  of project Project, in project tree In_Tree, and in the projects that
69    --  it imports directly or indirectly, and returns the result.
70
71    --  Package Mains is used to store the mains specified on the command line
72    --  and to retrieve them when a project file is used, to verify that the
73    --  files exist and that they belong to a project file.
74
75    package Mains is
76
77       --  Mains are stored in a table. An index is used to retrieve the mains
78       --  from the table.
79
80       procedure Add_Main (Name : String);
81       --  Add one main to the table
82
83       procedure Delete;
84       --  Empty the table
85
86       procedure Reset;
87       --  Reset the index to the beginning of the table
88
89       function Next_Main return String;
90       --  Increase the index and return the next main.
91       --  If table is exhausted, return an empty string.
92
93       function Number_Of_Mains return Natural;
94       --  Returns the number of mains added with Add_Main since the last call
95       --  to Delete.
96
97    end Mains;
98
99    procedure Test_If_Relative_Path
100      (Switch             : in out String_Access;
101       Parent             : String_Access;
102       Including_L_Switch : Boolean := True);
103    --  Test if Switch is a relative search path switch.
104    --  If it is, fail if Parent is null, otherwise prepend the path with
105    --  Parent. This subprogram is only called when using project files.
106    --  For gnatbind switches, Including_L_Switch is False, because the
107    --  argument of the -L switch is not a path.
108
109    ----------------------
110    -- Marking Routines --
111    ----------------------
112
113    procedure Mark (Source_File : File_Name_Type; Index : Int := 0);
114    --  Mark a unit, identified by its source file and, when Index is not 0,
115    --  the index of the unit in the source file. Marking is used to signal
116    --  that the unit has already been inserted in the Q.
117
118    function Is_Marked
119      (Source_File : File_Name_Type;
120       Index       : Int := 0) return Boolean;
121    --  Returns True if the unit was previously marked
122
123    procedure Delete_All_Marks;
124    --  Remove all file/index couples marked
125
126 end Makeutl;