------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, 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 README.md -- -- 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$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; 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.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; with call_framework; use call_framework; with Ocarina.Configuration; with Ocarina.AADL.Parser; with Ocarina.AADL.Printer; with Ocarina.Analyzer; use Ocarina.Analyzer; with Ocarina.AADL; use Ocarina.AADL; with Types; use Types; with Ocarina.Entities; use Ocarina.Entities; with Ocarina.Parser; procedure aadl2aadl is file_name : Unbounded_String := empty_string; procedure usage is begin Put_Line ("aadl2aadl is a program which displays an aadl file to the screen."); New_Line; Put_Line ("Check Cheddar home page for details : http://beru.univ-brest.fr/cheddar "); New_Line; New_Line; Put_Line ("Usage : aadl2aadl [switch] aadl-file-to-display"); Put_Line (" switch can be :"); Put_Line (" -u get this help"); New_Line; end usage; root : node_id := No_Node; success : Boolean := False; begin copyright ("aadl2aadl"); -- Get arguments -- loop case Getopt ("u v ") is when ASCII.NUL => exit; 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); Ocarina.Initialize; Ocarina.Configuration.Init_Modules; -- Parse AADL property files -- root := Ocarina.Parser.Parse ("AADL_Properties.aadl", root); root := Ocarina.Parser.Parse ("AADL_Project.aadl", root); -- If the two files above have not been found, use those of -- Ocarina. -- root := Ocarina.Parser.Parse_Standard_Property_Sets (root); if No (root) then Put_Line ("aadl2aadl.adb : Cannot parse standard property sets"); end if; root := Ocarina.Parser.Parse ("Cheddar_Properties.aadl", root); root := Ocarina.Parser.Parse ("User_Defined_Cheddar_Properties.aadl", root); -- Read and Parse file -- root := Ocarina.Parser.Parse (To_String (file_name), root); root := Ocarina.AADL.Parser.Process (To_String (file_name), root); -- Run AADL AST analysis -- if root /= No_Node then success := Ocarina.Analyzer.Analyze_Tree (root, Default_Analyzer_Options); if not success then root := No_Node; end if; end if; -- Check that the AADL specification is OK -- if root = No_Node then Put_Line ("aadl2aadl.adb : Syntax error in the AADL specification"); else Ocarina.AADL.Printer.Print_Subtree (root); end if; exception when GNAT.Command_Line.Invalid_Switch => begin Put_Line ("aadl2aadl.adb : invalid Switch ; " & Full_Switch); usage; end; when GNAT.Command_Line.Invalid_Parameter => begin Put_Line ("aadl2aadl.adb : missing parameter for switch ; " & Full_Switch); usage; end; when Ada.IO_Exceptions.Name_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Name_Error"); when Ada.IO_Exceptions.Status_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Status_Error"); when Ada.IO_Exceptions.Mode_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Mode_Error"); when Ada.IO_Exceptions.Use_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Use_Error"); when Ada.IO_Exceptions.Device_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Device_Error"); when Ada.IO_Exceptions.End_Error => Put_Line ("aadl2aadl.adb : Can not open project files, End_Error"); when Ada.IO_Exceptions.Data_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Data_Error"); when Ada.IO_Exceptions.Layout_Error => Put_Line ("aadl2aadl.adb : Can not open project files, Layout_Error"); when others => Put_Line ("This is an internal aadl2aadl 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 AADL files with your bug report"); end aadl2aadl;