------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2016, Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285 laboratory, 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: 1249 $ -- $Date: 2014-08-28 07:02:15 +0200 (Fri, 28 Aug 2014) $ -- $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) 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; function substring ( Str : in Unbounded_String; From : in Natural; To : in Natural) return Unbounded_String; end unbounded_strings;