]>
Commit | Line | Data |
---|---|---|
19235870 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
5 | -- P R J -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
fbf5a39b | 9 | -- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- |
19235870 RK |
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. -- | |
71ff80dc | 23 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
19235870 RK |
24 | -- -- |
25 | ------------------------------------------------------------------------------ | |
26 | ||
27 | -- The following package declares the data types for GNAT project. | |
28 | -- These data types may be used by GNAT Project-aware tools. | |
29 | ||
30 | -- Children of these package implements various services on these data types. | |
31 | -- See in particular Prj.Pars and Prj.Env. | |
32 | ||
fbf5a39b AC |
33 | with Casing; use Casing; |
34 | with Scans; use Scans; | |
19235870 | 35 | with Table; |
fbf5a39b AC |
36 | with Types; use Types; |
37 | ||
38 | with GNAT.OS_Lib; use GNAT.OS_Lib; | |
19235870 RK |
39 | |
40 | package Prj is | |
41 | ||
fbf5a39b AC |
42 | Empty_Name : Name_Id; |
43 | -- Name_Id for an empty name (no characters). | |
44 | -- Initialized by procedure Initialize. | |
45 | ||
46 | All_Packages : constant String_List_Access := null; | |
47 | -- Default value of parameter Packages of procedures Parse, in Prj.Pars and | |
48 | -- Prj.Part, indicating that all packages should be checked. | |
49 | ||
07fc65c4 GB |
50 | Project_File_Extension : String := ".gpr"; |
51 | -- The standard project file name extension. | |
52 | -- It is not a constant, because Canonical_Case_File_Name is called | |
53 | -- on this variable in the body of Prj. | |
54 | ||
79503fdd | 55 | Default_Ada_Spec_Suffix : Name_Id; |
b1085d2d GB |
56 | -- The Name_Id for the standard GNAT suffix for Ada spec source file |
57 | -- name ".ads". Initialized by Prj.Initialize. | |
58 | ||
fbf5a39b | 59 | Default_Ada_Body_Suffix : Name_Id; |
b1085d2d GB |
60 | -- The Name_Id for the standard GNAT suffix for Ada body source file |
61 | -- name ".adb". Initialized by Prj.Initialize. | |
62 | ||
fbf5a39b AC |
63 | Slash : Name_Id; |
64 | -- "/", used as the path of locally removed files | |
65 | ||
19235870 | 66 | type Verbosity is (Default, Medium, High); |
6663c393 RD |
67 | -- Verbosity when parsing GNAT Project Files |
68 | -- Default is default (very quiet, if no errors). | |
69 | -- Medium is more verbose. | |
70 | -- High is extremely verbose. | |
19235870 RK |
71 | |
72 | type Lib_Kind is (Static, Dynamic, Relocatable); | |
73 | ||
fbf5a39b | 74 | function Empty_String return Name_Id; |
19235870 RK |
75 | |
76 | type String_List_Id is new Nat; | |
77 | Nil_String : constant String_List_Id := 0; | |
78 | type String_Element is record | |
fbf5a39b AC |
79 | Value : Name_Id := No_Name; |
80 | Display_Value : Name_Id := No_Name; | |
19235870 | 81 | Location : Source_Ptr := No_Location; |
fbf5a39b | 82 | Flag : Boolean := False; |
19235870 RK |
83 | Next : String_List_Id := Nil_String; |
84 | end record; | |
fbf5a39b AC |
85 | -- To hold values for string list variables and array elements. |
86 | -- Component Flag may be used for various purposes. For source | |
87 | -- directories, it indicates if the directory contains Ada source(s). | |
19235870 RK |
88 | |
89 | package String_Elements is new Table.Table | |
90 | (Table_Component_Type => String_Element, | |
91 | Table_Index_Type => String_List_Id, | |
92 | Table_Low_Bound => 1, | |
93 | Table_Initial => 200, | |
94 | Table_Increment => 100, | |
95 | Table_Name => "Prj.String_Elements"); | |
6663c393 | 96 | -- The table for string elements in string lists |
19235870 RK |
97 | |
98 | type Variable_Kind is (Undefined, List, Single); | |
99 | -- Different kinds of variables | |
100 | ||
fbf5a39b AC |
101 | Ignored : constant Variable_Kind := Single; |
102 | -- Used to indicate that a package declaration must be ignored | |
103 | -- while processing the project tree (unknown package name). | |
104 | ||
19235870 RK |
105 | type Variable_Value (Kind : Variable_Kind := Undefined) is record |
106 | Location : Source_Ptr := No_Location; | |
107 | Default : Boolean := False; | |
108 | case Kind is | |
109 | when Undefined => | |
110 | null; | |
111 | when List => | |
112 | Values : String_List_Id := Nil_String; | |
113 | when Single => | |
fbf5a39b | 114 | Value : Name_Id := No_Name; |
19235870 RK |
115 | end case; |
116 | end record; | |
7fb754a1 GB |
117 | -- Values for variables and array elements. |
118 | -- Default is True if the current value is the default one for the variable | |
19235870 RK |
119 | |
120 | Nil_Variable_Value : constant Variable_Value := | |
121 | (Kind => Undefined, | |
122 | Location => No_Location, | |
123 | Default => False); | |
6663c393 | 124 | -- Value of a non existing variable or array element |
19235870 RK |
125 | |
126 | type Variable_Id is new Nat; | |
127 | No_Variable : constant Variable_Id := 0; | |
128 | type Variable is record | |
129 | Next : Variable_Id := No_Variable; | |
130 | Name : Name_Id; | |
131 | Value : Variable_Value; | |
132 | end record; | |
6663c393 | 133 | -- To hold the list of variables in a project file and in packages |
19235870 RK |
134 | |
135 | package Variable_Elements is new Table.Table | |
136 | (Table_Component_Type => Variable, | |
137 | Table_Index_Type => Variable_Id, | |
138 | Table_Low_Bound => 1, | |
139 | Table_Initial => 200, | |
140 | Table_Increment => 100, | |
141 | Table_Name => "Prj.Variable_Elements"); | |
6663c393 | 142 | -- The table of variable in list of variables |
19235870 RK |
143 | |
144 | type Array_Element_Id is new Nat; | |
145 | No_Array_Element : constant Array_Element_Id := 0; | |
146 | type Array_Element is record | |
fbf5a39b AC |
147 | Index : Name_Id; |
148 | Index_Case_Sensitive : Boolean := True; | |
149 | Value : Variable_Value; | |
150 | Next : Array_Element_Id := No_Array_Element; | |
19235870 | 151 | end record; |
6663c393 RD |
152 | -- Each Array_Element represents an array element and is linked (Next) |
153 | -- to the next array element, if any, in the array. | |
19235870 RK |
154 | |
155 | package Array_Elements is new Table.Table | |
156 | (Table_Component_Type => Array_Element, | |
157 | Table_Index_Type => Array_Element_Id, | |
158 | Table_Low_Bound => 1, | |
159 | Table_Initial => 200, | |
160 | Table_Increment => 100, | |
161 | Table_Name => "Prj.Array_Elements"); | |
162 | -- The table that contains all array elements | |
163 | ||
164 | type Array_Id is new Nat; | |
165 | No_Array : constant Array_Id := 0; | |
166 | type Array_Data is record | |
167 | Name : Name_Id := No_Name; | |
168 | Value : Array_Element_Id := No_Array_Element; | |
169 | Next : Array_Id := No_Array; | |
170 | end record; | |
6663c393 | 171 | -- Each Array_Data value represents an array. |
19235870 RK |
172 | -- Value is the id of the first element. |
173 | -- Next is the id of the next array in the project file or package. | |
174 | ||
175 | package Arrays is new Table.Table | |
176 | (Table_Component_Type => Array_Data, | |
177 | Table_Index_Type => Array_Id, | |
178 | Table_Low_Bound => 1, | |
179 | Table_Initial => 200, | |
180 | Table_Increment => 100, | |
181 | Table_Name => "Prj.Arrays"); | |
182 | -- The table that contains all arrays | |
183 | ||
184 | type Package_Id is new Nat; | |
185 | No_Package : constant Package_Id := 0; | |
186 | type Declarations is record | |
187 | Variables : Variable_Id := No_Variable; | |
188 | Attributes : Variable_Id := No_Variable; | |
189 | Arrays : Array_Id := No_Array; | |
190 | Packages : Package_Id := No_Package; | |
191 | end record; | |
192 | ||
193 | No_Declarations : constant Declarations := | |
194 | (Variables => No_Variable, | |
195 | Attributes => No_Variable, | |
196 | Arrays => No_Array, | |
197 | Packages => No_Package); | |
6663c393 | 198 | -- Declarations. Used in project structures and packages (what for???) |
19235870 RK |
199 | |
200 | type Package_Element is record | |
201 | Name : Name_Id := No_Name; | |
202 | Decl : Declarations := No_Declarations; | |
203 | Parent : Package_Id := No_Package; | |
204 | Next : Package_Id := No_Package; | |
205 | end record; | |
6663c393 | 206 | -- A package. Includes declarations that may include other packages. |
19235870 RK |
207 | |
208 | package Packages is new Table.Table | |
209 | (Table_Component_Type => Package_Element, | |
210 | Table_Index_Type => Package_Id, | |
211 | Table_Low_Bound => 1, | |
212 | Table_Initial => 100, | |
213 | Table_Increment => 100, | |
214 | Table_Name => "Prj.Packages"); | |
215 | -- The table that contains all packages. | |
216 | ||
217 | function Image (Casing : Casing_Type) return String; | |
6663c393 | 218 | -- Similar to 'Image (but avoid use of this attribute in compiler) |
19235870 RK |
219 | |
220 | function Value (Image : String) return Casing_Type; | |
6663c393 | 221 | -- Similar to 'Value (but avoid use of this attribute in compiler) |
19235870 RK |
222 | -- Raises Constraint_Error if not a Casing_Type image. |
223 | ||
fbf5a39b AC |
224 | -- The following record contains data for a naming scheme |
225 | ||
19235870 | 226 | type Naming_Data is record |
6663c393 | 227 | Current_Language : Name_Id := No_Name; |
b30668b7 | 228 | -- The programming language being currently considered |
19235870 | 229 | |
6663c393 | 230 | Dot_Replacement : Name_Id := No_Name; |
b30668b7 VC |
231 | -- The string to replace '.' in the source file name (for Ada). |
232 | ||
6663c393 | 233 | Dot_Repl_Loc : Source_Ptr := No_Location; |
19235870 RK |
234 | -- The position in the project file source where |
235 | -- Dot_Replacement is defined. | |
236 | ||
6663c393 | 237 | Casing : Casing_Type := All_Lower_Case; |
b30668b7 | 238 | -- The casing of the source file name (for Ada). |
19235870 | 239 | |
fbf5a39b | 240 | Spec_Suffix : Array_Element_Id := No_Array_Element; |
19235870 | 241 | -- The string to append to the unit name for the |
fbf5a39b | 242 | -- source file name of a spec. |
b30668b7 VC |
243 | -- Indexed by the programming language. |
244 | ||
6663c393 | 245 | Current_Spec_Suffix : Name_Id := No_Name; |
fbf5a39b | 246 | -- The "spec" suffix of the current programming language |
19235870 | 247 | |
6663c393 | 248 | Spec_Suffix_Loc : Source_Ptr := No_Location; |
19235870 | 249 | -- The position in the project file source where |
b30668b7 | 250 | -- Current_Spec_Suffix is defined. |
19235870 | 251 | |
fbf5a39b | 252 | Body_Suffix : Array_Element_Id := No_Array_Element; |
19235870 RK |
253 | -- The string to append to the unit name for the |
254 | -- source file name of a body. | |
b30668b7 VC |
255 | -- Indexed by the programming language. |
256 | ||
fbf5a39b AC |
257 | Current_Body_Suffix : Name_Id := No_Name; |
258 | -- The "body" suffix of the current programming language | |
19235870 | 259 | |
fbf5a39b | 260 | Body_Suffix_Loc : Source_Ptr := No_Location; |
19235870 | 261 | -- The position in the project file source where |
fbf5a39b | 262 | -- Current_Body_Suffix is defined. |
19235870 | 263 | |
6663c393 | 264 | Separate_Suffix : Name_Id := No_Name; |
19235870 | 265 | -- The string to append to the unit name for the |
b30668b7 | 266 | -- source file name of an Ada subunit. |
19235870 | 267 | |
6663c393 | 268 | Sep_Suffix_Loc : Source_Ptr := No_Location; |
19235870 | 269 | -- The position in the project file source where |
b30668b7 VC |
270 | -- Separate_Suffix is defined. |
271 | ||
fbf5a39b AC |
272 | Specs : Array_Element_Id := No_Array_Element; |
273 | -- An associative array mapping individual specs | |
b30668b7 VC |
274 | -- to source file names. Specific to Ada. |
275 | ||
6663c393 | 276 | Bodies : Array_Element_Id := No_Array_Element; |
b30668b7 VC |
277 | -- An associative array mapping individual bodies |
278 | -- to source file names. Specific to Ada. | |
19235870 | 279 | |
6663c393 | 280 | Specification_Exceptions : Array_Element_Id := No_Array_Element; |
fbf5a39b AC |
281 | -- An associative array listing spec file names that don't have the |
282 | -- spec suffix. Not used by Ada. Indexed by the programming language | |
283 | -- name. | |
19235870 | 284 | |
b30668b7 | 285 | Implementation_Exceptions : Array_Element_Id := No_Array_Element; |
fbf5a39b AC |
286 | -- An associative array listing body file names that don't have the |
287 | -- body suffix. Not used by Ada. Indexed by the programming language | |
288 | -- name. | |
19235870 RK |
289 | |
290 | end record; | |
19235870 RK |
291 | |
292 | function Standard_Naming_Data return Naming_Data; | |
293 | pragma Inline (Standard_Naming_Data); | |
294 | -- The standard GNAT naming scheme. | |
295 | ||
296 | function Same_Naming_Scheme | |
297 | (Left, Right : Naming_Data) | |
298 | return Boolean; | |
299 | -- Returns True if Left and Right are the same naming scheme | |
fbf5a39b | 300 | -- not considering Specs and Bodies. |
19235870 RK |
301 | |
302 | type Project_Id is new Nat; | |
303 | No_Project : constant Project_Id := 0; | |
304 | -- Id of a Project File | |
305 | ||
306 | type Project_List is new Nat; | |
307 | Empty_Project_List : constant Project_List := 0; | |
308 | -- A list of project files. | |
309 | ||
310 | type Project_Element is record | |
311 | Project : Project_Id := No_Project; | |
312 | Next : Project_List := Empty_Project_List; | |
313 | end record; | |
314 | -- Element in a list of project file. | |
315 | -- Next is the id of the next project file in the list. | |
316 | ||
317 | package Project_Lists is new Table.Table | |
318 | (Table_Component_Type => Project_Element, | |
319 | Table_Index_Type => Project_List, | |
320 | Table_Low_Bound => 1, | |
321 | Table_Initial => 100, | |
322 | Table_Increment => 100, | |
323 | Table_Name => "Prj.Project_Lists"); | |
324 | -- The table that contains the lists of project files. | |
325 | ||
fbf5a39b AC |
326 | -- The following record describes a project file representation |
327 | ||
19235870 | 328 | type Project_Data is record |
6663c393 | 329 | First_Referred_By : Project_Id := No_Project; |
19235870 | 330 | -- The project, if any, that was the first to be known |
fbc9a404 | 331 | -- as importing or extending this project. |
b30668b7 | 332 | -- Set by Prj.Proc.Process. |
19235870 | 333 | |
6663c393 | 334 | Name : Name_Id := No_Name; |
19235870 | 335 | -- The name of the project. |
b30668b7 | 336 | -- Set by Prj.Proc.Process. |
19235870 | 337 | |
6663c393 | 338 | Path_Name : Name_Id := No_Name; |
19235870 | 339 | -- The path name of the project file. |
b30668b7 | 340 | -- Set by Prj.Proc.Process. |
19235870 | 341 | |
fbf5a39b AC |
342 | Display_Path_Name : Name_Id := No_Name; |
343 | ||
6663c393 | 344 | Location : Source_Ptr := No_Location; |
19235870 RK |
345 | -- The location in the project file source of the |
346 | -- reserved word project. | |
b30668b7 | 347 | -- Set by Prj.Proc.Process. |
19235870 | 348 | |
fbf5a39b AC |
349 | Mains : String_List_Id := Nil_String; |
350 | -- The list of mains as specified by attribute Main. | |
351 | -- Set by Prj.Nmsc.Ada_Check. | |
352 | ||
6663c393 | 353 | Directory : Name_Id := No_Name; |
19235870 | 354 | -- The directory where the project file resides. |
b30668b7 | 355 | -- Set by Prj.Proc.Process. |
19235870 | 356 | |
fbf5a39b AC |
357 | Display_Directory : Name_Id := No_Name; |
358 | ||
359 | Dir_Path : String_Access; | |
360 | -- Same as Directory, but as an access to String. | |
361 | -- Set by Make.Compile_Sources.Collect_Arguments_And_Compile. | |
362 | ||
6663c393 | 363 | Library : Boolean := False; |
b30668b7 | 364 | -- True if this is a library project. |
fbf5a39b | 365 | -- Set by Prj.Nmsc.Language_Independent_Check. |
19235870 | 366 | |
6663c393 | 367 | Library_Dir : Name_Id := No_Name; |
19235870 | 368 | -- If a library project, directory where resides the library |
fbf5a39b AC |
369 | -- Set by Prj.Nmsc.Language_Independent_Check. |
370 | ||
371 | Display_Library_Dir : Name_Id := No_Name; | |
372 | ||
373 | Library_Src_Dir : Name_Id := No_Name; | |
374 | -- If a library project, directory where the sources and the ALI files | |
375 | -- of the library are copied. By default, if attribute Library_Src_Dir | |
376 | -- is not specified, sources are not copied anywhere and ALI files are | |
377 | -- copied in the Library Directory. | |
378 | -- Set by Prj.Nmsc.Language_Independent_Check. | |
379 | ||
380 | Display_Library_Src_Dir : Name_Id := No_Name; | |
19235870 | 381 | |
6663c393 | 382 | Library_Name : Name_Id := No_Name; |
19235870 | 383 | -- If a library project, name of the library |
fbf5a39b | 384 | -- Set by Prj.Nmsc.Language_Independent_Check. |
19235870 | 385 | |
6663c393 | 386 | Library_Kind : Lib_Kind := Static; |
19235870 | 387 | -- If a library project, kind of library |
fbf5a39b | 388 | -- Set by Prj.Nmsc.Language_Independent_Check. |
19235870 | 389 | |
6663c393 | 390 | Lib_Internal_Name : Name_Id := No_Name; |
19235870 | 391 | -- If a library project, internal name store inside the library |
fbf5a39b | 392 | -- Set by Prj.Nmsc.Language_Independent_Check. |
19235870 | 393 | |
6663c393 | 394 | Lib_Elaboration : Boolean := False; |
19235870 RK |
395 | -- If a library project, indicate if <lib>init and <lib>final |
396 | -- procedures need to be defined. | |
fbf5a39b AC |
397 | -- Set by Prj.Nmsc.Language_Independent_Check. |
398 | ||
399 | Standalone_Library : Boolean := False; | |
400 | -- Indicate that this is a Standalone Library Project File. | |
401 | -- Set by Prj.Nmsc.Ada_Check. | |
402 | ||
403 | Lib_Interface_ALIs : String_List_Id := Nil_String; | |
404 | -- For Standalone Library Project Files, indicate the list | |
405 | -- of Interface ALI files. | |
406 | -- Set by Prj.Nmsc.Ada_Check. | |
407 | ||
408 | Lib_Auto_Init : Boolean := False; | |
409 | -- For non static Standalone Library Project Files, indicate if | |
410 | -- the library initialisation should be automatic. | |
b30668b7 | 411 | |
6663c393 | 412 | Sources_Present : Boolean := True; |
b30668b7 VC |
413 | -- A flag that indicates if there are sources in this project file. |
414 | -- There are no sources if 1) Source_Dirs is specified as an | |
415 | -- empty list, 2) Source_Files is specified as an empty list, or | |
416 | -- 3) the current language is not in the list of the specified | |
417 | -- Languages. | |
19235870 | 418 | |
6663c393 | 419 | Sources : String_List_Id := Nil_String; |
19235870 | 420 | -- The list of all the source file names. |
b30668b7 | 421 | -- Set by Prj.Nmsc.Check_Naming_Scheme. |
19235870 | 422 | |
6663c393 | 423 | Source_Dirs : String_List_Id := Nil_String; |
19235870 | 424 | -- The list of all the source directories. |
b30668b7 | 425 | -- Set by Prj.Nmsc.Check_Naming_Scheme. |
19235870 | 426 | |
fbf5a39b AC |
427 | Known_Order_Of_Source_Dirs : Boolean := True; |
428 | -- False, if there is any /** in the Source_Dirs, because in this case | |
429 | -- the ordering of the source subdirs depend on the OS. If True, | |
430 | -- duplicate file names in the same project file are allowed. | |
431 | ||
6663c393 | 432 | Object_Directory : Name_Id := No_Name; |
19235870 | 433 | -- The object directory of this project file. |
b30668b7 | 434 | -- Set by Prj.Nmsc.Check_Naming_Scheme. |
19235870 | 435 | |
fbf5a39b AC |
436 | Display_Object_Dir : Name_Id := No_Name; |
437 | ||
79503fdd GB |
438 | Exec_Directory : Name_Id := No_Name; |
439 | -- The exec directory of this project file. | |
440 | -- Default is equal to Object_Directory. | |
441 | -- Set by Prj.Nmsc.Check_Naming_Scheme. | |
442 | ||
fbf5a39b AC |
443 | Display_Exec_Dir : Name_Id := No_Name; |
444 | ||
445 | Extends : Project_Id := No_Project; | |
19235870 | 446 | -- The reference of the project file, if any, that this |
fbf5a39b | 447 | -- project file extends. |
b30668b7 | 448 | -- Set by Prj.Proc.Process. |
19235870 | 449 | |
fbf5a39b | 450 | Extended_By : Project_Id := No_Project; |
19235870 | 451 | -- The reference of the project file, if any, that |
fbf5a39b | 452 | -- extends this project file. |
b30668b7 | 453 | -- Set by Prj.Proc.Process. |
19235870 | 454 | |
6663c393 | 455 | Naming : Naming_Data := Standard_Naming_Data; |
19235870 | 456 | -- The naming scheme of this project file. |
b30668b7 | 457 | -- Set by Prj.Nmsc.Check_Naming_Scheme. |
19235870 | 458 | |
6663c393 | 459 | Decl : Declarations := No_Declarations; |
19235870 RK |
460 | -- The declarations (variables, attributes and packages) |
461 | -- of this project file. | |
b30668b7 | 462 | -- Set by Prj.Proc.Process. |
19235870 | 463 | |
6663c393 | 464 | Imported_Projects : Project_List := Empty_Project_List; |
19235870 | 465 | -- The list of all directly imported projects, if any. |
b30668b7 | 466 | -- Set by Prj.Proc.Process. |
19235870 | 467 | |
fbf5a39b | 468 | Ada_Include_Path : String_Access := null; |
19235870 | 469 | -- The cached value of ADA_INCLUDE_PATH for this project file. |
7fb754a1 | 470 | -- Do not use this field directly outside of the compiler, use |
fbf5a39b AC |
471 | -- Prj.Env.Ada_Include_Path instead. |
472 | -- Set by Prj.Env.Ada_Include_Path. | |
19235870 | 473 | |
fbf5a39b | 474 | Ada_Objects_Path : String_Access := null; |
19235870 | 475 | -- The cached value of ADA_OBJECTS_PATH for this project file. |
7fb754a1 | 476 | -- Do not use this field directly outside of the compiler, use |
07fc65c4 | 477 | -- Prj.Env.Ada_Objects_Path instead. |
fbf5a39b AC |
478 | -- Set by Prj.Env.Ada_Objects_Path |
479 | ||
480 | Include_Path_File : Name_Id := No_Name; | |
481 | -- The cached value of the source path temp file for this project file. | |
482 | -- Set by gnatmake (Prj.Env.Set_Ada_Paths). | |
483 | ||
484 | Objects_Path_File_With_Libs : Name_Id := No_Name; | |
485 | -- The cached value of the object path temp file (including library | |
486 | -- dirs) for this project file. | |
487 | -- Set by gnatmake (Prj.Env.Set_Ada_Paths). | |
488 | ||
489 | Objects_Path_File_Without_Libs : Name_Id := No_Name; | |
490 | -- The cached value of the object path temp file (excluding library | |
491 | -- dirs) for this project file. | |
492 | -- Set by gnatmake (Prj.Env.Set_Ada_Paths). | |
19235870 | 493 | |
6663c393 | 494 | Config_File_Name : Name_Id := No_Name; |
19235870 | 495 | -- The name of the configuration pragmas file, if any. |
07fc65c4 | 496 | -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File). |
19235870 | 497 | |
6663c393 | 498 | Config_File_Temp : Boolean := False; |
19235870 RK |
499 | -- An indication that the configuration pragmas file is |
500 | -- a temporary file that must be deleted at the end. | |
07fc65c4 | 501 | -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File). |
19235870 | 502 | |
6663c393 | 503 | Config_Checked : Boolean := False; |
b30668b7 | 504 | -- A flag to avoid checking repetitively the configuration pragmas file. |
07fc65c4 | 505 | -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File). |
b30668b7 VC |
506 | |
507 | Language_Independent_Checked : Boolean := False; | |
508 | -- A flag that indicates that the project file has been checked | |
509 | -- for language independent features: Object_Directory, | |
510 | -- Source_Directories, Library, non empty Naming Suffixs. | |
19235870 | 511 | |
6663c393 | 512 | Checked : Boolean := False; |
b30668b7 | 513 | -- A flag to avoid checking repetitively the naming scheme of |
19235870 | 514 | -- this project file. |
b30668b7 | 515 | -- Set by Prj.Nmsc.Check_Naming_Scheme. |
19235870 | 516 | |
6663c393 RD |
517 | Seen : Boolean := False; |
518 | Flag1 : Boolean := False; | |
519 | Flag2 : Boolean := False; | |
19235870 | 520 | -- Various flags that are used in an ad hoc manner |
6663c393 RD |
521 | -- That's really not a good enough comment ??? we need to know what |
522 | -- these flags are used for, and give them proper names. If Flag1 | |
523 | -- and Flag2 have multiple uses, then either we use multiple fields | |
524 | -- or a renaming scheme. | |
19235870 | 525 | |
fbf5a39b AC |
526 | Depth : Natural := 0; |
527 | -- The maximum depth of a project in the project graph. | |
528 | -- Depth of main project is 0. | |
529 | ||
19235870 | 530 | end record; |
19235870 RK |
531 | |
532 | function Empty_Project return Project_Data; | |
533 | -- Return the representation of an empty project. | |
534 | ||
535 | package Projects is new Table.Table ( | |
536 | Table_Component_Type => Project_Data, | |
537 | Table_Index_Type => Project_Id, | |
538 | Table_Low_Bound => 1, | |
539 | Table_Initial => 100, | |
540 | Table_Increment => 100, | |
541 | Table_Name => "Prj.Projects"); | |
542 | -- The set of all project files. | |
543 | ||
07fc65c4 GB |
544 | type Put_Line_Access is access procedure |
545 | (Line : String; | |
546 | Project : Project_Id); | |
547 | -- Use to customize error reporting in Prj.Proc and Prj.Nmsc. | |
548 | ||
19235870 RK |
549 | procedure Expect (The_Token : Token_Type; Token_Image : String); |
550 | -- Check that the current token is The_Token. If it is not, then | |
551 | -- output an error message. | |
552 | ||
553 | procedure Initialize; | |
554 | -- This procedure must be called before using any services from the Prj | |
555 | -- hierarchy. Namet.Initialize must be called before Prj.Initialize. | |
556 | ||
557 | procedure Reset; | |
558 | -- This procedure resets all the tables that are used when processing a | |
559 | -- project file tree. Initialize must be called before the call to Reset. | |
560 | ||
07fc65c4 GB |
561 | procedure Register_Default_Naming_Scheme |
562 | (Language : Name_Id; | |
563 | Default_Spec_Suffix : Name_Id; | |
fbf5a39b | 564 | Default_Body_Suffix : Name_Id); |
07fc65c4 GB |
565 | -- Register the default suffixs for a given language. These extensions |
566 | -- will be ignored if the user has specified a new naming scheme in a | |
567 | -- project file. | |
fbf5a39b | 568 | -- |
07fc65c4 | 569 | -- Otherwise, this information will be automatically added to Naming_Data |
fbf5a39b | 570 | -- when a project is processed, in the lists Spec_Suffix and Body_Suffix. |
07fc65c4 | 571 | |
19235870 RK |
572 | generic |
573 | type State is limited private; | |
574 | with procedure Action | |
575 | (Project : Project_Id; | |
576 | With_State : in out State); | |
577 | procedure For_Every_Project_Imported | |
578 | (By : Project_Id; | |
579 | With_State : in out State); | |
580 | -- Call Action for each project imported directly or indirectly by project | |
b30668b7 | 581 | -- By. Action is called according to the order of importation: if A |
19235870 RK |
582 | -- imports B, directly or indirectly, Action will be called for A before |
583 | -- it is called for B. With_State may be used by Action to choose a | |
584 | -- behavior or to report some global result. | |
585 | ||
fbf5a39b AC |
586 | procedure Scan; |
587 | pragma Inline (Scan); | |
588 | -- Scan a token. Change all operator symbols to literal strings. | |
589 | ||
19235870 RK |
590 | private |
591 | ||
fbf5a39b AC |
592 | Initial_Buffer_Size : constant := 100; |
593 | ||
594 | Buffer : String_Access := new String (1 .. Initial_Buffer_Size); | |
595 | -- An extensible character buffer to store names. Used in Prj.Part and | |
596 | -- Prj.Strt. | |
597 | ||
598 | Buffer_Last : Natural := 0; | |
599 | -- The index of the last character in the Buffer | |
600 | ||
601 | Current_Packages_To_Check : String_List_Access := All_Packages; | |
602 | -- Global variable, set by Prj.Part.Parse, used by Prj.Dect. | |
603 | ||
604 | procedure Add_To_Buffer (S : String); | |
605 | -- Append a String to the Buffer | |
19235870 RK |
606 | |
607 | end Prj; |