Commit 8178b1ff authored by jhugues's avatar jhugues

* Initial import of the AADL to XML backend



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@3192 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 4564a110
......@@ -388,6 +388,7 @@ AC_OUTPUT([
resources/behavioural_properties/Makefile
resources/runtime/Makefile
resources/runtime/cheddar/Makefile
resources/runtime/aadl_xml/Makefile
projects/ocarina.gpr
src/main/Makefile
src/main/ocarina-configuration.adb
......
SUBDIRS = cheddar
SUBDIRS = cheddar aadl_xml
@DEBUG_FALSE@DEBUG_FLAG = --disable-debug
@DEBUG_TRUE@DEBUG_FLAG = --enable-debug
......
AUTOMAKE_OPTIONS = no-dependencies
AADL_XML_FILES = $(srcdir)/aadl.xsd
EXTRA_DIST = $(AADL_XML_FILES)
aadl_xml_xsd = ${shell $(CYGPATH_U) '$(includedir)/ocarina/runtime/aadl_xml'}
install-data-local:
$(INSTALL) -d $(DESTDIR)$(aadl_xml_xsd)
for f in $(AADL_XML_FILES); do $(INSTALL) -m 444 $$f $(DESTDIR)$(aadl_xml_xsd) ; done
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- AADL XML Root node -->
<xs:element name='aadl_xml'>
<xs:annotation>
<xs:documentation>
This node is the root of the XML tree, defining
* A root_system element as the root of the instance tree;
* A list of components
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='components'/>
</xs:sequence>
<xs:attribute name='root_system' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='components'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='component'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='component'>
<xs:complexType>
<xs:sequence>
<xs:element ref='classifier'/>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='features'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='subcomponents'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='connections'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='properties'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='flows'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='modes'/>
</xs:sequence>
<xs:sequence minOccurs='0' maxOccurs='1'>
<xs:element ref='annexes'/>
</xs:sequence>
</xs:sequence>
<xs:attribute name='category' use='required'>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value='abstract'/>
<xs:enumeration value='bus'/>
<xs:enumeration value='data'/>
<xs:enumeration value='device'/>
<xs:enumeration value='process'/>
<xs:enumeration value='processor'/>
<xs:enumeration value='thread'/>
<xs:enumeration value='port'/>
<xs:enumeration value='subprogram'/>
<xs:enumeration value='system'/>
<xs:enumeration value='virtual_bus'/>
<xs:enumeration value='virtual_processor'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name='identifier' type="xs:string" use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='classifier'>
<xs:complexType mixed='true'>
</xs:complexType>
</xs:element>
<xs:element name='features'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='feature'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='feature'>
<xs:complexType>
<xs:sequence>
<xs:element ref='direction'/>
<xs:element ref='type'/>
<xs:element ref='classifier' minOccurs='0' maxOccurs='1'/>
<xs:element ref='properties' minOccurs='0' maxOccurs='1'/>
</xs:sequence>
<xs:attribute name='identifier' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='direction'>
<xs:complexType>
<xs:attribute name='kind' use='required'>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value='in'/>
<xs:enumeration value='out'/>
<xs:enumeration value='in_out'/>
<xs:enumeration value='none'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name='type'>
<xs:complexType>
<xs:attribute name='kind' use='required'>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value='access'/>
<xs:enumeration value='data'/>
<xs:enumeration value='event'/>
<xs:enumeration value='event_data'/>
<xs:enumeration value='feature'/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name='subcomponents'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='component'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Connections -->
<xs:element name='connections'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='connection'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='connection'>
<xs:complexType>
<xs:sequence>
<xs:element ref='src' minOccurs='1' maxOccurs='1'/>
<xs:element ref='dst' minOccurs='1' maxOccurs='1'/>
<xs:element ref='properties' minOccurs='0' maxOccurs='1'/>
</xs:sequence>
<xs:attribute name='name' type="xs:string" use='optional'/>
</xs:complexType>
</xs:element>
<xs:element name='src'>
<xs:complexType>
<xs:attribute name='component' type="xs:string" use='required'/>
<xs:attribute name='feature' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<xs:element name='dst'>
<xs:complexType>
<xs:attribute name='component' type="xs:string" use='required'/>
<xs:attribute name='feature' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<!-- Properties -->
<xs:element name='properties'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='property'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='property'>
<xs:complexType>
<xs:sequence minOccurs='1' maxOccurs='unbounded'>
<xs:element ref='property_value'/>
</xs:sequence>
<xs:attribute name='name' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<xs:element name="property_value">
<xs:complexType>
<xs:choice>
<xs:element name="classifier" type="classifier_prop"/>
<xs:element name="reference" type="reference_prop"/>
<xs:element name="unit" type="unit_prop"/>
<xs:element name="value" type="value_prop"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:complexType name='classifier_prop'>
<xs:attribute name='name' type="xs:string" use='required'/>
</xs:complexType>
<xs:complexType name='unit_prop'>
<xs:attribute name='value' type="xs:string" use='required'/>
<xs:attribute name='unit' type="xs:string" use='required'/>
</xs:complexType>
<xs:complexType name='value_prop'>
<xs:attribute name='value' type="xs:string" use='required'/>
</xs:complexType>
<xs:complexType name='reference_prop'>
<xs:attribute name='value' type="xs:string" use='required'/>
</xs:complexType>
<!-- Modes -->
<xs:element name='modes'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='mode'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='mode'>
<xs:complexType>
<xs:attribute name='name' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<!-- Flows -->
<xs:element name='flows'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='flow'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name='flow'>
<xs:complexType>
<xs:attribute name='name' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
<!-- Annexes -->
<xs:element name='annexes'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:element ref='annex'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- To be completed -->
<xs:element name='annex'>
<xs:complexType>
<xs:sequence maxOccurs='unbounded'>
<xs:any minOccurs="0"/>
</xs:sequence>
<xs:attribute name='name' type="xs:string" use='required'/>
</xs:complexType>
</xs:element>
</xs:schema>
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ X M L . M A I N --
-- --
-- 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.AADL_XML.Main is
procedure Visit (E : Node_Id);
end Ocarina.Backends.AADL_XML.Main;
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ X M L . M A P P I N G --
-- --
-- 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.AADL_XML.Mapping is
function Map_HI_Node (E : Node_Id) return Node_Id;
function Map_HI_Unit (E : Node_Id) return Node_Id;
function Map_Processor (E : Node_Id) return Node_Id;
function Map_Process (E : Node_Id) return Node_Id;
function Map_Thread (E : Node_Id) return Node_Id;
function Map_Buffer (E : Node_Id; P : Node_Id) return Node_Id;
function Map_Dependency (E : Node_Id; P : Node_Id) return Node_Id;
function Map_Data (E : Node_Id) return Node_Id;
end Ocarina.Backends.AADL_XML.Mapping;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ X M L --
-- --
-- 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.Expander;
with Ocarina.Backends.Messages;
with Ocarina.Backends.AADL_XML.Main;
with Ocarina.Backends.Utils;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.XML_Tree.Generator;
with GNAT.Command_Line; use GNAT.Command_Line;
with Namet; use Namet;
package body Ocarina.Backends.AADL_XML is
use Ocarina.Instances;
use Ocarina.Backends.Messages;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Expander;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
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);
if No (Instance_Root) then
Display_Error ("Cannot instantiate the AADL model", Fatal => True);
end if;
-- Expand the AADL instance
Expand (Instance_Root);
Visit_Architecture_Instance (Instance_Root);
-- Abort if the construction of the XML tree failed
if No (XML_Root) then
Display_Error ("XML generation failed", Fatal => True);
end if;
Enter_Directory (Generated_Sources_Directory);
-- Create the XML file
XML_Tree.Generator.Generate (XML_Root);
Leave_Directory;
end Generate;
----------
-- Init --
----------
procedure Init is
begin
Generated_Sources_Directory := Get_String_Name (".");
Initialize_Option_Scan;
loop
case Getopt ("* o:") is
when ASCII.NUL =>
exit;
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 ("aadl_xml", Generate'Access, AADLXML);
end Init;
-----------
-- Reset --
-----------
procedure Reset is
begin
null;
end Reset;
---------------------------------
-- Visit_Architecture_Instance --
---------------------------------
procedure Visit_Architecture_Instance (E : Node_Id) is
begin
XML_Root := XTU.New_Node (XTN.K_HI_Distributed_Application);
XTN.Set_Name (XML_Root, No_Name);
XTN.Set_Units (XML_Root, XTU.New_List (XTN.K_List_Id));
XTN.Set_HI_Nodes (XML_Root, XTU.New_List (XTN.K_List_Id));
XTU.Push_Entity (XML_Root);
AADL_XML.Main.Visit (E);
XTU.Pop_Entity;
end Visit_Architecture_Instance;
end Ocarina.Backends.AADL_XML;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ X M L --
-- --
-- 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) --
-- --
------------------------------------------------------------------------------
-- This backend generates an XML file compatible with the AADL_XML profile
package Ocarina.Backends.AADL_XML is
procedure Generate (AADL_Root : Node_Id);
-- The main entry point of the AADL_XML backend
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;
Current_XML_Node : Node_Id;
Distributed_Application : Node_Id;
HI_Node : Node_Id;
HI_Unit : Node_Id;
-- The root of the XML trees
end Ocarina.Backends.AADL_XML;
......@@ -78,6 +78,7 @@ with Ocarina.Backends.Xtratum_Conf;
with Ocarina.Backends.ASN1_Tree.Nodes;
with Ocarina.Backends.ASN1_Tree.Nutils;
with Ocarina.Backends.ASN1_Values;
with Ocarina.Backends.AADL_XML;
with Ocarina.Options; use Ocarina.Options;
......@@ -197,6 +198,7 @@ package body Ocarina.Backends is
Cheddar.Init;
Connection_Matrix.Init;
Functions_Matrix.Init;
AADL_XML.Init;
end Init;
----------------------
......
......@@ -52,6 +52,7 @@ package Ocarina.Backends is
AADL,
AADL_Min,
AADL_Annex,
AADLXML,
ASN1_Deployment,
Behavior_PP,
Bound_T,
......
......@@ -55,6 +55,7 @@ Usage:
cheddar
connection_matrix
function_matrix
aadl_xml
aadl
aadl_min
aadl_annex
......
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