Commit 5fc3b4c7 by Robert Dewar Committed by Geert Bosch

* prj-attr.adb: Minor reformatting throughout

From-SVN: r46544
parent 8c736034
2001-10-26 Robert Dewar <dewar@gnat.com> 2001-10-26 Robert Dewar <dewar@gnat.com>
* prj-attr.adb: Minor reformatting throughout
2001-10-26 Robert Dewar <dewar@gnat.com>
* prj-attr.ads: Minor reformatting * prj-attr.ads: Minor reformatting
Add ??? comment (this whole spec has almost no comments) Add ??? comment (this whole spec has almost no comments)
......
...@@ -33,11 +33,20 @@ with Output; use Output; ...@@ -33,11 +33,20 @@ with Output; use Output;
package body Prj.Attr is package body Prj.Attr is
-- Names end with '#' -- Names end with '#'
-- Package names are preceded by 'P' -- Package names are preceded by 'P'
-- Attribute names are preceded by two capital letters:
-- 'S' for Single or 'L' for list, then -- Attribute names are preceded by two letters
-- 'V' for single variable, 'A' for associative array or
-- 'a' for case insensitive associative array. -- The first letter is one of
-- 'S' for Single
-- 'L' for list
-- The second letter is one of
-- 'V' for single variable
-- 'A' for associative array
-- 'a' for case insensitive associative array
-- End is indicated by two consecutive '#'. -- End is indicated by two consecutive '#'.
Initialisation_Data : constant String := Initialisation_Data : constant String :=
...@@ -129,8 +138,8 @@ package body Prj.Attr is ...@@ -129,8 +138,8 @@ package body Prj.Attr is
Package_Name : Name_Id := No_Name; Package_Name : Name_Id := No_Name;
Attribute_Name : Name_Id := No_Name; Attribute_Name : Name_Id := No_Name;
First_Attribute : Attribute_Node_Id := Attribute_First; First_Attribute : Attribute_Node_Id := Attribute_First;
begin
begin
-- Make sure the two tables are empty -- Make sure the two tables are empty
Attributes.Set_Last (Attributes.First); Attributes.Set_Last (Attributes.First);
...@@ -140,16 +149,21 @@ package body Prj.Attr is ...@@ -140,16 +149,21 @@ package body Prj.Attr is
Is_An_Attribute := True; Is_An_Attribute := True;
case Initialisation_Data (Start) is case Initialisation_Data (Start) is
when 'P' => when 'P' =>
-- New allowed package -- New allowed package
Start := Start + 1; Start := Start + 1;
Finish := Start; Finish := Start;
while Initialisation_Data (Finish) /= '#' loop while Initialisation_Data (Finish) /= '#' loop
Finish := Finish + 1; Finish := Finish + 1;
end loop; end loop;
Name_Len := Finish - Start; Name_Len := Finish - Start;
Name_Buffer (1 .. Name_Len) := Name_Buffer (1 .. Name_Len) :=
To_Lower (Initialisation_Data (Start .. Finish - 1)); To_Lower (Initialisation_Data (Start .. Finish - 1));
Package_Name := Name_Find; Package_Name := Name_Find;
for Index in Package_First .. Package_Attributes.Last loop for Index in Package_First .. Package_Attributes.Last loop
if Package_Name = Package_Attributes.Table (Index).Name then if Package_Name = Package_Attributes.Table (Index).Name then
Write_Line ("Duplicate package name """ & Write_Line ("Duplicate package name """ &
...@@ -166,16 +180,21 @@ package body Prj.Attr is ...@@ -166,16 +180,21 @@ package body Prj.Attr is
Package_Attributes.Table (Current_Package).Name := Package_Attributes.Table (Current_Package).Name :=
Package_Name; Package_Name;
Start := Finish + 1; Start := Finish + 1;
when 'S' => when 'S' =>
Kind_1 := Single; Kind_1 := Single;
when 'L' => when 'L' =>
Kind_1 := List; Kind_1 := List;
when others => when others =>
raise Program_Error; raise Program_Error;
end case; end case;
if Is_An_Attribute then if Is_An_Attribute then
-- New attribute -- New attribute
Start := Start + 1; Start := Start + 1;
case Initialisation_Data (Start) is case Initialisation_Data (Start) is
when 'V' => when 'V' =>
...@@ -187,11 +206,14 @@ package body Prj.Attr is ...@@ -187,11 +206,14 @@ package body Prj.Attr is
when others => when others =>
raise Program_Error; raise Program_Error;
end case; end case;
Start := Start + 1; Start := Start + 1;
Finish := Start; Finish := Start;
while Initialisation_Data (Finish) /= '#' loop while Initialisation_Data (Finish) /= '#' loop
Finish := Finish + 1; Finish := Finish + 1;
end loop; end loop;
Name_Len := Finish - Start; Name_Len := Finish - Start;
Name_Buffer (1 .. Name_Len) := Name_Buffer (1 .. Name_Len) :=
To_Lower (Initialisation_Data (Start .. Finish - 1)); To_Lower (Initialisation_Data (Start .. Finish - 1));
...@@ -199,12 +221,15 @@ package body Prj.Attr is ...@@ -199,12 +221,15 @@ package body Prj.Attr is
Attributes.Increment_Last; Attributes.Increment_Last;
if Current_Attribute = Empty_Attribute then if Current_Attribute = Empty_Attribute then
First_Attribute := Attributes.Last; First_Attribute := Attributes.Last;
if Current_Package /= Empty_Package then if Current_Package /= Empty_Package then
Package_Attributes.Table (Current_Package).First_Attribute Package_Attributes.Table (Current_Package).First_Attribute
:= Attributes.Last; := Attributes.Last;
end if; end if;
else else
-- Check that there are no duplicate attributes -- Check that there are no duplicate attributes
for Index in First_Attribute .. Attributes.Last - 1 loop for Index in First_Attribute .. Attributes.Last - 1 loop
if Attribute_Name = if Attribute_Name =
Attributes.Table (Index).Name then Attributes.Table (Index).Name then
...@@ -214,9 +239,11 @@ package body Prj.Attr is ...@@ -214,9 +239,11 @@ package body Prj.Attr is
raise Program_Error; raise Program_Error;
end if; end if;
end loop; end loop;
Attributes.Table (Current_Attribute).Next := Attributes.Table (Current_Attribute).Next :=
Attributes.Last; Attributes.Last;
end if; end if;
Current_Attribute := Attributes.Last; Current_Attribute := Attributes.Last;
Attributes.Table (Current_Attribute) := Attributes.Table (Current_Attribute) :=
(Name => Attribute_Name, (Name => Attribute_Name,
......
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