Commit 6f17e64b authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Parse Connections (incomplete), separate prefix

parent 28fb01a8
...@@ -1484,7 +1484,8 @@ begin ...@@ -1484,7 +1484,8 @@ begin
IV_Root := Root_System (Instantiate_Model (Root => Interface_Root)); IV_Root := Root_System (Instantiate_Model (Root => Interface_Root));
AST := AADL_to_Ada_IV (IV_Root); AST := AADL_to_Ada_IV (IV_Root);
for each of AST.Flat_Functions loop for each of AST.Flat_Functions loop
Put_Line ("From New AST: " & To_String (Each.Name)); Put_Line ("AST: " & To_String (Each.Prefix.Value_Or (US ("")))
& " " & To_String (Each.Name));
end loop; end loop;
Process_Interface_View (IV_Root); Process_Interface_View (IV_Root);
......
...@@ -420,12 +420,13 @@ package body Buildsupport_Utils is ...@@ -420,12 +420,13 @@ package body Buildsupport_Utils is
RI_Name : constant Name_Id := Get_Interface_Name RI_Name : constant Name_Id := Get_Interface_Name
(Get_Referenced_Entity (AIN.Destination (Conn))); (Get_Referenced_Entity (AIN.Destination (Conn)));
begin begin
Put_Line ("Caller function (has RI) : " & AIN_Case (Caller)); -- Put_Line (AIN.Node_Kind'Image (Kind (Caller)));
Put_Line ("Callee (has PI) : " & AIN_Case (Callee)); return Connection'(Caller =>
Put_Line ("PI Name: " & Get_Name_String (PI_Name)); (if Kind (Caller) = K_Subcomponent_Access_Instance then US ("_env")
Put_Line ("RI Name: " & Get_Name_String (RI_Name)); else US (AIN_Case (Caller))),
return Connection'(Caller => US (AIN_Case (Caller)), Callee =>
Callee => US (AIN_Case (Callee)), (if Kind (Callee) = K_Subcomponent_Access_Instance then US ("_env")
else US (AIN_Case (Callee))),
PI_Name => US (Get_Name_String (PI_Name)), PI_Name => US (Get_Name_String (PI_Name)),
RI_Name => US (Get_Name_String (RI_Name))); RI_Name => US (Get_Name_String (RI_Name)));
end Parse_Connection; end Parse_Connection;
...@@ -540,7 +541,8 @@ package body Buildsupport_Utils is ...@@ -540,7 +541,8 @@ package body Buildsupport_Utils is
-- * User Properties (from TASTE_IV_Properties.aadl) -- * User Properties (from TASTE_IV_Properties.aadl)
-- * Timers -- * Timers
-- * Provided and Required Interfaces -- * Provided and Required Interfaces
function Parse_Function (Name : String; function Parse_Function (Prefix : String;
Name : String;
Inst : Node_Id) return Taste_Terminal_Function Inst : Node_Id) return Taste_Terminal_Function
is is
Result : Taste_Terminal_Function; Result : Taste_Terminal_Function;
...@@ -553,6 +555,8 @@ package body Buildsupport_Utils is ...@@ -553,6 +555,8 @@ package body Buildsupport_Utils is
PI_Or_RI : Node_Id; PI_Or_RI : Node_Id;
begin begin
Result.Name := US (Name); Result.Name := US (Name);
Result.Prefix := (if Prefix'Length > 0 then Just (US (Prefix))
else Nothing);
Result.Language := Get_Source_Language (Inst); Result.Language := Get_Source_Language (Inst);
if Source_Text'Length /= 0 then if Source_Text'Length /= 0 then
Zip_Id := Source_Text (1); Zip_Id := Source_Text (1);
...@@ -596,8 +600,9 @@ package body Buildsupport_Utils is ...@@ -596,8 +600,9 @@ package body Buildsupport_Utils is
Inner : Node_Id; Inner : Node_Id;
Res : Functions.Vector := Functions.Empty_Vector; Res : Functions.Vector := Functions.Empty_Vector;
CI : constant Node_Id := Corresponding_Instance (Func); CI : constant Node_Id := Corresponding_Instance (Func);
Name : constant String := Prefix & Name : constant String := AIN_Case (Func);
(if Prefix'Length > 0 then "_" else "") & AIN_Case (Func); Next_Prefix : constant String := Prefix &
(if Prefix'Length > 0 then "_" else "") & Name;
begin begin
case Get_Category_Of_Component (CI) is case Get_Category_Of_Component (CI) is
...@@ -605,7 +610,8 @@ package body Buildsupport_Utils is ...@@ -605,7 +610,8 @@ package body Buildsupport_Utils is
if Present (AIN.Subcomponents (CI)) then if Present (AIN.Subcomponents (CI)) then
Inner := AIN.First_Node (AIN.Subcomponents (CI)); Inner := AIN.First_Node (AIN.Subcomponents (CI));
while Present (Inner) loop while Present (Inner) loop
Res := Res & Rec_Function (Prefix => Name, Func => Inner); Res := Res & Rec_Function (Prefix => Next_Prefix,
Func => Inner);
Inner := AIN.Next_Node (Inner); Inner := AIN.Next_Node (Inner);
end loop; end loop;
end if; end if;
...@@ -614,7 +620,9 @@ package body Buildsupport_Utils is ...@@ -614,7 +620,9 @@ package body Buildsupport_Utils is
if No (AIN.Subcomponents (CI)) or Res = Functions.Empty_Vector if No (AIN.Subcomponents (CI)) or Res = Functions.Empty_Vector
then then
Res := Res & Parse_Function (Name => Name, Inst => CI); Res := Res & Parse_Function (Prefix => Prefix,
Name => Name,
Inst => CI);
end if; end if;
when others => when others =>
null; null;
...@@ -633,6 +641,11 @@ package body Buildsupport_Utils is ...@@ -633,6 +641,11 @@ package body Buildsupport_Utils is
end loop; end loop;
Routes := Routes & Parse_System_Connections (System); Routes := Routes & Parse_System_Connections (System);
for Each of Routes loop
Put_Line (To_String (Each.Caller) & "." & To_String (Each.RI_Name)
& " -> " & To_String (Each.Callee) & "." &
To_String (Each.PI_Name));
end loop;
return IV_AST : constant Complete_Interface_View := return IV_AST : constant Complete_Interface_View :=
(Flat_Functions => Funcs, (Flat_Functions => Funcs,
......
...@@ -153,6 +153,7 @@ package Buildsupport_Utils is ...@@ -153,6 +153,7 @@ package Buildsupport_Utils is
type Taste_Terminal_Function is type Taste_Terminal_Function is
record record
Name : Unbounded_String; Name : Unbounded_String;
Prefix : Optional_Unbounded_String := Nothing;
Language : Supported_Source_Language; Language : Supported_Source_Language;
Zip_File : Optional_Unbounded_String := Nothing; Zip_File : Optional_Unbounded_String := Nothing;
Context_Params : Ctxt_Params.Vector; Context_Params : Ctxt_Params.Vector;
......
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