diff --git a/src/backends/ocarina-backends-expander.adb b/src/backends/ocarina-backends-expander.adb index 58129a9bf5ffea398f690ec50324aa60d16c0f31..bd3c927396f8b6d32d14ea7dd272a8495d530bda 100644 --- a/src/backends/ocarina-backends-expander.adb +++ b/src/backends/ocarina-backends-expander.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- it under terms of the GNU General Public License as published by the -- @@ -140,21 +140,23 @@ package body Ocarina.Backends.Expander is I := First_Node (Features (F)); while Present (I) loop - if Category = CC_Subprogram then N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node (K_Parameter_Instance, No_Location); else N := Ocarina.ME_AADL.AADL_Instances.Nutils.New_Node - (K_Port_Spec_Instance, No_Location); + (AIN.Kind (I), No_Location); AIN.Set_Identifier (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_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; - AIN.Set_Is_In (N, AIN.Is_In (I)); - AIN.Set_Is_Out (N, AIN.Is_Out (I)); AIN.Set_Corresponding_Instance (N, AIN.Corresponding_Instance (I)); AIN.Set_Sources diff --git a/src/core/instance/ocarina-instances-components-features.adb b/src/core/instance/ocarina-instances-components-features.adb index d74052dcfc441300d662aa87c8014a5578ce2854..cfc08f2ab151355b42f0975e54318edd096a1a6f 100644 --- a/src/core/instance/ocarina-instances-components-features.adb +++ b/src/core/instance/ocarina-instances-components-features.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- it under terms of the GNU General Public License as published by the -- @@ -148,6 +148,28 @@ package body Ocarina.Instances.Components.Features is AIN.Set_Destinations (New_Instance, 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 (Instance_Root, Port_Group, diff --git a/src/core/model/ocarina-analyzer-aadl-links.adb b/src/core/model/ocarina-analyzer-aadl-links.adb index cd1c34405f864c57f87164d435cb06d78b35a15b..3167da52b3e09158142dfc9c0373c561f6adb9b5 100644 --- a/src/core/model/ocarina-analyzer-aadl-links.adb +++ b/src/core/model/ocarina-analyzer-aadl-links.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- it under terms of the GNU General Public License as published by the -- @@ -1081,8 +1081,13 @@ package body Ocarina.Analyzer.AADL.Links is when K_Feature_Group_Spec => declare - Port_Group_Ref : constant Node_Id := Entity_Ref (Node); + Port_Group_Ref : Node_Id := Entity_Ref (Node); 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 Pointed_Node := Find_Port_Group_Classifier (Root => Root, @@ -1600,19 +1605,32 @@ package body Ocarina.Analyzer.AADL.Links is (Component => Component, Subcomponent_Identifier => Item (First_Node (Path (Entity_Node)))); - if Present (Pointed_Node) - and then Get_Referenced_Entity - (Entity_Ref - (Pointed_Node)) /= No_Node - then - Pointed_Node := - Find_Feature - (Component => Get_Referenced_Entity - (Entity_Ref (Pointed_Node)), - Feature_Identifier => Item - (Next_Node (First_Node (Path (Entity_Node))))); - - SC_Owned := True; + if Present (Pointed_Node) then + if Present (Entity_Ref (Pointed_Node)) + and then Present (Get_Referenced_Entity + (Entity_Ref (Pointed_Node))) + then + Pointed_Node := + Find_Feature + (Component => Get_Referenced_Entity + (Entity_Ref (Pointed_Node)), + Feature_Identifier => Item + (Next_Node (First_Node (Path (Entity_Node))))); + + 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; @@ -2398,7 +2416,7 @@ package body Ocarina.Analyzer.AADL.Links is 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. if Kind (Constant_Type (Node)) = K_Unique_Property_Type_Identifier then @@ -2576,7 +2594,8 @@ package body Ocarina.Analyzer.AADL.Links is (Classifier_Ref (List_Node)), Component_Identifier => Identifier (Classifier_Ref (List_Node)))); - when PO_Port_Group => + when PO_Port_Group | + PO_Feature_Group => Set_Referenced_Entity (Classifier_Ref (List_Node), Find_Port_Group_Classifier @@ -2750,7 +2769,6 @@ package body Ocarina.Analyzer.AADL.Links is Corresponding_Container := Pointed_Node; when others => - Corresponding_Container := No_Node; end case; @@ -2763,6 +2781,11 @@ package body Ocarina.Analyzer.AADL.Links is when AADL_V2 => Pointed_Node := Find_Subclause (Corresponding_Container, List_Node); + + if No (Pointed_Node) then + Pointed_Node := Find_Feature + (Corresponding_Container, List_Node); + end if; end case; else @@ -3336,7 +3359,6 @@ package body Ocarina.Analyzer.AADL.Links is Feature_Identifier => Item (First_Node (Path (Connection_End)))); end if; - Set_Corresponding_Entity (Item (First_Node (Path (Connection_End))), Corresponding_Node); @@ -3414,8 +3436,9 @@ package body Ocarina.Analyzer.AADL.Links is (Next_Node (First_Node (Path (Connection_End))))); elsif Kind (Corresponding_Node) = K_Feature_Group_Spec + and then Present (Entity_Ref (Corresponding_Node)) and then Present (Get_Referenced_Entity - (Entity_Ref (Corresponding_Node))) + (Entity_Ref (Corresponding_Node))) then Corresponding_Node := Find_Feature (Component => Get_Referenced_Entity @@ -3424,6 +3447,28 @@ package body Ocarina.Analyzer.AADL.Links is (Next_Node (First_Node (Path (Connection_End))))); 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 Corresponding_Node := No_Node; end if; diff --git a/src/core/model/ocarina-analyzer-aadl-semantics.adb b/src/core/model/ocarina-analyzer-aadl-semantics.adb index 6db3c4789d0c0c98c5252a753996ec3d4bb9d623..06d696d52d0c1cacc60af2d6f1a4accbf6a0cf70 100644 --- a/src/core/model/ocarina-analyzer-aadl-semantics.adb +++ b/src/core/model/ocarina-analyzer-aadl-semantics.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- it under terms of the GNU General Public License as published by the -- @@ -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); - 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 when K_Port_Spec | K_Parameter => @@ -901,28 +894,35 @@ package body Ocarina.Analyzer.AADL.Semantics is -- make sense: an in/out port could have two different -- connections. - Directions := (not Source_Is_Local - and then not Destination_Is_Local - and then Is_Out (Connection_Source) - and then Is_In (Connection_Destination)) - or else (Source_Is_Local - and then not Destination_Is_Local - and then Is_In (Connection_Source) - and then Is_In (Connection_Destination)) - or else (not Source_Is_Local - and then Destination_Is_Local - and then Is_Out (Connection_Source) - and then Is_Out (Connection_Destination)) - or else (Source_Is_Local - and then Destination_Is_Local - and then Is_In (Connection_Source) - 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 + if Present (Inversed_Entity (Connection_Source)) + or else Present (Inversed_Entity (Connection_Destination)) + then + -- + Directions := True; + else + Directions := (not Source_Is_Local + and then not Destination_Is_Local + and then Is_Out (Connection_Source) + and then Is_In (Connection_Destination)) + or else (Source_Is_Local + and then not Destination_Is_Local + and then Is_In (Connection_Source) + and then Is_In (Connection_Destination)) + or else (not Source_Is_Local + and then Destination_Is_Local + and then Is_Out (Connection_Source) + and then Is_Out (Connection_Destination)) + or else (Source_Is_Local + and then Destination_Is_Local + and then Is_In (Connection_Source) + 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 => Directions := True; diff --git a/src/frontends/aadl/ocarina-fe_aadl-parser-components-features.adb b/src/frontends/aadl/ocarina-fe_aadl-parser-components-features.adb index a93671bd5dccfb835f0f0c79c5abe6055b4dd9bb..301879103edc6215928b3a3dc0dfddc74562ed60 100644 --- a/src/frontends/aadl/ocarina-fe_aadl-parser-components-features.adb +++ b/src/frontends/aadl/ocarina-fe_aadl-parser-components-features.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- 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 return No_Node; end if; - if Feature_Group_Spec /= No_Node then - Set_Entity_Ref (Feature_Group_Spec, Group_Type_Ref); - end if; - + Set_Entity_Ref (Feature_Group_Spec, Group_Type_Ref); Set_Inverse_Of (Feature_Group_Spec, Inverse_Of); return Feature_Group_Spec; diff --git a/tests/osate-parameter-connections/ParameterConnections.aadl.out b/tests/osate-parameter-connections/ParameterConnections.aadl.out index dd5696f348d25e2b08db131478f172c1033f921f..548ee9b77f836babc5b1f33483456fb163e11bc4 100644 --- a/tests/osate-parameter-connections/ParameterConnections.aadl.out +++ b/tests/osate-parameter-connections/ParameterConnections.aadl.out @@ -1,13 +1,3 @@ -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: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 @@ -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: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: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: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 @@ -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: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: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: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