---------------------------------------- ---------------------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . G E N E R A T O R S . P O _ H I _ A D A -- -- -- -- B o d y -- -- -- -- Copyright (C) 2007, GET-Telecom Paris. -- -- -- -- 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.Generators.Messages; with Ocarina.Generators.Ada_Tree.Generator; with Ocarina.Generators.PO_HI_Ada.Runtime; with Ocarina.Generators.PO_HI_Ada.Naming; with Ocarina.Generators.PO_HI_Ada.Marshallers; with Ocarina.Generators.PO_HI_Ada.Deployment; with Ocarina.Generators.PO_HI_Ada.Activity; with Ocarina.Generators.PO_HI_Ada.Subprograms; with Ocarina.Generators.PO_HI_Ada.Types; with Ocarina.Generators.PO_HI_Ada.Main; with Ocarina.Generators.Utils; with Ocarina.Generators.Build_Utils; package body Ocarina.Generators.PO_HI_Ada is use Ocarina.Generators.Messages; use Ocarina.Generators.Ada_Tree.Generator; use Ocarina.Generators.PO_HI_Ada.Runtime; use Ocarina.Generators.Utils; 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 (Instance_Root : node_id; Options : generator_options := Default_Options) is begin Visit_Architecture_Instance (Instance_Root); -- Abort if the construction of the Ada tree failed if No (HI_Distributed_Application_Root) then Display_Error ("Code generation failed", Fatal => True); end if; -- At this point, we have a valid Ada tree, we can begin the -- Ada source file generation. -- Enter the output directory Enter_Directory (Options.Output_Directory); if not Options.Clean then -- Create the source files Ada_Tree.Generator.Generate (HI_Distributed_Application_Root); -- Generate the Makefiles Build_Utils.Makefiles.Generate (Instance_Root); -- Generate the Ada project files Build_Utils.Ada_Project_Files.Generate (Instance_Root); -- If the user requested to build the applications then we -- build it. if Options.Build then Build_Utils.Makefiles.Build (Instance_Root); end if; else Build_Utils.Makefiles.Clean (Instance_Root); end if; -- Leave the output directory Leave_Directory; end Generate; ---------- -- Init -- ---------- procedure Init is begin -- Registration of the generator Register_Generator (Generate'access, polyorb_hi_ada, "PolyORB-HI-Ada"); -- Initialize some units Ocarina.Generators.PO_HI_Ada.Runtime.Initialize; end Init; ----------- -- Reset -- ----------- procedure Reset is begin Ocarina.Generators.PO_HI_Ada.Runtime.Reset; end Reset; --------------------------------- -- Visit_Architecture_Instance -- --------------------------------- procedure Visit_Architecture_Instance (E : node_id) is begin -- Create the specs subtrees Naming.Package_Spec.Visit (E); Types.Package_Spec.Visit (E); Deployment.Package_Spec.Visit (E); Subprograms.Package_Spec.Visit (E); Activity.Package_Spec.Visit (E); Marshallers.Package_Spec.Visit (E); -- Create the bodies subtrees Types.Package_Body.Visit (E); Subprograms.Package_Body.Visit (E); Activity.Package_Body.Visit (E); Marshallers.Package_Body.Visit (E); -- The main subprogram Main.Subprogram_Body.Visit (E); -- The makefiles Build_Utils.Makefiles.Visit (E); -- The Ada project files Build_Utils.Ada_Project_Files.Visit (E); end Visit_Architecture_Instance; end Ocarina.Generators.PO_HI_Ada;