Commit 65db5523 authored by hugues.jerome's avatar hugues.jerome

* Correct pattern for accessors of data component types,

	  update backends to avoid treating subprogram subcomponents
	  when building types or marshallers.



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1456 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent f2dda3b1
......@@ -2008,6 +2008,9 @@ package body Ocarina.Backends.C_Common.Mapping is
Field := AIN.First_Node (Subcomponents (D));
while Present (Field) loop
if AINU.Is_Data
(Corresponding_Instance (Field))
then
if Mode = Mode_In then
Param := CTU.Make_Parameter_Specification
(Defining_Identifier =>
......@@ -2025,7 +2028,7 @@ package body Ocarina.Backends.C_Common.Mapping is
(Corresponding_Instance (Field))));
end if;
CTU.Append_Node_To_List (Param, Profile);
end if;
Field := AIN.Next_Node (Field);
end loop;
......
......@@ -626,7 +626,6 @@ package body Ocarina.Backends.C_Common.Subprograms is
S := First_Node (Features (E));
while Present (S) loop
Visit (Corresponding_Instance (S));
S := Next_Node (S);
......
......@@ -492,8 +492,9 @@ package body Ocarina.Backends.C_Common.Types is
while Present (C) loop
-- Generate the C type corresponding to the
-- subcomponent.
-- subcomponents.
if AINU.Is_Data (Corresponding_Instance (C)) then
Visit (Corresponding_Instance (C));
-- Make the record or private type component
......@@ -504,6 +505,7 @@ package body Ocarina.Backends.C_Common.Types is
Used_Type => Map_C_Data_Type_Designator
(Corresponding_Instance (C)));
Append_Node_To_List (N, Struct_Members);
end if;
C := Next_Node (C);
end loop;
......@@ -755,7 +757,9 @@ package body Ocarina.Backends.C_Common.Types is
S := First_Node (Features (E));
while Present (S) loop
if AINU.Is_Data (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
......@@ -1026,8 +1030,9 @@ package body Ocarina.Backends.C_Common.Types is
F := First_Node (Features (E));
while Present (F) loop
if Kind (F) = K_Port_Spec_Instance and then
AIN.Is_Data (F) then
if Kind (F) = K_Port_Spec_Instance
and then AIN.Is_Data (F)
then
Visit (Corresponding_Instance (F));
end if;
......@@ -1102,6 +1107,7 @@ package body Ocarina.Backends.C_Common.Types is
pragma Assert (AINU.Is_Subprogram (Spg));
-- Make the call to __po_hi_protected_lock
Call_Profile := New_List (CTN.K_Parameter_Profile);
Append_Node_To_List
(Make_Member_Designator
......@@ -1132,7 +1138,7 @@ package body Ocarina.Backends.C_Common.Types is
end loop;
end if;
-- 2 - The list of all record fileds given
-- 2 - The list of all record fields given
-- FIXME: Respect the mapping rules by setting the correct
-- parameter orientation. For now all parameter are
......@@ -1152,6 +1158,7 @@ package body Ocarina.Backends.C_Common.Types is
while Present (Param) loop
-- Create a parameter association
if AINU.Is_Data (Corresponding_Instance (Param)) then
N := Make_Variable_Address
(Make_Member_Designator
(Defining_Identifier =>
......@@ -1161,6 +1168,7 @@ package body Ocarina.Backends.C_Common.Types is
Is_Pointer =>
True));
Append_Node_To_List (N, Call_Profile);
end if;
Param := Next_Node (Param);
end loop;
......@@ -1364,7 +1372,10 @@ package body Ocarina.Backends.C_Common.Types is
-- Visit the subcomponents
while Present (C) loop
if AINU.Is_Data (Corresponding_Instance (C)) then
Visit (Corresponding_Instance (C));
end if;
C := Next_Node (C);
end loop;
......
......@@ -265,6 +265,11 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
-- Do not generate Ada type more than once
if No (Get_Handling (E, By_Name, H_Ada_Type_Spec)) then
-- Add a fake handling for now, to avoid infinite recursion
Set_Handling (E, By_Name, H_Ada_Type_Spec, No_Node + 1);
Language_Type := Get_Source_Language (E);
if Language_Type = Language_ASN1 then
......@@ -615,6 +620,7 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
-- Make the record or private type component
if AAU.Is_Data (Corresponding_Instance (C)) then
N := Make_Component_Declaration
(Defining_Identifier
=> Map_Ada_Defining_Identifier
......@@ -623,6 +629,7 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
=> Map_Ada_Data_Type_Designator
(Corresponding_Instance (C)));
Append_Node_To_List (N, Components);
end if;
C := Next_Node (C);
end loop;
......@@ -1127,6 +1134,7 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
while Present (Param) loop
-- Create a parameter association
if AAU.Is_Data (Corresponding_Instance (Param)) then
N := Make_Parameter_Association
(Selector_Name =>
Map_Ada_Protected_Aggregate_Identifier
......@@ -1135,6 +1143,7 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
(Param));
Append_Node_To_List (N, Call_Profile);
end if;
Param := Next_Node (Param);
end loop;
......@@ -1255,6 +1264,10 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
-- Do not generate Ada type more than once
if No (Get_Handling (E, By_Name, H_Ada_Type_Body)) then
-- Add a fake handling for now, to avoid infinite recursion
Set_Handling (E, By_Name, H_Ada_Type_Body, No_Node + 1);
Data_Representation := Get_Data_Representation (E);
case Data_Representation is
......
......@@ -346,7 +346,9 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
-- Visit the component instance corresponding to the
-- subcomponent S.
if AAU.Is_Data (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
......@@ -679,6 +681,7 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
C := First_Node (Subcomponents (E));
while Present (C) loop
if AAU.Is_Data (Corresponding_Instance (C)) then
Visit (Corresponding_Instance (C));
Parameters := New_List (CTN.K_Parameter_List);
......@@ -686,7 +689,8 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
(Make_Member_Designator
(Aggregate_Name => Make_Defining_Identifier
(PN (P_Value)),
Defining_Identifier => Map_C_Defining_Identifier (C),
Defining_Identifier =>
Map_C_Defining_Identifier (C),
Is_Pointer => False),
Parameters);
Append_Node_To_List
......@@ -696,10 +700,11 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
(Make_Defining_Identifier (PN (P_Offset)),
Parameters);
N := Make_Call_Profile
(Get_Marshall_Function_Name (Corresponding_Instance (C)),
(Get_Marshall_Function_Name
(Corresponding_Instance (C)),
Parameters);
Append_Node_To_List (N, Statements);
end if;
C := Next_Node (C);
end loop;
......@@ -809,6 +814,7 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
C := First_Node (Subcomponents (E));
while Present (C) loop
if AAU.Is_Data (Corresponding_Instance (C)) then
Visit (Corresponding_Instance (C));
Parameters := New_List (CTN.K_Parameter_List);
......@@ -828,10 +834,11 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
(Make_Defining_Identifier (PN (P_Offset)),
Parameters);
N := Make_Call_Profile
(Get_Unmarshall_Function_Name (Corresponding_Instance (C)),
(Get_Unmarshall_Function_Name
(Corresponding_Instance (C)),
Parameters);
Append_Node_To_List (N, Statements);
end if;
C := Next_Node (C);
end loop;
......@@ -1157,7 +1164,9 @@ package body Ocarina.Backends.PO_HI_C.Marshallers is
-- Visit the component instance corresponding to the
-- subcomponent S.
if AAU.Is_Data (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
......
......@@ -1572,6 +1572,7 @@ package body Ocarina.Backends.Utils is
-- container data component and the data
-- subcomponent.
if AAU.Is_Data (Corresponding_Instance (Field)) then
Param := ADU.Make_Parameter_Specification
(Map_Ada_Protected_Aggregate_Identifier
(F, Field),
......@@ -1579,6 +1580,7 @@ package body Ocarina.Backends.Utils is
(Corresponding_Instance (Field)),
Mode);
ADU.Append_Node_To_List (Param, Profile);
end if;
Field := Next_Node (Field);
end loop;
......
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