---------------------------------- ---------------------------------------------- -- -- -- OCARINA COMPONENTS -- -- -- -- OCARINA.AADL.PRINTER.COMPONENTS.FLOWS -- -- -- -- B o d y -- -- -- -- 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 Output; with Ocarina.Nodes; with Ocarina.Nutils; with Ocarina.AADL.Printer.Components.Modes; with Ocarina.AADL.Printer.Properties; with Ocarina.AADL.Printer.Identifiers; with Ocarina.Entities.Components.Flows; package body Ocarina.AADL.Printer.Components.Flows is use Output; use Ocarina.Nodes; use Ocarina.Nutils; use Ocarina.AADL.Printer.Components.Modes; use Ocarina.AADL.Printer.Properties; use Ocarina.AADL.Printer.Identifiers; use Ocarina.Entities.Components.Flows; procedure Print_Flow_Category (Category : Byte); ------------------------- -- Print_Flow_Category -- ------------------------- procedure Print_Flow_Category (Category : Byte) is begin case Flow_Category'Val (Category) is when FC_Source => Print_Token (T_Source); when FC_Sink => Print_Token (T_Sink); when FC_Path => Print_Token (T_Path); end case; end Print_Flow_Category; ------------------------------- -- Print_Flow_Implementation -- ------------------------------- procedure Print_Flow_Implementation (Node : Node_Id; Options : Output_Options) is Flow_Modes : constant Node_Id := In_Modes (Node); Flow_Kind : constant Node_Kind := Kind (Node); Is_End_To_End : Boolean; Is_Refinement : Boolean; Cat : Byte; List_Node : Node_Id; begin if Flow_Kind = K_Flow_Implementation_Refinement or else Flow_Kind = K_End_To_End_Flow_Refinement then Is_Refinement := True; else Is_Refinement := False; end if; if Flow_Kind = K_End_To_End_Flow_Spec or else Flow_Kind = K_End_To_End_Flow_Refinement then Is_End_To_End := True; else Is_End_To_End := False; Cat := Category (Node); end if; Write_Indentation; Print_Identifier (Identifier (Node)); Write_Space; Print_Token (T_Colon); Write_Space; if Is_Refinement then Print_Tokens ((T_Refined, T_To)); Write_Space; end if; if Is_End_To_End then Print_Tokens ((T_End, T_To, T_End, T_Flow)); else Print_Token (T_Flow); Write_Space; Print_Flow_Category (Cat); end if; if not Is_Refinement then Write_Space; if not Is_Empty (Connections (Node)) then List_Node := First_Node (Connections (Node)); while Present (List_Node) loop if List_Node /= First_Node (Connections (Node)) then Write_Space; Print_Token (T_Connection); Write_Space; end if; Print_Entity_Reference (List_Node); List_Node := Next_Node (List_Node); end loop; end if; Write_Eol; end if; Print_Contained_Property_Associations (Ocarina.Nodes.Properties (Node), Options); Print_In_Modes (Flow_Modes, Options); Print_Token (T_Semicolon); Write_Eol; end Print_Flow_Implementation; --------------------- -- Print_Flow_Spec -- --------------------- procedure Print_Flow_Spec (Node : Node_Id; Options : Output_Options) is Cat : constant Byte := Category (Node); begin Write_Indentation; Print_Item_Refined_To (Node); Write_Space; Print_Token (T_Flow); Write_Space; Print_Flow_Category (Cat); Write_Space; if not Is_Refinement (Node) then case Flow_Category'Val (Cat) is when FC_Source => Print_Entity_Reference (Source_Flow (Node)); when FC_Sink => Print_Entity_Reference (Sink_Flow (Node)); when FC_Path => Print_Entity_Reference (Source_Flow (Node)); Write_Space; Print_Token (T_Connection); Write_Space; Print_Entity_Reference (Sink_Flow (Node)); end case; end if; Print_Contained_Property_Associations (Ocarina.Nodes.Properties (Node), Options); Print_Token (T_Semicolon); Write_Eol; end Print_Flow_Spec; end Ocarina.AADL.Printer.Components.Flows;