Commit d458a1a5 authored by jhugues's avatar jhugues

* Add support for configuration variables passed by the user

          by mean of the Type_Source_Name property



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2516 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent c026bf85
......@@ -141,13 +141,18 @@ package body Ocarina.Backends.PO_HI_Ada.Naming is
N : Node_Id;
L : Node_Id;
P : Node_Id;
V : Node_Id;
Configuration_Data : Name_Id := No_Name;
begin
if AAU.Is_Process (E) then
Location := Get_Location (Get_Bound_Processor (E));
Port_Number := Get_Port_Number (E);
elsif AAU.Is_Device (E) then
Location := Get_Location (E);
Port_Number := Get_Port_Number (E);
Configuration_Data := Get_Type_Source_Name (E);
end if;
if Location = No_Name then
......@@ -178,9 +183,17 @@ package body Ocarina.Backends.PO_HI_Ada.Naming is
P := Make_Literal (To_Ada_Value (Port_Number));
end if;
if Configuration_Data = No_Name then
V := RE (RE_Null_Address);
else
V := Make_Attribute_Designator
(Map_Ada_Subprogram_Identifier (Configuration_Data),
A_Address);
end if;
-- Build the record aggregate
N := Make_Record_Aggregate (Make_List_Id (L, P));
N := Make_Record_Aggregate (Make_List_Id (L, P, V));
N := Make_Element_Association (Extract_Enumerator (E), N);
return N;
end Naming_Information;
......@@ -352,8 +365,6 @@ package body Ocarina.Backends.PO_HI_Ada.Naming is
end loop;
end if;
-- A useful marking (for future fetch of the transport layer)
-- Generate the naming table
case Transport_API is
......@@ -404,6 +415,7 @@ package body Ocarina.Backends.PO_HI_Ada.Naming is
Expression => Make_Array_Aggregate
(Naming_Table_List));
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
else
-- We generate the default name table
......
......@@ -294,7 +294,9 @@ package body Ocarina.Backends.PO_HI_Ada.Subprograms is
if not AAU.Is_Empty (AAN.Subcomponents (Implementation)) then
S := First_Node (Subcomponents (Implementation));
while Present (S) loop
Visit_Component_Instance (Corresponding_Instance (S));
if not AAU.Is_Subprogram (Corresponding_Instance (S)) then
Visit_Component_Instance (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
......@@ -891,7 +893,9 @@ package body Ocarina.Backends.PO_HI_Ada.Subprograms is
if not AAU.Is_Empty (AAN.Subcomponents (Implementation)) then
S := First_Node (Subcomponents (Implementation));
while Present (S) loop
Visit_Component_Instance (Corresponding_Instance (S));
if not AAU.Is_Subprogram (Corresponding_Instance (S)) then
Visit_Component_Instance (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
......
......@@ -42,7 +42,6 @@ with Ocarina.Backends.Utils;
with Ocarina.Backends.Properties;
with Ocarina.Backends.Ada_Tree.Nutils;
with Ocarina.Backends.Ada_Tree.Nodes;
with Ocarina.Backends.Ada_Values;
with Ocarina.Backends.PO_HI_Ada.Mapping;
with Ocarina.Backends.PO_HI_Ada.Runtime;
......@@ -60,7 +59,6 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package ADN renames Ocarina.Backends.Ada_Tree.Nodes;
package ADV renames Ocarina.Backends.Ada_Values;
------------------
-- Package_Spec --
......@@ -925,7 +923,7 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
declare
Profile : constant List_Id
:= New_List (ADN.K_Parameter_Profile);
A, B, C : Node_Id;
A : Node_Id;
begin
-- Entity
......@@ -951,62 +949,24 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
RE (RE_Stream_Element_Offset),
Mode_In);
Append_Node_To_List (A, Profile);
if not Is_Handled (Device) then
-- Make sure we import only
-- once definition for send
-- for this device.
Set_Handled (Device);
-- The subprogram spec
Get_Name_String
(Name
(Identifier
(Corresponding_Instance
(Device))));
Add_Str_To_Name_Buffer ("_send");
B := Make_Defining_Identifier
(Name_Find);
A := Make_Subprogram_Specification
(B,
Profile,
RE (RE_Error_Kind));
Append_Node_To_List (A, Declarations);
Get_Name_String
(Name
(Identifier
(Corresponding_Instance
(Device))));
Add_Str_To_Name_Buffer ("_send");
C := Make_Literal
(ADV.New_String_Value (Name_Find));
A := Make_Pragma_Statement
(Pragma_Import,
Make_List_Id
(Make_Defining_Identifier
(PN (P_C)),
B,
C));
Append_Node_To_List (A, Declarations);
end if;
end;
Get_Name_String
(Name
(Identifier
N := Make_Designator
(Unit_Name
(Get_Send_Function_Name
(Corresponding_Instance (Device))));
Add_With_Package (N);
N := Make_Designator
(Local_Name
(Get_Send_Function_Name
(Corresponding_Instance (Device))),
Unit_Name
(Get_Send_Function_Name
(Corresponding_Instance (Device))));
Add_Str_To_Name_Buffer ("_send");
N := Make_Defining_Identifier (Name_Find);
N := Make_Subprogram_Call
(N,
(ADN.Defining_Identifier (N),
Make_List_Id
(Make_Indexed_Component
(RE (RE_Entity_Table),
......
......@@ -4297,15 +4297,16 @@ package body Ocarina.Backends.Properties is
Impl := Get_Implementation (Device);
if Impl /= No_Node then
if Present (Impl) then
if not AINU.Is_Empty (AIN.Subcomponents (Impl)) then
S := AIN.First_Node (AIN.Subcomponents (Impl));
while Present (S) loop
I := Corresponding_Instance (S);
if Is_Subprogram (I) and then
AIN.Name (AIN.Identifier (S))
= Get_String_Name ("sender") and then
Get_Source_Name (I) /= No_Name then
if Is_Subprogram (I)
and then AIN.Name (AIN.Identifier (S))
= Get_String_Name ("sender")
and then Get_Source_Name (I) /= No_Name
then
return Get_Source_Name (I);
end if;
S := AIN.Next_Node (S);
......
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