Commit f3f39439 authored by Maxime Perrotin's avatar Maxime Perrotin

Work on the new AST

parent b9fe60b0
This diff is collapsed.
...@@ -6,12 +6,11 @@ with Ada.Text_IO; ...@@ -6,12 +6,11 @@ with Ada.Text_IO;
with GNAT.OS_Lib; with GNAT.OS_Lib;
-- with Ocarina.Namet; -- with Ocarina.Namet;
with Namet;
with Ocarina.Configuration; with Ocarina.Configuration;
with Ocarina.AADL_Values; with Ocarina.AADL_Values;
with Ocarina.Instances.Queries; with Ocarina.Instances.Queries;
with Ocarina.ME_AADL.AADL_Tree.Nodes; -- with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nodes; -- with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils; with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ada.Characters.Latin_1; with Ada.Characters.Latin_1;
...@@ -21,14 +20,13 @@ package body Buildsupport_Utils is ...@@ -21,14 +20,13 @@ package body Buildsupport_Utils is
use GNAT.OS_Lib; use GNAT.OS_Lib;
-- use Ocarina.Namet; -- use Ocarina.Namet;
use Namet;
use Ocarina.Instances.Queries; use Ocarina.Instances.Queries;
use Ocarina.ME_AADL.AADL_Instances.Nodes; -- use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Nutils; use Ocarina.ME_AADL.AADL_Instances.Nutils;
use Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; -- package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; -- package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
use type ATN.Node_Kind; -- use type ATN.Node_Kind;
------------ ------------
-- Banner -- -- Banner --
...@@ -115,8 +113,6 @@ package body Buildsupport_Utils is ...@@ -115,8 +113,6 @@ package body Buildsupport_Utils is
RCM_Operation_Kind : Name_Id; RCM_Operation_Kind : Name_Id;
Unprotected_Name : Name_Id; Unprotected_Name : Name_Id;
Protected_Name : Name_Id; Protected_Name : Name_Id;
Variator_Name : Name_Id;
Modifier_Name : Name_Id;
Cyclic_Name : Name_Id; Cyclic_Name : Name_Id;
Sporadic_Name : Name_Id; Sporadic_Name : Name_Id;
...@@ -136,12 +132,6 @@ package body Buildsupport_Utils is ...@@ -136,12 +132,6 @@ package body Buildsupport_Utils is
elsif RCM_Operation_Kind_N = Protected_Name then elsif RCM_Operation_Kind_N = Protected_Name then
return Protected_Operation; return Protected_Operation;
elsif RCM_Operation_Kind_N = Variator_Name then
return Variator_Operation;
elsif RCM_Operation_Kind_N = Modifier_Name then
return Modifier_Operation;
elsif RCM_Operation_Kind_N = Cyclic_Name then elsif RCM_Operation_Kind_N = Cyclic_Name then
return Cyclic_Operation; return Cyclic_Operation;
...@@ -149,7 +139,7 @@ package body Buildsupport_Utils is ...@@ -149,7 +139,7 @@ package body Buildsupport_Utils is
return Sporadic_Operation; return Sporadic_Operation;
end if; end if;
end if; end if;
return Unknown_Operation; Exit_On_Error (True, "Could not determine interface kind");
end Get_RCM_Operation_Kind; end Get_RCM_Operation_Kind;
----------------------- -----------------------
...@@ -256,10 +246,9 @@ package body Buildsupport_Utils is ...@@ -256,10 +246,9 @@ package body Buildsupport_Utils is
-- Input parameter is an AADL instance -- -- Input parameter is an AADL instance --
-------------------------------------------- --------------------------------------------
function Get_Properties_Map (D : Node_Id) return Property_Maps.Map is function Get_Properties_Map (D : Node_Id) return Property_Maps.Map is
properties : constant List_Id := properties : constant List_Id := AIN.Properties (D);
Ocarina.ME_AADL.AADL_Instances.Nodes.Properties (D);
result : Property_Maps.Map := Empty_Map; result : Property_Maps.Map := Empty_Map;
property : Node_Id := First_Node (properties); property : Node_Id := AIN.First_Node (properties);
prop_value : Node_Id; prop_value : Node_Id;
single_val : Node_Id; single_val : Node_Id;
begin begin
...@@ -268,8 +257,7 @@ package body Buildsupport_Utils is ...@@ -268,8 +257,7 @@ package body Buildsupport_Utils is
if Present (ATN.Single_Value (prop_value)) then if Present (ATN.Single_Value (prop_value)) then
-- Only support single-value properties for now -- Only support single-value properties for now
single_val := ATN.Single_Value (prop_value); single_val := ATN.Single_Value (prop_value);
result.Insert (Key => Get_Name_String result.Insert (Key => AIN_Case (property),
(Display_Name (Identifier (property))),
New_Item => New_Item =>
(case ATN.Kind (single_val) is (case ATN.Kind (single_val) is
when ATN.K_Signed_AADLNumber => when ATN.K_Signed_AADLNumber =>
...@@ -294,7 +282,7 @@ package body Buildsupport_Utils is ...@@ -294,7 +282,7 @@ package body Buildsupport_Utils is
when others => "ERROR! Unsupported kind: " when others => "ERROR! Unsupported kind: "
& ATN.Kind (single_val)'Img)); & ATN.Kind (single_val)'Img));
end if; end if;
property := Next_Node (property); property := AIN.Next_Node (property);
end loop; end loop;
return result; return result;
end Get_Properties_Map; end Get_Properties_Map;
...@@ -426,8 +414,6 @@ package body Buildsupport_Utils is ...@@ -426,8 +414,6 @@ package body Buildsupport_Utils is
Unprotected_Name := Get_String_Name ("unprotected"); Unprotected_Name := Get_String_Name ("unprotected");
Protected_Name := Get_String_Name ("protected"); Protected_Name := Get_String_Name ("protected");
Variator_Name := Get_String_Name ("variator");
Modifier_Name := Get_String_Name ("modifier");
Cyclic_Name := Get_String_Name ("cyclic"); Cyclic_Name := Get_String_Name ("cyclic");
Sporadic_Name := Get_String_Name ("sporadic"); Sporadic_Name := Get_String_Name ("sporadic");
......
...@@ -6,20 +6,29 @@ ...@@ -6,20 +6,29 @@
with Ocarina, with Ocarina,
-- Ocarina.Types, -- Ocarina.Types,
Types, Types,
Namet,
Ocarina.Backends.Properties, Ocarina.Backends.Properties,
Ada.Containers.Indefinite_Ordered_Maps, Ada.Containers.Indefinite_Ordered_Maps,
Ada.Containers.Indefinite_Vectors, Ada.Containers.Indefinite_Vectors,
Ocarina.ME_AADL.AADL_Tree.Nodes,
Ocarina.ME_AADL.AADL_Instances.Nodes,
Ada.Strings.Unbounded; Ada.Strings.Unbounded;
use Ocarina, use Ocarina,
Types,
Namet,
Ocarina.Backends.Properties, Ocarina.Backends.Properties,
Ocarina.ME_AADL.AADL_Tree.Nodes,
Ocarina.ME_AADL.AADL_Instances.Nodes,
Ada.Containers, Ada.Containers,
Ada.Strings.Unbounded; Ada.Strings.Unbounded;
package Buildsupport_Utils is package Buildsupport_Utils is
-- use Ocarina.Types; package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
use Types; package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
function US (Source : in String) return Unbounded_String renames
To_Unbounded_String;
procedure Banner; procedure Banner;
...@@ -33,11 +42,8 @@ package Buildsupport_Utils is ...@@ -33,11 +42,8 @@ package Buildsupport_Utils is
type Supported_RCM_Operation_Kind is (Unprotected_Operation, type Supported_RCM_Operation_Kind is (Unprotected_Operation,
Protected_Operation, Protected_Operation,
Variator_Operation,
Modifier_Operation,
Cyclic_Operation, Cyclic_Operation,
Sporadic_Operation, Sporadic_Operation);
Unknown_Operation);
function Get_RCM_Operation_Kind (E : Node_Id) function Get_RCM_Operation_Kind (E : Node_Id)
return Supported_RCM_Operation_Kind; return Supported_RCM_Operation_Kind;
...@@ -81,6 +87,22 @@ package Buildsupport_Utils is ...@@ -81,6 +87,22 @@ package Buildsupport_Utils is
function Get_Properties_Map (D : Node_Id) return Property_Maps.Map; function Get_Properties_Map (D : Node_Id) return Property_Maps.Map;
-- Shortcut to read an identifier from the parser, in lowercase
function ATN_Lower (N : Node_Id) return String is
(Get_Name_String (ATN.Name (ATN.Identifier (N))));
-- Shortcut to read an identifier from the parser, with original case
function ATN_Case (N : Node_Id) return String is
(Get_Name_String (ATN.Display_Name (ATN.Identifier (N))));
-- Shortcut to read an identifier from the parser, in lowercase
function AIN_Lower (N : Node_Id) return String is
(Get_Name_String (AIN.Name (AIN.Identifier (N))));
-- Shortcut to read an identifier from the parser, with original case
function AIN_Case (N : Node_Id) return String is
(Get_Name_String (AIN.Display_Name (AIN.Identifier (N))));
-- Types needed to build the AST of the TASTE Interface View in Ada -- Types needed to build the AST of the TASTE Interface View in Ada
type Parameter_Direction is (param_in, param_out); type Parameter_Direction is (param_in, param_out);
...@@ -99,27 +121,40 @@ package Buildsupport_Utils is ...@@ -99,27 +121,40 @@ package Buildsupport_Utils is
type Taste_Interface is type Taste_Interface is
record record
Name : Unbounded_String; Name : Unbounded_String;
In_Parameters : Parameters.Vector; In_Parameters : Parameters.Vector;
Out_Parameters : Parameters.Vector; Out_Parameters : Parameters.Vector;
RCM : Supported_RCM_Operation_Kind; RCM : Supported_RCM_Operation_Kind;
Period_Or_MIAT : Natural; Period_Or_MIAT : Natural;
WCET : Natural; WCET : Natural;
WCET_Unit : Unbounded_String; WCET_Unit : Unbounded_String;
Queue_Size : Natural; Queue_Size : Natural;
User_Properties : Property_Maps.Map;
end record; end record;
package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface); package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface);
type Taste_Terminal_Function is type Context_Parameter is
record record
Name : Unbounded_String; Name : Unbounded_String;
Language : Supported_Source_Language; Sort : Unbounded_String;
Zip_File : Unbounded_String; Default_Value : Unbounded_String;
Context_Params : Property_Maps.Map; ASN1_Module : Unbounded_String;
Timers : String_Vectors.Vector; ASN1_File_Name : Unbounded_String;
Provided : Interfaces.Vector; end record;
Required : Interfaces.Vector;
package Ctxt_Params is new Indefinite_Vectors (Natural, Context_Parameter);
type Taste_Terminal_Function is
record
Name : Unbounded_String;
Language : Supported_Source_Language;
Zip_File : Unbounded_String;
Context_Params : Ctxt_Params.Vector;
User_Properties : Property_Maps.Map;
Timers : String_Vectors.Vector;
Provided : Interfaces.Vector;
Required : Interfaces.Vector;
end record; end record;
package Functions is new Indefinite_Vectors (Natural, package Functions is new Indefinite_Vectors (Natural,
......
with "ocarina"; with "ocarina";
with "templates_parser"; -- from libtemplates-parser11.10.1-dev
project BuildSupport is project BuildSupport is
...@@ -21,17 +22,17 @@ project BuildSupport is ...@@ -21,17 +22,17 @@ project BuildSupport is
package binder is package binder is
for default_switches ("Ada") use ("-E", "-t", "-static"); for default_switches ("Ada") use ("-E", "-t", "-static");
end binder; end binder;
package Compiler is package Compiler is
for Default_Switches ("Ada") use for Default_Switches ("Ada") use
("-g", ("-g",
"-gnat05", "-gnat12",
"-gnatf", "-gnatf",
"-gnaty", "-gnaty",
-- "-gnatwa", "-gnatwa",
"-gnatoa", "-gnatoa",
"-gnatg", "-gnatg",
"-fstack-check"); "-fstack-check");
for Default_Switches ("C") use ("-g"); for Default_Switches ("C") use ("-g");
......
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