Commit 984432d0 authored by Jerome Hugues's avatar Jerome Hugues

* Address name collision in mapping multiple thread port to the same

      process

      For openaadl/ocarina#251
parent 3cb1d889
......@@ -45,6 +45,7 @@ with Ocarina.Backends.Utils;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.C_Common.Mapping;
package body Ocarina.Backends.AIR_Conf.AIR_Configuration is
......@@ -56,6 +57,7 @@ package body Ocarina.Backends.AIR_Conf.AIR_Configuration is
use Ocarina.Backends.Properties.ARINC653;
use Ocarina.Backends.Utils;
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.C_Common.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -150,21 +152,20 @@ package body Ocarina.Backends.AIR_Conf.AIR_Configuration is
while Present (C) loop
if Kind (C) = K_Connection_Instance then
Source_Port_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item
(AIN.Next_Node
(AIN.First_Node (AIN.Path (AIN.Source (C)))))));
Map_C_Enumerator_Name
(AIN.Item
(AIN.Next_Node
(AIN.First_Node (AIN.Path (AIN.Source (C))))),
Fully_Qualify_Parent => True);
Destination_Port_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item
(AIN.Next_Node
(AIN.First_Node
(AIN.Path (AIN.Destination (C)))))));
Map_C_Enumerator_Name
(AIN.Item
(AIN.Next_Node
(AIN.First_Node
(AIN.Path (AIN.Destination (C))))),
Fully_Qualify_Parent => True);
Source_Partition :=
AIN.Corresponding_Instance
......
......@@ -40,6 +40,7 @@ with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.ME_AADL.AADL_Tree.Entities;
with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.Utils;
with Ocarina.Instances.Queries;
......@@ -58,6 +59,7 @@ package body Ocarina.Backends.AIR_Conf.Partitions is
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Instances.Queries;
use Ocarina.Backends.C_Common.Mapping;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Messages;
......@@ -269,12 +271,15 @@ package body Ocarina.Backends.AIR_Conf.Partitions is
Port_Node := Make_XML_Node ("Queuing_Port");
end if;
-- Port name
-- Port name: partition + port name
Set_Str_To_Name_Buffer ("Name");
P := Make_Defining_Identifier (Name_Find);
Get_Name_String (Display_Name (Identifier (F)));
Get_Name_String
(Map_C_Enumerator_Name (F,
Fully_Qualify_Parent => True));
Q := Make_Defining_Identifier (To_Lower (Name_Find));
Append_Node_To_List
(Make_Assignement (P, Q),
......
......@@ -1772,11 +1772,29 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
(N,
CTN.Values (Global_Port_To_Entity));
N :=
Make_Literal
(CV.New_Pointed_Char_Value
(Map_C_Enumerator_Name (F)));
Append_Node_To_List (N, CTN.Values (Global_Port_Names));
-- For each feature of a thread, we define a
-- global port name as the name of the process
-- port.
--
-- Note: these names are also used by some other
-- backend, e.g. as part of TSP configuration.
declare
F_L : constant List_Id :=
(if Is_In (F) then
AAN.Sources (F) else
AAN.Destinations (F));
F_N : constant Node_Id := AAN.First_Node (F_L);
begin
N :=
Make_Literal
(CV.New_Pointed_Char_Value
(Map_C_Enumerator_Name
(Item (Foo_N),
Fully_Qualify_Parent => True)));
Append_Node_To_List
(N, CTN.Values (Global_Port_Names));
end;
N :=
Make_Literal
......
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