Commit 28fb01a8 authored by Maxime Perrotin's avatar Maxime Perrotin

Parse connections (in progress)

parent 70c9810c
......@@ -408,8 +408,46 @@ package body Buildsupport_Utils is
Funcs : Functions.Vector := Functions.Empty_Vector;
Routes : Channels.Vector; -- := Channels.Empty_Vector;
Current_Function : Node_Id;
-- Parse a connection
function Parse_Connection (Conn : Node_Id) return Connection is
Caller : constant Node_Id := AIN.Item (AIN.First_Node
(AIN.Path (AIN.Destination (Conn))));
Callee : constant Node_Id := AIN.Item (AIN.First_Node
(AIN.Path (AIN.Source (Conn))));
PI_Name : constant Name_Id := Get_Interface_Name
(Get_Referenced_Entity (AIN.Source (Conn)));
RI_Name : constant Name_Id := Get_Interface_Name
(Get_Referenced_Entity (AIN.Destination (Conn)));
begin
Put_Line ("Caller function (has RI) : " & AIN_Case (Caller));
Put_Line ("Callee (has PI) : " & AIN_Case (Callee));
Put_Line ("PI Name: " & Get_Name_String (PI_Name));
Put_Line ("RI Name: " & Get_Name_String (RI_Name));
return Connection'(Caller => US (AIN_Case (Caller)),
Callee => US (AIN_Case (Callee)),
PI_Name => US (Get_Name_String (PI_Name)),
RI_Name => US (Get_Name_String (RI_Name)));
end Parse_Connection;
-- Create a vector of connections for a given system
-- This vector will then be filtered to connect end-to-end functions
-- once the system is flattened
function Parse_System_Connections (System : Node_Id)
return Channels.Vector
is
Conn : Node_Id;
pragma Unreferenced (Routes);
Result : Channels.Vector;
begin
if Present (AIN.Connections (System)) then
Conn := AIN.First_Node (AIN.Connections (System));
while Present (Conn) loop
Result := Result & Parse_Connection (Conn);
Conn := AIN.Next_Node (Conn);
end loop;
end if;
return Result;
end Parse_System_Connections;
-- Parse an individual context parameter
function Parse_CP (Subco : Node_Id) return Context_Parameter is
......@@ -480,6 +518,7 @@ package body Buildsupport_Utils is
Result.RCM := Get_RCM_Operation_Kind (If_I);
Result.Period_Or_MIAT := Get_RCM_Period (If_I);
Result.WCET_ms := Get_Upper_WCET (If_I);
Result.User_Properties := Get_Properties_Map (If_I);
-- Parameters:
if not Is_Empty (AIN.Features (Sub_I)) then
Param_I := AIN.First_Node (AIN.Features (Sub_I));
......@@ -490,11 +529,6 @@ package body Buildsupport_Utils is
Param_I := AIN.Next_Node (Param_I);
end loop;
end if;
-- Parse the connection (if RI)
-- if not AIN.Is_Provided (If_I) then
-- Put_Line ("Required Interface " & To_String (Result.Name));
-- Put_Line ("Connected to " & AIN_Case (CI));
-- end if;
return Result;
end Parse_Interface;
......@@ -517,8 +551,6 @@ package body Buildsupport_Utils is
Subco : Node_Id;
-- To get the provided and required interfaces
PI_Or_RI : Node_Id;
If_AST : Taste_Interface;
pragma Unreferenced (If_AST);
begin
Result.Name := US (Name);
Result.Language := Get_Source_Language (Inst);
......@@ -554,6 +586,7 @@ package body Buildsupport_Utils is
PI_Or_RI := AIN.Next_Node (PI_Or_RI);
end loop;
end if;
Result.User_Properties := Get_Properties_Map (Inst);
return Result;
end Parse_Function;
......@@ -577,6 +610,8 @@ package body Buildsupport_Utils is
end loop;
end if;
Routes := Routes & Parse_System_Connections (CI);
if No (AIN.Subcomponents (CI)) or Res = Functions.Empty_Vector
then
Res := Res & Parse_Function (Name => Name, Inst => CI);
......@@ -597,17 +632,11 @@ package body Buildsupport_Utils is
Current_Function := AIN.Next_Node (Current_Function);
end loop;
-- Parse connections
if Present (AIN.Connections (System)) then
Conn := AIN.First_Node (AIN.Connections (System));
while Present (Conn) loop
Conn := AIN.Next_Node (Conn);
end loop;
end if;
Routes := Routes & Parse_System_Connections (System);
return IV_AST : constant Complete_Interface_View :=
(Flat_Functions => Funcs);
-- Connections => Routes);
(Flat_Functions => Funcs,
Connections => Routes);
end AADL_to_Ada_IV;
end Buildsupport_Utils;
......@@ -167,10 +167,10 @@ package Buildsupport_Utils is
type Connection is
record
Source_Function : Unbounded_String;
Dest_Function : Unbounded_String;
Source_RI_Name : Unbounded_String;
Dest_PI_Name : Unbounded_String;
Caller : Unbounded_String;
Callee : Unbounded_String;
RI_Name : Unbounded_String;
PI_Name : Unbounded_String;
end record;
package Channels is new Indefinite_Vectors (Natural, Connection);
......@@ -178,7 +178,7 @@ package Buildsupport_Utils is
type Complete_Interface_View is
record
Flat_Functions : Functions.Vector;
-- Connections : Channels.Vector;
Connections : Channels.Vector;
end record;
-- Function to build up the Ada AST by transforming the one from Ocarina
......
......@@ -9,6 +9,7 @@ PACKAGE interfaceview::IV::Function1_ShouldNotAppear::Nested1_Appear
PUBLIC
WITH interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::Nested2_Appear;
WITH interfaceview::IV::Y_Hidden::Z_Shown;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -39,6 +40,12 @@ END RI_world;
SUBPROGRAM IMPLEMENTATION RI_world.others
END RI_world.others;
SUBPROGRAM RI_ola_bis
END RI_ola_bis;
SUBPROGRAM IMPLEMENTATION RI_ola_bis.others
END RI_ola_bis.others;
SYSTEM Nested1_Appear
FEATURES
PI_hello : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function1_ShouldNotAppear::Nested1_Appear::PI_hello.others {
......@@ -54,6 +61,12 @@ FEATURES
Taste::InterfaceName => "world";
Taste::labelInheritance => "true";
};
RI_ola_bis : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "140345 66548";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "ola_bis";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (Ada);
Taste::Active_Interfaces => any;
......@@ -68,6 +81,7 @@ PACKAGE interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::
PUBLIC
WITH interfaceview::IV::Level0_Appear;
WITH interfaceview::IV::Y_Hidden::Z_Shown;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -98,6 +112,18 @@ END RI_my_final_result;
SUBPROGRAM IMPLEMENTATION RI_my_final_result.others
END RI_my_final_result.others;
SUBPROGRAM RI_ola
END RI_ola;
SUBPROGRAM IMPLEMENTATION RI_ola.others
END RI_ola.others;
SUBPROGRAM RI_RI1
END RI_RI1;
SUBPROGRAM IMPLEMENTATION RI_RI1.others
END RI_RI1.others;
SYSTEM Nested2_Appear
FEATURES
PI_world : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::Nested2_Appear::PI_world.others {
......@@ -113,6 +139,18 @@ FEATURES
Taste::InterfaceName => "my_final_result";
Taste::labelInheritance => "true";
};
RI_ola : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "156260 86774";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "ola";
Taste::labelInheritance => "true";
};
RI_RI1 : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::Nested2_Appear::RI_RI1.others {
Taste::coordinates => "172016 90485";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "RI1";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (Ada);
Taste::Active_Interfaces => any;
......@@ -132,6 +170,7 @@ PUBLIC
WITH interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::Nested2_Appear;
WITH interfaceview::IV::Level0_Appear;
WITH interfaceview::IV::Y_Hidden::Z_Shown;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -162,6 +201,12 @@ END RI_my_final_result;
SUBPROGRAM IMPLEMENTATION RI_my_final_result.others
END RI_my_final_result.others;
SUBPROGRAM RI_ola
END RI_ola;
SUBPROGRAM IMPLEMENTATION RI_ola.others
END RI_ola.others;
SYSTEM Should_Not_Appear_Either
FEATURES
PI_world : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either::Nested2_Appear::PI_world.others {
......@@ -177,6 +222,12 @@ FEATURES
Taste::InterfaceName => "my_final_result";
Taste::labelInheritance => "true";
};
RI_ola : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "144855 90656";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "ola";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
......@@ -194,6 +245,9 @@ CONNECTIONS
Function1_PI_my_final_result_Nested2_RI_my_final_result : SUBPROGRAM ACCESS RI_my_final_result -> Nested2_Appear.RI_my_final_result {
Taste::coordinates => "156260 82070 150557 82070 150557 80895 144855 80895";
};
Should_Not_Appear_Either_PI_ola_Nested2_Appear_RI_ola : SUBPROGRAM ACCESS RI_ola -> Nested2_Appear.RI_ola {
Taste::coordinates => "156260 86774 150558 86774 150558 90656 144855 90656";
};
END Should_Not_Appear_Either.others;
END interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either;
......@@ -240,6 +294,7 @@ WITH interfaceview::IV::Function1_ShouldNotAppear::Nested1_Appear;
WITH interfaceview::IV::Function1_ShouldNotAppear::Should_Not_Appear_Either;
WITH interfaceview::IV::Function1_ShouldNotAppear::MotherClass_Appear;
WITH interfaceview::IV::Level0_Appear;
WITH interfaceview::IV::Y_Hidden::Z_Shown;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -267,6 +322,18 @@ END RI_my_final_result;
SUBPROGRAM IMPLEMENTATION RI_my_final_result.others
END RI_my_final_result.others;
SUBPROGRAM RI_ola
END RI_ola;
SUBPROGRAM IMPLEMENTATION RI_ola.others
END RI_ola.others;
SUBPROGRAM RI_ola_bis
END RI_ola_bis;
SUBPROGRAM IMPLEMENTATION RI_ola_bis.others
END RI_ola_bis.others;
SYSTEM Function1_ShouldNotAppear
FEATURES
PI_hello : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function1_ShouldNotAppear::Nested1_Appear::PI_hello.others {
......@@ -282,6 +349,18 @@ FEATURES
Taste::InterfaceName => "my_final_result";
Taste::labelInheritance => "true";
};
RI_ola : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "124279 92808";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "ola";
Taste::labelInheritance => "true";
};
RI_ola_bis : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "124279 84791";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "ola_bis";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
......@@ -307,9 +386,15 @@ CONNECTIONS
Function1_PI_world_Nested1_RI_world : SUBPROGRAM ACCESS Should_Not_Appear_Either.PI_world -> Nested1_Appear.RI_world {
Taste::coordinates => "153203 65140 158967 65140 158967 70311";
};
Function1_ShouldNotAppear_PI_ola_bis_Nested1_Appear_RI_ola_bis : SUBPROGRAM ACCESS RI_ola_bis -> Nested1_Appear.RI_ola_bis {
Taste::coordinates => "140345 66548 140345 84791 124279 84791";
};
Function1_ShouldNotAppear_PI_my_final_result_Function1_RI_my_final_result : SUBPROGRAM ACCESS RI_my_final_result -> Should_Not_Appear_Either.RI_my_final_result {
Taste::coordinates => "144855 80895 134567 80895 134567 80311 124279 80311";
};
Function1_ShouldNotAppear_PI_ola_Should_Not_Appear_Either_RI_ola : SUBPROGRAM ACCESS RI_ola -> Should_Not_Appear_Either.RI_ola {
Taste::coordinates => "144855 90656 134567 90656 134567 92808 124279 92808";
};
END Function1_ShouldNotAppear.others;
END interfaceview::IV::Function1_ShouldNotAppear;
......@@ -370,11 +455,83 @@ END Level0_Appear.others;
END interfaceview::IV::Level0_Appear;
PACKAGE interfaceview::IV::Y_Hidden::Z_Shown
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_bonjour
END PI_bonjour;
SUBPROGRAM IMPLEMENTATION PI_bonjour.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_bonjour.others;
SYSTEM Z_Shown
FEATURES
PI_bonjour : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "102645 107303";
Taste::RCMoperationKind => unprotected;
Taste::InterfaceName => "bonjour";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
END Z_Shown;
SYSTEM IMPLEMENTATION Z_Shown.others
END Z_Shown.others;
END interfaceview::IV::Y_Hidden::Z_Shown;
PACKAGE interfaceview::IV::Y_Hidden
PUBLIC
WITH interfaceview::IV::Y_Hidden::Z_Shown;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_bonjour
END PI_bonjour;
SUBPROGRAM IMPLEMENTATION PI_bonjour.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_bonjour.others;
SYSTEM Y_Hidden
FEATURES
PI_bonjour : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Y_Hidden::Z_Shown::PI_bonjour.others {
Taste::coordinates => "109817 102811";
Taste::RCMoperationKind => unprotected;
Taste::InterfaceName => "bonjour";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
END Y_Hidden;
SYSTEM IMPLEMENTATION Y_Hidden.others
SUBCOMPONENTS
Z_Shown : SYSTEM interfaceview::IV::Y_Hidden::Z_Shown::Z_Shown.others {
Taste::coordinates => "82304 103585 102645 117224";
};
CONNECTIONS
Z_Shown_PI_bonjour_Y_Hidden_RI_bonjour : SUBPROGRAM ACCESS Z_Shown.PI_bonjour -> PI_bonjour {
Taste::coordinates => "109817 102811 104850 102811 104850 107303 102645 107303";
};
END Y_Hidden.others;
END interfaceview::IV::Y_Hidden;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::Function1_ShouldNotAppear;
WITH interfaceview::IV::Level0_Appear;
WITH interfaceview::IV::Y_Hidden;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
......@@ -389,6 +546,9 @@ SUBCOMPONENTS
Level0_Appear : SYSTEM interfaceview::IV::Level0_Appear::Level0_Appear.others {
Taste::coordinates => "81834 63257 99353 90064";
};
Y_Hidden : SYSTEM interfaceview::IV::Y_Hidden::Y_Hidden.others {
Taste::coordinates => "81833 95002 109817 119693";
};
CONNECTIONS
Function1_ShouldNotAppear_PI_hello_Level0_RI_I_say_hello : SUBPROGRAM ACCESS Function1_ShouldNotAppear.PI_hello -> Level0_Appear.RI_I_say_hello {
Taste::coordinates => "99353 67961 111816 67961 111816 55614 124279 55614";
......@@ -396,6 +556,12 @@ CONNECTIONS
Level0_PI_final_result_Function1_ShouldNotAppear_RI_my_final_result : SUBPROGRAM ACCESS Level0_Appear.PI_final_result -> Function1_ShouldNotAppear.RI_my_final_result {
Taste::coordinates => "124279 80311 111816 80311 111816 83249 99353 83249";
};
Y_Hidden_PI_bonjour_Function1_ShouldNotAppear_RI_ola : SUBPROGRAM ACCESS Y_Hidden.PI_bonjour -> Function1_ShouldNotAppear.RI_ola {
Taste::coordinates => "124279 92808 115667 92808 115667 102811 109817 102811";
};
Y_Hidden_PI_bonjour_Function1_ShouldNotAppear_RI_ola_bis : SUBPROGRAM ACCESS Y_Hidden.PI_bonjour -> Function1_ShouldNotAppear.RI_ola_bis {
Taste::coordinates => "124279 84791 115667 84791 115667 102811 109817 102811";
};
END interfaceview.others;
PROPERTIES
......
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