Commit 16405607 authored by jhugues's avatar jhugues
Browse files

* Add support for abstract features



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2658 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 36d69797
...@@ -90,6 +90,8 @@ package body Ocarina.BE_AADL.Components.Connections is ...@@ -90,6 +90,8 @@ package body Ocarina.BE_AADL.Components.Connections is
Print_Tokens ((T_Event, T_Port)); Print_Tokens ((T_Event, T_Port));
when CT_Event_Data => when CT_Event_Data =>
Print_Tokens ((T_Event, T_Data, T_Port)); Print_Tokens ((T_Event, T_Data, T_Port));
when CT_Feature =>
Print_Token (T_Feature);
when CT_Feature_Group => when CT_Feature_Group =>
case AADL_Version is case AADL_Version is
when AADL_V1 => when AADL_V1 =>
......
...@@ -158,10 +158,14 @@ package body Ocarina.BE_AADL.Components.Features is ...@@ -158,10 +158,14 @@ package body Ocarina.BE_AADL.Components.Features is
Write_Space; Write_Space;
end if; end if;
if Is_Data (Node) or else Is_Feature (Node) then
if Is_Data (Node) then if Is_Data (Node) then
Print_Token (T_Data); Print_Token (T_Data);
Write_Space; Write_Space;
Print_Token (T_Port); Print_Token (T_Port);
elsif Is_Feature (Node) then
Print_Token (T_Feature);
end if;
if Present (Class_Ref) then if Present (Class_Ref) then
Write_Space; Write_Space;
......
...@@ -635,8 +635,7 @@ package body Ocarina.Instances.Properties is ...@@ -635,8 +635,7 @@ package body Ocarina.Instances.Properties is
begin begin
if No (Property_Value) then if No (Property_Value) then
-- If there is no property value defined, simply return return No_Node;
return Instantiated_Value;
end if; end if;
case ATN.Kind (Property_Value) is case ATN.Kind (Property_Value) is
......
...@@ -193,6 +193,8 @@ package body Ocarina.Analyzer.AADL.Queries is ...@@ -193,6 +193,8 @@ package body Ocarina.Analyzer.AADL.Queries is
return PO_Event_Data_Port_Connections; return PO_Event_Data_Port_Connections;
when CT_Parameter => when CT_Parameter =>
return PO_Parameter_Connections; return PO_Parameter_Connections;
when CT_Feature =>
return PO_Feature;
when CT_Feature_Group => when CT_Feature_Group =>
case AADL_Version is case AADL_Version is
when AADL_V1 => when AADL_V1 =>
......
...@@ -299,12 +299,10 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -299,12 +299,10 @@ package body Ocarina.Analyzer.AADL.Semantics is
(Property, Entity_Of_Property); (Property, Entity_Of_Property);
end if; end if;
if Success then if not Success then
return True;
else
Display_Property_Not_Applicable (Property, Entity_Of_Property); Display_Property_Not_Applicable (Property, Entity_Of_Property);
return False;
end if; end if;
return Success;
end Check_Applies_To; end Check_Applies_To;
---------------------------------------------- ----------------------------------------------
...@@ -699,6 +697,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -699,6 +697,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
Success := False; Success := False;
when CT_Port_Connection when CT_Port_Connection
| CT_Feature
| CT_Access_Subprogram_Group | CT_Access_Subprogram_Group
| CT_Access_Virtual_Bus | CT_Access_Virtual_Bus
| CT_Access => | CT_Access =>
...@@ -1033,6 +1032,7 @@ package body Ocarina.Analyzer.AADL.Semantics is ...@@ -1033,6 +1032,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
Success := False; Success := False;
when CT_Port_Connection when CT_Port_Connection
| CT_Feature
| CT_Access_Subprogram_Group | CT_Access_Subprogram_Group
| CT_Access_Virtual_Bus | CT_Access_Virtual_Bus
| CT_Access => | CT_Access =>
......
...@@ -150,6 +150,7 @@ package body Ocarina.Builder.AADL.Components.Features is ...@@ -150,6 +150,7 @@ package body Ocarina.Builder.AADL.Components.Features is
Is_Out : Boolean; Is_Out : Boolean;
Is_Data : Boolean; Is_Data : Boolean;
Is_Event : Boolean; Is_Event : Boolean;
Is_Feature : Boolean;
Is_Refinement : Boolean := False; Is_Refinement : Boolean := False;
Associated_Entity : Node_Id := No_Node) Associated_Entity : Node_Id := No_Node)
return Node_Id return Node_Id
...@@ -173,6 +174,8 @@ package body Ocarina.Builder.AADL.Components.Features is ...@@ -173,6 +174,8 @@ package body Ocarina.Builder.AADL.Components.Features is
Set_Is_Out (Node, Is_Out); Set_Is_Out (Node, Is_Out);
Set_Is_Data (Node, Is_Data); Set_Is_Data (Node, Is_Data);
Set_Is_Event (Node, Is_Event); Set_Is_Event (Node, Is_Event);
Set_Is_Feature (Node, Is_Feature);
Set_Entity_Ref (Node, Associated_Entity); Set_Entity_Ref (Node, Associated_Entity);
-- We only create an inversed feature for in or out features -- We only create an inversed feature for in or out features
......
...@@ -49,6 +49,7 @@ package Ocarina.Builder.AADL.Components.Features is ...@@ -49,6 +49,7 @@ package Ocarina.Builder.AADL.Components.Features is
Is_Out : Boolean; Is_Out : Boolean;
Is_Data : Boolean; Is_Data : Boolean;
Is_Event : Boolean; Is_Event : Boolean;
Is_Feature : Boolean;
Is_Refinement : Boolean := False; Is_Refinement : Boolean := False;
Associated_Entity : Node_Id := No_Node) Associated_Entity : Node_Id := No_Node)
return Node_Id; return Node_Id;
......
...@@ -426,6 +426,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes { ...@@ -426,6 +426,7 @@ module Ocarina::ME_AADL::AADL_Tree::Nodes {
boolean Is_Out; boolean Is_Out;
// FIXME: Replace the two flags above by a Mode_Id flag // FIXME: Replace the two flags above by a Mode_Id flag
boolean Is_Feature;
boolean Is_Event; // FIXME: Rename to Is_Event_Port boolean Is_Event; // FIXME: Rename to Is_Event_Port
boolean Is_Data; // FIXME: Rename to Is_Data_Port boolean Is_Data; // FIXME: Rename to Is_Data_Port
}; };
......
...@@ -88,6 +88,7 @@ package Ocarina.ME_AADL is ...@@ -88,6 +88,7 @@ package Ocarina.ME_AADL is
-- AADL_V2 -- AADL_V2
CT_Access_Virtual_Bus, CT_Access_Virtual_Bus,
CT_Feature,
CT_Port_Connection, CT_Port_Connection,
CT_Access_Subprogram_Group, CT_Access_Subprogram_Group,
CT_Access); CT_Access);
......
...@@ -338,14 +338,15 @@ package body Ocarina.FE_AADL.Parser.Components.Connections is ...@@ -338,14 +338,15 @@ package body Ocarina.FE_AADL.Parser.Components.Connections is
Code := PC_Feature_Group_Connection; Code := PC_Feature_Group_Connection;
end if; end if;
Save_Lexer (Loc);
Scan_Token; Scan_Token;
if Token /= T_Group then if Token /= T_Group then
DPE (Code, T_Group); Category := CT_Feature;
Skip_Tokens (T_Semicolon); Restore_Lexer (Loc);
return No_Node; else
Category := CT_Feature_Group;
end if; end if;
Category := CT_Feature_Group;
else else
DPE (PC_Feature_Group_Connection, EMC_Not_Allowed_In_AADL_V1); DPE (PC_Feature_Group_Connection, EMC_Not_Allowed_In_AADL_V1);
Skip_Tokens (T_Semicolon); Skip_Tokens (T_Semicolon);
...@@ -535,6 +536,7 @@ package body Ocarina.FE_AADL.Parser.Components.Connections is ...@@ -535,6 +536,7 @@ package body Ocarina.FE_AADL.Parser.Components.Connections is
| CT_Port_Connection | CT_Port_Connection
| CT_Event_Data | CT_Event_Data
| CT_Event | CT_Event
| CT_Feature
| CT_Feature_Group => | CT_Feature_Group =>
In_Modes := P_In_Modes (PC_In_Modes_And_Transitions); In_Modes := P_In_Modes (PC_In_Modes_And_Transitions);
......
...@@ -125,7 +125,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -125,7 +125,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
end if; end if;
case Token is case Token is
when T_Data | T_Event => when T_Data | T_Event | T_Feature =>
if Code = PC_Parameter or else Code = PC_Parameter_Refinement then if Code = PC_Parameter or else Code = PC_Parameter_Refinement then
DPE (Code, T_Parameter); DPE (Code, T_Parameter);
Skip_Tokens (T_Semicolon); Skip_Tokens (T_Semicolon);
...@@ -273,6 +273,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -273,6 +273,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
Port_Spec : Node_Id := No_Node; Port_Spec : Node_Id := No_Node;
Is_Data : Boolean := False; Is_Data : Boolean := False;
Is_Event : Boolean := False; Is_Event : Boolean := False;
Is_Feature : Boolean := False;
Code : Parsing_Code; Code : Parsing_Code;
OK : Boolean; OK : Boolean;
Loc : Location; Loc : Location;
...@@ -293,21 +294,28 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -293,21 +294,28 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
else else
Restore_Lexer (Loc); Restore_Lexer (Loc);
end if; end if;
elsif Token = T_Data then elsif Token = T_Data then
Is_Data := True; Is_Data := True;
elsif Token = T_Feature then
Is_Feature := True;
else else
DPE (PC_Port_Type, ((T_Event, T_Data))); DPE (PC_Port_Type, ((T_Event, T_Data)));
return No_Node; return No_Node;
end if; end if;
if not Is_Feature then
Scan_Token; Scan_Token;
if Token /= T_Port then if Token /= T_Port then
DPE (PC_Port_Type, T_Port); DPE (PC_Port_Type, T_Port);
return No_Node; return No_Node;
end if; end if;
end if;
if Is_Data then if Is_Data or else Is_Feature then
Save_Lexer (Loc); Save_Lexer (Loc);
Scan_Token; Scan_Token;
if Token = T_Identifier then if Token = T_Identifier then
...@@ -331,6 +339,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -331,6 +339,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
Is_Out => Is_Out, Is_Out => Is_Out,
Is_Event => Is_Event, Is_Event => Is_Event,
Is_Data => Is_Data, Is_Data => Is_Data,
Is_Feature => Is_Feature,
Is_Refinement => Is_Refinement, Is_Refinement => Is_Refinement,
Associated_Entity => Class_Ref); Associated_Entity => Class_Ref);
...@@ -682,6 +691,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is ...@@ -682,6 +691,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
end if; end if;
Scan_Token; Scan_Token;
case Token is case Token is
when T_In | T_Out => when T_In | T_Out =>
Node := P_In_Out_Item (Container, Identifier, Is_Refinement, Code); Node := P_In_Out_Item (Container, Identifier, Is_Refinement, Code);
......
...@@ -1569,6 +1569,7 @@ package body Ocarina.Transfo.Fusions is ...@@ -1569,6 +1569,7 @@ package body Ocarina.Transfo.Fusions is
Is_In (Src_Feat), Is_In (Src_Feat),
Is_Out (Src_Feat), Is_Out (Src_Feat),
Is_Data (Src_Feat), Is_Data (Src_Feat),
Is_Feature (Src_Feat),
True); True);
else else
...@@ -1664,6 +1665,7 @@ package body Ocarina.Transfo.Fusions is ...@@ -1664,6 +1665,7 @@ package body Ocarina.Transfo.Fusions is
Is_In (Src_Feat), Is_In (Src_Feat),
Is_Out (Src_Feat), Is_Out (Src_Feat),
Is_Data (Src_Feat), Is_Data (Src_Feat),
Is_Feature (Src_Feat),
True); True);
else else
...@@ -1748,6 +1750,7 @@ package body Ocarina.Transfo.Fusions is ...@@ -1748,6 +1750,7 @@ package body Ocarina.Transfo.Fusions is
Is_In (Dst_Feat), Is_In (Dst_Feat),
Is_Out (Dst_Feat), Is_Out (Dst_Feat),
Is_Data (Dst_Feat), Is_Data (Dst_Feat),
Is_Feature (Dst_Feat),
True); True);
else else
...@@ -1835,6 +1838,7 @@ package body Ocarina.Transfo.Fusions is ...@@ -1835,6 +1838,7 @@ package body Ocarina.Transfo.Fusions is
Is_In (Dst_Feat), Is_In (Dst_Feat),
Is_Out (Dst_Feat), Is_Out (Dst_Feat),
Is_Data (Dst_Feat), Is_Data (Dst_Feat),
Is_Feature (Dst_Feat),
True); True);
else else
......
...@@ -642,6 +642,7 @@ package body Ocarina.Transfo.Move is ...@@ -642,6 +642,7 @@ package body Ocarina.Transfo.Move is
Is_Out => Is_Out (Dst), Is_Out => Is_Out (Dst),
Is_Data => Is_Data (Dst), Is_Data => Is_Data (Dst),
Is_Event => Is_Event (Dst), Is_Event => Is_Event (Dst),
Is_Feature => Is_Feature (Dst),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (New_Port) then if No (New_Port) then
...@@ -862,6 +863,7 @@ package body Ocarina.Transfo.Move is ...@@ -862,6 +863,7 @@ package body Ocarina.Transfo.Move is
Is_Out => False, Is_Out => False,
Is_Data => Is_Data (Src_Port), Is_Data => Is_Data (Src_Port),
Is_Event => Is_Event (Src_Port), Is_Event => Is_Event (Src_Port),
Is_Feature => Is_Feature (Src_Port),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (Src_P) then if No (Src_P) then
...@@ -887,6 +889,7 @@ package body Ocarina.Transfo.Move is ...@@ -887,6 +889,7 @@ package body Ocarina.Transfo.Move is
Is_Out => True, Is_Out => True,
Is_Data => Is_Data (Src_Port), Is_Data => Is_Data (Src_Port),
Is_Event => Is_Event (Src_Port), Is_Event => Is_Event (Src_Port),
Is_Feature => Is_Feature (Src_Port),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (Dst_P) then if No (Dst_P) then
...@@ -1328,6 +1331,7 @@ package body Ocarina.Transfo.Move is ...@@ -1328,6 +1331,7 @@ package body Ocarina.Transfo.Move is
Is_Out => Is_Out (Src), Is_Out => Is_Out (Src),
Is_Data => Is_Data (Src), Is_Data => Is_Data (Src),
Is_Event => Is_Event (Src), Is_Event => Is_Event (Src),
Is_Feature => Is_Feature (Src),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (New_Port) then if No (New_Port) then
...@@ -1533,6 +1537,7 @@ package body Ocarina.Transfo.Move is ...@@ -1533,6 +1537,7 @@ package body Ocarina.Transfo.Move is
Is_Out => True, Is_Out => True,
Is_Data => Is_Data (Src_Port), Is_Data => Is_Data (Src_Port),
Is_Event => Is_Event (Src_Port), Is_Event => Is_Event (Src_Port),
Is_Feature => Is_Feature (Src_Port),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (Src_P) then if No (Src_P) then
...@@ -1559,6 +1564,7 @@ package body Ocarina.Transfo.Move is ...@@ -1559,6 +1564,7 @@ package body Ocarina.Transfo.Move is
Is_Out => False, Is_Out => False,
Is_Data => Is_Data (Src_Port), Is_Data => Is_Data (Src_Port),
Is_Event => Is_Event (Src_Port), Is_Event => Is_Event (Src_Port),
Is_Feature => Is_Feature (Src_Port),
Is_Refinement => False, Is_Refinement => False,
Associated_Entity => Data_E); Associated_Entity => Data_E);
if No (Dst_P) then if No (Dst_P) then
......
Supports Markdown
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