1----------------------------------------------------------------------- 2-- Gate - GtkAda Components -- 3-- -- 4-- Copyright (C) 1999-2000 -- 5-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- 6-- Copyright (C) 2001-2013, AdaCore -- 7-- -- 8-- GATE is free software; you can redistribute it and/or modify it -- 9-- under the terms of the GNU General Public License as published by -- 10-- the Free Software Foundation; either version 2 of the License, or -- 11-- (at your option) any later version. -- 12-- -- 13-- This program is distributed in the hope that it will be useful, -- 14-- but WITHOUT ANY WARRANTY; without even the implied warranty of -- 15-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 16-- General Public License for more details. You should have received -- 17-- a copy of the GNU General Public License along with this library; -- 18-- if not, write to the Free Software Foundation, Inc., 59 Temple -- 19-- Place - Suite 330, Boston, MA 02111-1307, USA. -- 20----------------------------------------------------------------------- 21 22-- Parse a Glade's XML project file and generate the corresponding Ada code 23 24with Gtk.Main; use Gtk.Main; 25with Gtk.Glade; use Gtk.Glade; 26with Glib.Glade; use Glib; use Glib.Glade; use Glib.Glade.Glib_XML; 27with Ada.Command_Line; use Ada.Command_Line; 28with Ada.Text_IO; use Ada.Text_IO; 29with GNAT.OS_Lib; 30with Ada.Exceptions; use Ada.Exceptions; 31with System.Assertions; 32 33procedure Gate is 34 procedure Usage; 35 36 procedure Usage is 37 begin 38 Put_Line ("Usage: " & Command_Name & " project-file"); 39 New_Line; 40 Set_Exit_Status (1); 41 end Usage; 42 43begin 44 if Argument_Count /= 1 then 45 Usage; 46 return; 47 end if; 48 49 if not GNAT.OS_Lib.Is_Regular_File (Argument (1)) then 50 Put_Line (Argument (1) & " is not a regular file"); 51 Set_Exit_Status (2); 52 return; 53 end if; 54 55 Gtk.Main.Init; 56 Generate (Argument (1)); 57 58exception 59 when System.Assertions.Assert_Failure => 60 Put_Line ("GATE: the XML file seems to be corrupted. " & 61 "Please check it"); 62 Put_Line ("up manually, and try again"); 63 Set_Exit_Status (2); 64 65 when E : others => 66 Put_Line ("Exception = " & Exception_Name (E)); 67 Put_Line ("GATE: Internal error. " & 68 "Please send a bug report with the XML"); 69 Put_Line ("file " & Argument (1) & 70 " and the GtkAda version to " & "report@adacore.com"); 71 Set_Exit_Status (2); 72end Gate; 73