1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2004 Free Software Foundation, Inc. --
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. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- The following package declares the data types for GNAT project.
28 -- These data types may be used by GNAT Project-aware tools.
30 -- Children of these package implements various services on these data types.
31 -- See in particular Prj.Pars and Prj.Env.
33 with Casing; use Casing;
34 with Scans; use Scans;
36 with Types; use Types;
38 with GNAT.OS_Lib; use GNAT.OS_Lib;
43 -- Name_Id for an empty name (no characters). Initialized by the call
44 -- to procedure Initialize.
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.
50 Virtual_Prefix : constant String := "v$";
51 -- The prefix for virtual extending projects. Because of the '$', which is
52 -- normally forbidden for project names, there cannot be any name clash.
54 Project_File_Extension : String := ".gpr";
55 -- The standard project file name extension. It is not a constant, because
56 -- Canonical_Case_File_Name is called on this variable in the body of Prj.
58 Default_Ada_Spec_Suffix : Name_Id;
59 -- The Name_Id for the standard GNAT suffix for Ada spec source file
60 -- name ".ads". Initialized by Prj.Initialize.
62 Default_Ada_Body_Suffix : Name_Id;
63 -- The Name_Id for the standard GNAT suffix for Ada body source file
64 -- name ".adb". Initialized by Prj.Initialize.
67 -- "/", used as the path of locally removed files
69 type Languages_Processed is (Ada_Language, Other_Languages, All_Languages);
70 -- To specify how to process project files
72 type Programming_Language is
73 (Lang_Ada, Lang_C, Lang_C_Plus_Plus);
74 -- The set of languages supported
76 subtype Other_Programming_Language is
77 Programming_Language range Lang_C .. Programming_Language'Last;
78 -- The set of non-Ada languages supported
80 type Languages_In_Project is array (Programming_Language) of Boolean;
81 -- Set of supported languages used in a project
83 No_Languages : constant Languages_In_Project := (others => False);
84 -- No supported languages are used
86 type Impl_Suffix_Array is array (Programming_Language) of Name_Id;
87 -- Suffixes for the non spec sources of the different supported languages
90 No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_Name);
91 -- A default value for the non spec source suffixes
93 Lang_Ada_Name : aliased String := "ada";
94 Lang_C_Name : aliased String := "c";
95 Lang_C_Plus_Plus_Name : aliased String := "c++";
96 Lang_Names : constant array (Programming_Language) of String_Access :=
97 (Lang_Ada => Lang_Ada_Name 'Access,
98 Lang_C => Lang_C_Name 'Access,
99 Lang_C_Plus_Plus => Lang_C_Plus_Plus_Name'Access);
100 -- Names of the supported programming languages, to be used after switch
101 -- -x when using a GCC compiler.
103 Lang_Name_Ids : array (Programming_Language) of Name_Id;
104 -- Same as Lang_Names, but using Name_Id, instead of String_Access.
105 -- Initialized by Prj.Initialize.
107 Lang_Ada_Display_Name : aliased String := "Ada";
108 Lang_C_Display_Name : aliased String := "C";
109 Lang_C_Plus_Plus_Display_Name : aliased String := "C++";
111 constant array (Programming_Language) of String_Access :=
112 (Lang_Ada => Lang_Ada_Display_Name 'Access,
113 Lang_C => Lang_C_Display_Name 'Access,
114 Lang_C_Plus_Plus => Lang_C_Plus_Plus_Display_Name'Access);
115 -- Names of the supported programming languages, to be used for display
118 Ada_Impl_Suffix : aliased String := ".adb";
119 C_Impl_Suffix : aliased String := ".c";
120 C_Plus_Plus_Impl_Suffix : aliased String := ".cc";
121 Lang_Suffixes : constant array (Programming_Language) of String_Access :=
122 (Lang_Ada => Ada_Impl_Suffix 'Access,
123 Lang_C => C_Impl_Suffix 'Access,
124 Lang_C_Plus_Plus => C_Plus_Plus_Impl_Suffix'Access);
125 -- Default extension of the sources of the different languages.
127 Lang_Suffix_Ids : array (Programming_Language) of Name_Id;
128 -- Same as Lang_Suffixes, but using Name_Id, instead of String_Access.
129 -- Initialized by Prj.Initialize.
131 Gnatmake_String : aliased String := "gnatmake";
132 Gcc_String : aliased String := "gcc";
133 G_Plus_Plus_String : aliased String := "g++";
134 Default_Compiler_Names :
135 constant array (Programming_Language) of String_Access :=
136 (Lang_Ada => Gnatmake_String 'Access,
137 Lang_C => Gcc_String 'Access,
138 Lang_C_Plus_Plus => G_Plus_Plus_String'Access);
139 -- Default names of the compilers for the supported languages.
140 -- Used when no IDE'Compiler_Command is specified for a language.
141 -- For Ada, specify the gnatmake executable.
143 Ada_Args_Strings : aliased String := "";
144 C_Args_String : aliased String := "c";
145 C_Plus_Plus_Args_String : aliased String := "xx";
146 Lang_Args : constant array (Programming_Language) of String_Access :=
147 (Lang_Ada => Ada_Args_Strings 'Access,
148 Lang_C => C_Args_String 'Access,
149 Lang_C_Plus_Plus => C_Plus_Plus_Args_String'Access);
150 -- For each supported language, the string between "-c" and "args" to
151 -- be used in the gprmake switch for the start of the compiling switch
152 -- section for each supported language. For example, "-ccargs" indicates
153 -- the start of the C compiler switch section.
155 type Other_Source_Id is new Nat;
156 No_Other_Source : constant Other_Source_Id := 0;
157 type Other_Source is record
158 Language : Programming_Language; -- language of the source
159 File_Name : Name_Id; -- source file simple name
160 Path_Name : Name_Id; -- source full path name
161 Source_TS : Time_Stamp_Type; -- source file time stamp
162 Object_Name : Name_Id; -- object file simple name
163 Object_Path : Name_Id; -- object full path name
164 Object_TS : Time_Stamp_Type; -- object file time stamp
165 Dep_Name : Name_Id; -- dependency file simple name
166 Dep_Path : Name_Id; -- dependency full path name
167 Dep_TS : Time_Stamp_Type; -- dependency file time stamp
168 Naming_Exception : Boolean := False; -- True if a naming exception
169 Next : Other_Source_Id := No_Other_Source;
171 -- Data for a source in a language other than Ada
173 package Other_Sources is new Table.Table
174 (Table_Component_Type => Other_Source,
175 Table_Index_Type => Other_Source_Id,
176 Table_Low_Bound => 1,
177 Table_Initial => 200,
178 Table_Increment => 100,
179 Table_Name => "Prj.Other_Sources");
180 -- The table for sources of languages other than Ada
182 type Verbosity is (Default, Medium, High);
183 -- Verbosity when parsing GNAT Project Files
184 -- Default is default (very quiet, if no errors).
185 -- Medium is more verbose.
186 -- High is extremely verbose.
188 type Lib_Kind is (Static, Dynamic, Relocatable);
189 type Policy is (Autonomous, Compliant, Controlled, Restricted);
190 -- Type to specify the symbol policy, when symbol control is supported.
191 -- See full explanation about this type in package Symbols.
192 -- Autonomous: Create a symbol file without considering any reference
193 -- Compliant: Try to be as compatible as possible with an existing ref
194 -- Controlled: Fail if symbols are not the same as those in the reference
195 -- Restricted: Restrict the symbols to those in the symbol file
197 type Symbol_Record is record
198 Symbol_File : Name_Id := No_Name;
199 Reference : Name_Id := No_Name;
200 Symbol_Policy : Policy := Autonomous;
202 -- Type to keep the symbol data to be used when building a shared library
204 No_Symbols : Symbol_Record :=
205 (Symbol_File => No_Name,
206 Reference => No_Name,
207 Symbol_Policy => Autonomous);
208 -- The default value of the symbol data
210 function Empty_String return Name_Id;
211 -- Return the Name_Id for an empty string ""
213 type Project_Id is new Nat;
214 No_Project : constant Project_Id := 0;
215 -- Id of a Project File
217 type String_List_Id is new Nat;
218 Nil_String : constant String_List_Id := 0;
219 type String_Element is record
220 Value : Name_Id := No_Name;
222 Display_Value : Name_Id := No_Name;
223 Location : Source_Ptr := No_Location;
224 Flag : Boolean := False;
225 Next : String_List_Id := Nil_String;
227 -- To hold values for string list variables and array elements.
228 -- Component Flag may be used for various purposes. For source
229 -- directories, it indicates if the directory contains Ada source(s).
231 package String_Elements is new Table.Table
232 (Table_Component_Type => String_Element,
233 Table_Index_Type => String_List_Id,
234 Table_Low_Bound => 1,
235 Table_Initial => 200,
236 Table_Increment => 100,
237 Table_Name => "Prj.String_Elements");
238 -- The table for string elements in string lists
240 type Variable_Kind is (Undefined, List, Single);
241 -- Different kinds of variables
243 Ignored : constant Variable_Kind := Single;
244 -- Used to indicate that a package declaration must be ignored
245 -- while processing the project tree (unknown package name).
247 type Variable_Value (Kind : Variable_Kind := Undefined) is record
248 Project : Project_Id := No_Project;
249 Location : Source_Ptr := No_Location;
250 Default : Boolean := False;
255 Values : String_List_Id := Nil_String;
257 Value : Name_Id := No_Name;
261 -- Values for variables and array elements. Default is True if the
262 -- current value is the default one for the variable
264 Nil_Variable_Value : constant Variable_Value :=
265 (Project => No_Project,
267 Location => No_Location,
269 -- Value of a non existing variable or array element
271 type Variable_Id is new Nat;
272 No_Variable : constant Variable_Id := 0;
273 type Variable is record
274 Next : Variable_Id := No_Variable;
276 Value : Variable_Value;
278 -- To hold the list of variables in a project file and in packages
280 package Variable_Elements is new Table.Table
281 (Table_Component_Type => Variable,
282 Table_Index_Type => Variable_Id,
283 Table_Low_Bound => 1,
284 Table_Initial => 200,
285 Table_Increment => 100,
286 Table_Name => "Prj.Variable_Elements");
287 -- The table of variable in list of variables
289 type Array_Element_Id is new Nat;
290 No_Array_Element : constant Array_Element_Id := 0;
291 type Array_Element is record
293 Src_Index : Int := 0;
294 Index_Case_Sensitive : Boolean := True;
295 Value : Variable_Value;
296 Next : Array_Element_Id := No_Array_Element;
298 -- Each Array_Element represents an array element and is linked (Next)
299 -- to the next array element, if any, in the array.
301 package Array_Elements is new Table.Table
302 (Table_Component_Type => Array_Element,
303 Table_Index_Type => Array_Element_Id,
304 Table_Low_Bound => 1,
305 Table_Initial => 200,
306 Table_Increment => 100,
307 Table_Name => "Prj.Array_Elements");
308 -- The table that contains all array elements
310 type Array_Id is new Nat;
311 No_Array : constant Array_Id := 0;
312 type Array_Data is record
313 Name : Name_Id := No_Name;
314 Value : Array_Element_Id := No_Array_Element;
315 Next : Array_Id := No_Array;
317 -- Each Array_Data value represents an array.
318 -- Value is the id of the first element.
319 -- Next is the id of the next array in the project file or package.
321 package Arrays is new Table.Table
322 (Table_Component_Type => Array_Data,
323 Table_Index_Type => Array_Id,
324 Table_Low_Bound => 1,
325 Table_Initial => 200,
326 Table_Increment => 100,
327 Table_Name => "Prj.Arrays");
328 -- The table that contains all arrays
330 type Package_Id is new Nat;
331 No_Package : constant Package_Id := 0;
332 type Declarations is record
333 Variables : Variable_Id := No_Variable;
334 Attributes : Variable_Id := No_Variable;
335 Arrays : Array_Id := No_Array;
336 Packages : Package_Id := No_Package;
338 -- Contains the declarations (variables, single and array attributes,
339 -- packages) for a project or a package in a project.
341 No_Declarations : constant Declarations :=
342 (Variables => No_Variable,
343 Attributes => No_Variable,
345 Packages => No_Package);
346 -- Default value of Declarations: indicates that there is no declarations.
348 type Package_Element is record
349 Name : Name_Id := No_Name;
350 Decl : Declarations := No_Declarations;
351 Parent : Package_Id := No_Package;
352 Next : Package_Id := No_Package;
354 -- A package. Includes declarations that may include other packages.
356 package Packages is new Table.Table
357 (Table_Component_Type => Package_Element,
358 Table_Index_Type => Package_Id,
359 Table_Low_Bound => 1,
360 Table_Initial => 100,
361 Table_Increment => 100,
362 Table_Name => "Prj.Packages");
363 -- The table that contains all packages.
365 function Image (Casing : Casing_Type) return String;
366 -- Similar to 'Image (but avoid use of this attribute in compiler)
368 function Value (Image : String) return Casing_Type;
369 -- Similar to 'Value (but avoid use of this attribute in compiler)
370 -- Raises Constraint_Error if not a Casing_Type image.
372 -- The following record contains data for a naming scheme
374 type Naming_Data is record
375 Current_Language : Name_Id := No_Name;
376 -- The programming language being currently considered
378 Dot_Replacement : Name_Id := No_Name;
379 -- The string to replace '.' in the source file name (for Ada).
381 Dot_Repl_Loc : Source_Ptr := No_Location;
382 -- The position in the project file source where
383 -- Dot_Replacement is defined.
385 Casing : Casing_Type := All_Lower_Case;
386 -- The casing of the source file name (for Ada).
388 Spec_Suffix : Array_Element_Id := No_Array_Element;
389 -- The string to append to the unit name for the
390 -- source file name of a spec.
391 -- Indexed by the programming language.
393 Current_Spec_Suffix : Name_Id := No_Name;
394 -- The "spec" suffix of the current programming language
396 Spec_Suffix_Loc : Source_Ptr := No_Location;
397 -- The position in the project file source where
398 -- Current_Spec_Suffix is defined.
400 Body_Suffix : Array_Element_Id := No_Array_Element;
401 -- The string to append to the unit name for the
402 -- source file name of a body.
403 -- Indexed by the programming language.
405 Current_Body_Suffix : Name_Id := No_Name;
406 -- The "body" suffix of the current programming language
408 Body_Suffix_Loc : Source_Ptr := No_Location;
409 -- The position in the project file source where
410 -- Current_Body_Suffix is defined.
412 Separate_Suffix : Name_Id := No_Name;
413 -- String to append to unit name for source file name of an Ada subunit.
415 Sep_Suffix_Loc : Source_Ptr := No_Location;
416 -- Position in the project file source where Separate_Suffix is defined.
418 Specs : Array_Element_Id := No_Array_Element;
419 -- An associative array mapping individual specs to source file names.
420 -- This is specific to Ada.
422 Bodies : Array_Element_Id := No_Array_Element;
423 -- An associative array mapping individual bodies to source file names.
424 -- This is specific to Ada.
426 Specification_Exceptions : Array_Element_Id := No_Array_Element;
427 -- An associative array listing spec file names that do not have the
428 -- spec suffix. Not used by Ada. Indexed by programming language name.
430 Implementation_Exceptions : Array_Element_Id := No_Array_Element;
431 -- An associative array listing body file names that do not have the
432 -- body suffix. Not used by Ada. Indexed by programming language name.
436 function Standard_Naming_Data return Naming_Data;
437 pragma Inline (Standard_Naming_Data);
438 -- The standard GNAT naming scheme
440 function Same_Naming_Scheme
441 (Left, Right : Naming_Data)
443 -- Returns True if Left and Right are the same naming scheme
444 -- not considering Specs and Bodies.
446 type Project_List is new Nat;
447 Empty_Project_List : constant Project_List := 0;
448 -- A list of project files
450 type Project_Element is record
451 Project : Project_Id := No_Project;
452 Next : Project_List := Empty_Project_List;
454 -- Element in a list of project files. Next is the id of the next
455 -- project file in the list.
457 package Project_Lists is new Table.Table
458 (Table_Component_Type => Project_Element,
459 Table_Index_Type => Project_List,
460 Table_Low_Bound => 1,
461 Table_Initial => 100,
462 Table_Increment => 100,
463 Table_Name => "Prj.Project_Lists");
464 -- The table that contains the lists of project files
466 -- The following record describes a project file representation
468 type Project_Data is record
469 Languages : Languages_In_Project := No_Languages;
470 -- Indicate the different languages of the source of this project
472 Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
473 -- The source suffixes of the different languages other than Ada
475 First_Referred_By : Project_Id := No_Project;
476 -- The project, if any, that was the first to be known
477 -- as importing or extending this project.
478 -- Set by Prj.Proc.Process.
480 Name : Name_Id := No_Name;
481 -- The name of the project. Set by Prj.Proc.Process.
483 Path_Name : Name_Id := No_Name;
484 -- The path name of the project file. Set by Prj.Proc.Process.
486 Display_Path_Name : Name_Id := No_Name;
487 -- The path name used for display purposes. May be different from
488 -- Path_Name for platforms where the file names are case-insensitive.
490 Virtual : Boolean := False;
491 -- True for virtual extending projects
493 Location : Source_Ptr := No_Location;
494 -- The location in the project file source of the reserved word
495 -- project. Set by Prj.Proc.Process.
497 Mains : String_List_Id := Nil_String;
498 -- List of mains specified by attribute Main. Set by Prj.Nmsc.Ada_Check.
500 Directory : Name_Id := No_Name;
501 -- Directory where the project file resides. Set by Prj.Proc.Process.
503 Display_Directory : Name_Id := No_Name;
505 Dir_Path : String_Access;
506 -- Same as Directory, but as an access to String.
507 -- Set by Make.Compile_Sources.Collect_Arguments_And_Compile.
509 Library : Boolean := False;
510 -- True if this is a library project.
511 -- Set by Prj.Nmsc.Language_Independent_Check.
513 Library_Dir : Name_Id := No_Name;
514 -- If a library project, directory where resides the library
515 -- Set by Prj.Nmsc.Language_Independent_Check.
517 Display_Library_Dir : Name_Id := No_Name;
518 -- The name of the library directory, for display purposes.
519 -- May be different from Library_Dir for platforms where the file names
520 -- are case-insensitive.
522 Library_Src_Dir : Name_Id := No_Name;
523 -- If a library project, directory where the sources and the ALI files
524 -- of the library are copied. By default, if attribute Library_Src_Dir
525 -- is not specified, sources are not copied anywhere and ALI files are
526 -- copied in the Library Directory.
527 -- Set by Prj.Nmsc.Language_Independent_Check.
529 Display_Library_Src_Dir : Name_Id := No_Name;
530 -- The name of the library source directory, for display purposes.
531 -- May be different from Library_Src_Dir for platforms where the file
532 -- names are case-insensitive.
534 Library_Name : Name_Id := No_Name;
535 -- If a library project, name of the library
536 -- Set by Prj.Nmsc.Language_Independent_Check.
538 Library_Kind : Lib_Kind := Static;
539 -- If a library project, kind of library
540 -- Set by Prj.Nmsc.Language_Independent_Check.
542 Lib_Internal_Name : Name_Id := No_Name;
543 -- If a library project, internal name store inside the library
544 -- Set by Prj.Nmsc.Language_Independent_Check.
546 Standalone_Library : Boolean := False;
547 -- Indicate that this is a Standalone Library Project File.
548 -- Set by Prj.Nmsc.Ada_Check.
550 Lib_Interface_ALIs : String_List_Id := Nil_String;
551 -- For Standalone Library Project Files, indicate the list
552 -- of Interface ALI files. Set by Prj.Nmsc.Ada_Check.
554 Lib_Auto_Init : Boolean := False;
555 -- For non static Standalone Library Project Files, indicate if
556 -- the library initialisation should be automatic.
558 Symbol_Data : Symbol_Record := No_Symbols;
559 -- Symbol file name, reference symbol file name, symbol policy
561 Ada_Sources_Present : Boolean := True;
562 -- A flag that indicates if there are Ada sources in this project file.
563 -- There are no sources if any of the following is true:
564 -- 1) Source_Dirs is specified as an empty list
565 -- 2) Source_Files is specified as an empty list
566 -- 3) Ada is not in the list of the specified Languages
568 Other_Sources_Present : Boolean := True;
569 -- A flag that indicates that there are non-Ada sources in this project
571 Sources : String_List_Id := Nil_String;
572 -- The list of all the source file names. Set by
573 -- Prj.Nmsc.Check_Ada_Naming_Scheme.
575 First_Other_Source : Other_Source_Id := No_Other_Source;
576 Last_Other_Source : Other_Source_Id := No_Other_Source;
577 -- Head and tail of the list of sources of languages other than Ada
579 Imported_Directories_Switches : Argument_List_Access := null;
580 -- List of the -I switches to be used when compiling sources of
581 -- languages other than Ada.
583 Include_Path : String_Access := null;
584 -- Value to be used as CPATH, when using a GCC, instead of a list of
587 Include_Data_Set : Boolean := False;
588 -- Set True when Imported_Directories_Switches or Include_Path are set
590 Source_Dirs : String_List_Id := Nil_String;
591 -- The list of all the source directories.
592 -- Set by Prj.Nmsc.Language_Independent_Check.
594 Known_Order_Of_Source_Dirs : Boolean := True;
595 -- False, if there is any /** in the Source_Dirs, because in this case
596 -- the ordering of the source subdirs depend on the OS. If True,
597 -- duplicate file names in the same project file are allowed.
599 Object_Directory : Name_Id := No_Name;
600 -- The object directory of this project file.
601 -- Set by Prj.Nmsc.Language_Independent_Check.
603 Display_Object_Dir : Name_Id := No_Name;
604 -- The name of the object directory, for display purposes.
605 -- May be different from Object_Directory for platforms where the file
606 -- names are case-insensitive.
608 Exec_Directory : Name_Id := No_Name;
609 -- The exec directory of this project file. Default is equal to
610 -- Object_Directory. Set by Prj.Nmsc.Language_Independent_Check.
612 Display_Exec_Dir : Name_Id := No_Name;
613 -- The name of the exec directory, for display purposes.
614 -- May be different from Exec_Directory for platforms where the file
615 -- names are case-insensitive.
617 Extends : Project_Id := No_Project;
618 -- The reference of the project file, if any, that this
619 -- project file extends. Set by Prj.Proc.Process.
621 Extended_By : Project_Id := No_Project;
622 -- The reference of the project file, if any, that
623 -- extends this project file. Set by Prj.Proc.Process.
625 Naming : Naming_Data := Standard_Naming_Data;
626 -- The naming scheme of this project file.
627 -- Set by Prj.Nmsc.Check_Naming_Scheme.
629 Decl : Declarations := No_Declarations;
630 -- The declarations (variables, attributes and packages) of this
631 -- project file. Set by Prj.Proc.Process.
633 Imported_Projects : Project_List := Empty_Project_List;
634 -- The list of all directly imported projects, if any.
635 -- Set by Prj.Proc.Process.
637 Ada_Include_Path : String_Access := null;
638 -- The cached value of ADA_INCLUDE_PATH for this project file.
639 -- Do not use this field directly outside of the compiler, use
640 -- Prj.Env.Ada_Include_Path instead. Set by Prj.Env.Ada_Include_Path.
642 Ada_Objects_Path : String_Access := null;
643 -- The cached value of ADA_OBJECTS_PATH for this project file.
644 -- Do not use this field directly outside of the compiler, use
645 -- Prj.Env.Ada_Objects_Path instead. Set by Prj.Env.Ada_Objects_Path
647 Include_Path_File : Name_Id := No_Name;
648 -- The cached value of the source path temp file for this project file.
649 -- Set by gnatmake (Prj.Env.Set_Ada_Paths).
651 Objects_Path_File_With_Libs : Name_Id := No_Name;
652 -- The cached value of the object path temp file (including library
653 -- dirs) for this project file. Set by gnatmake (Prj.Env.Set_Ada_Paths).
655 Objects_Path_File_Without_Libs : Name_Id := No_Name;
656 -- The cached value of the object path temp file (excluding library
657 -- dirs) for this project file. Set by gnatmake (Prj.Env.Set_Ada_Paths).
659 Config_File_Name : Name_Id := No_Name;
660 -- The name of the configuration pragmas file, if any.
661 -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
663 Config_File_Temp : Boolean := False;
664 -- An indication that the configuration pragmas file is
665 -- a temporary file that must be deleted at the end.
666 -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
668 Config_Checked : Boolean := False;
669 -- A flag to avoid checking repetitively the configuration pragmas file.
670 -- Set by gnatmake (Prj.Env.Create_Config_Pragmas_File).
672 Language_Independent_Checked : Boolean := False;
673 -- A flag that indicates that the project file has been checked
674 -- for language independent features: Object_Directory,
675 -- Source_Directories, Library, non empty Naming Suffixs.
677 Checked : Boolean := False;
678 -- A flag to avoid checking repetitively the naming scheme of
679 -- this project file. Set by Prj.Nmsc.Check_Ada_Naming_Scheme.
681 Seen : Boolean := False;
682 -- A flag to mark a project as "visited" to avoid processing the same
683 -- project several time.
685 Need_To_Build_Lib : Boolean := False;
686 -- Indicates that the library of a Library Project needs to be built or
689 Depth : Natural := 0;
690 -- The maximum depth of a project in the project graph.
691 -- Depth of main project is 0.
693 Unkept_Comments : Boolean := False;
694 -- True if there are comments in the project sources that cannot
695 -- be kept in the project tree.
699 function Empty_Project return Project_Data;
700 -- Return the representation of an empty project
702 package Projects is new Table.Table (
703 Table_Component_Type => Project_Data,
704 Table_Index_Type => Project_Id,
705 Table_Low_Bound => 1,
706 Table_Initial => 100,
707 Table_Increment => 100,
708 Table_Name => "Prj.Projects");
709 -- The set of all project files
711 type Put_Line_Access is access procedure
713 Project : Project_Id);
714 -- Use to customize error reporting in Prj.Proc and Prj.Nmsc
716 procedure Expect (The_Token : Token_Type; Token_Image : String);
717 -- Check that the current token is The_Token. If it is not, then
718 -- output an error message.
720 procedure Initialize;
721 -- This procedure must be called before using any services from the Prj
722 -- hierarchy. Namet.Initialize must be called before Prj.Initialize.
725 -- This procedure resets all the tables that are used when processing a
726 -- project file tree. Initialize must be called before the call to Reset.
728 procedure Register_Default_Naming_Scheme
730 Default_Spec_Suffix : Name_Id;
731 Default_Body_Suffix : Name_Id);
732 -- Register the default suffixs for a given language. These extensions
733 -- will be ignored if the user has specified a new naming scheme in a
736 -- Otherwise, this information will be automatically added to Naming_Data
737 -- when a project is processed, in the lists Spec_Suffix and Body_Suffix.
740 type State is limited private;
741 with procedure Action
742 (Project : Project_Id;
743 With_State : in out State);
744 procedure For_Every_Project_Imported
746 With_State : in out State);
747 -- Call Action for each project imported directly or indirectly by project
748 -- By. Action is called according to the order of importation: if A
749 -- imports B, directly or indirectly, Action will be called for A before
750 -- it is called for B. With_State may be used by Action to choose a
751 -- behavior or to report some global result.
755 Initial_Buffer_Size : constant := 100;
756 -- Initial size for extensible buffer used below
758 Buffer : String_Access := new String (1 .. Initial_Buffer_Size);
759 -- An extensible character buffer to store names. Used in Prj.Part and
762 Buffer_Last : Natural := 0;
763 -- The index of the last character in the Buffer
765 Current_Packages_To_Check : String_List_Access := All_Packages;
766 -- Global variable, set by Prj.Part.Parse, used by Prj.Dect.
768 procedure Add_To_Buffer (S : String);
769 -- Append a String to the Buffer