diff options
Diffstat (limited to 'gcc/ada/prj-makr.adb')
-rw-r--r-- | gcc/ada/prj-makr.adb | 765 |
1 files changed, 476 insertions, 289 deletions
diff --git a/gcc/ada/prj-makr.adb b/gcc/ada/prj-makr.adb index 8278910825e..efbbad2a0b8 100644 --- a/gcc/ada/prj-makr.adb +++ b/gcc/ada/prj-makr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2002 Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -30,11 +30,11 @@ with Opt; with Output; with Osint; use Osint; with Prj; use Prj; +with Prj.Com; with Prj.Part; with Prj.PP; with Prj.Tree; use Prj.Tree; with Snames; use Snames; -with Stringt; use Stringt; with Table; use Table; with Ada.Characters.Handling; use Ada.Characters.Handling; @@ -46,6 +46,9 @@ with GNAT.Regpat; use GNAT.Regpat; package body Prj.Makr is + Non_Empty_Node : constant Project_Node_Id := 1; + -- Used for the With_Clause of the naming project + type Matched_Type is (True, False, Excluded); Naming_File_Suffix : constant String := "_naming"; @@ -63,6 +66,14 @@ package body Prj.Makr is procedure Write_A_String (S : String); -- Write a String to Output_FD + package Processed_Directories is new Table.Table + (Table_Component_Type => String_Access, + Table_Index_Type => Natural, + Table_Low_Bound => 0, + Table_Initial => 10, + Table_Increment => 10, + Table_Name => "Prj.Makr.Processed_Directories"); + ---------- -- Make -- ---------- @@ -73,10 +84,12 @@ package body Prj.Makr is Directories : Argument_List; Name_Patterns : Argument_List; Excluded_Patterns : Argument_List; + Foreign_Patterns : Argument_List; + Preproc_Switches : Argument_List; Very_Verbose : Boolean) is Path_Name : String (1 .. File_Path'Length + - Project_File_Extension'Length); + Project_File_Extension'Length); Path_Last : Natural := File_Path'Length; Directory_Last : Natural := 0; @@ -95,41 +108,36 @@ package body Prj.Makr is Naming_Package : Project_Node_Id := Empty_Node; Project_Naming_File_Name : String (1 .. Output_Name'Length + - Naming_File_Suffix'Length); + Naming_File_Suffix'Length); Project_Naming_Last : Natural; Project_Naming_Id : Name_Id := No_Name; Excluded_Expressions : array (Excluded_Patterns'Range) of Regexp; Regular_Expressions : array (Name_Patterns'Range) of Regexp; + Foreign_Expressions : array (Foreign_Patterns'Range) of Regexp; Source_List_Path : String (1 .. Output_Name'Length + - Source_List_File_Suffix'Length); + Source_List_File_Suffix'Length); Source_List_Last : Natural; Source_List_FD : File_Descriptor; - Str : String (1 .. 2_000); - Last : Natural; - Dir : Dir_Type; - - PD : Process_Descriptor; - Result : Expect_Match; Matcher : constant Pattern_Matcher := Compile (Expression => "expected|Unit.*\)|No such"); - Args : Argument_List := - (1 => new String'("-c"), - 2 => new String'("-gnats"), - 3 => new String'("-gnatu"), - 4 => new String'("-x"), - 5 => new String'("ada"), - 6 => null); + Args : Argument_List (1 .. Preproc_Switches'Length + 6); +-- (1 => new String'("-c"), +-- 2 => new String'("-gnats"), +-- 3 => new String'("-gnatu"), +-- 4 => new String'("-x"), +-- 5 => new String'("ada"), +-- 6 => null); type SFN_Pragma is record - Unit : String_Access; - File : String_Access; - Spec : Boolean; + Unit : String_Access; + File : String_Access; + Spec : Boolean; end record; package SFN_Pragmas is new Table.Table @@ -140,6 +148,338 @@ package body Prj.Makr is Table_Increment => 50, Table_Name => "Prj.Makr.SFN_Pragmas"); + procedure Process_Directory (Dir_Name : String; Recursively : Boolean); + -- Look for Ada and foreign sources in a directory, according to the + -- patterns. When Recursively is True, after looking for sources in + -- Dir_Name, look also in its subdirectories, if any. + + ----------------------- + -- Process_Directory -- + ----------------------- + + procedure Process_Directory (Dir_Name : String; Recursively : Boolean) is + Matched : Matched_Type := False; + Str : String (1 .. 2_000); + Last : Natural; + Dir : Dir_Type; + Process : Boolean := True; + + begin + if Opt.Verbose_Mode then + Output.Write_Str ("Processing directory """); + Output.Write_Str (Dir_Name); + Output.Write_Line (""""); + end if; + + -- Avoid processing several times the same directory. + + for Index in 1 .. Processed_Directories.Last loop + if Processed_Directories.Table (Index).all = Dir_Name then + Process := False; + exit; + end if; + end loop; + + if Process then + Processed_Directories. Increment_Last; + Processed_Directories.Table (Processed_Directories.Last) := + new String'(Dir_Name); + -- Get the source file names from the directory. + -- Fails if the directory does not exist. + + begin + Open (Dir, Dir_Name); + + exception + when Directory_Error => + Prj.Com.Fail ("cannot open directory """, Dir_Name, """"); + end; + + -- Process each regular file in the directory + + loop + Read (Dir, Str, Last); + exit when Last = 0; + + if Is_Regular_File + (Dir_Name & Directory_Separator & Str (1 .. Last)) + then + Matched := True; + + -- First, check if the file name matches at least one of + -- the excluded expressions; + + for Index in Excluded_Expressions'Range loop + if + Match (Str (1 .. Last), Excluded_Expressions (Index)) + then + Matched := Excluded; + exit; + end if; + end loop; + + -- If it does not match any of the excluded expressions, + -- check if the file name matches at least one of the + -- regular expressions. + + if Matched = True then + Matched := False; + + for Index in Regular_Expressions'Range loop + if + Match (Str (1 .. Last), Regular_Expressions (Index)) + then + Matched := True; + exit; + end if; + end loop; + end if; + + if Very_Verbose + or else (Matched = True and then Opt.Verbose_Mode) + then + Output.Write_Str (" Checking """); + Output.Write_Str (Str (1 .. Last)); + Output.Write_Str (""": "); + end if; + + -- If the file name matches one of the regular expressions, + -- parse it to get its unit name. + + if Matched = True then + declare + PD : Process_Descriptor; + Result : Expect_Match; + + begin + Args (Args'Last) := new String' + (Dir_Name & + Directory_Separator & + Str (1 .. Last)); + + begin + Non_Blocking_Spawn + (PD, "gcc", Args, Err_To_Out => True); + Expect (PD, Result, Matcher); + + exception + when Process_Died => + if Opt.Verbose_Mode then + Output.Write_Str ("(process died) "); + end if; + + Result := Expect_Timeout; + end; + + if Result /= Expect_Timeout then + + -- If we got a unit name, this is a valid source + -- file. + + declare + S : constant String := Expect_Out_Match (PD); + + begin + if S'Length >= 13 + and then S (S'First .. S'First + 3) = "Unit" + then + if Opt.Verbose_Mode then + Output.Write_Str + (S (S'Last - 4 .. S'Last - 1)); + Output.Write_Str (" of "); + Output.Write_Line + (S (S'First + 5 .. S'Last - 7)); + end if; + + if Project_File then + + -- Add the corresponding attribute in the + -- Naming package of the naming project. + + declare + Decl_Item : constant Project_Node_Id := + Default_Project_Node + (Of_Kind => + N_Declarative_Item); + + Attribute : constant Project_Node_Id := + Default_Project_Node + (Of_Kind => + N_Attribute_Declaration); + + Expression : constant Project_Node_Id := + Default_Project_Node + (Of_Kind => N_Expression, + And_Expr_Kind => Single); + + Term : constant Project_Node_Id := + Default_Project_Node + (Of_Kind => N_Term, + And_Expr_Kind => Single); + + Value : constant Project_Node_Id := + Default_Project_Node + (Of_Kind => N_Literal_String, + And_Expr_Kind => Single); + + begin + Set_Next_Declarative_Item + (Decl_Item, + To => First_Declarative_Item_Of + (Naming_Package)); + Set_First_Declarative_Item_Of + (Naming_Package, To => Decl_Item); + Set_Current_Item_Node + (Decl_Item, To => Attribute); + + if + S (S'Last - 5 .. S'Last) = "(spec)" + then + Set_Name_Of + (Attribute, To => Name_Spec); + else + Set_Name_Of + (Attribute, + To => Name_Body); + end if; + + Name_Len := S'Last - S'First - 11; + Name_Buffer (1 .. Name_Len) := + (To_Lower + (S (S'First + 5 .. S'Last - 7))); + Set_Associative_Array_Index_Of + (Attribute, To => Name_Find); + + Set_Expression_Of + (Attribute, To => Expression); + Set_First_Term (Expression, To => Term); + Set_Current_Term (Term, To => Value); + + Name_Len := Last; + Name_Buffer (1 .. Name_Len) := + Str (1 .. Last); + Set_String_Value_Of + (Value, To => Name_Find); + end; + + -- Add source file name to source list + -- file. + + Last := Last + 1; + Str (Last) := ASCII.LF; + + if Write (Source_List_FD, + Str (1)'Address, + Last) /= Last + then + Prj.Com.Fail ("disk full"); + end if; + else + -- Add an entry in the SFN_Pragmas table + + SFN_Pragmas.Increment_Last; + SFN_Pragmas.Table (SFN_Pragmas.Last) := + (Unit => new String' + (S (S'First + 5 .. S'Last - 7)), + File => new String'(Str (1 .. Last)), + Spec => S (S'Last - 5 .. S'Last) + = "(spec)"); + end if; + + else + if Opt.Verbose_Mode then + Output.Write_Line ("not a unit"); + end if; + end if; + end; + + else + if Opt.Verbose_Mode then + Output.Write_Line ("not a unit"); + end if; + end if; + + Close (PD); + end; + + else + if Matched = False then + -- Look if this is a foreign source + + for Index in Foreign_Expressions'Range loop + if Match (Str (1 .. Last), + Foreign_Expressions (Index)) + then + Matched := True; + exit; + end if; + end loop; + end if; + + if Very_Verbose then + case Matched is + when False => + Output.Write_Line ("no match"); + + when Excluded => + Output.Write_Line ("excluded"); + + when True => + Output.Write_Line ("foreign source"); + end case; + end if; + + if Project_File and Matched = True then + + -- Add source file name to source list file + + Last := Last + 1; + Str (Last) := ASCII.LF; + + if Write (Source_List_FD, + Str (1)'Address, + Last) /= Last + then + Prj.Com.Fail ("disk full"); + end if; + end if; + end if; + end if; + end loop; + + Close (Dir); + end if; + + -- If Recursively is True, call itself for each subdirectory. + -- We do that, even when this directory has already been processed, + -- because all of its subdirectories may not have been processed. + + if Recursively then + Open (Dir, Dir_Name); + + loop + Read (Dir, Str, Last); + exit when Last = 0; + + -- Do not call itself for "." or ".." + + if Is_Directory + (Dir_Name & Directory_Separator & Str (1 .. Last)) + and then Str (1 .. Last) /= "." + and then Str (1 .. Last) /= ".." + then + Process_Directory + (Dir_Name & Directory_Separator & Str (1 .. Last), + Recursively => True); + end if; + end loop; + + Close (Dir); + end if; + end Process_Directory; + + -- Start of processing for Make + begin -- Do some needed initializations @@ -150,6 +490,17 @@ package body Prj.Makr is SFN_Pragmas.Set_Last (0); + Processed_Directories.Set_Last (0); + + -- Initialize the compiler switches + + Args (1) := new String'("-c"); + Args (2) := new String'("-gnats"); + Args (3) := new String'("-gnatu"); + Args (4 .. 3 + Preproc_Switches'Length) := Preproc_Switches; + Args (4 + Preproc_Switches'Length) := new String'("-x"); + Args (5 + Preproc_Switches'Length) := new String'("ada"); + -- Get the path and file names if File_Names_Case_Sensitive then @@ -173,8 +524,8 @@ package body Prj.Makr is if Project_File then if Path_Last < Project_File_Extension'Length + 1 or else Path_Name - (Path_Last - Project_File_Extension'Length + 1 .. Path_Last) - /= Project_File_Extension + (Path_Last - Project_File_Extension'Length + 1 .. Path_Last) + /= Project_File_Extension then Path_Last := Path_Name'Last; end if; @@ -201,7 +552,7 @@ package body Prj.Makr is Output_Name (1 .. Project_Naming_Last); Project_Naming_File_Name (Project_Naming_Last + 1 .. - Project_Naming_Last + Naming_File_Suffix'Length) := + Project_Naming_Last + Naming_File_Suffix'Length) := Naming_File_Suffix; Project_Naming_Last := Project_Naming_Last + Naming_File_Suffix'Length; @@ -215,7 +566,7 @@ package body Prj.Makr is Project_Naming_File_Name (Project_Naming_Last + 1 .. - Project_Naming_Last + Project_File_Extension'Length) := + Project_Naming_Last + Project_File_Extension'Length) := Project_File_Extension; Project_Naming_Last := Project_Naming_Last + Project_File_Extension'Length; @@ -227,7 +578,7 @@ package body Prj.Makr is Output_Name (1 .. Source_List_Last); Source_List_Path (Source_List_Last + 1 .. - Source_List_Last + Source_List_File_Suffix'Length) := + Source_List_Last + Source_List_File_Suffix'Length) := Source_List_File_Suffix; Source_List_Last := Source_List_Last + Source_List_File_Suffix'Length; @@ -235,7 +586,7 @@ package body Prj.Makr is Output_Name (Output_Name_Last + 1 .. - Output_Name_Last + Project_File_Extension'Length) := + Output_Name_Last + Project_File_Extension'Length) := Project_File_Extension; Output_Name_Last := Output_Name_Last + Project_File_Extension'Length; end if; @@ -248,8 +599,10 @@ package body Prj.Makr is Change_Dir (Path_Name (1 .. Directory_Last)); exception when Directory_Error => - Fail ("unknown directory """ & - Path_Name (1 .. Directory_Last) & '"'); + Prj.Com.Fail + ("unknown directory """, + Path_Name (1 .. Directory_Last), + """"); end; end if; @@ -274,8 +627,10 @@ package body Prj.Makr is Fmode => Text); if Source_List_FD = Invalid_FD then - Fail ("cannot create file """ & - Source_List_Path (1 .. Source_List_Last) & '"'); + Prj.Com.Fail + ("cannot create file """, + Source_List_Path (1 .. Source_List_Last), + """"); end if; end if; @@ -283,26 +638,62 @@ package body Prj.Makr is -- the specified strings is in error. for Index in Excluded_Expressions'Range loop + if Very_Verbose then + Output.Write_Str ("Excluded pattern: """); + Output.Write_Str (Excluded_Patterns (Index).all); + Output.Write_Line (""""); + end if; + begin Excluded_Expressions (Index) := Compile (Pattern => Excluded_Patterns (Index).all, Glob => True); exception when Error_In_Regexp => - Fail ("invalid regular expression """ & - Excluded_Patterns (Index).all & '"'); + Prj.Com.Fail + ("invalid regular expression """, + Excluded_Patterns (Index).all, + """"); + end; + end loop; + + for Index in Foreign_Expressions'Range loop + if Very_Verbose then + Output.Write_Str ("Foreign pattern: """); + Output.Write_Str (Foreign_Patterns (Index).all); + Output.Write_Line (""""); + end if; + + begin + Foreign_Expressions (Index) := + Compile (Pattern => Foreign_Patterns (Index).all, Glob => True); + + exception + when Error_In_Regexp => + Prj.Com.Fail + ("invalid regular expression """, + Foreign_Patterns (Index).all, + """"); end; end loop; for Index in Regular_Expressions'Range loop + if Very_Verbose then + Output.Write_Str ("Pattern: """); + Output.Write_Str (Name_Patterns (Index).all); + Output.Write_Line (""""); + end if; + begin Regular_Expressions (Index) := Compile (Pattern => Name_Patterns (Index).all, Glob => True); exception when Error_In_Regexp => - Fail ("invalid regular expression """ & - Name_Patterns (Index).all & '"'); + Prj.Com.Fail + ("invalid regular expression """, + Name_Patterns (Index).all, + """"); end; end loop; @@ -370,8 +761,9 @@ package body Prj.Makr is declare Declaration : Project_Node_Id := - First_Declarative_Item_Of - (Project_Declaration_Of (Project_Node)); + First_Declarative_Item_Of + (Project_Declaration_Of + (Project_Node)); Previous : Project_Node_Id := Empty_Node; Current_Node : Project_Node_Id := Empty_Node; @@ -381,14 +773,14 @@ package body Prj.Makr is if (Kind_Of (Current_Node) = N_Attribute_Declaration and then - (Tree.Name_Of (Current_Node) = Name_Source_Files - or else Tree.Name_Of (Current_Node) = - Name_Source_List_File - or else Tree.Name_Of (Current_Node) = - Name_Source_Dirs)) + (Tree.Name_Of (Current_Node) = Name_Source_Files + or else Tree.Name_Of (Current_Node) = + Name_Source_List_File + or else Tree.Name_Of (Current_Node) = + Name_Source_Dirs)) or else - (Kind_Of (Current_Node) = N_Package_Declaration - and then Tree.Name_Of (Current_Node) = Name_Naming) + (Kind_Of (Current_Node) = N_Package_Declaration + and then Tree.Name_Of (Current_Node) = Name_Naming) then if Previous = Empty_Node then Set_First_Declarative_Item_Of @@ -482,10 +874,17 @@ package body Prj.Makr is (With_Clause, To => First_With_Clause_Of (Project_Node)); Set_First_With_Clause_Of (Project_Node, To => With_Clause); Set_Name_Of (With_Clause, To => Project_Naming_Id); - Start_String; - Store_String_Chars - (Project_Naming_File_Name (1 .. Project_Naming_Last)); - Set_String_Value_Of (With_Clause, To => End_String); + + -- We set the project node to something different than + -- Empty_Node, so that Prj.PP does not generate a limited + -- with clause. + + Set_Project_Node_Of (With_Clause, Non_Empty_Node); + + Name_Len := Project_Naming_Last; + Name_Buffer (1 .. Name_Len) := + Project_Naming_File_Name (1 .. Project_Naming_Last); + Set_String_Value_Of (With_Clause, To => Name_Find); end; Project_Declaration := Project_Declaration_Of (Project_Node); @@ -586,9 +985,10 @@ package body Prj.Makr is Set_Expression_Of (Attribute, To => Expression); Set_First_Term (Expression, To => Term); Set_Current_Term (Term, To => Value); - Start_String; - Store_String_Chars (Source_List_Path (1 .. Source_List_Last)); - Set_String_Value_Of (Value, To => End_String); + Name_Len := Source_List_Last; + Name_Buffer (1 .. Name_Len) := + Source_List_Path (1 .. Source_List_Last); + Set_String_Value_Of (Value, To => Name_Find); end; end if; @@ -597,14 +997,15 @@ package body Prj.Makr is for Index in Directories'Range loop declare - Dir_Name : constant String := Directories (Index).all; - Matched : Matched_Type := False; - + Dir_Name : constant String := Directories (Index).all; + Last : Natural := Dir_Name'Last; + Recursively : Boolean := False; begin - if Opt.Verbose_Mode then - Output.Write_Str ("Processing directory """); - Output.Write_Str (Dir_Name); - Output.Write_Line (""""); + if Dir_Name'Length >= 4 + and then (Dir_Name (Last - 2 .. Last) = "/**") + then + Last := Last - 3; + Recursively := True; end if; if Project_File then @@ -639,233 +1040,15 @@ package body Prj.Makr is Current_Source_Dir := Expression; Set_First_Term (Expression, To => Term); Set_Current_Term (Term, To => Value); - Start_String; - Store_String_Chars (S => Dir_Name); - Set_String_Value_Of (Value, To => End_String); + Name_Len := Dir_Name'Length; + Name_Buffer (1 .. Name_Len) := Dir_Name; + Set_String_Value_Of (Value, To => Name_Find); end; end if; - -- Get the source file names from the directory. - -- Fails if the directory does not exist. - - begin - Open (Dir, Dir_Name); - - exception - when Directory_Error => - Fail ("cannot open directory """ & Dir_Name & '"'); - end; - - -- Process each regular file in the directory - - loop - Read (Dir, Str, Last); - exit when Last = 0; - - if Is_Regular_File - (Dir_Name & Directory_Separator & Str (1 .. Last)) - then - Matched := True; - - -- First, check if the file name matches at least one of - -- the excluded expressions; - - for Index in Excluded_Expressions'Range loop - if - Match (Str (1 .. Last), Excluded_Expressions (Index)) - then - Matched := Excluded; - exit; - end if; - end loop; - - -- If it does not match any of the excluded expressions, - -- check if the file name matches at least one of the - -- regular expressions. - - if Matched = True then - Matched := False; - for Index in Regular_Expressions'Range loop - if - Match (Str (1 .. Last), Regular_Expressions (Index)) - then - Matched := True; - exit; - end if; - end loop; - end if; - - if Very_Verbose - or else (Matched = True and then Opt.Verbose_Mode) - then - Output.Write_Str (" Checking """); - Output.Write_Str (Str (1 .. Last)); - Output.Write_Str (""": "); - end if; - - -- If the file name matches one of the regular expressions, - -- parse it to get its unit name. - - if Matched = True then - Args (6) := new String' - (Dir_Name & - Directory_Separator & - Str (1 .. Last)); - - begin - Non_Blocking_Spawn - (PD, "gcc", Args, Err_To_Out => True); - Expect (PD, Result, Matcher); - - exception - when Process_Died => - if Opt.Verbose_Mode then - Output.Write_Str ("(process died) "); - end if; - - Result := Expect_Timeout; - end; - - if Result /= Expect_Timeout then - - -- If we got a unit name, this is a valid source file - - declare - S : constant String := Expect_Out_Match (PD); - - begin - if S'Length >= 13 - and then S (S'First .. S'First + 3) = "Unit" - then - if Opt.Verbose_Mode then - Output.Write_Str - (S (S'Last - 4 .. S'Last - 1)); - Output.Write_Str (" of "); - Output.Write_Line - (S (S'First + 5 .. S'Last - 7)); - end if; - - if Project_File then - - -- Add the corresponding attribute in the - -- Naming package of the naming project. - - declare - Decl_Item : constant Project_Node_Id := - Default_Project_Node - (Of_Kind => - N_Declarative_Item); - - Attribute : constant Project_Node_Id := - Default_Project_Node - (Of_Kind => - N_Attribute_Declaration); - - Expression : constant Project_Node_Id := - Default_Project_Node - (Of_Kind => N_Expression, - And_Expr_Kind => Single); - - Term : constant Project_Node_Id := - Default_Project_Node - (Of_Kind => N_Term, - And_Expr_Kind => Single); - - Value : constant Project_Node_Id := - Default_Project_Node - (Of_Kind => N_Literal_String, - And_Expr_Kind => Single); - - begin - Set_Next_Declarative_Item - (Decl_Item, - To => First_Declarative_Item_Of - (Naming_Package)); - Set_First_Declarative_Item_Of - (Naming_Package, To => Decl_Item); - Set_Current_Item_Node - (Decl_Item, To => Attribute); - - if S (S'Last - 5 .. S'Last) = "(spec)" then - Set_Name_Of - (Attribute, To => Name_Specification); - else - Set_Name_Of - (Attribute, - To => Name_Implementation); - end if; - - Start_String; - Store_String_Chars - (To_Lower - (S (S'First + 5 .. S'Last - 7))); - Set_Associative_Array_Index_Of - (Attribute, To => End_String); - - Set_Expression_Of - (Attribute, To => Expression); - Set_First_Term (Expression, To => Term); - Set_Current_Term (Term, To => Value); - - Start_String; - Store_String_Chars (Str (1 .. Last)); - Set_String_Value_Of - (Value, To => End_String); - end; - - -- Add source file name to source list file - - Last := Last + 1; - Str (Last) := ASCII.LF; - - if Write (Source_List_FD, - Str (1)'Address, - Last) /= Last - then - Fail ("disk full"); - end if; - else - -- Add an entry in the SFN_Pragmas table - - SFN_Pragmas.Increment_Last; - SFN_Pragmas.Table (SFN_Pragmas.Last) := - (Unit => new String' - (S (S'First + 5 .. S'Last - 7)), - File => new String'(Str (1 .. Last)), - Spec => S (S'Last - 5 .. S'Last) - = "(spec)"); - end if; - - else - if Opt.Verbose_Mode then - Output.Write_Line ("not a unit"); - end if; - end if; - end; - - else - if Opt.Verbose_Mode then - Output.Write_Line ("not a unit"); - end if; - end if; - - Close (PD); - - else - if Very_Verbose then - if Matched = False then - Output.Write_Line ("no match"); - - else - Output.Write_Line ("excluded"); - end if; - end if; - end if; - end if; - end loop; - - Close (Dir); + Process_Directory (Dir_Name (Dir_Name'First .. Last), Recursively); end; + end loop; if Project_File then @@ -897,7 +1080,8 @@ package body Prj.Makr is -- Fails if project file cannot be created if Output_FD = Invalid_FD then - Fail ("cannot create new """ & Path_Name (1 .. Path_Last) & '"'); + Prj.Com.Fail + ("cannot create new """, Path_Name (1 .. Path_Last), """"); end if; if Project_File then @@ -908,7 +1092,8 @@ package body Prj.Makr is (Project_Node, W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, - W_Str => Write_A_String'Access); + W_Str => Write_A_String'Access, + Backward_Compatibility => False); Close (Output_FD); -- Delete the naming project file if it already exists @@ -922,7 +1107,7 @@ package body Prj.Makr is if Opt.Verbose_Mode then Output.Write_Str ("Creating new naming project file """); Output.Write_Str (Project_Naming_File_Name - (1 .. Project_Naming_Last)); + (1 .. Project_Naming_Last)); Output.Write_Line (""""); end if; @@ -933,9 +1118,10 @@ package body Prj.Makr is -- Fails if naming project file cannot be created if Output_FD = Invalid_FD then - Fail ("cannot create new """ & - Project_Naming_File_Name (1 .. Project_Naming_Last) & - '"'); + Prj.Com.Fail + ("cannot create new """, + Project_Naming_File_Name (1 .. Project_Naming_Last), + """"); end if; -- Output the naming project file @@ -944,7 +1130,8 @@ package body Prj.Makr is (Project_Naming_Node, W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, - W_Str => Write_A_String'Access); + W_Str => Write_A_String'Access, + Backward_Compatibility => False); Close (Output_FD); else @@ -1006,7 +1193,7 @@ package body Prj.Makr is Str := S; if Write (Output_FD, Str (1)'Address, Str'Length) /= Str'Length then - Fail ("disk full"); + Prj.Com.Fail ("disk full"); end if; end if; end Write_A_String; |