-------------------------------------------------------- ------------------------ -- -- -- OCARINA COMPONENTS -- -- -- -- G A I A . P R O C E S S O R -- -- -- -- S p e c -- -- -- -- Copyright (C) 2005-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 Types; use Types; with GNAT.OS_Lib; package Gaia.Processor is procedure Init; -- Initialize the modules of the Gaia Processor procedure Reset; -- Resets te Gaia nodes procedure Process_Architecture_Instance (Architecture_Instance : Node_Id; Neutral_Tree_Root : out Node_Id; Output_Directory : String := "."; Success : out Boolean); -- Process the AADL tree and build a neutral tree that represents -- the distributed application architecture in a language -- independant way. function Normalize_Name (Name : Name_Id) return Name_Id; -- Rewrite Name so that it only contains characters that are legal -- in most languages: a-z, 0-9, _ function Get_DA_Protocol_Name (System_Instance : Node_Id) return Name_Id; -- Retrieves the string that indicate the protocol we will be using. function Get_Process_Location (Process_Instance : Node_Id) return Name_Id; -- Retrieves the string that indicates the location of the -- processor which Process_Instance is bound to. function Get_Process_Port_Number (Process_Instance : Node_Id) return Value_Id; procedure Dump (Gaia_Tree_Root : Node_Id); -- Dump the Gaia tree for debugging purpose. private Interface_Output_Desc, Body_Output_Desc : GNAT.OS_Lib.File_Descriptor; procedure Write_Unique_Instance_Name (Instance : Node_Id); -- Write a unique name for Instance, by concatenating its display -- name and node number. Thus the instance is perfectly identified -- by the Gaia parser. procedure Write_Instance_Name (Instance : Node_Id); -- Write the name of the instance. -- This part contains routines specifica to handle the missing -- jobs due to the order of entities in the Ocarina instance tree. -- A link in the Gaia tree is typically a call of one of these forma -- GN.Set_ (G_Node, GN.Scoped_Name (ON.Annotation (O_Node))); -- GN.Set_ (G_Node, ON.Annotation (O_Node)); -- If the Ocarina node O_Node has not been processed by the Gaia -- processor yet. Its annotation is then set to No_Node and the -- link cannot be performed. -- The purpose of the entities declared below is to register all -- the "missed links" to perform them after the processing of all -- the Ocarina instance tree. -- NB: It's imporatnat to note that this works because there is no -- node creation when setting a link. type Set_Procedure_Access is access procedure (N : Node_Id; V : Node_Id); procedure Try_Perform_Link (Set_Procedure : Set_Procedure_Access; G_Node : Node_Id; A_Node : Node_Id; Is_Scoped_Name : Boolean); -- Try to perform a link between the Gaia node G_Node and the -- Annotation of the AADL node A_Node using the Set_Procedure Gaia -- tree procedure. If Is_Scoped_Name is True, perform the link -- with the scoped name of the A_Node annotation If the link could -- not be performed, postpones its creation to the end of the Gaia -- tree processing. procedure Try_Perform_Link_From_Scratch (Set_Procedure : Set_Procedure_Access; A_Node_1 : Node_Id; A_Node_2 : Node_Id); -- Try to perform a link between the annotation of the AADL node -- A_Node_1 and the annotation of the AADL node A_Node_2 using the -- Set_ocedure Gaia tree procedure. If the link could not be -- performed, postpones its creation to the end of the Gaia tree -- processing. procedure Add_All_Missed_Links; -- Run all the previously registered missed links. Generally, the -- Add_All_Missed_Links missed links is called after processing -- the Ocarina instance tree with the Gaia processor. After all -- the links are performed, all the data structure allocated to -- store the missed links are deallocated. end Gaia.Processor;