----------------------------------------------- --------------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . E X P A N D E R . Q U E R I E S -- -- -- -- B o d y -- -- -- -- Copyright (C) 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 Namet; with Ocarina.Nodes; with Ocarina.Entities; with Ocarina.Entities.Properties; package body Ocarina.Expander.Queries is use Namet; use Ocarina.Nodes; use Ocarina.Entities; use Ocarina.Entities.Properties; ------------------------------------- -- Compute_Absolute_Name_Of_Entity -- ------------------------------------- function Compute_Absolute_Name_Of_Entity (Entity : node_id; Separator : name_id := No_Name) return name_id is pragma assert (Present (Entity)); Parent_Name : name_id; Entity_Name : name_id; Actual_Separator : name_id := Separator; begin if Actual_Separator = No_Name then Set_Str_To_Name_Buffer ("."); Actual_Separator := Name_Find; end if; case Kind (Entity) is when k_component_instance => if Parent_Subcomponent (Entity) = No_Node then -- If we are processing the top level system Entity_Name := No_Name; else Entity_Name := Compute_Absolute_Name_Of_Entity (Parent_Subcomponent (Entity), Actual_Separator); end if; when k_subcomponent_instance | k_feature_instance | k_port_spec_instance | k_subprogram_spec_instance | k_parameter_instance | k_subcomponent_access_instance | k_connection_instance | k_call_sequence_instance => Parent_Name := Compute_Absolute_Name_Of_Entity (Parent_Component (Entity), Actual_Separator); if Parent_Name /= No_Name then Get_Name_String (Parent_Name); Get_Name_String_And_Append (Actual_Separator); Get_Name_String_And_Append (Get_Name_Of_Entity (Entity)); else Get_Name_String (Get_Name_Of_Entity (Entity)); end if; Entity_Name := Name_Find; when others => Entity_Name := No_Name; end case; return Entity_Name; end Compute_Absolute_Name_Of_Entity; ------------------------- -- Is_Defined_Property -- ------------------------- function Is_Defined_Property (Entity : node_id; Name : String) return Boolean is begin return (Find_Property_Association_From_Name (Property_List => Ocarina.Nodes.Properties (Entity), Property_Name => Name) /= No_Node); end Is_Defined_Property; end Ocarina.Expander.Queries;