Commit 27df0842 authored by julien.delange's avatar julien.delange

* src/backends/ocarina-backends-xml_tree-nodes.idl

   - Update the definition of an XML_File so that
     we can specify another extension (.html in our case)

 * src/backends/ocarina-backends-connection_matrix-main.adb
   src/backends/ocarina-backends-connection_matrix-main.ads
   - Main backend code to produce the connectivity matrix
     of a model.

 * src/backends/ocarina-backends-connection_matrix.adb
   src/backends/ocarina-backends-connection_matrix.ads
   - Entry point for the connection_matrix backend

 * src/backends/ocarina-backends-xml_tree-generator.adb
 * src/backends/ocarina-backends-xml_tree-nutils.adb
   - By default, an XML file node will be created
     with the .xml file extension. .html will be optional
     and must be explicitly set by the user.

 * src/backends/ocarina-backends.adb
   src/backends/ocarina-backends.ads
   - Integrate the connection_matrix backend



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2017 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 77576db2
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.CONNECTION_MATRIX.MAIN --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. Ocarina is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- Ocarina is maintained by the Ocarina team --
-- (ocarina-users@listes.enst.fr) --
-- --
------------------------------------------------------------------------------
package Ocarina.Backends.Connection_Matrix.Main is
Connection_Matrix_Root_Node : Node_Id;
procedure Visit (E : Node_Id);
end Ocarina.Backends.Connection_Matrix.Main;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . C O N N E C T I O N _ M A T R I X --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. Ocarina is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- Ocarina is maintained by the Ocarina team --
-- (ocarina-users@listes.enst.fr) --
-- --
------------------------------------------------------------------------------
with Ocarina.Instances;
with Ocarina.Backends.Messages;
with Ocarina.Backends.Expander;
with Ocarina.Backends.XML_Tree.Generator;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Connection_Matrix.Main;
with GNAT.Command_Line; use GNAT.Command_Line;
with Namet; use Namet;
package body Ocarina.Backends.Connection_Matrix is
use Ocarina.Instances;
use Ocarina.Backends.Expander;
use Ocarina.Backends.Messages;
use Ocarina.Backends.XML_Tree.Generator;
use Ocarina.Backends.Utils;
Remove_Generated_Sources : Boolean := False;
Generated_Sources_Directory : Name_Id := No_Name;
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
-- compilation unit to be generated.
--------------
-- Generate --
--------------
procedure Generate (AADL_Root : Node_Id) is
Instance_Root : Node_Id;
begin
Instance_Root := Instantiate_Model (AADL_Root);
Expand (Instance_Root);
Visit_Architecture_Instance (Instance_Root);
-- Abort if the construction of the tree failed
if No (XML_Root) then
Display_Error ("Statistics generation failed", Fatal => True);
end if;
-- At this point, we have a valid tree, we can begin the XML
-- file generation.
-- Enter the output directory
Enter_Directory (Generated_Sources_Directory);
if not Remove_Generated_Sources then
-- Create the source files
XML_Tree.Generator.Generate (XML_Root);
end if;
-- Leave the output directory
Leave_Directory;
end Generate;
----------
-- Init --
----------
procedure Init is
begin
Generated_Sources_Directory := Get_String_Name (".");
Initialize_Option_Scan;
loop
case Getopt ("* b z o:") is
when ASCII.NUL =>
exit;
when 'z' =>
Remove_Generated_Sources := True;
when 'o' =>
declare
D : constant String := Parameter;
begin
if D'Length /= 0 then
Generated_Sources_Directory := Get_String_Name (D);
end if;
end;
when others =>
null;
end case;
end loop;
Register_Backend
("Connection_Matrix",
Generate'Access,
Connection_Matrix_Analysis);
end Init;
-----------
-- Reset --
-----------
procedure Reset is
begin
null;
end Reset;
---------------------------------
-- Visit_Architecture_Instance --
---------------------------------
procedure Visit_Architecture_Instance (E : Node_Id) is
begin
Main.Visit (E);
end Visit_Architecture_Instance;
end Ocarina.Backends.Connection_Matrix;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . C O N N E C T I O N _ M A T R I X --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. Ocarina is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING. --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- Ocarina is maintained by the Ocarina team --
-- (ocarina-users@listes.enst.fr) --
-- --
------------------------------------------------------------------------------
package Ocarina.Backends.Connection_Matrix is
procedure Generate (AADL_Root : Node_Id);
-- The main entry point of the generator
procedure Init;
-- Fills the corresponding location in the generator table by the
-- information on this generator and execute some initialization
-- routines necessary for its work.
procedure Reset;
private
XML_Root : Node_Id;
-- The root of the XML trees to generate HTML file.
end Ocarina.Backends.Connection_Matrix;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009, GET-Telecom Paris. --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -59,10 +59,10 @@ package body Ocarina.Backends.Stats.Main is
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Stats.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XV renames Ocarina.Backends.XML_Values;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XV renames Ocarina.Backends.XML_Values;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
......
......@@ -80,7 +80,8 @@ package body Ocarina.Backends.XML_Tree.Generator is
-------------------
function Get_File_Name (N : Node_Id) return Name_Id is
Suffix : constant String := ".xml";
Suffix_XML : constant String := ".xml";
Suffix_HTML : constant String := ".html";
begin
-- The File name corresponding is the lowerd name of N
......@@ -88,8 +89,11 @@ package body Ocarina.Backends.XML_Tree.Generator is
(Conventional_Base_Name (Name (Defining_Identifier (N))));
-- Adding file suffix
Add_Str_To_Name_Buffer (Suffix);
if Is_HTML (N) then
Add_Str_To_Name_Buffer (Suffix_HTML);
else
Add_Str_To_Name_Buffer (Suffix_XML);
end if;
return Name_Find;
end Get_File_Name;
......
......@@ -77,6 +77,7 @@ module Ocarina::Backends::XML_Tree::Nodes {
interface XML_File : Definition {
Node_Id Distributed_Application_Unit;
Node_Id Root_Node;
boolean Is_HTML;
Node_Id XML_DTD; // Identifier referring to XML file DTD
};
......
......@@ -580,6 +580,7 @@ package body Ocarina.Backends.XML_Tree.Nutils is
Set_Defining_Identifier (File, Identifier);
Set_Corresponding_Node (Identifier, File);
XTN.Set_Is_HTML (File, False);
XTN.Set_Root_Node (File, The_XML_Node);
if Present (DTD) then
XTN.Set_XML_DTD (File, DTD);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -50,6 +50,7 @@ with Ocarina.Backends.Stats;
with Ocarina.Backends.Subprograms;
with Ocarina.Backends.Carts;
with Ocarina.Backends.Cheddar;
with Ocarina.Backends.Connection_Matrix;
with Ocarina.Backends.MAST;
with Ocarina.Backends.MAST_Values;
with Ocarina.Backends.MAST_Tree.Nodes;
......@@ -188,6 +189,7 @@ package body Ocarina.Backends is
Carts.Init;
ASN1.Init;
Cheddar.Init;
Connection_Matrix.Init;
end Init;
----------------------
......@@ -248,6 +250,7 @@ package body Ocarina.Backends is
Stats.Reset;
Carts.Reset;
PO_QoS_Ada.Reset;
Connection_Matrix.Reset;
Ada_Tree.Nutils.Reset;
C_Tree.Nutils.Reset;
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -53,19 +53,20 @@ package Ocarina.Backends is
AADL_Min,
AADL_Annex,
ASN1_Deployment,
Behavior_PP,
Bound_T,
Carts_XML,
Cheddar_XML,
Connection_Matrix_Analysis,
MAST_Scheduling,
Petri_Nets,
PolyORB_QoS_Ada,
PolyORB_HI_Ada,
PolyORB_HI_C,
PolyORB_HI_RTSJ,
PolyORB_Kernel_C,
PolyORB_QoS_Ada,
Statistics,
Subprograms_Generator,
Carts_XML,
Cheddar_XML,
PolyORB_Kernel_C,
Behavior_PP,
REAL_PP,
REAL_Theorem);
-- Supported code generators. For each kind, at most one generator
......
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