------------------------------------------ -------------------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- G A I A . P R O C E S S O R . E N T I T I E S . N A M E S P A C E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005-2006, 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.Nodes; with Ocarina.Entities; with Ocarina.Entities.Components; with Gaia.Processor.Nodes; with Gaia.Processor.Nodes.Utils; with Gaia.Processor.Entities.Components; with Gaia.Processor.Messages; package body Gaia.Processor.Entities.Namespaces is package ON renames Ocarina.Nodes; package GN renames Gaia.Processor.Nodes; package GNU renames Gaia.Processor.Nodes.Utils; ----------------------- -- Process_Namespace -- ----------------------- function Process_Namespace (Namespace_Instance, Ada_Root_Node : in Node_Id) return Node_Id is use Ocarina.Entities; use Ocarina.Entities.Components; use Gaia.Processor.Entities.Components; use Gaia.Processor.Messages; use ON; use GN; use GNU; pragma Assert (Namespace_Instance /= No_Node and then ON.Kind (Namespace_Instance) = ON.K_Namespace_Instance); List_Node : Node_Id; The_Component : Node_Id; Namespace : constant Node_Id := GNU.New_Node (GN.K_Namespace); Success : Boolean := True; Identifier : Node_Id; begin Identifier := GNU.Make_Identifier (Get_Name_Of_Entity (Namespace_Instance)); Bind_Identifier_To_Entity (Identifier, Namespace); GN.Set_Scoped_Name (Namespace, Map_Namespace_Scoped_Name (Namespace, Namespace_Instance)); GN.Set_Public_Declarations (Namespace, New_List (K_Declaration_List)); GN.Set_Private_Declarations (Namespace, New_List (K_Declaration_List)); GNU.Append_Node_To_List (Namespace, GN.Namespaces (Ada_Root_Node)); if ON.Declarations (Namespace_Instance) /= No_List then List_Node := ON.First_Node (ON.Declarations (Namespace_Instance)); while Present (List_Node) loop The_Component := Item (List_Node); if ON.Kind (The_Component) = ON.K_Component_Instance then case Ocarina.Entities.Components.Get_Category_Of_Component (Corresponding_Declaration (The_Component)) is when CC_Data => Success := Process_Data (The_Component, Namespace) and then Success; when CC_Subprogram => Success := Process_Subprogram (The_Component, Namespace) and then Success; when CC_Thread => Success := Process_Thread (The_Component, Namespace) and then Success; when CC_Process => Success := Process_Process (The_Component, Namespace) and then Success; when others => Display_Wrong_Component_Category (The_Component); Success := False; end case; else Display_Wrong_Entity_Kind (The_Component, K_Component_Instance); Success := False; end if; List_Node := ON.Next_Node (List_Node); end loop; end if; if Success then return Namespace; else return No_Node; end if; end Process_Namespace; end Gaia.Processor.Entities.Namespaces;