Commit b2a61c49 authored by jhugues's avatar jhugues

* Add ASN.1 generation to PolyORB-HI/Ada



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@3581 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 044178b7
......@@ -49,6 +49,7 @@ with Ocarina.Backends.PO_HI_Ada.Subprograms;
with Ocarina.Backends.PO_HI_Ada.Transport;
with Ocarina.Backends.PO_HI_Ada.Types;
with Ocarina.Backends.PO_HI_Ada.Main;
with Ocarina.Backends.ASN1;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Build_Utils;
......@@ -117,6 +118,17 @@ package body Ocarina.Backends.PO_HI_Ada is
Custom_Body_Names : Name_Tables.Instance;
User_Source_Dirs : Name_Tables.Instance);
--------------------------
-- Set_ASN1_Deployment --
--------------------------
Generate_ASN1_Deployment : Boolean := False;
procedure Set_ASN1_Deployment (Use_It : Boolean) is
begin
Generate_ASN1_Deployment := Use_It;
end Set_ASN1_Deployment;
-----------------------------
-- PolyORB_HI_Ada_Makefile --
-----------------------------
......@@ -141,7 +153,6 @@ package body Ocarina.Backends.PO_HI_Ada is
pragma Unreferenced (Appli_Name,
Transport_API,
Ada_Sources,
Asn_Sources,
C_Libraries,
User_Source_Dirs,
Use_Transport,
......@@ -209,12 +220,33 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Str ("PROJECT_FILE = ");
Write_Name (Node_Name);
Write_Line (".gpr");
Write_Str ("ASN_SOURCES=");
if Generate_ASN1_Deployment then
Write_Str ("../../asn1_deployment.asn ");
end if;
if Length (Asn_Sources) > 0 then
for J in
Name_Tables.First .. Name_Tables.Last (Asn_Sources) loop
Write_Str ("");
Write_Name (Asn_Sources.Table (J));
exit when J = Name_Tables.Last (Asn_Sources);
Write_Space;
end loop;
end if;
Write_Eol;
-- The 'all' target
Write_Str ("all:");
-- First, process ASN.1 files
if Length (Asn_Sources) > 0 then
Write_Str (" generate-asn1-files");
end if;
-- If there are C files to be compiled, add a dependency on
-- these files
......@@ -278,6 +310,11 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Char (ASCII.HT);
Write_Str ("$(CC) $(CFLAGS) -I. $(CPU_CFLAGS) -c $<");
end if;
Write_Eol;
Write_Line ("generate-asn1-files: $(ASN_SOURCES)");
Write_Char (ASCII.HT);
Write_Line (" asn1.exe -Ada -uPER $(ASN_SOURCES)");
end PolyORB_HI_Ada_Makefile;
-------------------------------------
......@@ -508,6 +545,16 @@ package body Ocarina.Backends.PO_HI_Ada is
Generate_PolyORB_HI_Ada_Ada_Project_File (Instance_Root);
-- If we have to generate the ASN1 deployment file, then
-- we enter the directory that contains the generated
-- code and invoke directly the ASN1 generator with the
-- instance root. It should automatically create an .asn1
-- file that contains deployment/messages informations.
if Generate_ASN1_Deployment then
ASN1.Generate (Instance_Root);
end if;
-- If the user requested to build the applications then we
-- build it.
......
......@@ -49,6 +49,8 @@ package Ocarina.Backends.PO_HI_Ada is
procedure Reset;
-- Reset the internal units of the PO_HI_Ada generator
procedure Set_ASN1_Deployment (Use_It : Boolean);
private
Ada_Root : Node_Id;
-- The root of the Ada trees
......
......@@ -56,6 +56,7 @@ with Ocarina.AADL_Values; use Ocarina.AADL_Values;
with Ocarina.Analyzer; use Ocarina.Analyzer;
with Ocarina.Backends; use Ocarina.Backends;
with Ocarina.Backends.PO_HI_C;
with Ocarina.Backends.PO_HI_Ada;
with Ocarina.Backends.Execution_Tests;
use Ocarina.Backends.Execution_Tests;
with Ocarina.Configuration; use Ocarina.Configuration;
......@@ -908,7 +909,6 @@ procedure Ocarina_Cmd is
-- Process options.
if not Is_Empty (Used_Generator_Options) then
N := First_Node (Used_Generator_Options);
while Present (N) loop
......@@ -927,6 +927,7 @@ procedure Ocarina_Cmd is
if P = Get_String_Name ("asn1") then
Ocarina.Backends.PO_HI_C.Set_ASN1_Deployment (True);
Ocarina.Backends.PO_HI_Ada.Set_ASN1_Deployment (True);
end if;
N := Next_Node (N);
......
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