------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real time scheduling analysis tool. -- This program provides services to automatically check performances -- of real time architectures. -- -- Copyright (C) 2002-2010, by Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- the LISyC Team, University of Western Britanny. -- -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- 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: 554 $ -- $Date: 2012-10-12 19:47:56 +0200 (Fri, 12 Oct 2012) $ -- $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; level : in Natural := 0) 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; end unbounded_strings;