Commit cea7d069 authored by Maxime Perrotin's avatar Maxime Perrotin

Cleanup the code

parent 257f3b97
...@@ -31,7 +31,6 @@ with Ada.Strings.Unbounded, ...@@ -31,7 +31,6 @@ with Ada.Strings.Unbounded,
Ocarina.FE_AADL.Parser, Ocarina.FE_AADL.Parser,
Imported_Routines, Imported_Routines,
Buildsupport_Utils, Buildsupport_Utils,
buildsupport_version,
Ocarina.Backends.Utils; Ocarina.Backends.Utils;
use Ada.Strings.Unbounded, use Ada.Strings.Unbounded,
...@@ -190,8 +189,8 @@ procedure BuildSupport is ...@@ -190,8 +189,8 @@ procedure BuildSupport is
declare declare
-- Read the name of the function -- Read the name of the function
FV_Name_L : constant String := ATN_Lower (Current_Function); FV_Name_L : constant String := AIN_Lower (Current_Function);
FV_Name : constant String := ATN_Case (Current_Function); FV_Name : constant String := AIN_Case (Current_Function);
-- Read the source language -- Read the source language
Source_Language : constant Supported_Source_Language := Source_Language : constant Supported_Source_Language :=
Get_Source_Language (CI); Get_Source_Language (CI);
...@@ -794,7 +793,7 @@ procedure BuildSupport is ...@@ -794,7 +793,7 @@ procedure BuildSupport is
"programming_properties.aadl" & "programming_properties.aadl" &
"memory_properties.aadl" & "memory_properties.aadl" &
"modeling_properties.aadl" & "modeling_properties.aadl" &
"arinc653.aadl" & "arinc653_properties.aadl" &
"base_types.aadl" & "base_types.aadl" &
"data_model.aadl" & "data_model.aadl" &
"deployment.aadl"; "deployment.aadl";
...@@ -1335,7 +1334,7 @@ procedure BuildSupport is ...@@ -1335,7 +1334,7 @@ procedure BuildSupport is
elsif Ada.Command_Line.Argument (J) = "--version" elsif Ada.Command_Line.Argument (J) = "--version"
or else Ada.Command_Line.Argument (J) = "-v" or else Ada.Command_Line.Argument (J) = "-v"
then then
Put_Line (buildsupport_version.buildsupport_release); OS_Exit (0);
elsif Ada.Command_Line.Argument (J) = "--dataview" elsif Ada.Command_Line.Argument (J) = "--dataview"
or else Ada.Command_Line.Argument (J) = "-d" or else Ada.Command_Line.Argument (J) = "-d"
...@@ -1351,6 +1350,7 @@ procedure BuildSupport is ...@@ -1351,6 +1350,7 @@ procedure BuildSupport is
or else Ada.Command_Line.Argument (J) = "-h" or else Ada.Command_Line.Argument (J) = "-h"
then then
Usage; Usage;
OS_Exit (0);
else else
Set_Str_To_Name_Buffer (Ada.Command_Line.Argument (J)); Set_Str_To_Name_Buffer (Ada.Command_Line.Argument (J));
...@@ -1415,8 +1415,6 @@ procedure BuildSupport is ...@@ -1415,8 +1415,6 @@ procedure BuildSupport is
C_Set_AADLV2; C_Set_AADLV2;
Buildsupport_Utils.Init;
Exit_On_Error (Interface_View = 0, "Error: Missing Interface view!"); Exit_On_Error (Interface_View = 0, "Error: Missing Interface view!");
Set_Str_To_Name_Buffer (Ada.Command_Line.Argument (Interface_View)); Set_Str_To_Name_Buffer (Ada.Command_Line.Argument (Interface_View));
FN := Ocarina.Files.Search_File (Name_Find); FN := Ocarina.Files.Search_File (Name_Find);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
with Ada.Text_IO; with Ada.Text_IO;
with GNAT.OS_Lib; with GNAT.OS_Lib;
with Buildsupport_Version;
-- with Ocarina.Namet; -- with Ocarina.Namet;
with Ocarina.Configuration; with Ocarina.Configuration;
with Ocarina.AADL_Values; with Ocarina.AADL_Values;
...@@ -34,11 +35,12 @@ package body Buildsupport_Utils is ...@@ -34,11 +35,12 @@ package body Buildsupport_Utils is
procedure Banner is procedure Banner is
The_Banner : constant String := The_Banner : constant String :=
"buildsupport - contact: Maxime.Perrotin@esa.int or " "TASTE Buildsupport (Version "
& "Thanassis.Tsiodras@esa.int " & Buildsupport_Version.Buildsupport_Release & ") "
& ASCII.LF & ASCII.CR
& "Contact: Maxime.Perrotin@esa.int or Thanassis.Tsiodras@esa.int"
& ASCII.LF & ASCII.CR & ASCII.LF & ASCII.CR
& "Based on Ocarina: " & Ocarina.Configuration.Ocarina_Version; & "Based on Ocarina: " & Ocarina.Configuration.Ocarina_Version;
-- & " (" & Ocarina.Configuration.Ocarina_SVN_Revision & ")";
begin begin
Put_Line (The_Banner); Put_Line (The_Banner);
end Banner; end Banner;
...@@ -110,17 +112,16 @@ package body Buildsupport_Utils is ...@@ -110,17 +112,16 @@ package body Buildsupport_Utils is
-- Get_RCM_Operation_Kind -- -- Get_RCM_Operation_Kind --
---------------------------- ----------------------------
RCM_Operation_Kind : Name_Id;
Unprotected_Name : Name_Id;
Protected_Name : Name_Id;
Cyclic_Name : Name_Id;
Sporadic_Name : Name_Id;
function Get_RCM_Operation_Kind function Get_RCM_Operation_Kind
(E : Node_Id) return Supported_RCM_Operation_Kind (E : Node_Id) return Supported_RCM_Operation_Kind
is is
RCM_Operation_Kind_N : Name_Id; RCM_Operation_Kind_N : Name_Id;
RCM_Operation_Kind : constant Name_Id :=
Get_String_Name ("taste::rcmoperationkind");
Unprotected_Name : constant Name_Id := Get_String_Name ("unprotected");
Protected_Name : constant Name_Id := Get_String_Name ("protected");
Cyclic_Name : constant Name_Id := Get_String_Name ("cyclic");
Sporadic_Name : constant Name_Id := Get_String_Name ("sporadic");
begin begin
if Is_Defined_Enumeration_Property (E, RCM_Operation_Kind) then if Is_Defined_Enumeration_Property (E, RCM_Operation_Kind) then
RCM_Operation_Kind_N RCM_Operation_Kind_N
...@@ -147,9 +148,9 @@ package body Buildsupport_Utils is ...@@ -147,9 +148,9 @@ package body Buildsupport_Utils is
-- Get_RCM_Operation -- -- Get_RCM_Operation --
----------------------- -----------------------
RCM_Operation : Name_Id;
function Get_RCM_Operation (E : Node_Id) return Node_Id is function Get_RCM_Operation (E : Node_Id) return Node_Id is
RCM_Operation : constant Name_Id :=
Get_String_Name ("taste::rcmoperation");
begin begin
if Is_Subprogram_Access (E) then if Is_Subprogram_Access (E) then
return Corresponding_Instance (E); return Corresponding_Instance (E);
...@@ -166,9 +167,9 @@ package body Buildsupport_Utils is ...@@ -166,9 +167,9 @@ package body Buildsupport_Utils is
-- Get_APLC_Binding -- -- Get_APLC_Binding --
----------------------- -----------------------
APLC_Binding : Name_Id;
function Get_APLC_Binding (E : Node_Id) return List_Id is function Get_APLC_Binding (E : Node_Id) return List_Id is
APLC_Binding : constant Name_Id :=
Get_String_Name ("taste::aplc_binding");
begin begin
if Is_Defined_Property (E, APLC_Binding) then if Is_Defined_Property (E, APLC_Binding) then
return Get_List_Property (E, APLC_Binding); return Get_List_Property (E, APLC_Binding);
...@@ -181,9 +182,8 @@ package body Buildsupport_Utils is ...@@ -181,9 +182,8 @@ package body Buildsupport_Utils is
-- Get_RCM_Period -- -- Get_RCM_Period --
-------------------- --------------------
RCM_Period : Name_Id;
function Get_RCM_Period (D : Node_Id) return Unsigned_Long_Long is function Get_RCM_Period (D : Node_Id) return Unsigned_Long_Long is
RCM_Period : constant Name_Id := Get_String_Name ("taste::rcmperiod");
begin begin
if Is_Defined_Integer_Property (D, RCM_Period) then if Is_Defined_Integer_Property (D, RCM_Period) then
return Get_Integer_Property (D, RCM_Period); return Get_Integer_Property (D, RCM_Period);
...@@ -196,9 +196,9 @@ package body Buildsupport_Utils is ...@@ -196,9 +196,9 @@ package body Buildsupport_Utils is
-- Get_Ada_Package_Name -- -- Get_Ada_Package_Name --
-------------------------- --------------------------
Ada_Package_Name : Name_id;
function Get_Ada_Package_Name (D : Node_Id) return Name_Id is function Get_Ada_Package_Name (D : Node_Id) return Name_Id is
Ada_Package_Name : constant Name_id :=
Get_String_Name ("taste::ada_package_name");
begin begin
return Get_String_Property (D, Ada_Package_Name); return Get_String_Property (D, Ada_Package_Name);
end Get_Ada_Package_Name; end Get_Ada_Package_Name;
...@@ -207,9 +207,9 @@ package body Buildsupport_Utils is ...@@ -207,9 +207,9 @@ package body Buildsupport_Utils is
-- Get_Ellidiss_Tool_Version -- -- Get_Ellidiss_Tool_Version --
------------------------------- -------------------------------
Ellidiss_Tool_Version : Name_id;
function Get_Ellidiss_Tool_Version (D : Node_Id) return Name_Id is function Get_Ellidiss_Tool_Version (D : Node_Id) return Name_Id is
Ellidiss_Tool_Version : constant Name_id :=
Get_String_Name ("taste::version");
begin begin
return Get_String_Property (D, Ellidiss_Tool_Version); return Get_String_Property (D, Ellidiss_Tool_Version);
end Get_Ellidiss_Tool_Version; end Get_Ellidiss_Tool_Version;
...@@ -218,9 +218,9 @@ package body Buildsupport_Utils is ...@@ -218,9 +218,9 @@ package body Buildsupport_Utils is
-- Get_Interface_Name -- -- Get_Interface_Name --
------------------------ ------------------------
Interface_Name : Name_id;
function Get_Interface_Name (D : Node_Id) return Name_Id is function Get_Interface_Name (D : Node_Id) return Name_Id is
Interface_Name : constant Name_id :=
Get_String_Name ("taste::interfacename");
begin begin
return Get_String_Property (D, Interface_Name); return Get_String_Property (D, Interface_Name);
end Get_Interface_Name; end Get_Interface_Name;
...@@ -229,10 +229,10 @@ package body Buildsupport_Utils is ...@@ -229,10 +229,10 @@ package body Buildsupport_Utils is
-- Get ASN.1 Module name -- -- Get ASN.1 Module name --
--------------------------- ---------------------------
ASN1_Module : Name_id;
function Get_ASN1_Module_Name (D : Node_Id) return String is function Get_ASN1_Module_Name (D : Node_Id) return String is
id : Name_Id := No_Name; id : Name_Id := No_Name;
ASN1_Module : constant Name_id :=
Get_String_Name ("deployment::asn1_module_name");
begin begin
if Is_Defined_String_Property (D, ASN1_Module) then if Is_Defined_String_Property (D, ASN1_Module) then
id := Get_String_Property (D, ASN1_Module); id := Get_String_Property (D, ASN1_Module);
...@@ -292,13 +292,12 @@ package body Buildsupport_Utils is ...@@ -292,13 +292,12 @@ package body Buildsupport_Utils is
-- Get_ASN1_Encoding -- -- Get_ASN1_Encoding --
----------------------- -----------------------
ASN1_Encoding : Name_Id;
Native_Name : Name_Id;
UPER_Name : Name_Id;
ACN_Name : Name_Id;
function Get_ASN1_Encoding (E : Node_Id) return Supported_ASN1_Encoding is function Get_ASN1_Encoding (E : Node_Id) return Supported_ASN1_Encoding is
ASN1_Encoding_N : Name_Id; ASN1_Encoding_N : Name_Id;
ASN1_Encoding : constant Name_Id := Get_String_Name ("taste::encoding");
Native_Name : constant Name_Id := Get_String_Name ("native");
UPER_Name : constant Name_Id := Get_String_Name ("uper");
ACN_Name : constant Name_Id := Get_String_Name ("acn");
begin begin
if Is_Defined_Enumeration_Property (E, ASN1_Encoding) then if Is_Defined_Enumeration_Property (E, ASN1_Encoding) then
ASN1_Encoding_N := Get_Enumeration_Property (E, ASN1_Encoding); ASN1_Encoding_N := Get_Enumeration_Property (E, ASN1_Encoding);
...@@ -321,118 +320,76 @@ package body Buildsupport_Utils is ...@@ -321,118 +320,76 @@ package body Buildsupport_Utils is
-- Get_ASN1_Basic_Type -- -- Get_ASN1_Basic_Type --
------------------------- -------------------------
ASN1_Basic_Type : Name_Id; function Get_ASN1_Basic_Type (E : Node_Id) return Supported_ASN1_Basic_Type
Sequence_Name : Name_Id;
SequenceOf_Name : Name_Id;
Enumerated_Name : Name_Id;
Set_Name : Name_Id;
SetOf_Name : Name_Id;
Integer_Name : Name_Id;
Boolean_Name : Name_Id;
Real_Name : Name_Id;
OctetString_Name : Name_Id;
Choice_Name : Name_Id;
String_Name : Name_Id;
function Get_ASN1_Basic_Type
(E : Node_Id)
return Supported_ASN1_Basic_Type
is is
ASN1_Basic_Type : constant Name_Id :=
Get_String_Name ("taste::asn1_basic_type");
Sequence_Name : constant Name_Id := Get_String_Name ("asequence");
SequenceOf_Name : constant Name_Id := Get_String_Name ("asequenceof");
Enumerated_Name : constant Name_Id := Get_String_Name ("aenumerated");
Set_Name : constant Name_Id := Get_String_Name ("aset");
SetOf_Name : constant Name_Id := Get_String_Name ("asetof");
Integer_Name : constant Name_Id := Get_String_Name ("ainteger");
Boolean_Name : constant Name_Id := Get_String_Name ("aboolean");
Real_Name : constant Name_Id := Get_String_Name ("areal");
OctetString_Name : constant Name_Id := Get_String_Name ("aoctetstring");
Choice_Name : constant Name_Id := Get_String_Name ("achoice");
String_Name : constant Name_Id := Get_String_Name ("astring");
ASN1_Basic_Type_N : Name_Id; ASN1_Basic_Type_N : Name_Id;
begin begin
if Is_Defined_Enumeration_Property (E, ASN1_Basic_Type) then if Is_Defined_Enumeration_Property (E, ASN1_Basic_Type) then
ASN1_Basic_Type_N := Get_Enumeration_Property (E, ASN1_Basic_Type); ASN1_Basic_Type_N := Get_Enumeration_Property (E, ASN1_Basic_Type);
if ASN1_Basic_Type_N = Sequence_Name then if ASN1_Basic_Type_N = Sequence_Name then
return ASN1_Sequence; return ASN1_Sequence;
elsif ASN1_Basic_Type_N = SequenceOf_Name then elsif ASN1_Basic_Type_N = SequenceOf_Name then
return ASN1_SequenceOf; return ASN1_SequenceOf;
elsif ASN1_Basic_Type_N = Enumerated_Name then elsif ASN1_Basic_Type_N = Enumerated_Name then
return ASN1_Enumerated; return ASN1_Enumerated;
elsif ASN1_Basic_Type_N = Set_Name then elsif ASN1_Basic_Type_N = Set_Name then
return ASN1_Set; return ASN1_Set;
elsif ASN1_Basic_Type_N = SetOf_Name then elsif ASN1_Basic_Type_N = SetOf_Name then
return ASN1_SetOf; return ASN1_SetOf;
elsif ASN1_Basic_Type_N = Integer_Name then elsif ASN1_Basic_Type_N = Integer_Name then
return ASN1_Integer; return ASN1_Integer;
elsif ASN1_Basic_Type_N = Boolean_Name then elsif ASN1_Basic_Type_N = Boolean_Name then
return ASN1_Boolean; return ASN1_Boolean;
elsif ASN1_Basic_Type_N = Real_Name then elsif ASN1_Basic_Type_N = Real_Name then
return ASN1_Real; return ASN1_Real;
elsif ASN1_Basic_Type_N = OctetString_Name then elsif ASN1_Basic_Type_N = OctetString_Name then
return ASN1_OctetString; return ASN1_OctetString;
elsif ASN1_Basic_Type_N = Choice_Name then elsif ASN1_Basic_Type_N = Choice_Name then
return ASN1_Choice; return ASN1_Choice;
elsif ASN1_Basic_Type_N = String_Name then elsif ASN1_Basic_Type_N = String_Name then
return ASN1_String; return ASN1_String;
else else
raise Program_Error with "Undefined choice " raise Program_Error with "Undefined choice "
& Get_Name_String (ASN1_Basic_Type_N); & Get_Name_String (ASN1_Basic_Type_N);
end if; end if;
end if; end if;
Exit_On_Error (True, "Error: ASN.1 Basic type undefined!"); Exit_On_Error (True, "Error: ASN.1 Basic type undefined!");
return ASN1_Unknown; return ASN1_Unknown;
end Get_ASN1_Basic_Type; end Get_ASN1_Basic_Type;
---------- function AADL_to_Ada_IV (System : Node_Id) return Complete_Interface_View is
-- Init -- pragma Unreferenced (System);
---------- Funcs : Functions.Vector;
Routes : Channels.Vector;
procedure Init is
begin begin
RCM_Operation_Kind := return IV_AST : constant Complete_Interface_View :=
Get_String_Name ("taste::rcmoperationkind"); (Flat_Functions => Funcs,
Connections => Routes);
ASN1_Encoding := Get_String_Name ("taste::encoding"); end AADL_to_Ada_IV;
ASN1_Basic_Type
:= Get_String_Name ("taste::asn1_basic_type");
RCM_Period := Get_String_Name ("taste::rcmperiod");
RCM_Operation := Get_String_Name ("taste::rcmoperation");
APLC_Binding := Get_String_Name ("taste::aplc_binding");
Ellidiss_Tool_Version := Get_String_Name ("taste::version");
Interface_Name := Get_String_Name ("taste::interfacename");
Ada_Package_Name := Get_String_Name ("taste::ada_package_name");
ASN1_Module := Get_String_Name ("deployment::asn1_module_name");
Unprotected_Name := Get_String_Name ("unprotected");
Protected_Name := Get_String_Name ("protected");
Cyclic_Name := Get_String_Name ("cyclic");
Sporadic_Name := Get_String_Name ("sporadic");
Native_Name := Get_String_Name ("native");
UPER_Name := Get_String_Name ("uper");
ACN_Name := Get_String_Name ("acn");
Sequence_Name := Get_String_Name ("asequence");
SequenceOf_Name := Get_String_Name ("asequenceof");
Enumerated_Name := Get_String_Name ("aenumerated");
Set_Name := Get_String_Name ("aset");
SetOf_Name := Get_String_Name ("asetof");
Integer_Name := Get_String_Name ("ainteger");
Boolean_Name := Get_String_Name ("aboolean");
Real_Name := Get_String_Name ("areal");
OctetString_Name := Get_String_Name ("aoctetstring");
Choice_Name := Get_String_Name ("achoice");
String_Name := Get_String_Name ("astring");
end Init;
end Buildsupport_Utils; end Buildsupport_Utils;
...@@ -38,8 +38,6 @@ package Buildsupport_Utils is ...@@ -38,8 +38,6 @@ package Buildsupport_Utils is
type Synchronism is (Sync, Async); type Synchronism is (Sync, Async);
procedure Init;
type Supported_RCM_Operation_Kind is (Unprotected_Operation, type Supported_RCM_Operation_Kind is (Unprotected_Operation,
Protected_Operation, Protected_Operation,
Cyclic_Operation, Cyclic_Operation,
...@@ -176,4 +174,7 @@ package Buildsupport_Utils is ...@@ -176,4 +174,7 @@ package Buildsupport_Utils is
Connections : Channels.Vector; Connections : Channels.Vector;
end record; end record;
-- Function to build up the Ada AST by transforming the one from Ocarina
function AADL_to_Ada_IV (System : Node_Id) return Complete_Interface_View;
end Buildsupport_Utils; end Buildsupport_Utils;
...@@ -27,7 +27,7 @@ project BuildSupport is ...@@ -27,7 +27,7 @@ project BuildSupport is
package Compiler is package Compiler is
for Default_Switches ("Ada") use for Default_Switches ("Ada") use
("-g", ("-g",
"-gnat12", "-Ada2012",
"-gnatf", "-gnatf",
"-gnaty", "-gnaty",
"-gnatwa", "-gnatwa",
......
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