---------------------------------------------------------- ---------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- O C A R I N A . P N -- -- -- -- 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 Output; with Ocarina.AADL_Values; with Ocarina.Expander; with Ocarina.Nodes; with Ocarina.Entities; with Ocarina.PN.Components; with Ocarina.PN.Root; with Ocarina.PN.Printer; with Ocarina.PN.Nodes; package body Ocarina.PN is ---------------------- -- Create_Petri_Net -- ---------------------- function Create_Petri_Net (Root : Types.Node_Id; Options : PN_Options := Default_PN_Options) return Boolean is use Types; use Output; use Namet; use Ocarina.Nodes; use Ocarina.Entities; use Ocarina.Expander; use Ocarina.PN.Components; use Ocarina.PN.Root; use Ocarina.PN.Printer; pragma Assert (Root /= No_Node and then Kind (Root) = K_AADL_Specification); PN_Root, Instance_Root : Node_Id; begin Instance_Root := Expand_Model (Root); if Instance_Root /= No_Node and then not Create_Virtual_Connections (Instance_Root, Root_System (Instance_Root)) then Instance_Root := No_Node; end if; if Instance_Root /= No_Node then PN_Root := Process_Architecture_Instance (Instance_Root, Options); else PN_Root := No_Node; end if; if PN_Root /= No_Node then Create_PN_Declarations (PN_Root); end if; if PN_Root /= No_Node then Print_Root_Node (PN_Root, Options); Write_Str ("AADL files correctly processed in "); if Get_Name_String (Options.Output_Directory) /= "." then Write_Line (Get_Name_String (Options.Output_Directory)); else Write_Line (Get_Name_Of_Entity (Root_System (Instance_Root))); end if; else Write_Line ("ERROR while processing AADL files"); end if; return (PN_Root /= No_Node); end Create_Petri_Net; ---------- -- Init -- ---------- procedure Init is use Namet; use Ocarina.AADL_Values; begin Set_Str_To_Name_Buffer ("."); Default_PN_Options := (Output_Directory => Name_Find); Set_Str_To_Name_Buffer ("_"); Separator := Name_Find; Set_Str_To_Name_Buffer ("dispatch_protocol"); Dispatch_Property := Name_Find; Set_Str_To_Name_Buffer ("background"); Background_Dispatch := Name_Find; Set_Str_To_Name_Buffer ("<>"); Guard_Unequality := New_String_Value (Name_Find); Set_Str_To_Name_Buffer ("="); Guard_Equality := New_String_Value (Name_Find); Set_Str_To_Name_Buffer ("u"); Undefined_Value_Variable := Name_Find; end Init; ----------- -- Reset -- ----------- procedure Reset is begin Ocarina.PN.Nodes.Entries.Init; end Reset; end Ocarina.PN;