Commit db8e62c1 authored by yoogx's avatar yoogx

* Simplify code structure

        Part of openaadl/ocarina#128
parent 7a6d1b3d
......@@ -38,6 +38,7 @@ with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Build_Utils;
with Ocarina.Backends.Helper;
with Ocarina.Backends.Messages;
with Ocarina.Backends.Properties;
with Ocarina.Backends.Utils;
......@@ -52,6 +53,7 @@ package body Ocarina.Backends.Cheddar.Mapping is
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.Helper;
use Ocarina.Backends.Build_Utils;
use Ocarina.Backends.Messages;
use Ocarina.Backends.Properties;
......@@ -290,60 +292,54 @@ package body Ocarina.Backends.Cheddar.Mapping is
-- enclosing process.
P := Make_XML_Node ("resource_used_by");
declare
Access_List : constant List_Id :=
Connections
Access_List : constant AINU.Node_Array :=
Connections_Of
(Corresponding_Instance
(Get_Container_Process (Parent_Subcomponent (E))));
Connection : Node_Id;
K, M : Node_Id;
begin
if not AINU.Is_Empty (Access_List) then
Connection := AIN.First_Node (Access_List);
while Present (Connection) loop
if Kind (Connection) = K_Connection_Instance
and then
Get_Category_Of_Connection (Connection) =
CT_Access_Data
for Connection of Access_List loop
if Kind (Connection) = K_Connection_Instance
and then Get_Category_Of_Connection (Connection) =
CT_Access_Data
then
if Item (AIN.First_Node (Path (Source (Connection)))) =
Parent_Subcomponent (E)
then
if Item (AIN.First_Node (Path (Source (Connection)))) =
Parent_Subcomponent (E)
then
M := Make_XML_Node ("resource_user");
K :=
Make_Defining_Identifier
(Fully_Qualified_Instance_Name
(Corresponding_Instance
(Item
(AIN.First_Node
(Path (Destination (Connection)))))));
Append_Node_To_List (K, XTN.Subitems (M));
-- For now, we assume all tasks take the
-- resource at the beginning, and release it at
-- the end of their dispatch.
K := Make_Literal (XV.New_Numeric_Value (1, 1, 10));
Append_Node_To_List (K, XTN.Subitems (M));
K :=
Make_Literal
(XV.New_Numeric_Value
(To_Microseconds
(Get_Execution_Time
(Corresponding_Instance
(Item
(AIN.First_Node
(Path (Destination (Connection))))))
(1)),
1,
10));
Append_Node_To_List (K, XTN.Subitems (M));
Append_Node_To_List (M, XTN.Subitems (P));
end if;
M := Make_XML_Node ("resource_user");
K :=
Make_Defining_Identifier
(Fully_Qualified_Instance_Name
(Corresponding_Instance
(Item
(AIN.First_Node
(Path (Destination (Connection)))))));
Append_Node_To_List (K, XTN.Subitems (M));
-- For now, we assume all tasks take the
-- resource at the beginning, and release it at
-- the end of their dispatch.
K := Make_Literal (XV.New_Numeric_Value (1, 1, 10));
Append_Node_To_List (K, XTN.Subitems (M));
K :=
Make_Literal
(XV.New_Numeric_Value
(To_Microseconds
(Get_Execution_Time
(Corresponding_Instance
(Item
(AIN.First_Node
(Path (Destination (Connection))))))
(1)),
1,
10));
Append_Node_To_List (K, XTN.Subitems (M));
Append_Node_To_List (M, XTN.Subitems (P));
end if;
Connection := AIN.Next_Node (Connection);
end loop;
end if;
end if;
end loop;
end;
Append_Node_To_List (P, XTN.Subitems (N));
......
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