Commit 6617ca90 authored by Maxime Perrotin's avatar Maxime Perrotin
parents a4708757 44ffa149
......@@ -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),
......
......@@ -926,12 +926,13 @@ package body Ocarina.Backends.C_Common.Mapping is
---------------------------
function Map_C_Enumerator_Name
(E : Node_Id;
Custom_Parent : Node_Id := No_Node;
Entity : Boolean := False;
Server : Boolean := False;
Port_Type : Boolean := False;
Local_Port : Boolean := False) return Name_Id
(E : Node_Id;
Custom_Parent : Node_Id := No_Node;
Fully_Qualify_Parent : Boolean := False;
Entity : Boolean := False;
Server : Boolean := False;
Port_Type : Boolean := False;
Local_Port : Boolean := False) return Name_Id
is
C_Name_1 : Name_Id;
C_Name_2 : Name_Id;
......@@ -939,10 +940,19 @@ package body Ocarina.Backends.C_Common.Mapping is
if Kind (E) = K_Port_Spec_Instance then
C_Name_1 := CTU.To_C_Name (Display_Name (Identifier (E)));
Get_Name_String
(CTU.To_C_Name
(Display_Name
(Identifier (Parent_Subcomponent (Parent_Component (E))))));
if Fully_Qualify_Parent then
Get_Name_String
(CTU.To_C_Name
(Fully_Qualified_Instance_Name
(Parent_Component ((E)))));
else
Get_Name_String
(CTU.To_C_Name
(Display_Name
(Identifier (Parent_Subcomponent
(Parent_Component (E))))));
end if;
if Local_Port then
Add_Str_To_Name_Buffer ("_local_");
Get_Name_String_And_Append (C_Name_1);
......
......@@ -70,19 +70,22 @@ package Ocarina.Backends.C_Common.Mapping is
Variable : Name_Id := No_Name) return Node_Id;
function Map_C_Enum_Name (E : Node_Id; Enumerator : Name_Id) return Name_Id;
function Map_C_Enumerator_Name
(E : Node_Id;
Custom_Parent : Node_Id := No_Node;
Entity : Boolean := False;
Server : Boolean := False;
Port_Type : Boolean := False;
Local_Port : Boolean := False) return Name_Id;
(E : Node_Id;
Custom_Parent : Node_Id := No_Node;
Fully_Qualify_Parent : Boolean := False;
Entity : Boolean := False;
Server : Boolean := False;
Port_Type : Boolean := False;
Local_Port : Boolean := False) return Name_Id;
function Map_C_Define_Name
(E : Node_Id;
Nb_Ports : Boolean := False;
Nb_States : Boolean := False;
Max_Dispatch_Transitions_Per_Complete_State : Boolean := False;
Max_Dispatch_Triggers_Per_Dispatch_Transition : Boolean := False)
return Name_Id;
return Name_Id;
function Map_C_Full_Parameter_Name
(Spg : Node_Id;
P : Node_Id;
......
......@@ -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 (F_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