Commit e9e2838d authored by jhugues's avatar jhugues

* Correct parsing and processing of feature groups, and their

	 inverse



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@3584 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent f8faaceb
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2008-2009, GET-Telecom Paris. -- -- Copyright (C) 2008-2012, European Space Agency (ESA). --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -140,21 +140,23 @@ package body Ocarina.Backends.Expander is ...@@ -140,21 +140,23 @@ package body Ocarina.Backends.Expander is
I := First_Node (Features (F)); I := First_Node (Features (F));
while Present (I) loop while Present (I) loop
if Category = CC_Subprogram then if Category = CC_Subprogram then
N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node
(K_Parameter_Instance, No_Location); (K_Parameter_Instance, No_Location);
else else
N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node
(K_Port_Spec_Instance, No_Location); (AIN.Kind (I), No_Location);
AIN.Set_Identifier AIN.Set_Identifier
(N, AIU.Copy_Node (Identifier (I))); (N, AIU.Copy_Node (Identifier (I)));
end if;
if Kind (I) = K_Port_Spec_Instance then
AIN.Set_Is_Event (N, AIN.Is_Event (I)); AIN.Set_Is_Event (N, AIN.Is_Event (I));
AIN.Set_Is_Data (N, AIN.Is_Data (I)); AIN.Set_Is_Data (N, AIN.Is_Data (I));
AIN.Set_Is_In (N, AIN.Is_In (I));
AIN.Set_Is_Out (N, AIN.Is_Out (I));
end if; end if;
AIN.Set_Is_In (N, AIN.Is_In (I));
AIN.Set_Is_Out (N, AIN.Is_Out (I));
AIN.Set_Corresponding_Instance AIN.Set_Corresponding_Instance
(N, AIN.Corresponding_Instance (I)); (N, AIN.Corresponding_Instance (I));
AIN.Set_Sources AIN.Set_Sources
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2005-2009, GET-Telecom Paris. -- -- Copyright (C) 2005-2012, European Space Agency (ESA). --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -148,6 +148,28 @@ package body Ocarina.Instances.Components.Features is ...@@ -148,6 +148,28 @@ package body Ocarina.Instances.Components.Features is
AIN.Set_Destinations (New_Instance, AIN.Set_Destinations (New_Instance,
New_List (K_List_Id, No_Location)); New_List (K_List_Id, No_Location));
Success := Instantiate_Port_Group_Type
(Instance_Root,
Port_Group,
Ocarina.ME_AADL.AADL_Instances.Nodes.Features (New_Instance),
Container,
Inverse);
elsif Inverse_Of (Feature) /= No_Node
and then ATE.Get_Referenced_Entity
(Inverse_Of (Feature)) /= No_Node
then
New_Instance := New_Node (K_Feature_Group_Spec_Instance,
ATN.Loc (Feature));
AIN.Set_Features (New_Instance,
New_List (K_List_Id, ATN.Loc (Feature)));
AIN.Set_Identifier (New_Instance,
Duplicate_Identifier (ATN.Identifier (Feature)));
Port_Group := ATE.Get_Referenced_Entity (Inverse_Of (Feature));
AIN.Set_Sources
(New_Instance, New_List (K_List_Id, No_Location));
AIN.Set_Destinations (New_Instance,
New_List (K_List_Id, No_Location));
Success := Instantiate_Port_Group_Type Success := Instantiate_Port_Group_Type
(Instance_Root, (Instance_Root,
Port_Group, Port_Group,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2009, GET-Telecom Paris. -- -- Copyright (C) 2009-2012, European Space Agency (ESA). --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -1081,8 +1081,13 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1081,8 +1081,13 @@ package body Ocarina.Analyzer.AADL.Links is
when K_Feature_Group_Spec => when K_Feature_Group_Spec =>
declare declare
Port_Group_Ref : constant Node_Id := Entity_Ref (Node); Port_Group_Ref : Node_Id := Entity_Ref (Node);
begin begin
if No (Port_Group_Ref) then
-- If Entity_Ref is null, look for inverse
Port_Group_Ref := Inverse_Of (Node);
end if;
if Present (Port_Group_Ref) then if Present (Port_Group_Ref) then
Pointed_Node := Find_Port_Group_Classifier Pointed_Node := Find_Port_Group_Classifier
(Root => Root, (Root => Root,
...@@ -1600,19 +1605,32 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -1600,19 +1605,32 @@ package body Ocarina.Analyzer.AADL.Links is
(Component => Component, (Component => Component,
Subcomponent_Identifier => Item Subcomponent_Identifier => Item
(First_Node (Path (Entity_Node)))); (First_Node (Path (Entity_Node))));
if Present (Pointed_Node) if Present (Pointed_Node) then
and then Get_Referenced_Entity if Present (Entity_Ref (Pointed_Node))
(Entity_Ref and then Present (Get_Referenced_Entity
(Pointed_Node)) /= No_Node (Entity_Ref (Pointed_Node)))
then then
Pointed_Node := Pointed_Node :=
Find_Feature Find_Feature
(Component => Get_Referenced_Entity (Component => Get_Referenced_Entity
(Entity_Ref (Pointed_Node)), (Entity_Ref (Pointed_Node)),
Feature_Identifier => Item Feature_Identifier => Item
(Next_Node (First_Node (Path (Entity_Node))))); (Next_Node (First_Node (Path (Entity_Node)))));
SC_Owned := True; SC_Owned := True;
elsif Present (Inverse_Of (Pointed_Node))
and then Present (Get_Referenced_Entity
(Inverse_Of (Pointed_Node)))
then
Pointed_Node :=
Find_Feature
(Component => Get_Referenced_Entity
(Inverse_Of (Pointed_Node)),
Feature_Identifier => Item
(Next_Node (First_Node (Path (Entity_Node)))));
SC_Owned := True;
end if;
end if; end if;
end if; end if;
...@@ -2398,7 +2416,7 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2398,7 +2416,7 @@ package body Ocarina.Analyzer.AADL.Links is
end if; end if;
end if; end if;
-- Link constant type if it is a reference to a declare -- Link constant type if it is a reference to a declared
-- property type. -- property type.
if Kind (Constant_Type (Node)) = K_Unique_Property_Type_Identifier then if Kind (Constant_Type (Node)) = K_Unique_Property_Type_Identifier then
...@@ -2576,7 +2594,8 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2576,7 +2594,8 @@ package body Ocarina.Analyzer.AADL.Links is
(Classifier_Ref (List_Node)), (Classifier_Ref (List_Node)),
Component_Identifier => Identifier Component_Identifier => Identifier
(Classifier_Ref (List_Node)))); (Classifier_Ref (List_Node))));
when PO_Port_Group => when PO_Port_Group |
PO_Feature_Group =>
Set_Referenced_Entity Set_Referenced_Entity
(Classifier_Ref (List_Node), (Classifier_Ref (List_Node),
Find_Port_Group_Classifier Find_Port_Group_Classifier
...@@ -2750,7 +2769,6 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2750,7 +2769,6 @@ package body Ocarina.Analyzer.AADL.Links is
Corresponding_Container := Pointed_Node; Corresponding_Container := Pointed_Node;
when others => when others =>
Corresponding_Container := No_Node; Corresponding_Container := No_Node;
end case; end case;
...@@ -2763,6 +2781,11 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -2763,6 +2781,11 @@ package body Ocarina.Analyzer.AADL.Links is
when AADL_V2 => when AADL_V2 =>
Pointed_Node := Find_Subclause Pointed_Node := Find_Subclause
(Corresponding_Container, List_Node); (Corresponding_Container, List_Node);
if No (Pointed_Node) then
Pointed_Node := Find_Feature
(Corresponding_Container, List_Node);
end if;
end case; end case;
else else
...@@ -3336,7 +3359,6 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -3336,7 +3359,6 @@ package body Ocarina.Analyzer.AADL.Links is
Feature_Identifier => Item Feature_Identifier => Item
(First_Node (Path (Connection_End)))); (First_Node (Path (Connection_End))));
end if; end if;
Set_Corresponding_Entity (Item (First_Node (Path (Connection_End))), Set_Corresponding_Entity (Item (First_Node (Path (Connection_End))),
Corresponding_Node); Corresponding_Node);
...@@ -3414,8 +3436,9 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -3414,8 +3436,9 @@ package body Ocarina.Analyzer.AADL.Links is
(Next_Node (First_Node (Path (Connection_End))))); (Next_Node (First_Node (Path (Connection_End)))));
elsif Kind (Corresponding_Node) = K_Feature_Group_Spec elsif Kind (Corresponding_Node) = K_Feature_Group_Spec
and then Present (Entity_Ref (Corresponding_Node))
and then Present (Get_Referenced_Entity and then Present (Get_Referenced_Entity
(Entity_Ref (Corresponding_Node))) (Entity_Ref (Corresponding_Node)))
then then
Corresponding_Node := Find_Feature Corresponding_Node := Find_Feature
(Component => Get_Referenced_Entity (Component => Get_Referenced_Entity
...@@ -3424,6 +3447,28 @@ package body Ocarina.Analyzer.AADL.Links is ...@@ -3424,6 +3447,28 @@ package body Ocarina.Analyzer.AADL.Links is
(Next_Node (First_Node (Path (Connection_End))))); (Next_Node (First_Node (Path (Connection_End)))));
Is_Local := True; Is_Local := True;
elsif Kind (Corresponding_Node) = K_Feature_Group_Spec
and then Present (Inverse_Of (Corresponding_Node))
and then Present (Get_Referenced_Entity
(Inverse_Of (Corresponding_Node)))
then
Corresponding_Node := Find_Feature
(Component => Get_Referenced_Entity
(Inverse_Of (Corresponding_Node)),
Feature_Identifier => Item
(Next_Node (First_Node (Path (Connection_End)))));
Is_Local := True;
elsif Kind (Corresponding_Node) = K_Subcomponent_Access
and then Present (Get_Referenced_Entity
(Entity_Ref (Corresponding_Node)))
then
Corresponding_Node := Find_Feature
(Component => Get_Referenced_Entity
(Entity_Ref (Corresponding_Node)),
Feature_Identifier => Item
(Next_Node (First_Node (Path (Connection_End)))));
else else
Corresponding_Node := No_Node; Corresponding_Node := No_Node;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2009-2011, European Space Agency (ESA). -- -- Copyright (C) 2009-2012, European Space Agency (ESA). --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -884,13 +884,6 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -884,13 +884,6 @@ package body Ocarina.Analyzer.AADL.Semantics is
or else Kind (Connection_Source) = K_Subcomponent_Access or else Kind (Connection_Source) = K_Subcomponent_Access
or else Kind (Connection_Source) = K_Subcomponent); or else Kind (Connection_Source) = K_Subcomponent);
pragma Assert
(Kind (Connection_Destination) = K_Port_Spec
or else Kind (Connection_Destination) = K_Parameter
or else Kind (Connection_Destination) = K_Feature_Group_Spec
or else Kind (Connection_Destination) = K_Subcomponent_Access
or else Kind (Connection_Destination) = K_Subcomponent);
case Kind (Connection_Destination) is case Kind (Connection_Destination) is
when K_Port_Spec | K_Parameter => when K_Port_Spec | K_Parameter =>
...@@ -901,28 +894,35 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -901,28 +894,35 @@ package body Ocarina.Analyzer.AADL.Semantics is
-- make sense: an in/out port could have two different -- make sense: an in/out port could have two different
-- connections. -- connections.
Directions := (not Source_Is_Local if Present (Inversed_Entity (Connection_Source))
and then not Destination_Is_Local or else Present (Inversed_Entity (Connection_Destination))
and then Is_Out (Connection_Source) then
and then Is_In (Connection_Destination)) --
or else (Source_Is_Local Directions := True;
and then not Destination_Is_Local else
and then Is_In (Connection_Source) Directions := (not Source_Is_Local
and then Is_In (Connection_Destination)) and then not Destination_Is_Local
or else (not Source_Is_Local and then Is_Out (Connection_Source)
and then Destination_Is_Local and then Is_In (Connection_Destination))
and then Is_Out (Connection_Source) or else (Source_Is_Local
and then Is_Out (Connection_Destination)) and then not Destination_Is_Local
or else (Source_Is_Local and then Is_In (Connection_Source)
and then Destination_Is_Local and then Is_In (Connection_Destination))
and then Is_In (Connection_Source) or else (not Source_Is_Local
and then Is_Out (Connection_Destination)) and then Destination_Is_Local
or else (Is_In (Connection_Source) and then Is_Out (Connection_Source)
and then Is_Out (Connection_Source) and then Is_Out (Connection_Destination))
and then Is_Out (Connection_Destination) or else (Source_Is_Local
and then Is_In (Connection_Destination)); and then Destination_Is_Local
-- XXX The latest test may be redudant with the previous and then Is_In (Connection_Source)
-- ones and then Is_Out (Connection_Destination))
or else (Is_In (Connection_Source)
and then Is_Out (Connection_Source)
and then Is_Out (Connection_Destination)
and then Is_In (Connection_Destination));
-- XXX The latest test may be redudant with the previous
-- ones
end if;
when K_Feature_Group_Spec => when K_Feature_Group_Spec =>
Directions := True; Directions := True;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2008-2009, GET-Telecom Paris. -- -- Copyright (C) 2008-2012, European Space Agency (ESA). --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -946,10 +946,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -946,10 +946,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
return No_Node; return No_Node;
end if; end if;
if Feature_Group_Spec /= No_Node then Set_Entity_Ref (Feature_Group_Spec, Group_Type_Ref);
Set_Entity_Ref (Feature_Group_Spec, Group_Type_Ref);
end if;
Set_Inverse_Of (Feature_Group_Spec, Inverse_Of); Set_Inverse_Of (Feature_Group_Spec, Inverse_Of);
return Feature_Group_Spec; return Feature_Group_Spec;
......
ParameterConnections.aadl:41:05: in_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:46:05: out_data (port spec) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:48:05: out_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:50:05: out_data (port spec) and in_out_param (parameter) do not have compatible directions
ParameterConnections.aadl:55:05: in_out_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:62:05: in_event_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:67:05: out_event_data (port spec) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:69:05: out_event_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:71:05: out_event_data (port spec) and in_out_param (parameter) do not have compatible directions
ParameterConnections.aadl:76:05: in_out_event_data (port spec) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:81:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:81:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type
ParameterConnections.aadl:83:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:83:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type
ParameterConnections.aadl:85:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:85:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type
...@@ -17,13 +7,6 @@ ParameterConnections.aadl:92:15: out_event (entity reference) points to out_eve ...@@ -17,13 +7,6 @@ ParameterConnections.aadl:92:15: out_event (entity reference) points to out_eve
ParameterConnections.aadl:95:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:95:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:97:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:97:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:99:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:99:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:110:05: out_param (parameter) and in_data (port spec) do not have compatible directions
ParameterConnections.aadl:114:05: in_param (parameter) and in_out_data (port spec) do not have compatible directions
ParameterConnections.aadl:129:05: in_param (parameter) and in_event_data (port spec) do not have compatible directions
ParameterConnections.aadl:142:05: in_out_param (parameter) and in_event_data (port spec) do not have compatible directions
ParameterConnections.aadl:144:05: in_param (parameter) and out_event_data (port spec) do not have compatible directions
ParameterConnections.aadl:155:05: out_param (parameter) and in_event_data (port spec) do not have compatible directions
ParameterConnections.aadl:159:05: in_param (parameter) and in_out_event_data (port spec) do not have compatible directions
ParameterConnections.aadl:174:32: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:174:32: in_event (entity reference) points to in_event (port spec) , which is not of a proper type
ParameterConnections.aadl:187:36: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:187:36: in_event (entity reference) points to in_event (port spec) , which is not of a proper type
ParameterConnections.aadl:189:32: out_event (entity reference) points to out_event (port spec) , which is not of a proper type ParameterConnections.aadl:189:32: out_event (entity reference) points to out_event (port spec) , which is not of a proper type
...@@ -32,23 +15,5 @@ ParameterConnections.aadl:202:36: out_event (entity reference) points to out_ev ...@@ -32,23 +15,5 @@ ParameterConnections.aadl:202:36: out_event (entity reference) points to out_ev
ParameterConnections.aadl:204:32: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:204:32: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:215:33: out_event (entity reference) points to out_event (port spec) , which is not of a proper type ParameterConnections.aadl:215:33: out_event (entity reference) points to out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:217:36: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:217:36: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:219:05: in_param (parameter) and in_data (port spec) do not have compatible directions
ParameterConnections.aadl:230:33: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:230:33: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type
ParameterConnections.aadl:232:05: in_out_param (parameter) and in_data (port spec) do not have compatible directions
ParameterConnections.aadl:234:05: in_param (parameter) and out_data (port spec) do not have compatible directions
ParameterConnections.aadl:251:05: in_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:256:05: out_param (parameter) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:258:05: out_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:260:05: out_param (parameter) and in_out_param (parameter) do not have compatible directions
ParameterConnections.aadl:265:05: in_out_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:278:05: in_param (parameter) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:293:05: in_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:297:05: in_out_param (parameter) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:308:05: in_param (parameter) and in_out_param (parameter) do not have compatible directions
ParameterConnections.aadl:310:05: out_param (parameter) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:327:05: in_param (parameter) and in_param (parameter) do not have compatible directions
ParameterConnections.aadl:329:05: out_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:344:05: in_out_param (parameter) and out_param (parameter) do not have compatible directions
ParameterConnections.aadl:346:05: in_param (parameter) and in_out_param (parameter) do not have compatible directions
ParameterConnections.aadl:359:05: in_param (parameter) and out_param (parameter) do not have compatible directions
Cannot analyze AADL specifications Cannot analyze AADL specifications
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