------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, Université de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program 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 -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with unbounded_strings; use unbounded_strings; with Ada.Exceptions; use Ada.Exceptions; with Objects; use Objects; with Objects.extended; use Objects.extended; with Translate; use Translate; with initialize_framework; use initialize_framework; package body section_Set is procedure Add_section (My_sections : in out sections_Set; Name : in Unbounded_String; section_Type : in Sections_Type) is Dummy : Generic_Section_Ptr; begin Add_section (My_sections, Dummy, Name, section_Type); end Add_section; procedure Check_section (My_sections : in sections_Set; Name : in Unbounded_String; section_Type : in Sections_Type) is begin if Name = "" then Raise_Exception (Invalid_Parameter'Identity, To_String (Lb_section_Name (Current_Language) & Lb_Mandatory (Current_Language))); end if; if not Is_A_Valid_Identifier (Name) then Raise_Exception (Invalid_Parameter'Identity, To_String (Lb_section (Current_Language) & " " & Name & " : " & Lb_section_Name (Current_Language) & Lb_Colon & Lb_Invalid_Identifier (Current_Language))); end if; end Check_section; procedure Add_section (My_sections : in out sections_Set; A_section : in out Generic_Section_Ptr; Name : in Unbounded_String; section_Type : in Sections_Type) is My_Iterator : iterator; New_synchronization_section : Synchronization_Section_Ptr; New_computation_section : Computation_Section_Ptr; begin check_initialize; Check_section (My_sections, Name, section_Type); if (get_number_of_elements (My_sections) > 0) then reset_iterator (My_sections, My_Iterator); loop current_element (My_sections, A_section, My_Iterator); if (Name = A_section.name) then Raise_Exception (Invalid_Parameter'Identity, To_String (Lb_section (Current_Language) & " " & Name & " : " & Lb_section_Name (Current_Language) & Lb_Already_Defined (Current_Language))); end if; exit when is_last_element (My_sections, My_Iterator); next_element (My_sections, My_Iterator); end loop; end if; case section_Type is when Automaton_Type => New_synchronization_section := new Synchronization_Section; A_section := Generic_Section_Ptr (New_synchronization_section); when others => New_computation_section := new Computation_Section; A_section := Generic_Section_Ptr (New_computation_section); end case; A_section.name := Name; A_section.section_type := section_Type; add (My_sections, A_section); exception when full_set => Raise_Exception (Invalid_Parameter'Identity, To_String (Lb_Can_Not_Define_More_sections (Current_Language))); end Add_section; function Search_section (My_sections : in sections_Set; type_name : in Sections_Type) return Generic_Section_Ptr is My_Iterator : iterator; A_section : Generic_Section_Ptr; Result : Generic_Section_Ptr; Found : Boolean := False; begin reset_iterator (My_sections, My_Iterator); loop current_element (My_sections, A_section, My_Iterator); if (A_section.section_type = type_name) then Found := True; Result := A_section; end if; exit when is_last_element (My_sections, My_Iterator); next_element (My_sections, My_Iterator); end loop; if not Found then Raise_Exception (section_Not_Found'Identity, To_String (Lb_section (Current_Language) & "=" & type_name'Img)); end if; return Result; end Search_section; function Search_section (My_sections : in sections_Set; Name : in Unbounded_String) return Generic_Section_Ptr is My_Iterator : iterator; A_section : Generic_Section_Ptr; Result : Generic_Section_Ptr; Found : Boolean := False; begin reset_iterator (My_sections, My_Iterator); loop current_element (My_sections, A_section, My_Iterator); if (A_section.name = Name) then Found := True; Result := A_section; end if; exit when is_last_element (My_sections, My_Iterator); next_element (My_sections, My_Iterator); end loop; if not Found then Raise_Exception (section_Not_Found'Identity, To_String (Lb_section_Name (Current_Language) & "=" & Name)); end if; return Result; end Search_section; function Export_Aadl_Implementations (My_sections : in sections_Set) return Unbounded_String is begin return empty_string; end Export_Aadl_Implementations; function Export_Aadl_Declarations (My_sections : in sections_Set; Number_Of_Ht : in Natural) return Unbounded_String is begin return empty_string; end Export_Aadl_Declarations; end section_Set;