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