Commit c116b980 by Vincent Celier Committed by Arnaud Charlet

prj.adb, [...]: Remove declarations that were for gprmake only

2008-07-31  Vincent Celier  <celier@adacore.com>

	* prj.adb, clean.adb, prj-nmsc.adb, prj.ads: Remove declarations that
	were for gprmake only

From-SVN: r138365
parent 3023ce42
...@@ -826,9 +826,6 @@ package body Clean is ...@@ -826,9 +826,6 @@ package body Clean is
Index2 : Int; Index2 : Int;
Lib_File : File_Name_Type; Lib_File : File_Name_Type;
Source_Id : Other_Source_Id;
Source : Other_Source;
Global_Archive : Boolean := False; Global_Archive : Boolean := False;
begin begin
...@@ -881,7 +878,7 @@ package body Clean is ...@@ -881,7 +878,7 @@ package body Clean is
-- Source_Dirs or Source_Files is specified as an empty list, -- Source_Dirs or Source_Files is specified as an empty list,
-- so always look for Ada units in extending projects. -- so always look for Ada units in extending projects.
if Data.Langs (Ada_Language_Index) if Data.Ada_Sources_Present
or else Data.Extends /= No_Project or else Data.Extends /= No_Project
then then
for Unit in Unit_Table.First .. for Unit in Unit_Table.First ..
...@@ -1044,40 +1041,6 @@ package body Clean is ...@@ -1044,40 +1041,6 @@ package body Clean is
end if; end if;
end if; end if;
if Data.Other_Sources_Present then
-- There is non-Ada code: delete the object files and
-- the dependency files if they exist.
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop
Source :=
Project_Tree.Other_Sources.Table (Source_Id);
if Is_Regular_File
(Get_Name_String (Source.Object_Name))
then
Delete (Obj_Dir, Get_Name_String (Source.Object_Name));
end if;
if
Is_Regular_File (Get_Name_String (Source.Dep_Name))
then
Delete (Obj_Dir, Get_Name_String (Source.Dep_Name));
end if;
Source_Id := Source.Next;
end loop;
-- If it is a library with only non Ada sources, delete
-- the fake archive and the dependency file, if they exist.
if Data.Library
and then not Data.Langs (Ada_Language_Index)
then
Clean_Archive (Project, Global => False);
end if;
end if;
end; end;
end if; end if;
......
...@@ -65,9 +65,6 @@ package body Prj.Nmsc is ...@@ -65,9 +65,6 @@ package body Prj.Nmsc is
ALI_Suffix : constant String := ".ali"; ALI_Suffix : constant String := ".ali";
-- File suffix for ali files -- File suffix for ali files
Object_Suffix : constant String := Get_Target_Object_Suffix.all;
-- File suffix for object files
type Name_Location is record type Name_Location is record
Name : File_Name_Type; Name : File_Name_Type;
Location : Source_Ptr; Location : Source_Ptr;
...@@ -267,20 +264,6 @@ package body Prj.Nmsc is ...@@ -267,20 +264,6 @@ package body Prj.Nmsc is
Data : in out Project_Data); Data : in out Project_Data);
-- Check the configuration attributes for the project -- Check the configuration attributes for the project
procedure Check_For_Source
(File_Name : File_Name_Type;
Path_Name : Path_Name_Type;
Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
Location : Source_Ptr;
Language : Language_Index;
Suffix : String;
Naming_Exception : Boolean);
-- Check if a file, with name File_Name and path Path_Name, in a source
-- directory is a source for language Language in project Project of
-- project tree In_Tree. ???
procedure Check_If_Externally_Built procedure Check_If_Externally_Built
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
...@@ -369,15 +352,6 @@ package body Prj.Nmsc is ...@@ -369,15 +352,6 @@ package body Prj.Nmsc is
-- Current_Dir should represent the current directory, and is passed for -- Current_Dir should represent the current directory, and is passed for
-- efficiency to avoid system calls to recompute it. -- efficiency to avoid system calls to recompute it.
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
For_Language : Language_Index;
Current_Dir : String);
-- Find all the sources in all of the source directories of a project for
-- a specified language.
procedure Search_Directories procedure Search_Directories
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
...@@ -467,8 +441,7 @@ package body Prj.Nmsc is ...@@ -467,8 +441,7 @@ package body Prj.Nmsc is
-- Source_Names. -- Source_Names.
procedure Find_Explicit_Sources procedure Find_Explicit_Sources
(Lang : Language_Index; (Current_Dir : String;
Current_Dir : String;
Project : Project_Id; Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
Data : in out Project_Data); Data : in out Project_Data);
...@@ -566,16 +539,6 @@ package body Prj.Nmsc is ...@@ -566,16 +539,6 @@ package body Prj.Nmsc is
-- Current_Dir should represent the current directory, and is passed for -- Current_Dir should represent the current directory, and is passed for
-- efficiency to avoid system calls to recompute it. -- efficiency to avoid system calls to recompute it.
procedure Record_Other_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
Language : Language_Index;
Naming_Exceptions : Boolean);
-- Record the sources of a language in a project. When Naming_Exceptions is
-- True, mark the found sources as such, to later remove those that are not
-- named in a list of sources.
procedure Remove_Source procedure Remove_Source
(Id : Source_Id; (Id : Source_Id;
Replaced_By : Source_Id; Replaced_By : Source_Id;
...@@ -597,13 +560,6 @@ package body Prj.Nmsc is ...@@ -597,13 +560,6 @@ package body Prj.Nmsc is
(Data : Project_Data; In_Tree : Project_Tree_Ref); (Data : Project_Data; In_Tree : Project_Tree_Ref);
-- List all the source directories of a project -- List all the source directories of a project
function Suffix_For
(Language : Language_Index;
Naming : Naming_Data;
In_Tree : Project_Tree_Ref) return File_Name_Type;
-- Get the suffix for the source of a language from a package naming. If
-- not specified, return the default for the language.
procedure Warn_If_Not_Sources procedure Warn_If_Not_Sources
(Project : Project_Id; (Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
...@@ -2449,287 +2405,6 @@ package body Prj.Nmsc is ...@@ -2449,287 +2405,6 @@ package body Prj.Nmsc is
end loop; end loop;
end Check_Configuration; end Check_Configuration;
----------------------
-- Check_For_Source --
----------------------
procedure Check_For_Source
(File_Name : File_Name_Type;
Path_Name : Path_Name_Type;
Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
Location : Source_Ptr;
Language : Language_Index;
Suffix : String;
Naming_Exception : Boolean)
is
Name : String := Get_Name_String (File_Name);
Real_Location : Source_Ptr := Location;
begin
Canonical_Case_File_Name (Name);
-- A file is a source of a language if Naming_Exception is True (case
-- of naming exceptions) or if its file name ends with the suffix.
if Naming_Exception
or else
(Name'Length > Suffix'Length
and then
Name (Name'Last - Suffix'Length + 1 .. Name'Last) = Suffix)
then
if Real_Location = No_Location then
Real_Location := Data.Location;
end if;
declare
Path_Id : Path_Name_Type;
C_Path_Id : Path_Name_Type;
-- The path name id (in canonical case)
File_Id : File_Name_Type;
-- The file name id (in canonical case)
Obj_Id : File_Name_Type;
-- The object file name
Obj_Path_Id : Path_Name_Type;
-- The object path name
Dep_Id : File_Name_Type;
-- The dependency file name
Dep_Path_Id : Path_Name_Type;
-- The dependency path name
Dot_Pos : Natural := 0;
-- Position of the last dot in Name
Source : Other_Source;
Source_Id : Other_Source_Id := Data.First_Other_Source;
begin
-- Get the file name id
if Osint.File_Names_Case_Sensitive then
File_Id := File_Name;
else
Name_Len := Name'Length;
Name_Buffer (1 .. Name_Len) := Name;
File_Id := Name_Find;
end if;
-- Get the path name id
Path_Id := Path_Name;
if Osint.File_Names_Case_Sensitive then
C_Path_Id := Path_Name;
else
declare
C_Path : String := Get_Name_String (Path_Name);
begin
Canonical_Case_File_Name (C_Path);
Name_Len := C_Path'Length;
Name_Buffer (1 .. Name_Len) := C_Path;
C_Path_Id := Name_Find;
end;
end if;
-- Find the position of the last dot
for J in reverse Name'Range loop
if Name (J) = '.' then
Dot_Pos := J;
exit;
end if;
end loop;
if Dot_Pos <= Name'First then
Dot_Pos := Name'Last + 1;
end if;
-- Compute the object file name
Get_Name_String (File_Id);
Name_Len := Dot_Pos - Name'First;
for J in Object_Suffix'Range loop
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Object_Suffix (J);
end loop;
Obj_Id := Name_Find;
-- Compute the object path name
Get_Name_String (Data.Object_Directory.Display_Name);
if Name_Buffer (Name_Len) /= Directory_Separator
and then Name_Buffer (Name_Len) /= '/'
then
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Directory_Separator;
end if;
Add_Str_To_Name_Buffer (Get_Name_String (Obj_Id));
Obj_Path_Id := Name_Find;
-- Compute the dependency file name
Get_Name_String (File_Id);
Name_Len := Dot_Pos - Name'First + 1;
Name_Buffer (Name_Len) := '.';
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := 'd';
Dep_Id := Name_Find;
-- Compute the dependency path name
Get_Name_String (Data.Object_Directory.Display_Name);
if Name_Buffer (Name_Len) /= Directory_Separator
and then Name_Buffer (Name_Len) /= '/'
then
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Directory_Separator;
end if;
Add_Str_To_Name_Buffer (Get_Name_String (Dep_Id));
Dep_Path_Id := Name_Find;
-- Check if source is already in the list of source for this
-- project: it may have already been specified as a naming
-- exception for the same language or an other language, or
-- they may be two identical file names in different source
-- directories.
while Source_Id /= No_Other_Source loop
Source := In_Tree.Other_Sources.Table (Source_Id);
if Source.File_Name = File_Id then
-- Two sources of different languages cannot have the same
-- file name.
if Source.Language /= Language then
Error_Msg_File_1 := File_Name;
Error_Msg
(Project, In_Tree,
"{ cannot be a source of several languages",
Real_Location);
return;
-- No problem if a file has already been specified as
-- a naming exception of this language.
elsif Source.Path_Name = C_Path_Id then
-- Reset the naming exception flag, if this is not a
-- naming exception.
if not Naming_Exception then
In_Tree.Other_Sources.Table
(Source_Id).Naming_Exception := False;
end if;
return;
-- There are several files with the same names, but the
-- order of the source directories is known (no /**):
-- only the first one encountered is kept, the other ones
-- are ignored.
elsif Data.Known_Order_Of_Source_Dirs then
return;
-- But it is an error if the order of the source directories
-- is not known.
else
Error_Msg_File_1 := File_Name;
Error_Msg
(Project, In_Tree,
"{ is found in several source directories",
Real_Location);
return;
end if;
-- Two sources with different file names cannot have the same
-- object file name.
elsif Source.Object_Name = Obj_Id then
Error_Msg_File_1 := File_Id;
Error_Msg_File_2 := Source.File_Name;
Error_Msg_File_3 := Obj_Id;
Error_Msg
(Project, In_Tree,
"{ and { have the same object file {",
Real_Location);
return;
end if;
Source_Id := Source.Next;
end loop;
if Current_Verbosity = High then
Write_Str (" found ");
Display_Language_Name (Language);
Write_Str (" source """);
Write_Str (Get_Name_String (File_Name));
Write_Line ("""");
Write_Str (" object path = ");
Write_Line (Get_Name_String (Obj_Path_Id));
end if;
-- Create the Other_Source record
Source :=
(Language => Language,
File_Name => File_Id,
Path_Name => Path_Id,
Source_TS => File_Stamp (Path_Id),
Object_Name => Obj_Id,
Object_Path => Obj_Path_Id,
Object_TS => File_Stamp (Obj_Path_Id),
Dep_Name => Dep_Id,
Dep_Path => Dep_Path_Id,
Dep_TS => File_Stamp (Dep_Path_Id),
Naming_Exception => Naming_Exception,
Next => No_Other_Source);
-- And add it to the Other_Sources table
Other_Source_Table.Increment_Last (In_Tree.Other_Sources);
In_Tree.Other_Sources.Table
(Other_Source_Table.Last (In_Tree.Other_Sources)) := Source;
-- There are sources of languages other than Ada in this project
Data.Other_Sources_Present := True;
-- And there are sources of this language in this project
Set (Language, True, Data, In_Tree);
-- Add this source to the list of sources of languages other than
-- Ada of the project.
if Data.First_Other_Source = No_Other_Source then
Data.First_Other_Source :=
Other_Source_Table.Last (In_Tree.Other_Sources);
else
In_Tree.Other_Sources.Table (Data.Last_Other_Source).Next :=
Other_Source_Table.Last (In_Tree.Other_Sources);
end if;
Data.Last_Other_Source :=
Other_Source_Table.Last (In_Tree.Other_Sources);
end;
end if;
end Check_For_Source;
------------------------------- -------------------------------
-- Check_If_Externally_Built -- -- Check_If_Externally_Built --
------------------------------- -------------------------------
...@@ -4683,11 +4358,8 @@ package body Prj.Nmsc is ...@@ -4683,11 +4358,8 @@ package body Prj.Nmsc is
(Name => Name_Ada, Next => No_Name_List); (Name => Name_Ada, Next => No_Name_List);
-- Attribute Languages is not specified. So, it defaults to -- Attribute Languages is not specified. So, it defaults to
-- a project of language Ada only. -- a project of language Ada only. No sources of languages
-- other than Ada
Data.Langs (Ada_Language_Index) := True;
-- No sources of languages other than Ada
Data.Other_Sources_Present := False; Data.Other_Sources_Present := False;
...@@ -4757,13 +4429,10 @@ package body Prj.Nmsc is ...@@ -4757,13 +4429,10 @@ package body Prj.Nmsc is
NL_Id : Name_List_Index := No_Name_List; NL_Id : Name_List_Index := No_Name_List;
begin begin
if Get_Mode = Ada_Only then -- Assume there are no language declared
-- Assume that there is no language specified yet
Data.Other_Sources_Present := False; Data.Ada_Sources_Present := False;
Data.Ada_Sources_Present := False; Data.Other_Sources_Present := False;
end if;
-- If there are no languages declared, there are no sources -- If there are no languages declared, there are no sources
...@@ -4820,21 +4489,9 @@ package body Prj.Nmsc is ...@@ -4820,21 +4489,9 @@ package body Prj.Nmsc is
(Lang_Name, No_Name_List); (Lang_Name, No_Name_List);
if Get_Mode = Ada_Only then if Get_Mode = Ada_Only then
Index := Language_Indexes.Get (Lang_Name); -- Check for language Ada
if Index = No_Language_Index then
Add_Language_Name (Lang_Name);
Index := Last_Language_Index;
end if;
Set (Index, True, Data, In_Tree);
Set (Language_Processing =>
Default_Language_Processing_Data,
For_Language => Index,
In_Project => Data,
In_Tree => In_Tree);
if Index = Ada_Language_Index then if Lang_Name = Name_Ada then
Data.Ada_Sources_Present := True; Data.Ada_Sources_Present := True;
else else
...@@ -5936,155 +5593,6 @@ package body Prj.Nmsc is ...@@ -5936,155 +5593,6 @@ package body Prj.Nmsc is
end Find_Ada_Sources; end Find_Ada_Sources;
------------------
-- Find_Sources --
------------------
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
For_Language : Language_Index;
Current_Dir : String)
is
Source_Dir : String_List_Id;
Element : String_Element;
Dir : Dir_Type;
Current_Source : String_List_Id := Nil_String;
Source_Recorded : Boolean := False;
begin
if Current_Verbosity = High then
Write_Line ("Looking for sources:");
end if;
-- Loop through subdirectories
Source_Dir := Data.Source_Dirs;
while Source_Dir /= Nil_String loop
begin
Source_Recorded := False;
Element := In_Tree.String_Elements.Table (Source_Dir);
if Element.Value /= No_Name then
Get_Name_String (Element.Display_Value);
declare
Source_Directory : constant String :=
Name_Buffer (1 .. Name_Len) &
Directory_Separator;
Dir_Last : constant Natural :=
Compute_Directory_Last (Source_Directory);
begin
if Current_Verbosity = High then
Write_Str ("Source_Dir = ");
Write_Line (Source_Directory);
end if;
-- We look to every entry in the source directory
Open (Dir, Source_Directory
(Source_Directory'First .. Dir_Last));
loop
Read (Dir, Name_Buffer, Name_Len);
if Current_Verbosity = High then
Write_Str (" Checking ");
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
exit when Name_Len = 0;
declare
File_Name : constant File_Name_Type := Name_Find;
Path : constant String :=
Normalize_Pathname
(Name => Name_Buffer (1 .. Name_Len),
Directory => Source_Directory
(Source_Directory'First .. Dir_Last),
Resolve_Links => Opt.Follow_Links_For_Files,
Case_Sensitive => True);
Path_Name : Path_Name_Type;
begin
Name_Len := Path'Length;
Name_Buffer (1 .. Name_Len) := Path;
Path_Name := Name_Find;
if For_Language = Ada_Language_Index then
-- We attempt to register it as a source. However,
-- there is no error if the file does not contain
-- a valid source. But there is an error if we have
-- a duplicate unit name.
Record_Ada_Source
(File_Name => File_Name,
Path_Name => Path_Name,
Project => Project,
In_Tree => In_Tree,
Data => Data,
Location => No_Location,
Current_Source => Current_Source,
Source_Recorded => Source_Recorded,
Current_Dir => Current_Dir);
else
Check_For_Source
(File_Name => File_Name,
Path_Name => Path_Name,
Project => Project,
In_Tree => In_Tree,
Data => Data,
Location => No_Location,
Language => For_Language,
Suffix =>
Body_Suffix_Of (For_Language, Data, In_Tree),
Naming_Exception => False);
end if;
end;
end loop;
Close (Dir);
end;
end if;
exception
when Directory_Error =>
null;
end;
if Source_Recorded then
In_Tree.String_Elements.Table (Source_Dir).Flag :=
True;
end if;
Source_Dir := Element.Next;
end loop;
if Current_Verbosity = High then
Write_Line ("end Looking for sources.");
end if;
if For_Language = Ada_Language_Index then
-- If we have looked for sources and found none, then it is an error,
-- except if it is an extending project. If a non extending project
-- is not supposed to contain any source files, then never call
-- Find_Sources.
if Current_Source /= Nil_String then
Data.Ada_Sources_Present := True;
elsif Data.Extends = No_Project then
Report_No_Sources (Project, "Ada", In_Tree, Data.Location);
end if;
end if;
end Find_Sources;
-------------------------------- --------------------------------
-- Free_Ada_Naming_Exceptions -- -- Free_Ada_Naming_Exceptions --
-------------------------------- --------------------------------
...@@ -7606,8 +7114,7 @@ package body Prj.Nmsc is ...@@ -7606,8 +7114,7 @@ package body Prj.Nmsc is
--------------------------- ---------------------------
procedure Find_Explicit_Sources procedure Find_Explicit_Sources
(Lang : Language_Index; (Current_Dir : String;
Current_Dir : String;
Project : Project_Id; Project : Project_Id;
In_Tree : Project_Tree_Ref; In_Tree : Project_Tree_Ref;
Data : in out Project_Data) Data : in out Project_Data)
...@@ -7654,18 +7161,9 @@ package body Prj.Nmsc is ...@@ -7654,18 +7161,9 @@ package body Prj.Nmsc is
Data.Ada_Sources_Present := Current /= Nil_String; Data.Ada_Sources_Present := Current /= Nil_String;
end if; end if;
-- If we are processing other languages in the case of gprmake, if Get_Mode = Multi_Language then
-- we should not reset the list of sources, which was already
-- initialized for the Ada files.
if Get_Mode /= Ada_Only or else Lang /= Ada_Language_Index then
if Current = Nil_String then if Current = Nil_String then
case Get_Mode is Data.First_Language_Processing := No_Language_Index;
when Ada_Only =>
Data.Source_Dirs := Nil_String;
when Multi_Language =>
Data.First_Language_Processing := No_Language_Index;
end case;
-- This project contains no source. For projects that -- This project contains no source. For projects that
-- don't extend other projects, this also means that -- don't extend other projects, this also means that
...@@ -7743,17 +7241,8 @@ package body Prj.Nmsc is ...@@ -7743,17 +7241,8 @@ package body Prj.Nmsc is
end loop; end loop;
if Get_Mode = Ada_Only then if Get_Mode = Ada_Only then
if Lang = Ada_Language_Index then Get_Path_Names_And_Record_Ada_Sources
Get_Path_Names_And_Record_Ada_Sources (Project, In_Tree, Data, Current_Dir);
(Project, In_Tree, Data, Current_Dir);
else
Record_Other_Sources
(Project => Project,
In_Tree => In_Tree,
Data => Data,
Language => Lang,
Naming_Exceptions => False);
end if;
end if; end if;
end; end;
...@@ -7787,18 +7276,8 @@ package body Prj.Nmsc is ...@@ -7787,18 +7276,8 @@ package body Prj.Nmsc is
if Get_Mode = Ada_Only then if Get_Mode = Ada_Only then
-- Look in the source directories to find those sources -- Look in the source directories to find those sources
if Lang = Ada_Language_Index then Get_Path_Names_And_Record_Ada_Sources
Get_Path_Names_And_Record_Ada_Sources (Project, In_Tree, Data, Current_Dir);
(Project, In_Tree, Data, Current_Dir);
else
Record_Other_Sources
(Project => Project,
In_Tree => In_Tree,
Data => Data,
Language => Lang,
Naming_Exceptions => False);
end if;
end if; end if;
end if; end if;
end; end;
...@@ -7808,22 +7287,9 @@ package body Prj.Nmsc is ...@@ -7808,22 +7287,9 @@ package body Prj.Nmsc is
-- specified. Find all the files that satisfy the naming -- specified. Find all the files that satisfy the naming
-- scheme in all the source directories. -- scheme in all the source directories.
case Get_Mode is if Get_Mode = Ada_Only then
when Ada_Only => Find_Ada_Sources (Project, In_Tree, Data, Current_Dir);
if Lang = Ada_Language_Index then end if;
Find_Ada_Sources (Project, In_Tree, Data, Current_Dir);
else
-- Find all the files that satisfy the naming scheme in
-- all the source directories. All the naming exceptions
-- that effectively exist are also part of the source
-- of this language.
Find_Sources (Project, In_Tree, Data, Lang, Current_Dir);
end if;
when Multi_Language =>
null;
end case;
end if; end if;
if Get_Mode = Multi_Language then if Get_Mode = Multi_Language then
...@@ -7888,7 +7354,6 @@ package body Prj.Nmsc is ...@@ -7888,7 +7354,6 @@ package body Prj.Nmsc is
end if; end if;
if Get_Mode = Ada_Only if Get_Mode = Ada_Only
and then Lang = Ada_Language_Index
and then Data.Extends = No_Project and then Data.Extends = No_Project
then then
-- We should have found at least one source, if not report an error -- We should have found at least one source, if not report an error
...@@ -8829,9 +8294,6 @@ package body Prj.Nmsc is ...@@ -8829,9 +8294,6 @@ package body Prj.Nmsc is
procedure Remove_Locally_Removed_Files_From_Units; procedure Remove_Locally_Removed_Files_From_Units;
-- Mark all locally removed sources as such in the Units table -- Mark all locally removed sources as such in the Units table
procedure Process_Other_Sources_In_Ada_Only_Mode;
-- Find sources for language other than Ada when in Ada_Only mode
procedure Process_Sources_In_Multi_Language_Mode; procedure Process_Sources_In_Multi_Language_Mode;
-- Find all source files when in multi language mode -- Find all source files when in multi language mode
...@@ -8896,116 +8358,6 @@ package body Prj.Nmsc is ...@@ -8896,116 +8358,6 @@ package body Prj.Nmsc is
end Remove_Locally_Removed_Files_From_Units; end Remove_Locally_Removed_Files_From_Units;
-------------------------------------------- --------------------------------------------
-- Process_Other_Sources_In_Ada_Only_Mode --
--------------------------------------------
procedure Process_Other_Sources_In_Ada_Only_Mode is
begin
-- Set Source_Present to False. It will be set back to True
-- whenever a source is found.
Data.Other_Sources_Present := False;
for Lang in Ada_Language_Index + 1 .. Last_Language_Index loop
-- For each language (other than Ada) in the project file
if Is_Present (Lang, Data, In_Tree) then
-- Reset the indication that there are sources of this
-- language. It will be set back to True whenever we find
-- a source of the language.
Set (Lang, False, Data, In_Tree);
-- First, get the source suffix for the language
Set (Suffix => Suffix_For (Lang, Data.Naming, In_Tree),
For_Language => Lang,
In_Project => Data,
In_Tree => In_Tree);
-- Then, deal with the naming exceptions, if any
Source_Names.Reset;
declare
Naming_Exceptions : constant Variable_Value :=
Value_Of
(Index => Language_Names.Table (Lang),
Src_Index => 0,
In_Array => Data.Naming.Implementation_Exceptions,
In_Tree => In_Tree);
Element_Id : String_List_Id;
Element : String_Element;
File_Id : File_Name_Type;
Source_Found : Boolean := False;
begin
-- If there are naming exceptions, look through them one
-- by one.
if Naming_Exceptions /= Nil_Variable_Value then
Element_Id := Naming_Exceptions.Values;
while Element_Id /= Nil_String loop
Element := In_Tree.String_Elements.Table (Element_Id);
if Osint.File_Names_Case_Sensitive then
File_Id := File_Name_Type (Element.Value);
else
Get_Name_String (Element.Value);
Canonical_Case_File_Name
(Name_Buffer (1 .. Name_Len));
File_Id := Name_Find;
end if;
-- Put each naming exception in the Source_Names hash
-- table, but if there are repetition, don't bother
-- after the first instance.
if Source_Names.Get (File_Id) = No_Name_Location then
Source_Found := True;
Source_Names.Set
(File_Id,
(Name => File_Id,
Location => Element.Location,
Source => No_Source,
Except => False,
Found => False));
end if;
Element_Id := Element.Next;
end loop;
-- If there is at least one naming exception, record
-- those that are found in the source directories.
if Source_Found then
Record_Other_Sources
(Project => Project,
In_Tree => In_Tree,
Data => Data,
Language => Lang,
Naming_Exceptions => True);
end if;
end if;
end;
-- Now, check if a list of sources is declared either through
-- a string list (attribute Source_Files) or a text file
-- (attribute Source_List_File). If a source list is declared,
-- we will consider only those naming exceptions that are
-- on the list.
Source_Names.Reset;
Find_Explicit_Sources
(Lang, Current_Dir, Project, In_Tree, Data);
end if;
end loop;
end Process_Other_Sources_In_Ada_Only_Mode;
--------------------------------------------
-- Process_Sources_In_Multi_Language_Mode -- -- Process_Sources_In_Multi_Language_Mode --
-------------------------------------------- --------------------------------------------
...@@ -9077,7 +8429,7 @@ package body Prj.Nmsc is ...@@ -9077,7 +8429,7 @@ package body Prj.Nmsc is
end loop; end loop;
Find_Explicit_Sources Find_Explicit_Sources
(Ada_Language_Index, Current_Dir, Project, In_Tree, Data); (Current_Dir, Project, In_Tree, Data);
-- Mark as such the sources that are declared as excluded -- Mark as such the sources that are declared as excluded
...@@ -9219,15 +8571,10 @@ package body Prj.Nmsc is ...@@ -9219,15 +8571,10 @@ package body Prj.Nmsc is
case Get_Mode is case Get_Mode is
when Ada_Only => when Ada_Only =>
if Is_A_Language (In_Tree, Data, Name_Ada) then if Is_A_Language (In_Tree, Data, Name_Ada) then
Find_Explicit_Sources Find_Explicit_Sources (Current_Dir, Project, In_Tree, Data);
(Ada_Language_Index, Current_Dir, Project, In_Tree, Data);
Remove_Locally_Removed_Files_From_Units; Remove_Locally_Removed_Files_From_Units;
end if; end if;
if Data.Other_Sources_Present then
Process_Other_Sources_In_Ada_Only_Mode;
end if;
when Multi_Language => when Multi_Language =>
if Data.First_Language_Processing /= No_Language_Index then if Data.First_Language_Processing /= No_Language_Index then
Process_Sources_In_Multi_Language_Mode; Process_Sources_In_Multi_Language_Mode;
...@@ -9624,179 +8971,6 @@ package body Prj.Nmsc is ...@@ -9624,179 +8971,6 @@ package body Prj.Nmsc is
end if; end if;
end Record_Ada_Source; end Record_Ada_Source;
--------------------------
-- Record_Other_Sources --
--------------------------
procedure Record_Other_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Data : in out Project_Data;
Language : Language_Index;
Naming_Exceptions : Boolean)
is
Source_Dir : String_List_Id;
Element : String_Element;
Path : Path_Name_Type;
Dir : Dir_Type;
Canonical_Name : File_Name_Type;
Name_Str : String (1 .. 1_024);
Last : Natural := 0;
NL : Name_Location;
First_Error : Boolean := True;
Suffix : constant String :=
Body_Suffix_Of (Language, Data, In_Tree);
begin
Source_Dir := Data.Source_Dirs;
while Source_Dir /= Nil_String loop
Element := In_Tree.String_Elements.Table (Source_Dir);
declare
Dir_Path : constant String :=
Get_Name_String (Element.Display_Value);
begin
if Current_Verbosity = High then
Write_Str ("checking directory """);
Write_Str (Dir_Path);
Write_Str (""" for ");
if Naming_Exceptions then
Write_Str ("naming exceptions");
else
Write_Str ("sources");
end if;
Write_Str (" of Language ");
Display_Language_Name (Language);
end if;
Open (Dir, Dir_Path);
loop
Read (Dir, Name_Str, Last);
exit when Last = 0;
if Is_Regular_File
(Dir_Path & Directory_Separator & Name_Str (1 .. Last))
then
Name_Len := Last;
Name_Buffer (1 .. Name_Len) := Name_Str (1 .. Last);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
Canonical_Name := Name_Find;
NL := Source_Names.Get (Canonical_Name);
if NL /= No_Name_Location then
if NL.Found then
if not Data.Known_Order_Of_Source_Dirs then
Error_Msg_File_1 := Canonical_Name;
Error_Msg
(Project, In_Tree,
"{ is found in several source directories",
NL.Location);
end if;
else
NL.Found := True;
Source_Names.Set (Canonical_Name, NL);
Name_Len := Dir_Path'Length;
Name_Buffer (1 .. Name_Len) := Dir_Path;
Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer (Name_Str (1 .. Last));
Path := Name_Find;
Check_For_Source
(File_Name => Canonical_Name,
Path_Name => Path,
Project => Project,
In_Tree => In_Tree,
Data => Data,
Location => NL.Location,
Language => Language,
Suffix => Suffix,
Naming_Exception => Naming_Exceptions);
end if;
end if;
end if;
end loop;
Close (Dir);
end;
Source_Dir := Element.Next;
end loop;
if not Naming_Exceptions then
NL := Source_Names.Get_First;
-- It is an error if a source file name in a source list or
-- in a source list file is not found.
while NL /= No_Name_Location loop
if not NL.Found then
Err_Vars.Error_Msg_File_1 := NL.Name;
if First_Error then
Error_Msg
(Project, In_Tree, "source file { cannot be found",
NL.Location);
First_Error := False;
else
Error_Msg
(Project, In_Tree, "\source file { cannot be found",
NL.Location);
end if;
end if;
NL := Source_Names.Get_Next;
end loop;
-- Any naming exception of this language that is not in a list
-- of sources must be removed.
declare
Source_Id : Other_Source_Id;
Prev_Id : Other_Source_Id;
Source : Other_Source;
begin
Prev_Id := No_Other_Source;
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop
Source := In_Tree.Other_Sources.Table (Source_Id);
if Source.Language = Language
and then Source.Naming_Exception
then
if Current_Verbosity = High then
Write_Str ("Naming exception """);
Write_Str (Get_Name_String (Source.File_Name));
Write_Str (""" is not in the list of sources,");
Write_Line (" so it is removed.");
end if;
if Prev_Id = No_Other_Source then
Data.First_Other_Source := Source.Next;
else
In_Tree.Other_Sources.Table (Prev_Id).Next := Source.Next;
end if;
Source_Id := Source.Next;
if Source_Id = No_Other_Source then
Data.Last_Other_Source := Prev_Id;
end if;
else
Prev_Id := Source_Id;
Source_Id := Source.Next;
end if;
end loop;
end;
end if;
end Record_Other_Sources;
------------------- -------------------
-- Remove_Source -- -- Remove_Source --
------------------- -------------------
...@@ -9971,52 +9145,6 @@ package body Prj.Nmsc is ...@@ -9971,52 +9145,6 @@ package body Prj.Nmsc is
Write_Line ("end Source_Dirs."); Write_Line ("end Source_Dirs.");
end Show_Source_Dirs; end Show_Source_Dirs;
----------------
-- Suffix_For --
----------------
function Suffix_For
(Language : Language_Index;
Naming : Naming_Data;
In_Tree : Project_Tree_Ref) return File_Name_Type
is
Suffix : constant Variable_Value :=
Value_Of
(Index => Language_Names.Table (Language),
Src_Index => 0,
In_Array => Naming.Body_Suffix,
In_Tree => In_Tree);
begin
-- If no suffix for this language in package Naming, use the default
if Suffix = Nil_Variable_Value then
Name_Len := 0;
case Language is
when Ada_Language_Index =>
Add_Str_To_Name_Buffer (".adb");
when C_Language_Index =>
Add_Str_To_Name_Buffer (".c");
when C_Plus_Plus_Language_Index =>
Add_Str_To_Name_Buffer (".cpp");
when others =>
return No_File;
end case;
-- Otherwise use the one specified
else
Get_Name_String (Suffix.Value);
end if;
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
return Name_Find;
end Suffix_For;
------------------------- -------------------------
-- Warn_If_Not_Sources -- -- Warn_If_Not_Sources --
------------------------- -------------------------
......
...@@ -32,9 +32,11 @@ with Prj.Attr; ...@@ -32,9 +32,11 @@ with Prj.Attr;
with Prj.Env; with Prj.Env;
with Prj.Err; use Prj.Err; with Prj.Err; use Prj.Err;
with Snames; use Snames; with Snames; use Snames;
with Table;
with Uintp; use Uintp; with Uintp; use Uintp;
with System.Case_Util; use System.Case_Util; with System.Case_Util; use System.Case_Util;
with System.HTable;
package body Prj is package body Prj is
...@@ -50,8 +52,6 @@ package body Prj is ...@@ -50,8 +52,6 @@ package body Prj is
The_Empty_String : Name_Id; The_Empty_String : Name_Id;
Name_C_Plus_Plus : Name_Id;
Default_Ada_Spec_Suffix_Id : File_Name_Type; Default_Ada_Spec_Suffix_Id : File_Name_Type;
Default_Ada_Body_Suffix_Id : File_Name_Type; Default_Ada_Body_Suffix_Id : File_Name_Type;
Slash_Id : Path_Name_Type; Slash_Id : Path_Name_Type;
...@@ -83,9 +83,7 @@ package body Prj is ...@@ -83,9 +83,7 @@ package body Prj is
Specs => No_Array_Element, Specs => No_Array_Element,
Bodies => No_Array_Element, Bodies => No_Array_Element,
Specification_Exceptions => No_Array_Element, Specification_Exceptions => No_Array_Element,
Implementation_Exceptions => No_Array_Element, Implementation_Exceptions => No_Array_Element);
Impl_Suffixes => No_Impl_Suffixes,
Supp_Suffixes => No_Supp_Language_Index);
Project_Empty : constant Project_Data := Project_Empty : constant Project_Data :=
(Qualifier => Unspecified, (Qualifier => Unspecified,
...@@ -113,6 +111,8 @@ package body Prj is ...@@ -113,6 +111,8 @@ package body Prj is
Lib_Auto_Init => False, Lib_Auto_Init => False,
Libgnarl_Needed => Unknown, Libgnarl_Needed => Unknown,
Symbol_Data => No_Symbols, Symbol_Data => No_Symbols,
Ada_Sources_Present => True,
Other_Sources_Present => True,
Ada_Sources => Nil_String, Ada_Sources => Nil_String,
Sources => Nil_String, Sources => Nil_String,
First_Source => No_Source, First_Source => No_Source,
...@@ -152,17 +152,7 @@ package body Prj is ...@@ -152,17 +152,7 @@ package body Prj is
Seen => False, Seen => False,
Need_To_Build_Lib => False, Need_To_Build_Lib => False,
Depth => 0, Depth => 0,
Unkept_Comments => False, Unkept_Comments => False);
Langs => No_Languages,
Supp_Languages => No_Supp_Language_Index,
Ada_Sources_Present => True,
Other_Sources_Present => True,
First_Other_Source => No_Other_Source,
Last_Other_Source => No_Other_Source,
First_Lang_Processing =>
Default_First_Language_Processing_Data,
Supp_Language_Processing =>
No_Supp_Language_Index);
package Temp_Files is new Table.Table package Temp_Files is new Table.Table
(Table_Component_Type => Path_Name_Type, (Table_Component_Type => Path_Name_Type,
...@@ -174,18 +164,6 @@ package body Prj is ...@@ -174,18 +164,6 @@ package body Prj is
-- Table to store the path name of all the created temporary files, so that -- Table to store the path name of all the created temporary files, so that
-- they can be deleted at the end, or when the program is interrupted. -- they can be deleted at the end, or when the program is interrupted.
-----------------------
-- Add_Language_Name --
-----------------------
procedure Add_Language_Name (Name : Name_Id) is
begin
Last_Language_Index := Last_Language_Index + 1;
Language_Indexes.Set (Name, Last_Language_Index);
Language_Names.Increment_Last;
Language_Names.Table (Last_Language_Index) := Name;
end Add_Language_Name;
------------------- -------------------
-- Add_To_Buffer -- -- Add_To_Buffer --
------------------- -------------------
...@@ -341,21 +319,6 @@ package body Prj is ...@@ -341,21 +319,6 @@ package body Prj is
return ""; return "";
end Body_Suffix_Of; end Body_Suffix_Of;
function Body_Suffix_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return String
is
Suffix_Id : constant File_Name_Type :=
Suffix_Of (Language, In_Project, In_Tree);
begin
if Suffix_Id /= No_File then
return Get_Name_String (Suffix_Id);
else
return "." & Get_Name_String (Language_Names.Table (Language));
end if;
end Body_Suffix_Of;
----------------------------- -----------------------------
-- Default_Ada_Body_Suffix -- -- Default_Ada_Body_Suffix --
----------------------------- -----------------------------
...@@ -430,17 +393,6 @@ package body Prj is ...@@ -430,17 +393,6 @@ package body Prj is
Write_Str (Name_Buffer (1 .. Name_Len)); Write_Str (Name_Buffer (1 .. Name_Len));
end Display_Language_Name; end Display_Language_Name;
---------------------------
-- Display_Language_Name --
---------------------------
procedure Display_Language_Name (Language : Language_Index) is
begin
Get_Name_String (Language_Names.Table (Language));
To_Upper (Name_Buffer (1 .. 1));
Write_Str (Name_Buffer (1 .. Name_Len));
end Display_Language_Name;
---------------- ----------------
-- Empty_File -- -- Empty_File --
---------------- ----------------
...@@ -638,22 +590,12 @@ package body Prj is ...@@ -638,22 +590,12 @@ package body Prj is
Name_Len := 1; Name_Len := 1;
Name_Buffer (1) := '/'; Name_Buffer (1) := '/';
Slash_Id := Name_Find; Slash_Id := Name_Find;
Name_Len := 3;
Name_Buffer (1 .. 3) := "c++";
Name_C_Plus_Plus := Name_Find;
Prj.Env.Initialize; Prj.Env.Initialize;
Prj.Attr.Initialize; Prj.Attr.Initialize;
Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project)); Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends)); Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External)); Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
Language_Indexes.Reset;
Last_Language_Index := No_Language_Index;
Language_Names.Init;
Add_Language_Name (Name_Ada);
Add_Language_Name (Name_C);
Add_Language_Name (Name_C_Plus_Plus);
end if; end if;
if Tree /= No_Project_Tree then if Tree /= No_Project_Tree then
...@@ -729,84 +671,6 @@ package body Prj is ...@@ -729,84 +671,6 @@ package body Prj is
return False; return False;
end Is_Extending; end Is_Extending;
----------------
-- Is_Present --
----------------
function Is_Present
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Boolean
is
begin
case Language is
when No_Language_Index =>
return False;
when First_Language_Indexes =>
return In_Project.Langs (Language);
when others =>
declare
Supp : Supp_Language;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Supp_Languages;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Present_Languages.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Present;
end if;
Supp_Index := Supp.Next;
end loop;
return False;
end;
end case;
end Is_Present;
---------------------------------
-- Language_Processing_Data_Of --
---------------------------------
function Language_Processing_Data_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Language_Processing_Data
is
begin
case Language is
when No_Language_Index =>
return Default_Language_Processing_Data;
when First_Language_Indexes =>
return In_Project.First_Lang_Processing (Language);
when others =>
declare
Supp : Supp_Language_Data;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Supp_Language_Processing;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Supp_Languages.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Data;
end if;
Supp_Index := Supp.Next;
end loop;
return Default_Language_Processing_Data;
end;
end case;
end Language_Processing_Data_Of;
----------------------- -----------------------
-- Objects_Exist_For -- -- Objects_Exist_For --
----------------------- -----------------------
...@@ -980,13 +844,6 @@ package body Prj is ...@@ -980,13 +844,6 @@ package body Prj is
begin begin
Prj.Env.Initialize; Prj.Env.Initialize;
-- gprmake tables
Present_Language_Table.Init (Tree.Present_Languages);
Supp_Suffix_Table.Init (Tree.Supp_Suffixes);
Supp_Language_Table.Init (Tree.Supp_Languages);
Other_Source_Table.Init (Tree.Other_Sources);
-- Visible tables -- Visible tables
Language_Data_Table.Init (Tree.Languages_Data); Language_Data_Table.Init (Tree.Languages_Data);
...@@ -1040,144 +897,6 @@ package body Prj is ...@@ -1040,144 +897,6 @@ package body Prj is
and then Left.Separate_Suffix = Right.Separate_Suffix; and then Left.Separate_Suffix = Right.Separate_Suffix;
end Same_Naming_Scheme; end Same_Naming_Scheme;
---------
-- Set --
---------
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref)
is
begin
case Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.Langs (Language) := Present;
when others =>
declare
Supp : Supp_Language;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Supp_Languages;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Present_Languages.Table (Supp_Index);
if Supp.Index = Language then
In_Tree.Present_Languages.Table (Supp_Index).Present :=
Present;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => Language, Present => Present,
Next => In_Project.Supp_Languages);
Present_Language_Table.Increment_Last
(In_Tree.Present_Languages);
Supp_Index :=
Present_Language_Table.Last (In_Tree.Present_Languages);
In_Tree.Present_Languages.Table (Supp_Index) :=
Supp;
In_Project.Supp_Languages := Supp_Index;
end;
end case;
end Set;
procedure Set
(Language_Processing : Language_Processing_Data;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref)
is
begin
case For_Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.First_Lang_Processing (For_Language) :=
Language_Processing;
when others =>
declare
Supp : Supp_Language_Data;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Supp_Language_Processing;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Supp_Languages.Table (Supp_Index);
if Supp.Index = For_Language then
In_Tree.Supp_Languages.Table
(Supp_Index).Data := Language_Processing;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => For_Language, Data => Language_Processing,
Next => In_Project.Supp_Language_Processing);
Supp_Language_Table.Increment_Last
(In_Tree.Supp_Languages);
Supp_Index := Supp_Language_Table.Last
(In_Tree.Supp_Languages);
In_Tree.Supp_Languages.Table (Supp_Index) := Supp;
In_Project.Supp_Language_Processing := Supp_Index;
end;
end case;
end Set;
procedure Set
(Suffix : File_Name_Type;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref)
is
begin
case For_Language is
when No_Language_Index =>
null;
when First_Language_Indexes =>
In_Project.Naming.Impl_Suffixes (For_Language) := Suffix;
when others =>
declare
Supp : Supp_Suffix;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Naming.Supp_Suffixes;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Supp_Suffixes.Table (Supp_Index);
if Supp.Index = For_Language then
In_Tree.Supp_Suffixes.Table (Supp_Index).Suffix := Suffix;
return;
end if;
Supp_Index := Supp.Next;
end loop;
Supp := (Index => For_Language, Suffix => Suffix,
Next => In_Project.Naming.Supp_Suffixes);
Supp_Suffix_Table.Increment_Last (In_Tree.Supp_Suffixes);
Supp_Index := Supp_Suffix_Table.Last (In_Tree.Supp_Suffixes);
In_Tree.Supp_Suffixes.Table (Supp_Index) := Supp;
In_Project.Naming.Supp_Suffixes := Supp_Index;
end;
end case;
end Set;
--------------------- ---------------------
-- Set_Body_Suffix -- -- Set_Body_Suffix --
--------------------- ---------------------
...@@ -1426,45 +1145,6 @@ package body Prj is ...@@ -1426,45 +1145,6 @@ package body Prj is
end if; end if;
end Standard_Naming_Data; end Standard_Naming_Data;
---------------
-- Suffix_Of --
---------------
function Suffix_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return File_Name_Type
is
begin
case Language is
when No_Language_Index =>
return No_File;
when First_Language_Indexes =>
return In_Project.Naming.Impl_Suffixes (Language);
when others =>
declare
Supp : Supp_Suffix;
Supp_Index : Supp_Language_Index;
begin
Supp_Index := In_Project.Naming.Supp_Suffixes;
while Supp_Index /= No_Supp_Language_Index loop
Supp := In_Tree.Supp_Suffixes.Table (Supp_Index);
if Supp.Index = Language then
return Supp.Suffix;
end if;
Supp_Index := Supp.Next;
end loop;
return No_File;
end;
end case;
end Suffix_Of;
------------------- -------------------
-- Switches_Name -- -- Switches_Name --
------------------- -------------------
......
...@@ -32,15 +32,12 @@ ...@@ -32,15 +32,12 @@
with Casing; use Casing; with Casing; use Casing;
with Namet; use Namet; with Namet; use Namet;
with Scans; use Scans; with Scans; use Scans;
with Table;
with Types; use Types; with Types; use Types;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables; with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Dynamic_Tables; with GNAT.Dynamic_Tables;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with System.HTable;
package Prj is package Prj is
Subdirs_Option : constant String := "--subdirs="; Subdirs_Option : constant String := "--subdirs=";
...@@ -838,164 +835,6 @@ package Prj is ...@@ -838,164 +835,6 @@ package Prj is
-- Similar to 'Value (but avoid use of this attribute in compiler) -- Similar to 'Value (but avoid use of this attribute in compiler)
-- Raises Constraint_Error if not a Casing_Type image. -- Raises Constraint_Error if not a Casing_Type image.
-- Declarations for gprmake:
First_Language_Index : constant Language_Index := 1;
First_Language_Indexes_Last : constant Language_Index := 5;
Ada_Language_Index : constant Language_Index :=
First_Language_Index;
C_Language_Index : constant Language_Index :=
Ada_Language_Index + 1;
C_Plus_Plus_Language_Index : constant Language_Index :=
C_Language_Index + 1;
Last_Language_Index : Language_Index := No_Language_Index;
subtype First_Language_Indexes is Language_Index
range First_Language_Index .. First_Language_Indexes_Last;
package Language_Indexes is new System.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Language_Index,
No_Element => No_Language_Index,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- Mapping of language names to language indexes
package Language_Names is new Table.Table
(Table_Component_Type => Name_Id,
Table_Index_Type => Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100,
Table_Name => "Prj.Language_Names");
-- The table for the name of programming languages
procedure Add_Language_Name (Name : Name_Id);
procedure Display_Language_Name (Language : Language_Index);
type Languages_In_Project is array (First_Language_Indexes) of Boolean;
-- Set of supported languages used in a project
No_Languages : constant Languages_In_Project := (others => False);
-- No supported languages are used
type Supp_Language_Index is new Nat;
No_Supp_Language_Index : constant Supp_Language_Index := 0;
type Supp_Language is record
Index : Language_Index := No_Language_Index;
Present : Boolean := False;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Present_Language_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Language,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for the presence of languages with an index that is outside
-- of First_Language_Indexes.
type Impl_Suffix_Array is array (First_Language_Indexes) of File_Name_Type;
-- Suffixes for the non spec sources of the different supported languages
-- in a project.
No_Impl_Suffixes : constant Impl_Suffix_Array := (others => No_File);
-- A default value for the non spec source suffixes
type Supp_Suffix is record
Index : Language_Index := No_Language_Index;
Suffix : File_Name_Type := No_File;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Supp_Suffix_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Suffix,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for the presence of languages with an index that is outside
-- of First_Language_Indexes.
type Lang_Kind is (GNU, Other);
type Language_Processing_Data is record
Compiler_Drivers : Name_List_Index := No_Name_List;
Compiler_Paths : Name_Id := No_Name;
Compiler_Kinds : Lang_Kind := GNU;
Dependency_Options : Name_List_Index := No_Name_List;
Compute_Dependencies : Name_List_Index := No_Name_List;
Include_Options : Name_List_Index := No_Name_List;
Binder_Drivers : Name_Id := No_Name;
Binder_Driver_Paths : Name_Id := No_Name;
end record;
Default_Language_Processing_Data :
constant Language_Processing_Data :=
(Compiler_Drivers => No_Name_List,
Compiler_Paths => No_Name,
Compiler_Kinds => GNU,
Dependency_Options => No_Name_List,
Compute_Dependencies => No_Name_List,
Include_Options => No_Name_List,
Binder_Drivers => No_Name,
Binder_Driver_Paths => No_Name);
type First_Language_Processing_Data is
array (First_Language_Indexes) of Language_Processing_Data;
Default_First_Language_Processing_Data :
constant First_Language_Processing_Data :=
(others => Default_Language_Processing_Data);
type Supp_Language_Data is record
Index : Language_Index := No_Language_Index;
Data : Language_Processing_Data := Default_Language_Processing_Data;
Next : Supp_Language_Index := No_Supp_Language_Index;
end record;
package Supp_Language_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Supp_Language_Data,
Table_Index_Type => Supp_Language_Index,
Table_Low_Bound => 1,
Table_Initial => 4,
Table_Increment => 100);
-- The table for language data when there are more languages than
-- in First_Language_Indexes.
type Other_Source_Id is new Nat;
No_Other_Source : constant Other_Source_Id := 0;
type Other_Source is record
Language : Language_Index; -- language of the source
File_Name : File_Name_Type; -- source file simple name
Path_Name : Path_Name_Type; -- source full path name
Source_TS : Time_Stamp_Type; -- source file time stamp
Object_Name : File_Name_Type; -- object file simple name
Object_Path : Path_Name_Type; -- object full path name
Object_TS : Time_Stamp_Type; -- object file time stamp
Dep_Name : File_Name_Type; -- dependency file simple name
Dep_Path : Path_Name_Type; -- dependency full path name
Dep_TS : Time_Stamp_Type; -- dependency file time stamp
Naming_Exception : Boolean := False; -- True if a naming exception
Next : Other_Source_Id := No_Other_Source;
end record;
-- Data for a source in a language other than Ada
package Other_Source_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Other_Source,
Table_Index_Type => Other_Source_Id,
Table_Low_Bound => 1,
Table_Initial => 200,
Table_Increment => 100);
-- The table for sources of languages other than Ada
-- The following record contains data for a naming scheme -- The following record contains data for a naming scheme
type Naming_Data is record type Naming_Data is record
...@@ -1044,10 +883,6 @@ package Prj is ...@@ -1044,10 +883,6 @@ package Prj is
-- An associative array listing body file names that do not have the -- An associative array listing body file names that do not have the
-- body suffix. Not used by Ada. Indexed by programming language name. -- body suffix. Not used by Ada. Indexed by programming language name.
-- For gprmake:
Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
end record; end record;
function Spec_Suffix_Of function Spec_Suffix_Of
...@@ -1407,6 +1242,12 @@ package Prj is ...@@ -1407,6 +1242,12 @@ package Prj is
-- Sources -- -- Sources --
------------- -------------
Ada_Sources_Present : Boolean := True;
-- True if there are Ada sources in the project
Other_Sources_Present : Boolean := True;
-- True if there are non-Ada sources in the project
Ada_Sources : String_List_Id := Nil_String; Ada_Sources : String_List_Id := Nil_String;
-- The list of all the Ada source file names (gnatmake only) -- The list of all the Ada source file names (gnatmake only)
...@@ -1515,32 +1356,6 @@ package Prj is ...@@ -1515,32 +1356,6 @@ package Prj is
-- True if there are comments in the project sources that cannot be kept -- True if there are comments in the project sources that cannot be kept
-- in the project tree. -- in the project tree.
------------------
-- For gprmake --
------------------
Langs : Languages_In_Project := No_Languages;
Supp_Languages : Supp_Language_Index := No_Supp_Language_Index;
-- Indicate the different languages of the source of this project
Ada_Sources_Present : Boolean := True;
-- True if there are Ada sources in the project
Other_Sources_Present : Boolean := True;
-- True if there are sources from languages other than Ada in the
-- project.
First_Other_Source : Other_Source_Id := No_Other_Source;
-- First source of a language other than Ada
Last_Other_Source : Other_Source_Id := No_Other_Source;
-- Last source of a language other than Ada
First_Lang_Processing : First_Language_Processing_Data :=
Default_First_Language_Processing_Data;
Supp_Language_Processing : Supp_Language_Index :=
No_Supp_Language_Index;
-- Language configurations
end record; end record;
function Empty_Project (Tree : Project_Tree_Ref) return Project_Data; function Empty_Project (Tree : Project_Tree_Ref) return Project_Data;
...@@ -1664,13 +1479,6 @@ package Prj is ...@@ -1664,13 +1479,6 @@ package Prj is
Files_HT : Files_Htable.Instance; Files_HT : Files_Htable.Instance;
Source_Paths_HT : Source_Paths_Htable.Instance; Source_Paths_HT : Source_Paths_Htable.Instance;
-- For gprmake:
Present_Languages : Present_Language_Table.Instance;
Supp_Suffixes : Supp_Suffix_Table.Instance;
Supp_Languages : Supp_Language_Table.Instance;
Other_Sources : Other_Source_Table.Instance;
-- Private part -- Private part
Private_Part : Private_Project_Tree_Data; Private_Part : Private_Project_Tree_Data;
...@@ -1743,59 +1551,6 @@ package Prj is ...@@ -1743,59 +1551,6 @@ package Prj is
(Source_File_Name : File_Name_Type) return File_Name_Type; (Source_File_Name : File_Name_Type) return File_Name_Type;
-- Returns the switches file name corresponding to a source file name -- Returns the switches file name corresponding to a source file name
-- For gprmake
function Body_Suffix_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return String;
-- Returns the suffix of sources of language Language in project In_Project
-- in project tree In_Tree.
function Is_Present
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Boolean;
-- Return True when Language is one of the languages used in
-- project In_Project.
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Indicate if Language is or not a language used in project In_Project
function Language_Processing_Data_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Language_Processing_Data;
-- Return the Language_Processing_Data for language Language in project
-- In_Project. Return the default when no Language_Processing_Data are
-- defined for the language.
procedure Set
(Language_Processing : Language_Processing_Data;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Set the Language_Processing_Data for language Language in project
-- In_Project.
function Suffix_Of
(Language : Language_Index;
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return File_Name_Type;
-- Return the suffix for language Language in project In_Project. Return
-- No_Name when no suffix is defined for the language.
procedure Set
(Suffix : File_Name_Type;
For_Language : Language_Index;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
-- Set the suffix for language Language in project In_Project
---------------- ----------------
-- Temp Files -- -- Temp Files --
---------------- ----------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment