------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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: 395 $ -- $Date: 2011-04-11 20:43:38 +0200 (lun., 11 avr. 2011) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; with unbounded_strings; use unbounded_strings; with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; with Text_IO; use Text_IO; with Version; use Version; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Systems; use Systems; with Task_Set; use Task_Set; with Processor_Set; use Processor_Set; with Address_Space_Set; use Address_Space_Set; with Resource_Set; use Resource_Set; with Buffer_Set; use Buffer_Set; with Call_Framework; use Call_Framework; with Project; use Project; with Xml_Generic_Parsers; use Xml_Generic_Parsers; with Xml_Generic_Parsers.Architecture; use Xml_Generic_Parsers.Architecture; with Xml_Generic_Parsers.event_table; use Xml_Generic_Parsers.event_table; procedure v2tov3eventtable is Sys : System; File_Name : Unbounded_String; -- Is the command should run in verbose mode ? -- Verbose : Boolean := False; procedure Usage is begin Put_Line( "old_eventtable2new_eventtable allows you to convert Cheddar 2.1 event table file to Cheddar 2.2 event table file." ); New_Line; Put_Line( "Check Cheddar home page for details : http://beru.univ-brest.fr/~singhoff/cheddar " ); New_Line; New_Line; Put_Line ("Usage : old_eventtable2new_eventtable xml-event-table-file-name"); Put_Line (" switch can be :"); Put_Line (" -u get this help"); Put_Line (" -v verbose mode "); New_Line; New_Line; end Usage; begin Copyright ("old_eventtable2new_eventtable"); -- Get arguments -- loop case Getopt ("u v") is when ASCII.NUL => exit; when 'v' => Verbose := True; when 'u' => Usage; OS_Exit (0); when others => Usage; OS_Exit (0); end case; end loop; loop declare S : constant String := Get_Argument (Do_Expansion => True); begin exit when S'Length = 0; File_Name := File_Name & S; end; end loop; Call_Framework.initialize (False); if (File_Name = empty_string) then Usage; OS_Exit (0); else Initialize (Sys); Read_From_Xml_File (Sys, Project_File_Dir_List, File_Name); Put_Line (To_String (XML_String (Sys, 0))); end if; exception when GNAT.Command_Line.Invalid_Switch => begin Put_Line ("old_eventtable2new_eventtable.adb : invalid Switch " & Full_Switch); Usage; end; when GNAT.Command_Line.Invalid_Parameter => Put_Line ("old_eventtable2new_eventtable.adb : missing parameter for switch " & Full_Switch); when Xml_Read_Error => Put_Line ( "v2tov3eventable.adb : Can not read project file ; Xml Fatal Error ; " & Exception_Message); when Task_Set.Invalid_Parameter => Put_Line ("v2tov3eventable.adb : invalid task argument ; " & Exception_Message); when Address_Space_Set.Invalid_Parameter => Put_Line ( "v2tov3eventable.adb : invalid addresss space argument ; " & Exception_Message); when Processor_Set.Invalid_Parameter => Put_Line ("v2tov3eventable.adb : invalid processor argument ; " & Exception_Message); when Buffer_Set.Invalid_Parameter => Put_Line ("v2tov3eventable.adb : invalid buffer argument ; " & Exception_Message); when Resource_Set.Invalid_Parameter => Put_Line ("v2tov3eventable.adb : invalid resource argument ; " & Exception_Message); when Ada.IO_Exceptions.Name_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Name_Error"); when Ada.IO_Exceptions.Status_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Status_Error") ; when Ada.IO_Exceptions.Mode_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Mode_Error"); when Ada.IO_Exceptions.Use_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Use_Error"); when Ada.IO_Exceptions.Device_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Device_Error") ; when Ada.IO_Exceptions.End_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, End_Error"); when Ada.IO_Exceptions.Data_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Data_Error"); when Ada.IO_Exceptions.Layout_Error => Put_Line( "v2tov3eventable.adb : Can not open project files, Layout_Error") ; when others => Put_Line ("This is an internal bug ... sorry"); Put_Line ("Exception name : " & Exception_Name); Put_Line ("Exception message : " & Exception_Message); Put_Line ("Please, send a bug report to cheddar@listes.univ-brest.fr"); Put_Line( "Do not forget to join the XML Cheddar project files with your bug report"); end v2tov3eventtable;