OSDN Git Service

2009-07-27 Emmanuel Briot <briot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / xsinfo.adb
index 891f981..691e901 100644 (file)
@@ -6,26 +6,24 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                                                                          --
---          Copyright (C) 1992-2000 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT 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  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Program to construct C header file a-sinfo.h (C version of sinfo.ads spec,
+--  Program to construct C header file sinfo.h (C version of sinfo.ads spec,
 --  for use by Gigi, contains all definitions and access functions, but does
 --  not contain set procedures, since Gigi never modifies the GNAT tree)
 
 
 --    Output files:
 
---       a-sinfo.h     Corresponding c header file
+--       sinfo.h       Corresponding c header file
 
 --  Note: this program assumes that sinfo.ads has passed the error checks
 --  which are carried out by the CSinfo utility, so it does not duplicate
---  these checks and assumes the soruce is correct.
+--  these checks and assumes the source is correct.
 
 --  An optional argument allows the specification of an output file name to
---  override the default a-sinfo.h file name for the generated output file.
+--  override the default sinfo.h file name for the generated output file.
 
 with Ada.Command_Line;              use Ada.Command_Line;
 with Ada.Strings.Unbounded;         use Ada.Strings.Unbounded;
@@ -67,31 +65,35 @@ procedure XSinfo is
    Rtn       : VString := Nul;
    Term      : VString := Nul;
 
-   InS       : File_Type;
-   Ofile     : File_Type;
-
-   wsp     : Pattern := Span (' ' & ASCII.HT);
-   Wsp_For : Pattern := wsp & "for";
-   Is_Cmnt : Pattern := wsp & "--";
-   Typ_Nod : Pattern := wsp * A & "type Node_Kind is";
-   Get_Nam : Pattern := wsp * A & "N_" &  Break (",)") * Nam
-                          & Len (1) * Term;
-   Sub_Typ : Pattern := wsp * A & "subtype " &  Break (' ') * N;
-   No_Cont : Pattern := wsp & Break (' ') * N1 & " .. " & Break (';') * N2;
-   Cont_N1 : Pattern := wsp & Break (' ') * N1 & " .." & Rpos (0);
-   Cont_N2 : Pattern := Span (' ') & Break (';') * N2;
-   Is_Func : Pattern := wsp * A & "function " & Rest * Nam;
-   Get_Arg : Pattern := wsp & "(N : " & Break (')') * Arg
-                          & ") return " & Break (';') * Rtn
-                          & ';' & wsp & "--" & wsp & Rest * Comment;
+   InS   : File_Type;
+   Ofile : File_Type;
+
+   wsp     : constant Pattern := Span (' ' & ASCII.HT);
+   Wsp_For : constant Pattern := wsp & "for";
+   Is_Cmnt : constant Pattern := wsp & "--";
+   Typ_Nod : constant Pattern := wsp * A & "type Node_Kind is";
+   Get_Nam : constant Pattern := wsp * A & "N_" &  Break (",)") * Nam
+                                 & Len (1) * Term;
+   Sub_Typ : constant Pattern := wsp * A & "subtype " &  Break (' ') * N;
+   No_Cont : constant Pattern := wsp & Break (' ') * N1
+                                 & " .. " & Break (';') * N2;
+   Cont_N1 : constant Pattern := wsp & Break (' ') * N1 & " .." & Rpos (0);
+   Cont_N2 : constant Pattern := Span (' ') & Break (';') * N2;
+   Is_Func : constant Pattern := wsp * A & "function " & Rest * Nam;
+   Get_Arg : constant Pattern := wsp & "(N : " & Break (')') * Arg
+                                 & ") return " & Break (';') * Rtn
+                                 & ';' & wsp & "--" & wsp & Rest * Comment;
 
    NKV : Natural;
 
    M : Match_Result;
 
-
    procedure Getline;
-   --  Get non-comment, non-blank line. Also skips "for " rep clauses.
+   --  Get non-comment, non-blank line. Also skips "for " rep clauses
+
+   -------------
+   -- Getline --
+   -------------
 
    procedure Getline is
    begin
@@ -119,7 +121,7 @@ begin
    if Argument_Count > 0 then
       Create (Ofile, Out_File, Argument (1));
    else
-      Create (Ofile, Out_File, "a-sinfo.h");
+      Create (Ofile, Out_File, "sinfo.h");
    end if;
 
    Open (InS, In_File, "sinfo.ads");