------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, 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 README.md -- -- 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 Ada.Strings.Maps.Constants; with Text_IO; use Text_IO; package body unbounded_strings is function unbounded_ht (number : in Natural := 1) return Unbounded_String is result : Unbounded_String := empty_string; begin for i in 1 .. number loop result := result & unbounded_lf; end loop; return result; end unbounded_ht; function xml_string (s : in unbounded_string_ptr) return Unbounded_String is begin return xml_string (s.all); end xml_string; function to_upper (s : String) return Unbounded_String is begin return to_upper (To_Unbounded_String (s)); end to_upper; function to_lower (s : String) return Unbounded_String is begin return to_lower (To_Unbounded_String (s)); end to_lower; function to_upper (s : Unbounded_String) return Unbounded_String is begin return Translate (s, Ada.Strings.Maps.Constants.Upper_Case_Map); end to_upper; function to_lower (s : Unbounded_String) return Unbounded_String is begin return Translate (s, Ada.Strings.Maps.Constants.Lower_Case_Map); end to_lower; procedure to_double (from : in Unbounded_String; to : out Double; ok : out Boolean) is begin to := Double'value (To_String (from)); ok := True; exception when Constraint_Error => to := 0.0; ok := False; end to_double; procedure initialize (st : out Unbounded_String) is begin st := empty_string; end initialize; procedure put (s : unbounded_string_ptr) is begin Put (To_String (s.all)); end put; function suppress_space (s : in String) return Unbounded_String is result : Unbounded_String; begin for i in 1 .. s'length loop if s (i) /= ' ' then Append (result, s (i)); end if; end loop; return result; end suppress_space; function suppress_space (s : in Unbounded_String) return Unbounded_String is begin return suppress_space (To_String (s)); end suppress_space; function has_space (s : in String) return Boolean is begin for i in 1 .. s'length loop if s (i) /= ' ' then return True; end if; end loop; return False; end has_space; function has_space (s : in Unbounded_String) return Boolean is begin return has_space (To_String (s)); end has_space; function element_in_list (e : in Unbounded_String; l : in unbounded_string_list) return Boolean is current : unbounded_string_ptr; is_found : Boolean := False; local_iterator : unbounded_string_iterator; begin reset_head_iterator (l, local_iterator); current_element (l, current, local_iterator); while not is_tail_element (l, local_iterator) loop if current.all = e then is_found := True; exit; end if; next_element (l, local_iterator); end loop; if current.all = e then is_found := True; end if; return is_found; end element_in_list; function convert (a : in Unbounded_String) return Unbounded_String is begin return a; end convert; function substring (Str : in Unbounded_String; From : in Natural; To : in Natural) return Unbounded_String is begin return To_Unbounded_String (To_String (Str) (From .. To)); end substring; end unbounded_strings;