---------------------------------- ---------------------------------------------- -- -- -- 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;