------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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: 548 $ -- $Date: 2012-10-12 01:48:51 +0200 (Fri, 12 Oct 2012) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Numerics.Aux; use Ada.Numerics.Aux; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; with convert_unbounded_strings; with primitive_xml_strings; use primitive_xml_strings; with tables; with lists; with Unchecked_Deallocation; package unbounded_strings is -- Some standard strings constants -- unbounded_sp : constant Unbounded_String := To_Unbounded_String (" "); unbounded_lf : constant Unbounded_String := To_Unbounded_String ("" & ASCII.LF); function unbounded_ht (number : in Natural := 1) return Unbounded_String; pragma Inline (unbounded_ht); empty_string : constant Unbounded_String := To_Unbounded_String (""); -- Some standard strings sub-program -- -- Look for spaces into a string -- function has_space (s : in Unbounded_String) return Boolean; function has_space (s : in String) return Boolean; -- Remove spaces of an unbounded_string -- function suppress_space (s : in Unbounded_String) return Unbounded_String; function suppress_space (s : in String) return Unbounded_String; -- Convert an unbounded_string to ... another unbounded_string -- function convert (a : in unbounded_string) return unbounded_string; ---------------------------------------------- -- String tables ---------------------------------------------- -- Maximum number of strings composing a table of strings -- max_strings : constant Natural := 100; procedure initialize (st : out Unbounded_String); package strings_table_package is new tables ( Unbounded_String, Max_Strings, Put, xml_string, xml_ref_string); use Strings_Table_Package; subtype strings_range is strings_table_package.table_range; subtype strings_table is strings_table_package.table; ------------------------------------------------------ -- Convert unbounded_strings to standard numeric types ------------------------------------------------------ procedure to_natural is new convert_unbounded_strings (Natural, 0); procedure to_integer is new convert_unbounded_strings (Integer, 0); procedure to_boolean is new convert_unbounded_strings (Boolean, True); procedure to_double (from : in Unbounded_String; to : out Double; ok : out Boolean); function to_upper (s : Unbounded_String) return Unbounded_String; function to_lower (s : Unbounded_String) return Unbounded_String; function to_upper (s : String) return Unbounded_String; function to_lower (s : String) return Unbounded_String; -------------------------------------------------------------------- -- Pointers to unbounded_string and sub programms to manipulate it -------------------------------------------------------------------- type unbounded_string_ptr is access Unbounded_String; procedure free is new Unchecked_Deallocation ( Unbounded_String, unbounded_string_ptr); procedure put (s : unbounded_string_ptr); function xml_string (s : in unbounded_string_ptr; level : in Natural := 0) return Unbounded_String; ------------------------------------------------------ -- List of unbounded_string ------------------------------------------------------ package unbounded_string_list_package is new lists ( unbounded_string_ptr, put, free, xml_string); use unbounded_string_list_package; subtype unbounded_string_list is unbounded_string_list_package.list; subtype unbounded_string_iterator is unbounded_string_list_package.iterator; function element_in_list (e : in Unbounded_String; l : in unbounded_string_list) return Boolean; end unbounded_strings;