1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2009, 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 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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Ada.Characters.Handling; use Ada.Characters.Handling;
27 with Ada.Unchecked_Deallocation;
30 with Osint; use Osint;
31 with Output; use Output;
33 with Prj.Err; use Prj.Err;
34 with Snames; use Snames;
35 with Uintp; use Uintp;
37 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
39 with System.Case_Util; use System.Case_Util;
44 Object_Suffix : constant String := Get_Target_Object_Suffix.all;
45 -- File suffix for object files
47 Initial_Buffer_Size : constant := 100;
48 -- Initial size for extensible buffer used in Add_To_Buffer
50 The_Empty_String : Name_Id := No_Name;
52 subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case;
54 type Cst_String_Access is access constant String;
56 All_Lower_Case_Image : aliased constant String := "lowercase";
57 All_Upper_Case_Image : aliased constant String := "UPPERCASE";
58 Mixed_Case_Image : aliased constant String := "MixedCase";
60 The_Casing_Images : constant array (Known_Casing) of Cst_String_Access :=
61 (All_Lower_Case => All_Lower_Case_Image'Access,
62 All_Upper_Case => All_Upper_Case_Image'Access,
63 Mixed_Case => Mixed_Case_Image'Access);
65 Project_Empty : constant Project_Data :=
66 (Qualifier => Unspecified,
67 Externally_Built => False,
68 Config => Default_Project_Config,
70 Display_Name => No_Name,
71 Path => No_Path_Information,
73 Location => No_Location,
75 Directory => No_Path_Information,
77 Library_Dir => No_Path_Information,
78 Library_Src_Dir => No_Path_Information,
79 Library_ALI_Dir => No_Path_Information,
80 Library_Name => No_Name,
81 Library_Kind => Static,
82 Lib_Internal_Name => No_Name,
83 Standalone_Library => False,
84 Lib_Interface_ALIs => Nil_String,
85 Lib_Auto_Init => False,
86 Libgnarl_Needed => Unknown,
87 Symbol_Data => No_Symbols,
88 Interfaces_Defined => False,
89 Source_Dirs => Nil_String,
90 Source_Dir_Ranks => No_Number_List,
91 Object_Directory => No_Path_Information,
92 Library_TS => Empty_Time_Stamp,
93 Exec_Directory => No_Path_Information,
94 Extends => No_Project,
95 Extended_By => No_Project,
96 Languages => No_Language_Index,
97 Decl => No_Declarations,
98 Imported_Projects => null,
99 Include_Path_File => No_Path,
100 All_Imported_Projects => null,
101 Ada_Include_Path => null,
102 Ada_Objects_Path => null,
103 Objects_Path => null,
104 Objects_Path_File_With_Libs => No_Path,
105 Objects_Path_File_Without_Libs => No_Path,
106 Config_File_Name => No_Path,
107 Config_File_Temp => False,
108 Config_Checked => False,
109 Need_To_Build_Lib => False,
111 Unkept_Comments => False);
113 procedure Free (Project : in out Project_Id);
114 -- Free memory allocated for Project
116 procedure Free_List (Languages : in out Language_Ptr);
117 procedure Free_List (Source : in out Source_Id);
118 procedure Free_List (Languages : in out Language_List);
119 -- Free memory allocated for the list of languages or sources
121 procedure Free_Units (Table : in out Units_Htable.Instance);
122 -- Free memory allocated for unit information in the project
124 procedure Language_Changed (Iter : in out Source_Iterator);
125 procedure Project_Changed (Iter : in out Source_Iterator);
126 -- Called when a new project or language was selected for this iterator
128 function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean;
129 -- Return True if there is at least one ALI file in the directory Dir
135 procedure Add_To_Buffer
137 To : in out String_Access;
138 Last : in out Natural)
142 To := new String (1 .. Initial_Buffer_Size);
146 -- If Buffer is too small, double its size
148 while Last + S'Length > To'Last loop
150 New_Buffer : constant String_Access :=
151 new String (1 .. 2 * Last);
154 New_Buffer (1 .. Last) := To (1 .. Last);
160 To (Last + 1 .. Last + S'Length) := S;
161 Last := Last + S'Length;
164 ---------------------------
165 -- Delete_Temporary_File --
166 ---------------------------
168 procedure Delete_Temporary_File
169 (Tree : Project_Tree_Ref;
170 Path : Path_Name_Type)
173 pragma Warnings (Off, Dont_Care);
176 if not Debug.Debug_Flag_N then
177 if Current_Verbosity = High then
178 Write_Line ("Removing temp file: " & Get_Name_String (Path));
181 Delete_File (Get_Name_String (Path), Dont_Care);
184 1 .. Temp_Files_Table.Last (Tree.Private_Part.Temp_Files)
186 if Tree.Private_Part.Temp_Files.Table (Index) = Path then
187 Tree.Private_Part.Temp_Files.Table (Index) := No_Path;
191 end Delete_Temporary_File;
193 ---------------------------
194 -- Delete_All_Temp_Files --
195 ---------------------------
197 procedure Delete_All_Temp_Files (Tree : Project_Tree_Ref) is
199 pragma Warnings (Off, Dont_Care);
201 Path : Path_Name_Type;
204 if not Debug.Debug_Flag_N then
206 1 .. Temp_Files_Table.Last (Tree.Private_Part.Temp_Files)
208 Path := Tree.Private_Part.Temp_Files.Table (Index);
210 if Path /= No_Path then
211 if Current_Verbosity = High then
212 Write_Line ("Removing temp file: "
213 & Get_Name_String (Path));
216 Delete_File (Get_Name_String (Path), Dont_Care);
220 Temp_Files_Table.Free (Tree.Private_Part.Temp_Files);
221 Temp_Files_Table.Init (Tree.Private_Part.Temp_Files);
224 -- If any of the environment variables ADA_PRJ_INCLUDE_FILE or
225 -- ADA_PRJ_OBJECTS_FILE has been set, then reset their value to
226 -- the empty string. On VMS, this has the effect of deassigning
227 -- the logical names.
229 if Tree.Private_Part.Current_Source_Path_File /= No_Path then
230 Setenv (Project_Include_Path_File, "");
233 if Tree.Private_Part.Current_Object_Path_File /= No_Path then
234 Setenv (Project_Objects_Path_File, "");
236 end Delete_All_Temp_Files;
238 ---------------------
239 -- Dependency_Name --
240 ---------------------
242 function Dependency_Name
243 (Source_File_Name : File_Name_Type;
244 Dependency : Dependency_File_Kind) return File_Name_Type
255 (Source_File_Name, Makefile_Dependency_Suffix));
261 (Source_File_Name, ALI_Dependency_Suffix));
269 function Empty_File return File_Name_Type is
271 return File_Name_Type (The_Empty_String);
278 function Empty_Project return Project_Data is
280 Prj.Initialize (Tree => No_Project_Tree);
281 return Project_Empty;
288 function Empty_String return Name_Id is
290 return The_Empty_String;
297 procedure Expect (The_Token : Token_Type; Token_Image : String) is
299 if Token /= The_Token then
300 -- ??? Should pass user flags here instead
301 Error_Msg (Gnatmake_Flags, Token_Image & " expected", Token_Ptr);
310 (File : File_Name_Type;
311 With_Suffix : String) return File_Name_Type
316 Get_Name_String (File);
317 Last := Name_Len + 1;
319 while Name_Len /= 0 and then Name_Buffer (Name_Len) /= '.' loop
320 Name_Len := Name_Len - 1;
323 if Name_Len <= 1 then
327 for J in With_Suffix'Range loop
328 Name_Buffer (Name_Len) := With_Suffix (J);
329 Name_Len := Name_Len + 1;
332 Name_Len := Name_Len - 1;
337 ---------------------
338 -- Project_Changed --
339 ---------------------
341 procedure Project_Changed (Iter : in out Source_Iterator) is
343 Iter.Language := Iter.Project.Project.Languages;
344 Language_Changed (Iter);
347 ----------------------
348 -- Language_Changed --
349 ----------------------
351 procedure Language_Changed (Iter : in out Source_Iterator) is
353 Iter.Current := No_Source;
355 if Iter.Language_Name /= No_Name then
356 while Iter.Language /= null
357 and then Iter.Language.Name /= Iter.Language_Name
359 Iter.Language := Iter.Language.Next;
363 -- If there is no matching language in this project, move to next
365 if Iter.Language = No_Language_Index then
366 if Iter.All_Projects then
367 Iter.Project := Iter.Project.Next;
369 if Iter.Project /= null then
370 Project_Changed (Iter);
374 Iter.Project := null;
378 Iter.Current := Iter.Language.First_Source;
380 if Iter.Current = No_Source then
381 Iter.Language := Iter.Language.Next;
382 Language_Changed (Iter);
385 end Language_Changed;
387 ---------------------
388 -- For_Each_Source --
389 ---------------------
391 function For_Each_Source
392 (In_Tree : Project_Tree_Ref;
393 Project : Project_Id := No_Project;
394 Language : Name_Id := No_Name) return Source_Iterator
396 Iter : Source_Iterator;
398 Iter := Source_Iterator'
400 Project => In_Tree.Projects,
401 All_Projects => Project = No_Project,
402 Language_Name => Language,
403 Language => No_Language_Index,
404 Current => No_Source);
406 if Project /= null then
407 while Iter.Project /= null
408 and then Iter.Project.Project /= Project
410 Iter.Project := Iter.Project.Next;
414 Project_Changed (Iter);
423 function Element (Iter : Source_Iterator) return Source_Id is
432 procedure Next (Iter : in out Source_Iterator) is
434 Iter.Current := Iter.Current.Next_In_Lang;
435 if Iter.Current = No_Source then
436 Iter.Language := Iter.Language.Next;
437 Language_Changed (Iter);
441 --------------------------------
442 -- For_Every_Project_Imported --
443 --------------------------------
445 procedure For_Every_Project_Imported
447 With_State : in out State;
448 Imported_First : Boolean := False)
450 use Project_Boolean_Htable;
451 Seen : Project_Boolean_Htable.Instance := Project_Boolean_Htable.Nil;
453 procedure Recursive_Check (Project : Project_Id);
454 -- Check if a project has already been seen. If not seen, mark it as
455 -- Seen, Call Action, and check all its imported projects.
457 ---------------------
458 -- Recursive_Check --
459 ---------------------
461 procedure Recursive_Check (Project : Project_Id) is
465 if not Get (Seen, Project) then
466 Set (Seen, Project, True);
468 if not Imported_First then
469 Action (Project, With_State);
472 -- Visited all extended projects
474 if Project.Extends /= No_Project then
475 Recursive_Check (Project.Extends);
478 -- Visited all imported projects
480 List := Project.Imported_Projects;
481 while List /= null loop
482 Recursive_Check (List.Project);
486 if Imported_First then
487 Action (Project, With_State);
492 -- Start of processing for For_Every_Project_Imported
495 Recursive_Check (Project => By);
497 end For_Every_Project_Imported;
504 (In_Tree : Project_Tree_Ref;
505 Project : Project_Id;
506 In_Imported_Only : Boolean := False;
507 In_Extended_Only : Boolean := False;
508 Base_Name : File_Name_Type) return Source_Id
510 Result : Source_Id := No_Source;
512 procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id);
513 -- Look for Base_Name in the sources of Proj
515 ----------------------
516 -- Look_For_Sources --
517 ----------------------
519 procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id) is
520 Iterator : Source_Iterator;
523 Iterator := For_Each_Source (In_Tree => In_Tree, Project => Proj);
524 while Element (Iterator) /= No_Source loop
525 if Element (Iterator).File = Base_Name then
526 Src := Element (Iterator);
532 end Look_For_Sources;
534 procedure For_Imported_Projects is new For_Every_Project_Imported
535 (State => Source_Id, Action => Look_For_Sources);
539 -- Start of processing for Find_Source
542 if In_Extended_Only then
544 while Proj /= No_Project loop
545 Look_For_Sources (Proj, Result);
546 exit when Result /= No_Source;
548 Proj := Proj.Extends;
551 elsif In_Imported_Only then
552 Look_For_Sources (Project, Result);
554 if Result = No_Source then
555 For_Imported_Projects
557 With_State => Result);
560 Look_For_Sources (No_Project, Result);
570 function Hash is new System.HTable.Hash (Header_Num => Header_Num);
571 -- Used in implementation of other functions Hash below
573 function Hash (Name : File_Name_Type) return Header_Num is
575 return Hash (Get_Name_String (Name));
578 function Hash (Name : Name_Id) return Header_Num is
580 return Hash (Get_Name_String (Name));
583 function Hash (Name : Path_Name_Type) return Header_Num is
585 return Hash (Get_Name_String (Name));
588 function Hash (Project : Project_Id) return Header_Num is
590 if Project = No_Project then
591 return Header_Num'First;
593 return Hash (Get_Name_String (Project.Name));
601 function Image (The_Casing : Casing_Type) return String is
603 return The_Casing_Images (The_Casing).all;
606 -----------------------------
607 -- Is_Standard_GNAT_Naming --
608 -----------------------------
610 function Is_Standard_GNAT_Naming
611 (Naming : Lang_Naming_Data) return Boolean
614 return Get_Name_String (Naming.Spec_Suffix) = ".ads"
615 and then Get_Name_String (Naming.Body_Suffix) = ".adb"
616 and then Get_Name_String (Naming.Dot_Replacement) = "-";
617 end Is_Standard_GNAT_Naming;
623 procedure Initialize (Tree : Project_Tree_Ref) is
625 if The_Empty_String = No_Name then
628 The_Empty_String := Name_Find;
631 Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
632 Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
633 Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
636 if Tree /= No_Project_Tree then
645 function Is_Extending
646 (Extending : Project_Id;
647 Extended : Project_Id) return Boolean
653 while Proj /= No_Project loop
654 if Proj = Extended then
658 Proj := Proj.Extends;
669 (Source_File_Name : File_Name_Type;
670 Object_File_Suffix : Name_Id := No_Name) return File_Name_Type
673 if Object_File_Suffix = No_Name then
675 (Source_File_Name, Object_Suffix);
678 (Source_File_Name, Get_Name_String (Object_File_Suffix));
682 ----------------------
683 -- Record_Temp_File --
684 ----------------------
686 procedure Record_Temp_File
687 (Tree : Project_Tree_Ref;
688 Path : Path_Name_Type)
691 Temp_Files_Table.Append (Tree.Private_Part.Temp_Files, Path);
692 end Record_Temp_File;
698 procedure Free (Project : in out Project_Id) is
699 procedure Unchecked_Free is new Ada.Unchecked_Deallocation
700 (Project_Data, Project_Id);
703 if Project /= null then
704 Free (Project.Ada_Include_Path);
705 Free (Project.Objects_Path);
706 Free (Project.Ada_Objects_Path);
707 Free_List (Project.Imported_Projects, Free_Project => False);
708 Free_List (Project.All_Imported_Projects, Free_Project => False);
709 Free_List (Project.Languages);
711 Unchecked_Free (Project);
719 procedure Free_List (Languages : in out Language_List) is
720 procedure Unchecked_Free is new Ada.Unchecked_Deallocation
721 (Language_List_Element, Language_List);
724 while Languages /= null loop
725 Tmp := Languages.Next;
726 Unchecked_Free (Languages);
735 procedure Free_List (Source : in out Source_Id) is
736 procedure Unchecked_Free is new
737 Ada.Unchecked_Deallocation (Source_Data, Source_Id);
742 while Source /= No_Source loop
743 Tmp := Source.Next_In_Lang;
744 Free_List (Source.Alternate_Languages);
746 if Source.Unit /= null
747 and then Source.Kind in Spec_Or_Body
749 Source.Unit.File_Names (Source.Kind) := null;
752 Unchecked_Free (Source);
762 (List : in out Project_List;
763 Free_Project : Boolean)
765 procedure Unchecked_Free is new
766 Ada.Unchecked_Deallocation (Project_List_Element, Project_List);
771 while List /= null loop
778 Unchecked_Free (List);
787 procedure Free_List (Languages : in out Language_Ptr) is
788 procedure Unchecked_Free is new
789 Ada.Unchecked_Deallocation (Language_Data, Language_Ptr);
794 while Languages /= null loop
795 Tmp := Languages.Next;
796 Free_List (Languages.First_Source);
797 Unchecked_Free (Languages);
806 procedure Free_Units (Table : in out Units_Htable.Instance) is
807 procedure Unchecked_Free is new
808 Ada.Unchecked_Deallocation (Unit_Data, Unit_Index);
813 Unit := Units_Htable.Get_First (Table);
814 while Unit /= No_Unit_Index loop
815 if Unit.File_Names (Spec) /= null then
816 Unit.File_Names (Spec).Unit := No_Unit_Index;
819 if Unit.File_Names (Impl) /= null then
820 Unit.File_Names (Impl).Unit := No_Unit_Index;
823 Unchecked_Free (Unit);
824 Unit := Units_Htable.Get_Next (Table);
827 Units_Htable.Reset (Table);
834 procedure Free (Tree : in out Project_Tree_Ref) is
835 procedure Unchecked_Free is new
836 Ada.Unchecked_Deallocation (Project_Tree_Data, Project_Tree_Ref);
840 Name_List_Table.Free (Tree.Name_Lists);
841 Number_List_Table.Free (Tree.Number_Lists);
842 String_Element_Table.Free (Tree.String_Elements);
843 Variable_Element_Table.Free (Tree.Variable_Elements);
844 Array_Element_Table.Free (Tree.Array_Elements);
845 Array_Table.Free (Tree.Arrays);
846 Package_Table.Free (Tree.Packages);
847 Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
849 Free_List (Tree.Projects, Free_Project => True);
850 Free_Units (Tree.Units_HT);
854 Temp_Files_Table.Free (Tree.Private_Part.Temp_Files);
856 Unchecked_Free (Tree);
864 procedure Reset (Tree : Project_Tree_Ref) is
868 Name_List_Table.Init (Tree.Name_Lists);
869 Number_List_Table.Init (Tree.Number_Lists);
870 String_Element_Table.Init (Tree.String_Elements);
871 Variable_Element_Table.Init (Tree.Variable_Elements);
872 Array_Element_Table.Init (Tree.Array_Elements);
873 Array_Table.Init (Tree.Arrays);
874 Package_Table.Init (Tree.Packages);
875 Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
877 Free_List (Tree.Projects, Free_Project => True);
878 Free_Units (Tree.Units_HT);
880 -- Private part table
882 Temp_Files_Table.Init (Tree.Private_Part.Temp_Files);
884 Tree.Private_Part.Current_Source_Path_File := No_Path;
885 Tree.Private_Part.Current_Object_Path_File := No_Path;
892 function Switches_Name
893 (Source_File_Name : File_Name_Type) return File_Name_Type
896 return Extend_Name (Source_File_Name, Switches_Dependency_Suffix);
903 function Value (Image : String) return Casing_Type is
905 for Casing in The_Casing_Images'Range loop
906 if To_Lower (Image) = To_Lower (The_Casing_Images (Casing).all) then
911 raise Constraint_Error;
914 ---------------------
915 -- Has_Ada_Sources --
916 ---------------------
918 function Has_Ada_Sources (Data : Project_Id) return Boolean is
922 Lang := Data.Languages;
923 while Lang /= No_Language_Index loop
924 if Lang.Name = Name_Ada then
925 return Lang.First_Source /= No_Source;
933 ------------------------
934 -- Contains_ALI_Files --
935 ------------------------
937 function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean is
938 Dir_Name : constant String := Get_Name_String (Dir);
940 Name : String (1 .. 1_000);
942 Result : Boolean := False;
945 Open (Direct, Dir_Name);
947 -- For each file in the directory, check if it is an ALI file
950 Read (Direct, Name, Last);
952 Canonical_Case_File_Name (Name (1 .. Last));
953 Result := Last >= 5 and then Name (Last - 3 .. Last) = ".ali";
961 -- If there is any problem, close the directory if open and return True.
962 -- The library directory will be added to the path.
965 if Is_Open (Direct) then
970 end Contains_ALI_Files;
972 --------------------------
973 -- Get_Object_Directory --
974 --------------------------
976 function Get_Object_Directory
977 (Project : Project_Id;
978 Including_Libraries : Boolean;
979 Only_If_Ada : Boolean := False) return Path_Name_Type
982 if (Project.Library and then Including_Libraries)
984 (Project.Object_Directory /= No_Path_Information
985 and then (not Including_Libraries or else not Project.Library))
987 -- For a library project, add the library ALI directory if there is
988 -- no object directory or if the library ALI directory contains ALI
989 -- files; otherwise add the object directory.
991 if Project.Library then
992 if Project.Object_Directory = No_Path_Information
993 or else Contains_ALI_Files (Project.Library_ALI_Dir.Name)
995 return Project.Library_ALI_Dir.Name;
997 return Project.Object_Directory.Name;
1000 -- For a non-library project, add object directory if it is not a
1001 -- virtual project, and if there are Ada sources in the project or
1002 -- one of the projects it extends. If there are no Ada sources,
1003 -- adding the object directory could disrupt the order of the
1004 -- object dirs in the path.
1006 elsif not Project.Virtual then
1008 Add_Object_Dir : Boolean;
1012 Add_Object_Dir := not Only_If_Ada;
1014 while not Add_Object_Dir and then Prj /= No_Project loop
1015 if Has_Ada_Sources (Prj) then
1016 Add_Object_Dir := True;
1022 if Add_Object_Dir then
1023 return Project.Object_Directory.Name;
1030 end Get_Object_Directory;
1032 -----------------------------------
1033 -- Ultimate_Extending_Project_Of --
1034 -----------------------------------
1036 function Ultimate_Extending_Project_Of
1037 (Proj : Project_Id) return Project_Id
1043 while Prj /= null and then Prj.Extended_By /= No_Project loop
1044 Prj := Prj.Extended_By;
1048 end Ultimate_Extending_Project_Of;
1050 -----------------------------------
1051 -- Compute_All_Imported_Projects --
1052 -----------------------------------
1054 procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
1055 Project : Project_Id;
1057 procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean);
1058 -- Recursively add the projects imported by project Project, but not
1059 -- those that are extended.
1065 procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean) is
1066 pragma Unreferenced (Dummy);
1067 List : Project_List;
1071 -- A project is not importing itself
1073 Prj2 := Ultimate_Extending_Project_Of (Prj);
1075 if Project /= Prj2 then
1077 -- Check that the project is not already in the list. We know the
1078 -- one passed to Recursive_Add have never been visited before, but
1079 -- the one passed it are the extended projects.
1081 List := Project.All_Imported_Projects;
1082 while List /= null loop
1083 if List.Project = Prj2 then
1090 -- Add it to the list
1092 Project.All_Imported_Projects :=
1093 new Project_List_Element'
1095 Next => Project.All_Imported_Projects);
1099 procedure For_All_Projects is
1100 new For_Every_Project_Imported (Boolean, Recursive_Add);
1102 Dummy : Boolean := False;
1103 List : Project_List;
1106 List := Tree.Projects;
1107 while List /= null loop
1108 Project := List.Project;
1109 Free_List (Project.All_Imported_Projects, Free_Project => False);
1110 For_All_Projects (Project, Dummy);
1113 end Compute_All_Imported_Projects;
1119 function Is_Compilable (Source : Source_Id) return Boolean is
1121 return Source.Language.Config.Compiler_Driver /= No_File
1122 and then Length_Of_Name (Source.Language.Config.Compiler_Driver) /= 0
1123 and then not Source.Locally_Removed;
1126 ------------------------------
1127 -- Object_To_Global_Archive --
1128 ------------------------------
1130 function Object_To_Global_Archive (Source : Source_Id) return Boolean is
1132 return Source.Language.Config.Kind = File_Based
1133 and then Source.Kind = Impl
1134 and then Source.Language.Config.Objects_Linked
1135 and then Is_Compilable (Source)
1136 and then Source.Language.Config.Object_Generated;
1137 end Object_To_Global_Archive;
1139 ----------------------------
1140 -- Get_Language_From_Name --
1141 ----------------------------
1143 function Get_Language_From_Name
1144 (Project : Project_Id;
1145 Name : String) return Language_Ptr
1148 Result : Language_Ptr;
1151 Name_Len := Name'Length;
1152 Name_Buffer (1 .. Name_Len) := Name;
1153 To_Lower (Name_Buffer (1 .. Name_Len));
1156 Result := Project.Languages;
1157 while Result /= No_Language_Index loop
1158 if Result.Name = N then
1162 Result := Result.Next;
1165 return No_Language_Index;
1166 end Get_Language_From_Name;
1172 function Other_Part (Source : Source_Id) return Source_Id is
1174 if Source.Unit /= No_Unit_Index then
1177 return Source.Unit.File_Names (Spec);
1179 return Source.Unit.File_Names (Impl);
1192 function Create_Flags
1193 (Report_Error : Error_Handler;
1194 When_No_Sources : Error_Warning;
1195 Require_Sources_Other_Lang : Boolean := True;
1196 Allow_Duplicate_Basenames : Boolean := True;
1197 Compiler_Driver_Mandatory : Boolean := False;
1198 Error_On_Unknown_Language : Boolean := True;
1199 Require_Obj_Dirs : Error_Warning := Error)
1200 return Processing_Flags
1203 return Processing_Flags'
1204 (Report_Error => Report_Error,
1205 When_No_Sources => When_No_Sources,
1206 Require_Sources_Other_Lang => Require_Sources_Other_Lang,
1207 Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
1208 Error_On_Unknown_Language => Error_On_Unknown_Language,
1209 Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
1210 Require_Obj_Dirs => Require_Obj_Dirs);
1218 (Table : Name_List_Table.Instance;
1219 List : Name_List_Index) return Natural
1221 Count : Natural := 0;
1222 Tmp : Name_List_Index;
1226 while Tmp /= No_Name_List loop
1228 Tmp := Table.Table (Tmp).Next;
1235 -- Make sure that the standard config and user project file extensions are
1236 -- compatible with canonical case file naming.
1238 Canonical_Case_File_Name (Config_Project_File_Extension);
1239 Canonical_Case_File_Name (Project_File_Extension);