------------------------------------------------------------ -------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . G E N E R A T O R S -- -- -- -- S p e c -- -- -- -- 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) -- -- -- ------------------------------------------------------------------------------ -- This package is the root of all the source code generators of -- Ocarina. It provides routines to register and select a code -- generators. All the code generators should be implemented as child -- packages of Ocarina.Generators. All the calls to these generators -- have to be done through the procedure Generate exported by this -- package. After selecting the wanted code generator. with Types; use Types; package Ocarina.Generators is type Generator_Options is record Clean : Boolean; -- If True, the generator is used as a cleaner and will delete -- all generated files. Build : Boolean; -- If True, compile the generated application Output_Directory : Name_Id; -- All the source code will be generated in the given -- 'Output_Directory' if it is different from -- No_Name. Otherwise, the source code will be generated in the -- current directory. Working_Directory : Name_Id; end record; -- This structure allows the user to customize the parameters of -- the code generators. Default_Options : Generator_Options; -- The default generator options Working_Directory : Name_Id; -- The working directory. It may be different from the *actual* -- working directory if the user wants it. type Generator_Access is access procedure (Instance_Root : Node_Id; Options : Generator_Options := Default_Options); -- Each implemented code generator have to make visible a -- subprogram having this signature. This subprogram will serve as -- an entry point to all the generator routines. 'Instance_Root' -- is the root of the AADL instance tree from which the user wants -- to generate the code. 'Options' designate the option given by -- the user. type Generator_Kind is ( Invalid_Generator, PolyORB_QoS_Ada, PolyORB_HI_Ada, PolyORB_HI_C); -- Supported code generators. For each kind, at most one generator -- must be implemented. function Current_Generator_Kind return Generator_Kind; -- Return the latest selected generator kind or -- 'Invalid_Generator' if no generator has been selected yet. procedure Register_Generator (The_Generator_Access : Generator_Access; The_Generator_Kind : Generator_Kind; The_Generator_Name : String); -- Register a new code generator. Raise Program_Error if the given -- signature is null or if the the generator name is the empty -- string or if a generator of the same kind has already been -- registered. procedure Select_Generator (The_Generator_Name : String); -- Search whether it exists a generator having the name -- 'The_Generator_Name' and set it as the current generator. Raise -- Program_Error if the generator is not found. procedure Select_Generator (The_Generator_Kind : Generator_Kind); -- Same as above but using the generator kind. Raise Program_Error -- if no generator having the given kind has been registered. procedure Generate_Code (Distributed_Application_Root : Node_Id; Options : Generator_Options := Default_Options); -- Calls the current generator entry point. Raise Program_Error if -- no generator has been selected yet. procedure Init; -- Initialize the Generators module by registering the several -- implemented code generators. procedure Reset; -- Resets the Generators module by resetting the node entries of -- the several trees. procedure Write_Generators (Indent : Natural); -- Displays the list of registered generators each one on a new -- line indented by 'Indent'. end Ocarina.Generators;