Commit cfc1a54a authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

work in progress

parent f0618efc
......@@ -42,21 +42,21 @@ package body TASTE.Data_View is
Files : ASN1_Maps.Map;
Current_Type : Node_Id;
function Parse_Type (Data_Type : Node_Id) return ASN1_File is
Asntype : constant Node_Id := Corresponding_Instance (Data_Type);
Name : constant String := Get_Name_String
(Get_Type_Source_Name (Asntype));
begin
Put_Line ("Data type : " & AIN_Case (Data_Type));
Put_Line (" |_" & Name);
Put_Line (" |_ Module : " & Get_Name_String
(Get_String_Property (Asntype,
Get_String_Name ("taste::ada_package_name"))));
Put_Line (" |_ File : " & Get_Name_String
(Get_Source_Text (Asntype)(1)));
return ASN1_File'(Path => US (Name),
Modules => String_Vectors.Empty_Vector); -- TODO
end Parse_Type;
-- function Parse_Type (Data_Type : Node_Id) return ASN1_File is
-- Asntype : constant Node_Id := Corresponding_Instance (Data_Type);
-- Name : constant String := Get_Name_String
-- (Get_Type_Source_Name (Asntype));
-- begin
-- Put_Line ("Data type : " & AIN_Case (Data_Type));
-- Put_Line (" |_" & Name);
-- Put_Line (" |_ Module : " & Get_Name_String
-- (Get_String_Property (Asntype,
-- Get_String_Name ("taste::ada_package_name"))));
-- Put_Line (" |_ File : " & Get_Name_String
-- (Get_Source_Text (Asntype)(1)));
-- return ASN1_File'(Path => US (Name),
-- Modules => String_Vectors.Empty_Vector); -- TODO
-- end Parse_Type;
F : Name_Id;
Loc : Location;
......@@ -91,8 +91,39 @@ package body TASTE.Data_View is
raise Data_View_Error with "Component is not a data type!";
end if;
declare
Type_File : constant ASN1_File := Parse_Type (Current_Type);
Asntype : constant Node_Id := Corresponding_Instance (Data_Type);
Sort : constant String := Get_Name_String
(Get_Type_Source_Name (Asntype));
Module : constant String := Get_Name_String
(Get_String_Property (Asntype,
Get_String_Name ("taste::ada_package_name")));
Filename : constant String := Get_Name_String
(Get_Source_Text (Asntype (1)));
-- Type_File : constant ASN1_File := Parse_Type (Current_Type);
begin
if Files.Contains (Key => Filename) then
declare
Current_File : ASN1_File := Files.Element (Filename);
begin
if Current_File.Modules.Contains (Module) then
Current_File.Modules.Element (Module).Append (Sort);
else
declare
Types : String_Vectors.Vector;
begin
Types.Append (Sort);
Current_File.Modules.Insert (Key => Module,
New_Item => Types);
end;
end if;
end;
else
declare
New_File : ASN1_File;
begin
New_File.Path := Filename;
-- etc
Files.Insert (Key => To_String (Type_File.Path),
New_Item => Type_File);
Current_Type := AIN.Next_Node (Current_Type);
......
......@@ -36,16 +36,19 @@ package TASTE.Data_View is
"data_model.aadl" &
"deployment.aadl";
package ASN1_Module_Maps is new Indefinite_Ordered_Maps
(String, String_Vectors.Vector);
type ASN1_File is
record
Path : Unbounded_String;
Modules : String_Vectors.Vector;
Modules : ASN1_Module_Maps.Map;
end record;
package ASN1_Maps is new Indefinite_Ordered_Maps (String, ASN1_File);
package ASN1_File_Maps is new Indefinite_Ordered_Maps (String, ASN1_File);
type Taste_Data_View is tagged
record
ASN1_Files : ASN1_Maps.Map;
ASN1_Files : ASN1_File_Maps.Map;
end record;
function Parse_Data_View (Dataview_Root : Node_Id) return Taste_Data_View
......
package TASTE.Parser_Version is
Parser_Release : constant String :=
"89bf5a8 ; Commit Date: Wed Jan 24 10:54:55 2018 ";
"f0618ef ; Commit Date: Thu Jan 25 14:24:31 2018 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from r0b92ed3)";
"Ocarina 2017.x (Working Copy from rd078c54)";
end TASTE.Parser_Version;
\ No newline at end of file
Supports Markdown
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