------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 Text_IO; use Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; use unbounded_strings.unbounded_string_list_package; with Parameters; use Parameters; with Parameters.extended; use Parameters.extended; use Parameters.Framework_Parameters_Table_Package; with Task_Set; use Task_Set; use Task_Set.Generic_Task_Set; with Systems; use Systems; with Call_Framework; use Call_Framework; with Call_Framework_Interface; use Call_Framework_Interface; use Call_Framework_Interface.Framework_Response_Package; use Call_Framework_Interface.Framework_Request_Package; with Call_Scheduling_Framework; use Call_Scheduling_Framework; with GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; with Version; use Version; with Ada.Exceptions; use Ada.Exceptions; with architecture_models; use architecture_models; with architecture_factory; use architecture_factory; procedure Select_Feasibility_Test_Simple_From_Xml is -- A set of variables required to call the framework -- Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; Sys : System; Project_File_List : unbounded_string_list; Project_File_Dir_List : unbounded_string_list; Into : File_Type; -- Is the command should run in verbose mode ? -- Verbose : Boolean := False; -- The XML file to read -- Input_File : Boolean := False; Input_File_Name : Unbounded_String; -- The XML file to write --compliant_time_triggered_communication ( Output_File : Boolean := False; Output_File_Name : Unbounded_String; -- The defined architecture to analyze -- succeed : Boolean := False; Defined_Architecture : Boolean := False; Defined_Architecture_Name : Natural; procedure Usage is begin Put_Line( "select_feasibility_tests_from_xml is a program which select feasibility tests from an XML Cheddar project file and save the result into a second XML 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 : select_feasibility_tests_from_xml"); Put_Line (" switch can be :"); Put_Line (" -u get this help"); Put_Line (" -v verbose mode "); Put_Line( " -o file-name, write the scheduling into the file file-name "); Put_Line( " -i file-name, read the system to analyze from the XML file file-name " ); Put_Line( " -a architecture-name, analyze dor demonstration from pre-defined example architecture-name " ); Put_Line (" architecture-name can be:"); Put_Line( " (1) compliant_ttc, (2)uncompliant_ttc, (3)compliant_rav, (4)uncompliant_rav, (5)compliant_unpl, (6)uncompliant_unpl, (7)uncompliant_env, (8)uncompliant_buff " ); New_Line; end Usage; begin Copyright ("select_feasibility_tests_from_xml"); -- Get arguments -- loop case GNAT.Command_Line.Getopt ("u v i: o: a:") is when ASCII.NUL => exit; when 'i' => Input_File := True; Input_File_Name := To_Unbounded_String (GNAT.Command_Line.Parameter); when 'o' => Output_File := True; Output_File_Name := To_Unbounded_String (GNAT.Command_Line.Parameter); when 'v' => Verbose := True; when 'u' => Usage; OS_Exit (0); when 'a' => Defined_Architecture := True; to_natural (To_Unbounded_String (GNAT.Command_Line.Parameter), Defined_Architecture_Name, succeed); when others => Usage; OS_Exit (0); end case; end loop; -- Is an input file and an output file given ??? -- if ((not Input_File) and (not Defined_Architecture)) or (not Output_File) or (Defined_Architecture and Input_File) then Usage; OS_Exit (0); end if; -- Initialize the Cheddar framework -- Call_Framework.initialize (False); -- Read the XML project file -- initialize (Project_File_List); if Input_File then Systems.Read_From_Xml_File (Sys, Project_File_Dir_List, Input_File_Name); else if Defined_Architecture then Put ("valeur de defined architecture : "); Put (Integer'Image (Defined_Architecture_Name)); case Defined_Architecture_Name is when 1 => compliant_time_triggered_communication (Sys); when 2 => uncompliant_time_triggered_communication (Sys); when 3 => compliant_ravenscar (Sys); when 4 => uncompliant_ravenscar (Sys); when 5 => compliant_unplugged (Sys); when 6 => uncompliant_unplugged (Sys); when 7 => model1 (Sys); when 8 => uncompliant_buffer (Sys); when others => Usage; OS_Exit (0); end case; end if; end if; -- Select the feasibility tests for the system given in argument -- Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); A_Request.statement := Select_Feasibility_Tests_Simple; Add (Request_List, A_Request); Sequential_Framework_Request (Sys, Request_List, Response_List); if Verbose then Put (To_String (XML_String (Sys))); Put_Line (To_String (Response_List.Entries (0).title)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (To_String (Response_List.Entries (J).text)); end loop; end if; -- Export results into the txt file -- Create (Into, Mode => Out_File, Name => To_String (Output_File_Name)); New_Line (Into); Put (Into, To_String (XML_String (Sys))); Put_Line (Into, To_String (Response_List.Entries (0).title)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (Into, To_String (Response_List.Entries (J).text)); end loop; Close (Into); end Select_Feasibility_Test_Simple_From_Xml;