Commit 55e298c5 authored by yoogx's avatar yoogx

* Remove PolyORB/Ada backend

parent 1c86364d
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . P O _ Q O S _ A D A . H E L P E R S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
-- This package contains the routines that generates the
-- '<..>_Helpers' package of the distributed application nodes
package Ocarina.Backends.PO_QoS_Ada.Helpers is
package Package_Spec is
procedure Visit (E : Node_Id);
end Package_Spec;
package Package_Body is
procedure Visit (E : Node_Id);
end Package_Body;
end Ocarina.Backends.PO_QoS_Ada.Helpers;
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . P O _ Q O S _ A D A . M A I N --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
-- This package contains the routines that generates the main
-- subprogram of the distributed application nodes
package Ocarina.Backends.PO_QoS_Ada.Main is
package Subprogram_Body is
procedure Visit (E : Node_Id);
end Subprogram_Body;
end Ocarina.Backends.PO_QoS_Ada.Main;
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . P O _ Q O S _ A D A . M A P P I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
-- This package contains routines to map entities from the AADL
-- instance tree into entities of the Ada tree.
with Ocarina.Backends.Properties;
package Ocarina.Backends.PO_QoS_Ada.Mapping is
use Ocarina.Backends.Properties;
-- The routines below map AADL entities into API dependant
-- entities.
function Map_Distributed_Application (E : Node_Id) return Node_Id;
-- Create a PolyORB-QoS Ada distributed application node mapped
-- from the AADL architecture instance node E.
function Map_QoS_Node (E : Node_Id) return Node_Id;
-- Create a PolyORB-QoS Ada node of a distributed application
function Map_QoS_Unit
(E : Node_Id;
F : Node_Id := No_Node)
return Node_Id;
-- Create the node that contain all the Ada units generated for a
-- particular node of the distributed application.
function Map_TC_Variable_Identifier (E : Node_Id) return Node_Id;
-- Maps a TypeCode variable identifier corresponding to the data
-- component instance E.
function Map_Record_Field_Identifier (S : Node_Id) return Node_Id;
-- Maps a record field identifier from the data subcomponent E
function Map_Initialize_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the initialize routine of the data
-- component E
function Map_Initialized_Flag_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the boolean flag corresponding to the
-- Data component E.
function Map_Package_Instantiation_Designator (E : Node_Id) return Node_Id;
-- Returns a designator for the instantiated package corresponding
-- to the node E.
function Map_Dependency (Dep : Node_Id) return Node_Id;
-- Deduces a dependency string from a package name
function Map_Object_Type_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the servant corresponding to thread
-- E.
function Map_Reference_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the reference corresponding to the
-- destination port E.
function Map_Thread_Controller_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the subprogram that performs the `job'
-- of thread E.
function Map_Ada_Time (T : Time_Type) return Node_Id;
-- Create the call from the corresponding Ada real time routines
-- to create an Ada time span that corresponds to the given time
-- T. If an error occurs (for example if the given time is too
-- small to be generated by Ada or the used unit is too fine
-- grained (picoseconds), return No_Node.
function Map_Ada_Priority (P : Unsigned_Long_Long) return Node_Id;
-- Maps the given AADL priority into an Ada priority
function Map_Buffer_Instance_Identifier (P : Node_Id) return Node_Id;
-- Maps an identifier for a buffer instance corresponding to an
-- event [data] port P.
function Map_Variable_Identifier (P : Node_Id) return Node_Id;
-- Maps an identifier for a local variable corresponding to port P
function Map_Mutex_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the mutex generated for thead E
function Map_Port_Argument_Identifier (E : Node_Id) return Node_Id;
function Map_Port_Boolean_Identifier (E : Node_Id) return Node_Id;
-- Mapping for entities to handle connections between threads and
-- subprograms.
function Map_Get_Subprogram_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the Get_<...> subprogram generated for
-- port or a proptected data E.
function Map_Put_Subprogram_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for the Put_<...> subprogram generated for
-- port E.
function Map_Push_Back_Subprogram_Identifier (E : Node_Id) return Node_Id;
-- Maps an identifier for Push_back_<...> subprogram generated for
-- port E.
function Must_Have_Port_Number (E : Node_Id) return Boolean;
-- Return True iff the process instance E must have been assigned
-- a port number. A process that must have a port number is a
-- process that has IN ports or a process that has threads with IN
-- ports. The second case is due tp the fact that inter-thread
-- communication is handled using PolyORB-QoS refernces.
procedure Compute_Servant_Index (T : Node_Id);
-- Computes a new index for the servant corresponding to the
-- thread T and set it as the name_table_info of a conventional
-- name_id. The incrementation of the index is done for thread in
-- the same process.
function Get_Servant_Index (T : Node_Id) return Nat;
-- Deduce the conventional name_id from the thread T
-- names, gets the name_table_info of the obtained name_id and
-- returns it.
procedure Bind_Ada_Identifier_To_Package (I : Node_Id; P : Node_Id);
-- Links the Ada Identifier I to the Package declaration P. The
-- binding is performed 'by name'.
function Get_Bound_Package (I : Node_Id) return Node_Id;
-- Return the package declaration bound to the Ada identifier
-- I. Returns No_Node if no package has been bound to I, I is
-- No_Node or the name of I is No_Name.
-- The Bind_AADL_To_<..> subprograms creates bindings between a
-- node from the AADL instance tree and a <..> node.
procedure Bind_AADL_To_Setup (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Parameters (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Obj_Adapters (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Helpers (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Main (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Servants (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Namespaces (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_TypeCode (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Execute_Servant (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_From_Any (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Initialize (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Reference (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Subprogram (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Feature_Subprogram (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Set (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Build (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_To_Any (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Thread_Controller (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Type_Definition (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Put (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Push_Back (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Get (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Package (G : Node_Id; A : Node_Id);
end Ocarina.Backends.PO_QoS_Ada.Mapping;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.PO_QOS_ADA.NAMESPACES --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
package Ocarina.Backends.PO_QoS_Ada.Namespaces is
package Package_Spec is
procedure Visit (E : Node_Id);
end Package_Spec;
package Package_Body is
procedure Visit (E : Node_Id);
end Package_Body;
end Ocarina.Backends.PO_QoS_Ada.Namespaces;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.PO_QOS_ADA.OBJ_ADAPTERS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Ada_Tree.Nutils;
with Ocarina.Backends.Ada_Tree.Nodes;
with Ocarina.Backends.PO_QoS_Ada.Runtime;
with Ocarina.Backends.Ada_Values;
package body Ocarina.Backends.PO_QoS_Ada.Obj_Adapters is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Ada_Tree.Nutils;
use Ocarina.Backends.PO_QoS_Ada.Runtime;
use Ocarina.Backends.Ada_Values;
package AAN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package ADN renames Ocarina.Backends.Ada_Tree.Nodes;
pragma Unreferenced (AAN);
------------------
-- Package_Spec --
------------------
package body Package_Spec is
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
procedure Visit_System_Instance (E : Node_Id);
procedure Visit_Process_Instance (E : Node_Id);
-----------
-- Visit --
-----------
procedure Visit (E : Node_Id) is
begin
case Kind (E) is
when K_Architecture_Instance =>
Visit_Architecture_Instance (E);
when K_Component_Instance =>
Visit_Component_Instance (E);
when others =>
null;
end case;
end Visit;
---------------------------------
-- Visit_Architecture_Instance --
---------------------------------
procedure Visit_Architecture_Instance (E : Node_Id) is
begin
Visit (Root_System (E));
end Visit_Architecture_Instance;
------------------------------
-- Visit_Component_Instance --
------------------------------
procedure Visit_Component_Instance (E : Node_Id) is
Category : constant Component_Category
:= Get_Category_Of_Component (E);
begin
case Category is
when CC_System =>
Visit_System_Instance (E);
when CC_Process =>
Visit_Process_Instance (E);
when others =>
null;
end case;
end Visit_Component_Instance;
----------------------------
-- Visit_Process_Instance --
----------------------------
procedure Visit_Process_Instance (E : Node_Id) is
U : constant Node_Id := ADN.Distributed_Application_Unit
(ADN.Helpers_Node (Backend_Node (Identifier (E))));
P : constant Node_Id := ADN.Entity (U);
N : Node_Id;
S : Node_Id;
N_Servants : Unsigned_Long_Long := 0;
begin
Push_Entity (P);
Push_Entity (U);
Set_Obj_Adapters_Spec;
-- Count the number of threads having IN ports (servants)
if not AAU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the corresponding component instance
if AAU.Is_Thread (Corresponding_Instance (S)) and then
Has_In_Ports (Corresponding_Instance (S))
then
N_Servants := N_Servants + 1;
end if;
S := Next_Node (S);
end loop;
end if;
-- Do not generate the Object_Adapter package instantiation
-- only if there are servants in on the node.
if N_Servants > 0 then
N := Make_Literal (New_Integer_Value (N_Servants, 1, 10));
-- Instantiate the generic package
N := Make_Package_Instantiation
(Defining_Identifier => ADN.Defining_Identifier
(ADN.Package_Declaration
(Current_Package)),
Generic_Package => RU (RU_ARAO_Object_Adapter_G),
Parameter_List => Make_List_Id (N));
ADN.Set_Is_Instantiated_Package (Current_Package, True);
ADN.Set_Package_Instantiation (Current_Package, N);
end if;
Pop_Entity; -- U
Pop_Entity; -- P
end Visit_Process_Instance;
---------------------------
-- Visit_System_Instance --
---------------------------
procedure Visit_System_Instance (E : Node_Id) is
S : Node_Id;
begin
Push_Entity (Ada_Root);
if not AAU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the corresponding component instance
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
Pop_Entity; -- Ada_Root
end Visit_System_Instance;
end Package_Spec;
end Ocarina.Backends.PO_QoS_Ada.Obj_Adapters;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.PO_QOS_ADA.OBJ_ADAPTERS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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 TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
package Ocarina.Backends.PO_QoS_Ada.Obj_Adapters is
package Package_Spec is
procedure Visit (E : Node_Id);
end Package_Spec;
end Ocarina.Backends.PO_QoS_Ada.Obj_Adapters;
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.PO_QOS_ADA.PARAMETERS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- --
-- 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. --
-- --