OSDN Git Service

2004-05-05 Emmanuel Briot <briot@act-europe.fr>
[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 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, 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 GNAT.OS_Lib; use GNAT.OS_Lib;
28 with Osint;
29 with Prj;         use Prj;
30 with Types;       use Types;
31
32 package Makeutl is
33
34    type Fail_Proc is access procedure
35      (S1 : String; S2 : String := ""; S3 : String := "");
36    Do_Fail : Fail_Proc := Osint.Fail'Access;
37
38    function Unit_Index_Of (ALI_File : File_Name_Type) return Int;
39    --  Find the index of a unit in a source file. Return zero if the file
40    --  is not a multi-unit source file.
41
42    function Is_External_Assignment (Argv : String) return Boolean;
43    --  Verify that an external assignment switch is syntactically correct.
44    --  Correct forms are
45    --      -Xname=value
46    --      -X"name=other value"
47    --  Assumptions: 'First = 1, Argv (1 .. 2) = "-X"
48    --  When this function returns True, the external assignment has
49    --  been entered by a call to Prj.Ext.Add, so that in a project
50    --  file, External ("name") will return "value".
51
52    --  Package Mains is used to store the mains specified on the command line
53    --  and to retrieve them when a project file is used, to verify that the
54    --  files exist and that they belong to a project file.
55
56    function Linker_Options_Switches (Project  : Project_Id) return String_List;
57
58    package Mains is
59
60       --  Mains are stored in a table. An index is used to retrieve the mains
61       --  from the table.
62
63       procedure Add_Main (Name : String);
64       --  Add one main to the table
65
66       procedure Delete;
67       --  Empty the table
68
69       procedure Reset;
70       --  Reset the index to the beginning of the table
71
72       function Next_Main return String;
73       --  Increase the index and return the next main.
74       --  If table is exhausted, return an empty string.
75
76       function Number_Of_Mains return Natural;
77       --  Returns the number of mains added with Add_Main since the last call
78       --  to Delete.
79
80    end Mains;
81
82    procedure Test_If_Relative_Path
83      (Switch             : in out String_Access;
84       Parent             : String_Access;
85       Including_L_Switch : Boolean := True);
86    --  Test if Switch is a relative search path switch.
87    --  If it is, fail if Parent is null, otherwise prepend the path with
88    --  Parent. This subprogram is only called when using project files.
89    --  For gnatbind switches, Including_L_Switch is False, because the
90    --  argument of the -L switch is not a path.
91
92    ----------------------
93    -- Marking Routines --
94    ----------------------
95
96    procedure Mark (Source_File : File_Name_Type; Index : Int := 0);
97    --  Mark a unit, identified by its source file and, when Index is not 0,
98    --  the index of the unit in the source file. Marking is used to signal
99    --  that the unit has already been inserted in the Q.
100
101    function Is_Marked
102      (Source_File : File_Name_Type;
103       Index       : Int := 0)
104       return Boolean;
105    --  Returns True if the unit was previously marked.
106
107    procedure Delete_All_Marks;
108    --  Remove all file/index couples marked
109
110 end Makeutl;