------------------------------------------------------------- ------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- G A I A . M G M T -- -- -- -- B o d y -- -- -- -- Copyright (C) 2006-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 Namet; with Gaia.Utils; with Gaia.Translator; with Gaia.Generator; with Ocarina.Expander; with Gaia.Processor; with Gaia.Messages; package body Gaia.Mgmt is -------------- -- Generate -- -------------- function Generate (Root : Types.Node_Id; Options : Gaia_Options) return Boolean is use Types; use Namet; use Gaia.Translator; use Gaia.Generator; use Ocarina.Expander; use Gaia.Processor; use Gaia.Messages; Instance_Root, Neutral_Root : Node_Id := No_Node; Success : Boolean := True; The_Translator : Translator_Facility_Access; The_Generator : Generator_Facility_Access; pragma Assert (Root /= No_Node); begin -- Build the instance tree Instance_Root := Expand_Model (Root); if Instance_Root = No_Node then Display_Error ("The AADL model cannot be expanded.", Fatal => True); Success := False; end if; -- Process the AADL tree and generate a neutral tree that -- represents the distributed application if Success then Process_Architecture_Instance (Instance_Root, Neutral_Root, Get_Name_String (Options.Output_Directory), Success); if not Success then Display_Error ("The AADL model cannot be processed", Fatal => True); end if; end if; if Success then -- If the user requeste to dump the Gaia tree, then dump it -- and then exit. if Options.Dump_Gaia_Tree then Dump (Neutral_Root); else -- Generate API independant code The_Translator := Select_Translator (Get_Name_String (Options.Translator_Name)); The_Translator.all (Neutral_Root, Options, Success); if not Success then Display_Error ("Problems when generating API independant code", Fatal => True); end if; -- Generate API dependant code The_Generator := Select_Generator (Get_Name_String (Options.Generator_Name)); The_Generator.all (Neutral_Root, Options, Success); if not Success then Display_Error ("Problems when generating API dependant code", Fatal => True); end if; end if; end if; return Success; end Generate; ---------- -- Init -- ---------- procedure Init is begin Default_Gaia_Options := (Gaia.Utils.Get_String_Name ("."), Gaia.Utils.Get_String_Name ("ps"), Gaia.Utils.Get_String_Name ("ps"), False); end Init; end Gaia.Mgmt;