Commit 0158a248 authored by jhugues's avatar jhugues

* Extend support for property types with "list of"



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@5762 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 39a85f98
......@@ -7,71 +7,70 @@ property set Communication_Properties is
Fan_Out_Policy: enumeration (Broadcast, RoundRobin, Selective, OnDemand)
applies to (port);
-- XXX not supported by Ocarina
-- Connection_Pattern: list of list of Supported_Connection_Patterns
-- applies to (connection);
-- Connection_Set: list of Connection_Pair
-- applies to (connection);
-- Connection_Pair: type record (
-- src: list of aadlinteger;
-- dst: list of aadlinteger;);
Connection_Pattern: list of list of Supported_Connection_Patterns
applies to (connection);
Connection_Set: list of Connection_Pair
applies to (connection);
Connection_Pair: type record (
src: list of aadlinteger;
dst: list of aadlinteger;);
Overflow_Handling_Protocol: enumeration (DropOldest, DropNewest, Error) => DropOldest
applies to (event port, event data port, subprogram access);
Queue_Processing_Protocol: Supported_Queue_Processing_Protocols => FIFO
applies to (event port, event data port, subprogram access);
Queue_Size: aadlinteger 0 .. Max_Queue_Size => 1
applies to (event port, event data port, subprogram access);
Required_Connection: aadlboolean => true
applies to (feature);
Timing: enumeration (sampled, immediate, delayed) => sampled
applies to (port connection);
Transmission_Type: enumeration (push, pull)
applies to (data port, port connection, bus, virtual bus);
Input_Rate: Rate_Spec => (Value_Range => 1.0 .. 1.0; Rate_Unit => PerDispatch; Rate_Distribution => Fixed;)
applies to (port);
Input_Time: list of IO_Time_Spec => ((Time => Dispatch; Offset => 0 ns .. 0 ns;))
applies to (port);
IO_Time_Spec: type record (
Offset: Time_Range;
Time: IO_Reference_Time;
);
IO_Reference_Time: type enumeration (Dispatch, Start, Completion, Deadline, NoIO);
Output_Rate: Rate_Spec => (Value_Range => 1.0 .. 1.0; Rate_Unit => PerDispatch; Rate_Distribution => Fixed;)
applies to (port);
Output_Time: list of IO_Time_Spec => ((Time => Completion; Offset => 0 ns .. 0 ns;))
applies to (port);
Rate_Spec: type record (
Value_Range: range of aadlreal;
Rate_Unit: enumeration (PerSecond, PerDispatch);
Rate_Distribution: Supported_Distributions;
);
Subprogram_Call_Rate: Rate_Spec => (Value_Range => 1.0 .. 1.0; Rate_Unit => PerDispatch; Rate_Distribution => Fixed;)
applies to (subprogram access);
Transmission_Time: record (
Fixed: Time_Range;
PerByte: Time_Range;)
applies to (bus);
Actual_Latency: Time_Range
applies to (flow, connection, bus, processor, device, port);
Latency: Time_Range
applies to (flow, connection, bus, processor, device, port);
end Communication_Properties;
\ No newline at end of file
......@@ -7,110 +7,109 @@ property set Deployment_Properties is
Allowed_Processor_Binding_Class:
inherit list of classifier (processor, virtual processor, system)
applies to (thread, thread group, process, system, virtual processor, device);
Allowed_Processor_Binding: inherit list of reference (processor, virtual processor, system)
applies to (thread, thread group, process, system, virtual processor, device);
Actual_Processor_Binding: inherit list of reference (processor, virtual processor)
applies to (thread, thread group, process, system, virtual processor, device);
Allowed_Memory_Binding_Class:
inherit list of classifier (memory, system, processor)
applies to (thread, thread group, process, system, device, data, data port, event data port, subprogram, subprogram group, processor);
Allowed_Memory_Binding: inherit list of reference (memory, system, processor)
applies to (thread, thread group, process, system, device, data, data port, event data port, subprogram, subprogram group, processor);
Actual_Memory_Binding: inherit list of reference (memory)
applies to (thread, thread group, process, system, processor, device, data, data port, event data port, subprogram, subprogram group);
Allowed_Connection_Binding_Class:
inherit list of classifier (processor, virtual processor, bus, virtual bus, device, memory)
applies to (feature, connection, thread, thread group, process, system, virtual bus, port); -- XXX added port
Allowed_Connection_Binding: inherit list of reference (processor, virtual processor, bus, virtual bus, device, memory)
applies to (feature, connection, thread, thread group, process, system, virtual bus);
Actual_Connection_Binding: inherit list of reference (processor, virtual processor, bus, virtual bus, device, memory)
applies to (feature, connection, thread, thread group, process, system, virtual bus);
Allowed_Subprogram_Call: list of reference (subprogram)
applies to (subprogram access);
Actual_Subprogram_Call: reference (subprogram)
applies to (subprogram access);
Allowed_Subprogram_Call_Binding:
list of reference (bus, processor, device)
applies to (subprogram, thread, thread group, process, system);
Actual_Subprogram_Call_Binding: list of reference (bus, processor, memory, device)
applies to (subprogram);
Provided_Virtual_Bus_Class: inherit list of classifier (virtual bus)
applies to (bus, virtual bus, processor, virtual processor, device, memory, system);
Required_Virtual_Bus_Class: inherit list of classifier (virtual bus)
applies to (virtual bus, connection, port, thread, thread group, process, system, device);
Provided_Connection_Quality_Of_Service: inherit list of Supported_Connection_QoS
applies to (bus, virtual bus, processor, virtual processor, system, device, memory);
Required_Connection_Quality_Of_Service: inherit list of Supported_Connection_QoS
applies to (port, connection, virtual bus, thread, thread group, process, system, device);
-- XXX not supported by Ocarina
-- Not_Collocated: record ( Targets: list of reference (data,
-- thread, process, system, connection); Location:
-- classifier (processor, memory, bus, system);) applies
-- to (process, system);
-- Collocated: record ( Targets: list of reference (data, thread,
-- process, system, connection); Location: classifier
-- (processor, memory, bus, system);) applies to
-- (process, system);
Not_Collocated: record (
Targets: list of reference (data, thread, process, system, connection);
Location: classifier (processor, memory, bus, system);) applies
to (process, system);
Collocated: record ( Targets: list of reference (data, thread,
process, system, connection); Location: classifier
(processor, memory, bus, system);) applies to
(process, system);
Allowed_Connection_Type: list of enumeration
(Sampled_Data_Connection, Immediate_Data_Connection,
Delayed_Data_Connection, Port_Connection,
Data_Access_Connection,
Subprogram_Access_Connection)
applies to (bus, device);
Allowed_Dispatch_Protocol: list of Supported_Dispatch_Protocols
applies to (processor, virtual processor);
Allowed_Period: list of Time_Range
applies to (processor, system, virtual processor);
Allowed_Physical_Access_Class: list of classifier (device, processor, memory, bus)
applies to (bus);
Allowed_Physical_Access: list of reference (device, processor, memory, bus)
applies to (bus);
Memory_Protocol: enumeration (execute_only, read_only, write_only, read_write) => read_write
applies to (memory);
Runtime_Protection_Support : aadlboolean
Runtime_Protection_Support : aadlboolean
applies to (processor, virtual processor);
Scheduling_Protocol: inherit list of Supported_Scheduling_Protocols
applies to (virtual processor, processor);
Preemptive_Scheduler: aadlboolean
applies to (processor);
Thread_Limit: aadlinteger 0 .. Max_Thread_Limit
applies to (processor, virtual processor);
Priority_Map: list of Priority_Mapping
applies to (processor);
Priority_Mapping: type record (
Aadl_Priority: aadlinteger;
RTOS_Priority: aadlinteger;);
Priority_Range: range of aadlinteger
applies to (processor, virtual processor);
end Deployment_Properties;
......@@ -36,6 +36,7 @@ with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.BE_AADL.Properties;
with Ocarina.BE_AADL.Identifiers;
with Ocarina.BE_AADL.Components;
with Ocarina.BE_AADL.Components.Arrays;
package body Ocarina.BE_AADL.Components.Features is
......@@ -44,6 +45,7 @@ package body Ocarina.BE_AADL.Components.Features is
use Ocarina.BE_AADL.Properties;
use Ocarina.BE_AADL.Identifiers;
use Ocarina.BE_AADL.Components;
use Ocarina.BE_AADL.Components.Arrays;
-------------------
-- Print_Feature --
......@@ -174,6 +176,11 @@ package body Ocarina.BE_AADL.Components.Features is
else
Print_Token (T_Port);
end if;
if Present (Array_Dimensions (Node)) then
Write_Space;
Print_Array_Dimensions (Array_Dimensions (Node));
end if;
end Print_Port_Spec;
-------------------------------
......
......@@ -393,6 +393,12 @@ package body Ocarina.BE_AADL.Properties.Values is
Print_Identifier (Identifier (Node));
Write_Space;
Print_Token (T_Colon);
if Is_List (Node) then
Write_Space;
Print_Token (T_List);
Write_Space;
Print_Token (T_Of);
end if;
Write_Space;
Print_Property_Type_Designator (Property_Type_Designator (Node));
Print_Token (T_Semicolon);
......
......@@ -253,8 +253,10 @@ package body Ocarina.BE_AADL.Properties is
end if;
if Is_List (Property_Name_Type (Node)) then
Print_Tokens ((T_List, T_Of));
Write_Space;
for J in 1 .. Multiplicity (Property_Name_Type (Node)) loop
Print_Tokens ((T_List, T_Of));
Write_Space;
end loop;
end if;
Print_Property_Type_Designator
......
......@@ -63,7 +63,8 @@ package body Ocarina.FE_AADL.Parser.Components.Arrays is
use Ocarina.ME_AADL.AADL_Tree.Nutils;
pragma Assert (Container /= No_Node
and then (Kind (Container) = K_Subcomponent));
and then (Kind (Container) = K_Subcomponent
or else Kind (Container) = K_Port_Spec));
Loc : Location;
List_Array_Dim : List_Id := No_List;
......
......@@ -35,6 +35,7 @@ with Locations;
with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.FE_AADL.Lexer;
with Ocarina.ME_AADL.Tokens;
with Ocarina.FE_AADL.Parser.Components.Arrays;
with Ocarina.FE_AADL.Parser.Identifiers;
with Ocarina.FE_AADL.Parser.Properties;
with Ocarina.Builder.AADL.Components.Features;
......@@ -246,6 +247,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
-- port_spec ::=
-- defining_port_identifier : ( in | out | in out ) port_type
-- XXX dimensions ???
-- [ { { port_property_association }+ } ] ;
-- port_refinement ::=
......@@ -268,6 +270,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
use Parser.Properties;
use Parser.Identifiers;
use Ocarina.Builder.AADL.Components.Features;
use Parser.Components.Arrays;
Class_Ref : Node_Id := No_Node;
Port_Spec : Node_Id := No_Node;
......@@ -277,6 +280,7 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
Code : Parsing_Code;
OK : Boolean;
Loc : Location;
Array_Dimensions : Node_Id;
begin
if Is_Refinement then
......@@ -343,6 +347,29 @@ package body Ocarina.FE_AADL.Parser.Components.Features is
Is_Refinement => Is_Refinement,
Associated_Entity => Class_Ref);
Save_Lexer (Loc);
Scan_Token;
if Token = T_Left_Square_Bracket then
case AADL_Version is
when AADL_V2 =>
Array_Dimensions := P_Array_Dimensions (Port_Spec);
if No (Array_Dimensions) then
DPE (Code);
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
Set_Array_Dimensions (Port_Spec, Array_Dimensions);
when AADL_V1 =>
DPE (CODE, EMC_Not_Allowed_In_AADL_V1);
Skip_Tokens (T_Semicolon);
return No_Node;
end case;
else
Restore_Lexer (Loc);
end if;
OK := P_Property_Associations (Port_Spec, True, PAT_Simple, Code);
if not OK then
......
......@@ -82,7 +82,6 @@ package body Ocarina.FE_AADL.Parser.Components.Prototypes is
Is_Refinement : Boolean;
OK : Boolean;
begin
P_Identifier_Refined_To
(Refinable_To_RT (Refinable),
False,
......@@ -146,7 +145,6 @@ package body Ocarina.FE_AADL.Parser.Components.Prototypes is
end if;
return Prototype;
end P_Prototype_Or_Prototype_Refinement;
--------------------------
......@@ -269,7 +267,6 @@ package body Ocarina.FE_AADL.Parser.Components.Prototypes is
end if;
return Prototype_Binding;
end P_Prototype_Binding;
end Ocarina.FE_AADL.Parser.Components.Prototypes;
......@@ -633,7 +633,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
-- P_Multi_Valued_Property --
-----------------------------
-- multi_valued_property ::= list of property_type_designator
-- multi_valued_property ::= (list of)+ property_type_designator
-- [ => ( [ default_property_expression
-- { , default_property_expression }* ] ) ]
......@@ -648,7 +648,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Property_Type_Designator : Node_Id;
Property_Expressions : List_Id;
Loc : Location;
begin
Valued_Property := New_Node (K_Multi_Valued_Property, Token_Location);
......@@ -659,7 +658,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
end if;
Property_Type_Designator := P_Property_Type_Designator;
if No (Property_Type_Designator) then
-- error when parsing Property_Type_Designator, quit
return No_Node;
......@@ -694,7 +692,6 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Set_Property_Type_Designator (Valued_Property, Property_Type_Designator);
Set_Property_Expressions (Valued_Property, Property_Expressions);
return Valued_Property;
end P_Multi_Valued_Property;
......@@ -1766,9 +1763,11 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
-- P_Record_Type_Element --
----------------------------
-- XXX To be renamed in P_Record_Field someday ..
-- AADL_V2
--
-- defining_field_identifier : property_type_designator
-- defining_field_identifier : [list of ] property_type_designator
function P_Record_Type_Element
(Container : Node_Id)
......@@ -1785,6 +1784,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Identifier : Node_Id;
Record_Element : Node_Id;
Property_Type_Designator : Node_Id;
Is_List : Boolean := False;
begin
Save_Lexer (Loc);
......@@ -1803,6 +1803,21 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Scan_Token;
if Token = T_Colon then
Save_Lexer (Loc);
Scan_Token;
if Token = T_List then
Scan_Token;
if Token /= T_Of then
DPE (PC_Record_Type_Element, T_Of);
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
Is_List := True;
else
Restore_Lexer (Loc);
end if;
Property_Type_Designator := P_Property_Type_Designator;
if No (Property_Type_Designator) then
DPE (PC_Record_Type_Element);
......@@ -1817,6 +1832,7 @@ package body Ocarina.FE_AADL.Parser.Properties.Values is
Set_Property_Type_Designator (Record_Element,
Property_Type_Designator);
Set_Is_List (Record_Element, Is_List);
return Record_Element;
end P_Record_Type_Element;
......
......@@ -67,12 +67,110 @@ package body Ocarina.FE_AADL.Parser.Properties is
function P_Property_Owner_Category return Node_Id;
function P_Property_Value (Container : Node_Id) return Node_Id;
----------------------
-- P_Property_Value --
----------------------
-- property_value ::= single_property_value | property_list_value
function P_Property_Value (Container : Node_Id) return Node_Id is
pragma Unreferenced (Container);
use Lexer;
use Ocarina.ME_AADL.Tokens;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.Builder.AADL.Properties;
use Ocarina.FE_AADL.Parser.Components.Modes;
use Ocarina.FE_AADL.Parser.Identifiers;
use Ocarina.FE_AADL.Parser.Properties.Values;
Loc : Location;
Prop_Value : Node_Id;
Parse_List_Of_Properties : Boolean := True;
begin
-- Parse Property_Value
Save_Lexer (Loc);
Scan_Token;
-- The AADLv2 BNF is ambiguous, a string starting with a '('
-- can either be a list of property expressions e.g. "(foo,
-- bar);" _or_ a single_expression containing a record term,
-- e.g. "(foo => 1; bar =>2;)". This look ahead loop scans
-- token to see which case we are currently processing.
declare
Loc2 : Location;
begin
Save_Lexer (Loc2);
if Token = T_Left_Parenthesis then
while Token /= T_Right_Parenthesis loop
Scan_Token;
if Token = T_Semicolon
or else Token = T_Applies
then
Parse_List_Of_Properties := False;
end if;
end loop;
else
Parse_List_Of_Properties := False;
end if;
Restore_Lexer (Loc2);
end;
if Parse_List_Of_Properties then
Save_Lexer (Loc);
Scan_Token;
if Token = T_Right_Parenthesis then
-- Property_List_Value is empty
Prop_Value := Node_Id (New_List (K_List_Id, Loc));
Set_Kind (Prop_Value, K_Property_List_Value);
Set_First_Node (List_Id (Prop_Value), No_Node);
Set_Last_Node (List_Id (Prop_Value), No_Node);
else
Restore_Lexer (Loc);
-- Prop_Value :=
-- Node_Id (P_Items_List (P_Property_Value'Access,
Prop_Value := Node_Id (P_Items_List (P_Property_Expression'Access,
No_Node,
T_Comma, T_Right_Parenthesis,
PC_Property_List_Value));
if No (Prop_Value) then
-- error when parsing Property_Expression list, quit
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
Set_Kind (Prop_Value, K_Property_List_Value);
end if;
else
Restore_Lexer (Loc);
Prop_Value := P_Property_Expression (No_Node);
if No (Prop_Value) then
-- error when parsing Property_Expression, quit
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
end if;
return Prop_Value;
end P_Property_Value;
----------------------------
-- P_Property_Association --
----------------------------
function P_Property_Association (Container : Node_Id) return Node_Id is
use Ocarina.ME_AADL.Tokens;
begin
......@@ -157,8 +255,6 @@ package body Ocarina.FE_AADL.Parser.Properties is
-- annex_path ::=
-- [ { annex_identifier } ] { ** model_element_identifier }+
-- property_value ::= single_property_value | property_list_value
-- single_property_value ::= property_expression
-- property_list_value ::=
......@@ -209,7 +305,6 @@ package body Ocarina.FE_AADL.Parser.Properties is
Property_Loc : Location;
Item : Node_Id;
Parse_List_Of_Properties : Boolean := True;
begin
Save_Lexer (Loc);
Scan_Token;
......@@ -301,67 +396,7 @@ package body Ocarina.FE_AADL.Parser.Properties is
-- Parse Property_Value
Save_Lexer (Loc);
Scan_Token;
-- The AADLv2 BNF is ambiguous, a string starting with a '('
-- can either be a list of property expressions e.g. "(foo,
-- bard);"_or_ a single_expression containing a record term,
-- e.g. "(foo => 1; bar =>2;)". This look ahead loop scans
-- token to see which case we are currently processing.
declare
Loc2 : Location;
begin
Save_Lexer (Loc2);
if Token = T_Left_Parenthesis then
while Token /= T_Right_Parenthesis loop
Scan_Token;
if Token = T_Semicolon then
Parse_List_Of_Properties := False;
end if;
end loop;
else
Parse_List_Of_Properties := False;
end if;
Restore_Lexer (Loc2);
end;
if Parse_List_Of_Properties then
Save_Lexer (Loc);
Scan_Token;
if Token = T_Right_Parenthesis then
-- Property_List_Value is empty
Prop_Value := Node_Id (New_List (K_List_Id, Loc));
Set_Kind (Prop_Value, K_Property_List_Value);
Set_First_Node (List_Id (Prop_Value), No_Node);
Set_Last_Node (List_Id (Prop_Value), No_Node);
else
Restore_Lexer (Loc);
Prop_Value := Node_Id (P_Items_List (P_Property_Expression'Access,
No_Node,
T_Comma, T_Right_Parenthesis,
PC_Property_List_Value));
if No (Prop_Value) then
-- error when parsing Property_Expression list, quit
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
Set_Kind (Prop_Value, K_Property_List_Value);
end if;
else
Restore_Lexer (Loc);
Prop_Value := P_Property_Expression (No_Node);
if No (Prop_Value) then
-- error when parsing Property_Expression, quit
Skip_Tokens (T_Semicolon);
return No_Node;
end if;
end if;
Prop_Value := P_Property_Value (Container);
-- Parse 'applies to ...'
......@@ -694,6 +729,7 @@ package body Ocarina.FE_AADL.Parser.Properties is
Multiple_Default_Value : List_Id;
Owner_Categories : List_Id;
Loc : Location;
Multiplicity : Int := 0;
begin
Save_Lexer (Loc);
Scan_Token;
......@@ -726,6 +762,22 @@ package body Ocarina.FE_AADL.Parser.Properties is
if Token = T_List then
Is_A_List := True;
Multiplicity := 1;
Save_Lexer (Loc);
Scan_Token;
if Token = T_Of then
Scan_Token;
if Token /= T_List then
Restore_Lexer (Loc);
else
Multiplicity := 2; -- XXX shall we iterate? BNF says yes
end if;
else
Restore_Lexer (Loc);
end if;
Property_Definition_Value := P_Multi_Valued_Property;
Single_Default_Value := No_Node;
......@@ -831,6 +883,7 @@ package body Ocarina.FE_AADL.Parser.Properties is
Property_Type_Is_A_List => Is_A_List,
Applies_To_All => Is_All,
Applies_To => Owner_Categories);
Set_Multiplicity (Property_Name_Type (Property), Multiplicity);
return Property;
end P_Property_Definition_Declaration;
......
example_005.aadl:29:21: parsing Port_Spec, token ';' is expected, found token '['
example_005.aadl:27:01: parsing Features, list is empty
Cannot parse AADL specifications
example_005.aadl:16:03: Connection_Pattern (property association) does not point to anything
example_005.aadl:16:22: (property term) does not point to anything or to something unreachable
example_005.aadl:18:03: Connection_Pattern (property association) does not point to anything
example_005.aadl:18:22: (property term) does not point to anything or to something unreachable
Cannot analyze AADL specifications
example_014.aadl:14:32: parsing Property_Expression, not allowed in aadl v2
example_014.aadl:15:01: parsing Property_Association or Contained_Property_Association, token ';' is expected, found keyword 'end'
example_014.aadl:13:01: parsing Properties, list is empty
example_014.aadl:16:01: parsing AADL_Declaration, not allowed in aadl v2
example_014.aadl:18:01: parsing AADL_Declaration, not allowed in aadl v2