Commit be811d75 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files
parents 2ce999e5 3ae8c88f
ada/buildsupport_version.ads
buildsupport
tmpBuild
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
UNAME := $(shell uname)
CC=gcc
exec = buildsupport
all: build
build:
ifeq ($(UNAME), Linux)
@echo "package Buildsupport_Version is" > ada/buildsupport_version.ads.new
@echo -n " Buildsupport_Release : constant String := \"" >> ada/buildsupport_version.ads.new
@git log --oneline | head -1 | cut -f1 -d' ' | tr -d '\012' >> ada/buildsupport_version.ads.new
@echo "\";" >> ada/buildsupport_version.ads.new
@echo -n "end Buildsupport_Version;" >> ada/buildsupport_version.ads.new
@if [ ! -f "ada/buildsupport_version.ads" ] ; then \
mv ada/buildsupport_version.ads.new ada/buildsupport_version.ads; \
else \
MD1=`cat ada/buildsupport_version.ads | md5sum` ; \
MD2=`cat ada/buildsupport_version.ads.new | md5sum` ; \
if [ "$$MD1" != "$$MD2" ] ; then \
mv ada/buildsupport_version.ads.new ada/buildsupport_version.ads ; \
else \
rm ada/buildsupport_version.ads.new ; \
fi ; \
fi
endif
ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH \
$(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug"
install:
$(MAKE)
cp buildsupport `ocarina-config --prefix`/bin/
cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/
clean:
rm -rf tmpBuild $(exec) *~
.PHONY: install clean build
buildsupport is a low-level TASTE command, responsible for the generation of skeletons and some glue code.
License: LGPL (see LICENSE file)
Copyright (c) 2008-2017 European Space Agency
This diff is collapsed.
This diff is collapsed.
-- *************************** buildsupport **************************** --
-- (c) 2017 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- Set of helper functions for buildsupport
with Ocarina,
-- Ocarina.Types,
Ocarina.Types,
Ocarina.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,
Option_Type;
use Ocarina,
Ocarina.Types,
Ocarina.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
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
function US (Source : String) return Unbounded_String renames
To_Unbounded_String;
procedure Banner;
procedure Usage;
procedure Exit_On_Error (Error : Boolean; Reason : String);
type Synchronism is (Sync, Async);
type Supported_RCM_Operation_Kind is (Unprotected_Operation,
Protected_Operation,
Cyclic_Operation,
Sporadic_Operation,
Any_Operation);
function Get_RCM_Operation_Kind (E : Node_Id)
return Supported_RCM_Operation_Kind;
function Get_RCM_Operation (E : Node_Id) return Node_Id;
function Get_RCM_Period (D : Node_Id) return Unsigned_Long_Long;
function Get_APLC_Binding (E : Node_Id) return List_Id;
type Supported_ASN1_Encoding is (Default, Native, UPER, ACN);
function Get_ASN1_Encoding (E : Node_Id) return Supported_ASN1_Encoding;
type Supported_ASN1_Basic_Type is (ASN1_Sequence,
ASN1_SequenceOf,
ASN1_Enumerated,
ASN1_Set,
ASN1_SetOf,
ASN1_Integer,
ASN1_Boolean,
ASN1_Real,
ASN1_OctetString,
ASN1_Choice,
ASN1_String,
ASN1_Unknown);
package Property_Maps is new Indefinite_Ordered_Maps (String, String);
use Property_Maps;
package String_Vectors is new Indefinite_Vectors (Natural, String);
function Get_ASN1_Basic_Type (E : Node_Id) return Supported_ASN1_Basic_Type;
function Get_Ada_Package_Name (D : Node_Id) return Name_Id;
function Get_Ellidiss_Tool_Version (D : Node_Id) return Name_Id;
function Get_Interface_Name (D : Node_Id) return Name_Id;
function Get_ASN1_Module_Name (D : Node_Id) return String;
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);
package Option_UString is new Option_Type (Unbounded_String);
use Option_UString;
subtype Optional_Unbounded_String is Option_UString.Option;
package Option_ULL is new Option_Type (Unsigned_Long_Long);
use Option_ULL;
subtype Optional_Long_Long is Option_ULL.Option;
type ASN1_Parameter is
record
Name : Unbounded_String;
Sort : Unbounded_String;
ASN1_Module : Unbounded_String;
ASN1_Basic_Type : Supported_ASN1_Basic_Type;
ASN1_File_Name : Unbounded_String;
Encoding : Supported_ASN1_Encoding;
Direction : Parameter_Direction;
end record;
package Parameters is new Indefinite_Vectors (Natural, ASN1_Parameter);
type Taste_Interface is
record
Name : Unbounded_String;
Params : Parameters.Vector;
RCM : Supported_RCM_Operation_Kind;
Period_Or_MIAT : Unsigned_Long_Long;
WCET_ms : Optional_Long_Long := Nothing;
Queue_Size : Optional_Long_Long := Nothing;
User_Properties : Property_Maps.Map;
end record;
package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface);
type Context_Parameter is
record
Name : Unbounded_String;
Sort : Unbounded_String;
Default_Value : Unbounded_String;
ASN1_Module : Unbounded_String;
ASN1_File_Name : Optional_Unbounded_String := Nothing;
end record;
package Ctxt_Params is new Indefinite_Vectors (Natural, Context_Parameter);
type Taste_Terminal_Function is
record
Name : Unbounded_String;
Prefix : Optional_Unbounded_String := Nothing;
Language : Supported_Source_Language;
Zip_File : Optional_Unbounded_String := Nothing;
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,
Taste_Terminal_Function);
type Connection is
record
Caller : Unbounded_String;
Callee : Unbounded_String;
RI_Name : Unbounded_String;
PI_Name : Unbounded_String;
end record;
package Channels is new Indefinite_Vectors (Natural, Connection);
package Connection_Maps is new Indefinite_Ordered_Maps (String,
Channels.Vector,
"=" => Channels."=");
type Complete_Interface_View is
record
Flat_Functions : Functions.Vector;
End_To_End_Conn : Channels.Vector;
Nested_Conn : Connection_Maps.Map;
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;
-- *************************** buildsupport **************************** --
-- (c) 2015 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
with Ocarina.Types; use Ocarina.Types;
-- with Types; use Types;
package Imported_Routines is
procedure C_Set_OutDir (Dir : String; Len : Integer);
procedure C_Set_Stack (Val : String; Len : Integer);
procedure C_Set_Timer_Resolution (Val : String; Len : Integer);
procedure C_New_APLC (Arg : String; Len : Integer);
procedure C_New_FV (Arg : String; Len : Integer; CS : String);
procedure C_Set_PolyORBHI_C;
procedure C_Add_PI (Arg : String;
Len : Integer);
procedure C_Add_RI (Arg : String;
Len : Integer;
DistFV : String;
DLen : Integer;
DistName : String;
DistNameLen : Integer);
procedure C_Set_Distant_APLC (Arg : String; Len : Integer);
procedure C_End_IF;
procedure C_End_FV;
procedure C_Set_Root_Node (Arg : String; Len : Integer);
procedure C_New_Process (Arg : String;
Len : Integer;
Id : String;
LenId : Integer;
Node_Name : String;
Len_Node : Integer;
Coverage : Integer);
procedure C_New_Processor (Name : String;
Name_Len : Integer;
Classifier : String;
Classifier_Len : Integer;
Platform : String;
Platform_Len : Integer);
procedure C_New_Bus (Name : String;
Name_Len : Integer;
Classifier : String;
Classifier_Len : Integer);
procedure C_New_Device (Name : String;
Name_Len : Integer;
Classifier : String;
Classifier_Len : Integer;
Associated_Processor : String;
Associated_Processor_Len : Integer;
Configuration : String;
Configuration_Len : Integer;
Accessed_Bus : String;
Accessed_Bus_Len : Integer;
Access_Port : String;
Access_Port_Len : Integer;
Asn1_Filename : String;
Asn1_Filename_Len : Integer;
Asn1_Typename : String;
Asn1_Typename_Len : Integer;
Asn1_Modulename : String;
Asn1_Modulename_Len : Integer);
procedure C_New_Connection (Src_System : String;
Src_System_Length : Integer;
Src_Port : String;
Src_Port_Length : Integer;
Bus : String;
Bus_Length : Integer;
Dst_System : String;
Dst_System_Length : Integer;
Dst_Port : String;
Dst_Port_Length : Integer);
procedure C_Add_Binding (Arg : String; Len : Integer);
procedure C_End_Process;
procedure C_End_Bus;
procedure C_End_Device;
procedure C_End_Connection;
procedure C_Add_In_Param
(name : String;
Len1 : Integer;
partype : String;
Len2 : Integer;
module : String;
Len3 : Integer;
filename : String;
Len4 : Integer);
procedure C_Add_Out_Param
(name : String;
Len1 : Integer;
partype : String;
Len2 : Integer;
module : String;
Len3 : Integer;
filename : String;
Len4 : Integer);
procedure C_Add_Package
(Name : String;
Len : Integer);
procedure C_Set_Compute_Time
(Lower_Bound : Unsigned_Long_Long;
Lower_Unit : String;
Len2 : Integer;
Upper_Bound : Unsigned_Long_Long;
Upper_Unit : String;
Len4 : Integer);
procedure C_Set_Context_Variable
(varName : String;
nameLen : Integer;
varType : String;
typeLen : Integer;
varVal : String;
valLen : Integer;
varMod : String;
modLen : Integer;
varFile : String;
fileLen : Integer;
fullName : String);
procedure C_Set_Period (Period : Unsigned_Long_Long);
procedure C_Set_Interface_Queue_Size (Size : Unsigned_Long_Long);
procedure C_Set_Glue;
procedure C_Set_SMP2;
procedure C_Set_Interfaceview
(name : String;
len : Integer);
procedure C_Set_Dataview
(name : String;
len : Integer);
procedure C_Set_Zipfile
(name : String;
len : Integer);
procedure C_Set_Gateway;
procedure C_Keep_case;
procedure C_Set_Test;
procedure C_Set_Future;
procedure C_Set_OnlyCV;
procedure C_Set_AADLV2;
procedure C_Set_Language_To_SDL;
procedure C_Set_Language_To_Simulink;
procedure C_Set_Language_To_Other;
procedure C_Set_Language_To_C;
procedure C_Set_Language_To_QGenAda;
procedure C_Set_Language_To_QGenC;
procedure C_Set_Language_To_CPP;
procedure C_Set_Language_To_VDM;
procedure C_Set_Language_To_OpenGEODE;
procedure C_Set_Language_To_BlackBox_Device;
procedure C_Set_Language_To_RTDS;
procedure C_Set_Language_To_Rhapsody;
procedure C_Set_Language_To_Scade;
procedure C_Set_Language_To_Ada;
procedure C_Set_Language_To_GUI;
procedure C_Set_Language_To_VHDL;
procedure C_Set_Language_To_System_C;
procedure C_Set_Native_Encoding;
procedure C_Set_UPER_Encoding;
procedure C_Set_ACN_Encoding;
procedure C_Set_Sync_IF;
procedure C_Set_ASync_IF;
procedure C_Set_Unknown_IF;
procedure C_Set_Cyclic_IF;
procedure C_Set_Sporadic_IF;
procedure C_Set_Variator_IF;
procedure C_Set_Protected_IF;
procedure C_Set_Unprotected_IF;
procedure C_Set_UndefinedKind_IF;
procedure C_Init;
procedure C_End;
procedure C_Set_ASN1_BasicType_Sequence;
procedure C_Set_ASN1_BasicType_SequenceOf;
procedure C_Set_ASN1_BasicType_Enumerated;
procedure C_Set_ASN1_BasicType_Set;
procedure C_Set_ASN1_BasicType_SetOf;
procedure C_Set_ASN1_BasicType_Integer;
procedure C_Set_ASN1_BasicType_Boolean;
procedure C_Set_ASN1_BasicType_Real;
procedure C_Set_ASN1_BasicType_Choice;
procedure C_Set_ASN1_BasicType_String;
procedure C_Set_ASN1_BasicType_Unknown;
procedure C_Set_ASN1_BasicType_OctetString;
procedure C_Set_Debug_Messages;
procedure C_New_Drivers_Section;
procedure C_End_Drivers_Section;
private
pragma Import (C, C_New_Drivers_Section, "New_Drivers_Section");
pragma Import (C, C_End_Drivers_Section, "End_Drivers_Section");
pragma Import (C, C_Set_PolyORBHI_C, "Set_PolyorbHI_C");
pragma Import (C, C_Set_Root_Node, "Set_Root_Node");
pragma Import (C, C_New_Process, "New_Process");
pragma Import (C, C_New_Connection, "New_Connection");
pragma Import (C, C_New_Processor, "New_Processor");
pragma Import (C, C_New_Bus, "New_Bus");
pragma Import (C, C_New_Device, "New_Device");
pragma Import (C, C_Add_Binding, "Add_Binding");
pragma Import (C, C_End_Process, "End_Process");
pragma Import (C, C_End_Bus, "End_Bus");
pragma Import (C, C_End_Device, "End_Device");