OSDN Git Service

* decl2.c (maybe_emit_vtables): Produce same comdat group when outputting
[pf3gnuchains/gcc-fork.git] / gcc / ada / xgnatugn.adb
index 3a55df4..ee3b07d 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 2003-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,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, 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.          --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -65,7 +64,7 @@
 --       appropriate vms equivalents. Note that replacements do not occur
 --       within ^alpha^beta^ sequences.
 
---       Any occurence of [filename].extension, where extension one of the
+--       Any occurrence of [filename].extension, where extension one of the
 --       following:
 
 --           "o", "ads", "adb", "ali", "ada", "atb", "ats", "adc", "c"
@@ -90,7 +89,7 @@
 --       this is because we have menu problems if we let makeinfo handle
 --       these ifset/ifclear pairs.
 --       Note: @ifset/@ifclear commands for the edition flags (FSFEDITION,
---       PROEDITION, ACADEMICEDITION) are passed through unchanged
+--       PROEDITION, GPLEDITION) are passed through unchanged
 
 with Ada.Command_Line;           use Ada.Command_Line;
 with Ada.Strings;                use Ada.Strings;
@@ -98,6 +97,7 @@ with Ada.Strings.Fixed;          use Ada.Strings.Fixed;
 with Ada.Strings.Unbounded;      use Ada.Strings.Unbounded;
 with Ada.Strings.Maps;           use Ada.Strings.Maps;
 with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
+with Ada.Streams.Stream_IO;      use Ada.Streams.Stream_IO;
 with Ada.Text_IO;                use Ada.Text_IO;
 
 with GNAT.Spitbol;               use GNAT.Spitbol;
@@ -109,12 +109,14 @@ procedure Xgnatugn is
    --  Print usage information. Invoked if an invalid command line is
    --  encountered.
 
-   Output_File : File_Type;
+   subtype Sfile is Ada.Streams.Stream_IO.File_Type;
+
+   Output_File : Sfile;
    --  The preprocessed output is written to this file
 
    type Input_File is record
       Name : VString;
-      Data : File_Type;
+      Data : Ada.Text_IO.File_Type;
       Line : Natural := 0;
    end record;
    --  Records information on an input file. Name and Line are used
@@ -124,6 +126,10 @@ procedure Xgnatugn is
    --  Returns a line from Input and performs the necessary
    --  line-oriented checks (length, character set, trailing spaces).
 
+   procedure Put_Line (F : Sfile; S : String);
+   procedure Put_Line (F : Sfile; S : VString);
+   --  Local version of Put_Line ensures Unix style line endings
+
    Number_Of_Warnings : Natural := 0;
    Number_Of_Errors   : Natural := 0;
    Warnings_Enabled   : Boolean;
@@ -161,27 +167,27 @@ procedure Xgnatugn is
    --  It contains the Texinfo source code. Process_Source_File
    --  performs the necessary replacements.
 
-   type Flag_Type is (UNW, VMS, FSFEDITION, PROEDITION, ACADEMICEDITION);
+   type Flag_Type is (UNW, VMS, FSFEDITION, PROEDITION, GPLEDITION);
    --  The flags permitted in @ifset or @ifclear commands:
    --
    --  Targets for preprocessing
    --    UNW (Unix and Windows) or VMS
    --
    --  Editions of the manual
-   --    FSFEDITION, PROEDITION, or ACADEMICEDITION
+   --    FSFEDITION, PROEDITION, or GPLEDITION
    --
    --  Conditional commands for target are processed by xgnatugn
    --
    --  Conditional commands for edition are passed through unchanged
 
    subtype Target_Type is Flag_Type range UNW .. VMS;
-   subtype Edition_Type is Flag_Type range FSFEDITION .. ACADEMICEDITION;
+   subtype Edition_Type is Flag_Type range FSFEDITION .. GPLEDITION;
 
    Target : Target_Type;
    --  The Target variable is initialized using the command line
 
-   Valid_Characters : constant Character_Set
-     := To_Set (Span => (' ',  '~'));
+   Valid_Characters : constant Character_Set :=
+                        To_Set (Span => (' ',  '~'));
    --  This array controls which characters are permitted in the input
    --  file (after line breaks have been removed). Valid characters
    --  are all printable ASCII characters and the space character.
@@ -353,6 +359,21 @@ procedure Xgnatugn is
       end;
    end Get_Line;
 
+   --------------
+   -- Put_Line --
+   --------------
+
+   procedure Put_Line (F : Sfile; S : String) is
+   begin
+      String'Write (Stream (F), S);
+      Character'Write (Stream (F), ASCII.LF);
+   end Put_Line;
+
+   procedure Put_Line (F : Sfile; S : VString) is
+   begin
+      Put_Line (F, To_String (S));
+   end Put_Line;
+
    -----------
    -- Error --
    -----------
@@ -477,7 +498,7 @@ procedure Xgnatugn is
                   Non_Word_Character : constant Natural :=
                                          Index (Source,
                                                 Word_Characters or
-                                                  To_Set (" "),
+                                                  To_Set (" ."),
                                                 Outside);
 
                begin
@@ -748,7 +769,7 @@ procedure Xgnatugn is
 
                      else
 
-                        --  Extend Seq to cover the current (known) word.
+                        --  Extend Seq to cover the current (known) word
 
                         Seq.Last := Token.Span.Last;
                         Next_Token;
@@ -1045,7 +1066,7 @@ procedure Xgnatugn is
 
             if (not Have_Conditional) or (Flag in Edition_Type) then
 
-               --  The ordinary case.
+               --  The ordinary case
 
                if not Currently_Excluding then
                   Put_Line (Output_File, Rewritten);
@@ -1068,7 +1089,7 @@ procedure Xgnatugn is
       --  case).
 
       procedure Add (Extension, Replacement : String);
-      --  Adds an extension with a custom replacement.
+      --  Adds an extension with a custom replacement
 
       ---------
       -- Add --
@@ -1294,7 +1315,7 @@ begin
       begin
          Target := Flag_Type'Value (Argument (1));
 
-         if Target not in Target_Type then
+         if not Target'Valid then
             Valid_Command_Line := False;
          end if;
 
@@ -1312,7 +1333,7 @@ begin
          Open (Source_File.Data, In_File, Argument (2));
 
       exception
-         when Name_Error =>
+         when Ada.Text_IO.Name_Error =>
             Valid_Command_Line := False;
       end;
    end if;
@@ -1325,7 +1346,7 @@ begin
          Open (Dictionary_File.Data, In_File, Argument (3));
 
       exception
-         when Name_Error =>
+         when Ada.Text_IO.Name_Error =>
             Valid_Command_Line := False;
       end;
    end if;
@@ -1350,7 +1371,7 @@ begin
          Create (Output_File, Out_File, S (Output_File_Name));
 
       exception
-         when Name_Error | Use_Error =>
+         when Ada.Text_IO.Name_Error | Ada.Text_IO.Use_Error =>
             Valid_Command_Line := False;
       end;
    end if;