Commit 6a441755 authored by Bechir Zalila's avatar Bechir Zalila
Browse files

* (ocarina-be_aadl.ads): Generate_AADL_Model: Make this subprogram

	public as it will be used in the Fault Tolerence Module. Added an
	 optiona parameter Whole_Tree to pilot the disegarding of first
	parameter Node.

	* (ocarina-be_aadl.adb): Generate_Whole_AADL_Model: New internal
	 wrapper which is registered as the AADL Backend main entry point
parent 1eb91182
......@@ -64,10 +64,8 @@ package body Ocarina.BE_AADL is
use Ocarina.BE_AADL.Components;
use Ocarina.BE_AADL.Identifiers;
procedure Generate_AADL_Model (Node : Node_Id);
-- Prints all the AADL source corresponding to the subtree having
-- Node as a root. If given the absolute root of an AADL syntactic
-- tree, prints all the parsed AADL source.
procedure Generate_Whole_AADL_Model (Node : Node_Id);
-- Prints all the AADL parsed sources
procedure Generate_Min_AADL_Model (Node : Node_Id);
-- Instantiates the AADL tree, then for each node of the root
......@@ -90,7 +88,7 @@ package body Ocarina.BE_AADL is
procedure Init is
begin
Register_Backend ("aadl", Generate_AADL_Model'Access, AADL);
Register_Backend ("aadl", Generate_Whole_AADL_Model'Access, AADL);
Register_Backend ("aadl_min", Generate_Min_AADL_Model'Access, AADL_Min);
Register_Backend ("aadl_annex", Generate_AADL_Annex'Access, AADL_Annex);
......@@ -193,8 +191,11 @@ package body Ocarina.BE_AADL is
-- Generate_AADL_Model --
-------------------------
procedure Generate_AADL_Model (Node : Node_Id) is
pragma Unreferenced (Node);
procedure Generate_AADL_Model
(Node : Node_Id;
Whole_Tree : Boolean := True)
is
pragma Assert (Whole_Tree or else Present (Node));
procedure Internal_Print_Subtree is new Print_Constrained_Subtree
(Always_Printable);
......@@ -204,9 +205,11 @@ package body Ocarina.BE_AADL is
Set_Output (Create_File (Get_Name_String (Output_Filename), Binary));
end if;
Internal_Print_Subtree (Entries.First, No_Node);
-- Note: we use Entries.First instead of Node to visit the
-- whole declarative tree.
if Whole_Tree then
Internal_Print_Subtree (Entries.First, No_Node);
else
Internal_Print_Subtree (Node, No_Node);
end if;
Set_Standard_Error;
end Generate_AADL_Model;
......@@ -353,6 +356,15 @@ package body Ocarina.BE_AADL is
end if;
end Always_Printable;
-------------------------------
-- Generate_Whole_AADL_Model --
-------------------------------
procedure Generate_Whole_AADL_Model (Node : Node_Id) is
begin
Generate_AADL_Model (Node, True);
end Generate_Whole_AADL_Model;
-----------------------------
-- Generate_Min_AADL_Model --
-----------------------------
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -54,6 +54,14 @@ package Ocarina.BE_AADL is
-- Print the AADL declarations for which the given Is_Printable
-- (<Node>, Criterion) is True.
procedure Generate_AADL_Model
(Node : Node_Id;
Whole_Tree : Boolean := True);
-- Prints all the AADL source corresponding to the subtree having
-- Node as a root. If given the absolute root of an AADL syntactic
-- tree, prints all the parsed AADL source. If the Whole_Tree is
-- True, disregards Node and prints the whole declarative tree.
private
No_Labels : constant Token_List_Type := (1 => T_Error);
......
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