OSDN Git Service

2009-10-01 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / ada / osint.ads
index 704febd..a44d4e2 100644 (file)
@@ -6,60 +6,71 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                                                                          --
---          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2009, 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. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package contains the low level, operating system routines used in
---  the GNAT compiler and binder for command line processing and file input
---  output.
+--  This package contains the low level, operating system routines used in the
+--  compiler and binder for command line processing and file input output.
+
+with Namet; use Namet;
+with Types; use Types;
 
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-with System;      use System;
-with Types;       use Types;
+with System.OS_Lib; use System.OS_Lib;
+with System;        use System;
 
-pragma Elaborate (GNAT.OS_Lib);
+pragma Elaborate_All (System.OS_Lib);
+--  For the call to function Get_Target_Object_Suffix in the private part
 
 package Osint is
 
+   Multi_Unit_Index_Character : Character := '~';
+   --  The character before the index of the unit in a multi-unit source, in
+   --  ALI and object file names. This is not a constant, because it is changed
+   --  to '$' on VMS.
+
+   Ada_Include_Path          : constant String := "ADA_INCLUDE_PATH";
+   Ada_Objects_Path          : constant String := "ADA_OBJECTS_PATH";
+   Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE";
+   Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE";
+
+   procedure Initialize;
+   --  Initialize internal tables
+
    function Normalize_Directory_Name (Directory : String) return String_Ptr;
    --  Verify and normalize a directory name. If directory name is invalid,
    --  this will return an empty string. Otherwise it will insure a trailing
    --  slash and make other normalizations.
 
-   type File_Type is (Source, Library, Config);
+   type File_Type is (Source, Library, Config, Definition, Preprocessing_Data);
 
    function Find_File
-     (N :    File_Name_Type;
-      T :    File_Type)
-      return File_Name_Type;
-   --  Finds a source, library or config file depending on the value
-   --  of T following the directory search order rules unless N is the
-   --  name of the file just read with Next_Main_File and already
-   --  contains directiory information, in which case just look in the
-   --  Primary_Directory.  Returns File_Name_Type of the full file name
-   --  if found, No_File if file not found. Note that for the special
-   --  case of gnat.adc, only the compilation environment directory is
-   --  searched, i.e. the directory where the ali and object files are
-   --  written. Another special case is when Debug_Generated_Code is
-   --  set and the file name ends on ".dg", in which case we look for
-   --  the generated file only in the current directory, since that is
-   --  where it is always built.
+     (N : File_Name_Type;
+      T : File_Type) return File_Name_Type;
+   --  Finds a source, library or config file depending on the value of T
+   --  following the directory search order rules unless N is the name of the
+   --  file just read with Next_Main_File and already contains directory
+   --  information, in which case just look in the Primary_Directory. Returns
+   --  File_Name_Type of the full file name if found, No_File if file not
+   --  found. Note that for the special case of gnat.adc, only the compilation
+   --  environment directory is searched, i.e. the directory where the ali and
+   --  object files are written. Another special case is Debug_Generated_Code
+   --  set and the file name ends on ".dg", in which case we look for the
+   --  generated file only in the current directory, since that is where it is
+   --  always built.
 
    function Get_File_Names_Case_Sensitive return Int;
    pragma Import (C, Get_File_Names_Case_Sensitive,
@@ -79,33 +90,42 @@ package Osint is
    --  so that two file names compare equal if they refer to the same file.
 
    function Number_Of_Files return Int;
-   --  gives the total number of filenames found on the command line.
+   --  Gives the total number of filenames found on the command line
 
-   procedure Add_File (File_Name : String);
-   --  Called by the subprogram processing the command line for each
-   --  file name found.
+   No_Index : constant := -1;
+   --  Value used in Add_File to indicate no index is specified for main
+
+   procedure Add_File (File_Name : String; Index : Int := No_Index);
+   --  Called by the subprogram processing the command line for each file name
+   --  found. The index, when not defaulted to No_Index is the index of the
+   --  subprogram in its source, zero indicating that the source is not
+   --  multi-unit.
 
    procedure Find_Program_Name;
    --  Put simple name of current program being run (excluding the directory
    --  path) in Name_Buffer, with the length in Name_Len.
 
-   function Program_Name (Nam : String) return String_Access;
-   --  In the native compilation case, Create a string containing Nam. In
-   --  the cross compilation case, looks at the prefix of the current
-   --  program being run and prepend it to Nam. For instance if the program
-   --  being run is <target>-gnatmake and Nam is "gcc", the returned value
-   --  will be a pointer to "<target>-gcc". This function clobbers
-   --  Name_Buffer and Name_Len.
+   function Program_Name (Nam : String; Prog : String) return String_Access;
+   --  In the native compilation case, Create a string containing Nam. In the
+   --  cross compilation case, looks at the prefix of the current program being
+   --  run and prepend it to Nam. For instance if the program being run is
+   --  <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
+   --  to "<target>-gcc". In the specific case where AAMP_On_Target is set, the
+   --  name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are
+   --  mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len.
+   --  Also look at any suffix, e.g. gnatmake-4.1 -> "gcc-4.1". Prog is the
+   --  default name of the current program being executed, e.g. "gnatmake",
+   --  "gnatlink".
 
    procedure Write_Program_Name;
-   --  Writes name of program as invoked to the current output
-   --  (normally standard output).
+   --  Writes name of program as invoked to the current output (normally
+   --  standard output).
 
-   procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
+   procedure Fail (S : String);
    pragma No_Return (Fail);
-   --  Outputs error messages S1 & S2 & S3 preceded by the name of the
-   --  executing program and exits with E_Fatal. The output goes to
-   --  standard error, except if special output is in effect (see Output).
+   --  Outputs error message S preceded by the name of the executing program
+   --  and exits with E_Fatal. The output goes to standard error, except if
+   --  special output is in effect (see Output).
 
    function Is_Directory_Separator (C : Character) return Boolean;
    --  Returns True if C is a directory separator
@@ -116,7 +136,7 @@ package Osint is
    --  directory part in the name.
 
    function Is_Readonly_Library (File : File_Name_Type) return Boolean;
-   --  Check if this library file is a read-only file.
+   --  Check if this library file is a read-only file
 
    function Strip_Directory (Name : File_Name_Type) return File_Name_Type;
    --  Strips the prefix directory name (if any) from Name. Returns the
@@ -132,14 +152,20 @@ package Osint is
    --  instance under DOS it adds the ".exe" suffix, whereas under UNIX no
    --  suffix is added.
 
+   function Executable_Name (Name : String) return String;
+   --  Same as above, with String parameters
+
    function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
-   --  Returns the time stamp of file Name. Name should include relative
-   --  path information in order to locate it. If the source file cannot be
-   --  opened, or Name = No_File, and all blank time stamp is returned (this is
-   --  not an error situation).
+   --  Returns the time stamp of file Name. Name should include relative path
+   --  information in order to locate it. If the source file cannot be opened,
+   --  or Name = No_File, and all blank time stamp is returned (this is not an
+   --  error situation).
+
+   function File_Stamp (Name : Path_Name_Type) return Time_Stamp_Type;
+   --  Same as above for a path name
 
    type String_Access_List is array (Positive range <>) of String_Access;
-   --  Deferenced type used to return a list of file specs in
+   --  Dereferenced type used to return a list of file specs in
    --  To_Canonical_File_List.
 
    type String_Access_List_Access is access all String_Access_List;
@@ -148,60 +174,77 @@ package Osint is
 
    function To_Canonical_File_List
      (Wildcard_Host_File : String;
-      Only_Dirs          : Boolean)
-      return               String_Access_List_Access;
+      Only_Dirs          : Boolean) return String_Access_List_Access;
    --  Expand a wildcard host syntax file or directory specification (e.g. on
-   --  a VMS host, any file or directory spec that contains:
-   --  "*", or "%", or "...")
-   --  and return a list of valid Unix syntax file or directory specs.
+   --  a VMS host, any file or directory spec that contains: "*", or "%", or
+   --  "...") and return a list of valid Unix syntax file or directory specs.
    --  If Only_Dirs is True, then only return directories.
 
    function To_Canonical_Dir_Spec
      (Host_Dir     : String;
-      Prefix_Style : Boolean)
-      return         String_Access;
+      Prefix_Style : Boolean) return String_Access;
    --  Convert a host syntax directory specification (e.g. on a VMS host:
    --  "SYS$DEVICE:[DIR]") to canonical (Unix) syntax (e.g. "/sys$device/dir").
-   --  If Prefix_Style then make it a valid file specification prefix.
-   --  A file specification prefix is a directory specification that
-   --  can be appended with a simple file specification to yield a valid
-   --  absolute or relative path to a file. On a conversion to Unix syntax
-   --  this simply means the spec has a trailing slash ("/").
+   --  If Prefix_Style then make it a valid file specification prefix. A file
+   --  specification prefix is a directory specification that can be appended
+   --  with a simple file specification to yield a valid absolute or relative
+   --  path to a file. On a conversion to Unix syntax this simply means the
+   --  spec has a trailing slash ("/").
 
    function To_Canonical_File_Spec
-     (Host_File : String)
-      return      String_Access;
+     (Host_File : String) return String_Access;
    --  Convert a host syntax file specification (e.g. on a VMS host:
    --  "SYS$DEVICE:[DIR]FILE.EXT;69 to canonical (Unix) syntax (e.g.
    --  "/sys$device/dir/file.ext.69").
 
    function To_Canonical_Path_Spec
-     (Host_Path : String)
-      return      String_Access;
+     (Host_Path : String) return String_Access;
    --  Convert a host syntax Path specification (e.g. on a VMS host:
    --  "SYS$DEVICE:[BAR],DISK$USER:[FOO] to canonical (Unix) syntax (e.g.
    --  "/sys$device/foo:disk$user/foo").
 
    function To_Host_Dir_Spec
      (Canonical_Dir : String;
-      Prefix_Style  : Boolean)
-      return          String_Access;
+      Prefix_Style  : Boolean) return String_Access;
    --  Convert a canonical syntax directory specification to host syntax.
    --  The Prefix_Style flag is currently ignored but should be set to
    --  False.
 
    function To_Host_File_Spec
-     (Canonical_File : String)
-      return           String_Access;
-   --  Convert a canonical syntax file specification to host syntax.
+     (Canonical_File : String) return String_Access;
+   --  Convert a canonical syntax file specification to host syntax
+
+   function Relocate_Path
+     (Prefix : String;
+      Path   : String) return String_Ptr;
+   --  Given an absolute path and a prefix, if Path starts with Prefix,
+   --  replace the Prefix substring with the root installation directory.
+   --  By default, try to compute the root installation directory by looking
+   --  at the executable name as it was typed on the command line and, if
+   --  needed, use the PATH environment variable. If the above computation
+   --  fails, return Path. This function assumes Prefix'First = Path'First.
+
+   function Shared_Lib (Name : String) return String;
+   --  Returns the runtime shared library in the form -l<name>-<version> where
+   --  version is the GNAT runtime library option for the platform. For example
+   --  this routine called with Name set to "gnat" will return "-lgnat-5.02"
+   --  on UNIX and Windows and -lgnat_5_02 on VMS.
 
    -------------------------
    -- Search Dir Routines --
    -------------------------
 
+   function Include_Dir_Default_Prefix return String;
+   --  Return the directory of the run-time library sources, as modified
+   --  by update_path.
+
+   function Object_Dir_Default_Prefix return String;
+   --  Return the directory of the run-time library ALI and object files, as
+   --  modified by update_path.
+
    procedure Add_Default_Search_Dirs;
-   --  This routine adds the default search dirs indicated by the
-   --  environment variables and sdefault package.
+   --  This routine adds the default search dirs indicated by the environment
+   --  variables and sdefault package.
 
    procedure Add_Lib_Search_Dir (Dir : String);
    --  Add Dir at the end of the library file search path
@@ -211,14 +254,13 @@ package Osint is
 
    procedure Get_Next_Dir_In_Path_Init
      (Search_Path : String_Access);
-   function  Get_Next_Dir_In_Path
-     (Search_Path : String_Access)
-      return        String_Access;
-   --  These subprograms are used to parse out the directory names in a
-   --  search path specified by a Search_Path argument. The procedure
-   --  initializes an internal pointer to point to the initial directory
-   --  name, and calls to the function return successive directory names,
-   --  with a null pointer marking the end of the list.
+   function Get_Next_Dir_In_Path
+     (Search_Path : String_Access) return String_Access;
+   --  These subprograms are used to parse out the directory names in a search
+   --  path specified by a Search_Path argument. The procedure initializes an
+   --  internal pointer to point to the initial directory name, and calls to
+   --  the function return successive directory names, with a null pointer
+   --  marking the end of the list.
 
    type Search_File_Type is (Include, Objects);
 
@@ -244,15 +286,18 @@ package Osint is
                            new String'("ada_source_path");
    Objects_Search_File : constant String_Access :=
                            new String'("ada_object_path");
-   --  Names of the files containg the default include or objects search
+   --  Names of the files containing the default include or objects search
    --  directories. These files, located in Sdefault.Search_Dir_Prefix, do
    --  not necessarily exist.
 
+   Exec_Name : String_Ptr;
+   --  Executable name as typed by the user (used to compute the
+   --  executable prefix).
+
    function Read_Default_Search_Dirs
      (Search_Dir_Prefix       : String_Access;
       Search_File             : String_Access;
-      Search_Dir_Default_Name : String_Access)
-      return                    String_Access;
+      Search_Dir_Default_Name : String_Access) return String_Access;
    --  Read and return the default search directories from the file located
    --  in Search_Dir_Prefix (as modified by update_path) and named Search_File.
    --  If no such file exists or an error occurs then instead return the
@@ -260,8 +305,7 @@ package Osint is
 
    function Get_RTS_Search_Dir
      (Search_Dir : String;
-      File_Type  : Search_File_Type)
-      return       String_Ptr;
+      File_Type  : Search_File_Type) return String_Ptr;
    --  This function retrieves the paths to the search (resp. lib) dirs and
    --  return them. The search dir can be absolute or relative. If the search
    --  dir contains Include_Search_File (resp. Object_Search_File), then this
@@ -300,13 +344,11 @@ package Osint is
    --
    --    CR
    --    CR/LF
-   --    LF/CR
    --    LF
 
-   --  The source is terminated by an EOF (16#1A#) character, which is
-   --  the last charcater of the returned source bufer (note that any
-   --  EOF characters in positions other than the last source character
-   --  are treated as representing blanks).
+   --  The source is terminated by an EOF (16#1A#) character, which is the last
+   --  character of the returned source buffer (note that any EOF characters in
+   --  positions other than the last source character are treated as blanks).
    --
    --  The logical lower bound of the source buffer is the input value of Lo,
    --  and on exit Hi is set to the logical upper bound of the source buffer.
@@ -327,10 +369,10 @@ package Osint is
    --  without any directory information. The implementation is responsible
    --  for searching for the file in the appropriate directories.
    --
-   --  Note the special case that if the file name is gnat.adc, then the
-   --  search for the file is done ONLY in the directory corresponding to
-   --  the current compilation environment, i.e. in the same directory
-   --  where the ali and object files will be written.
+   --  Note the special case that if the file name is gnat.adc, then the search
+   --  for the file is done ONLY in the directory corresponding to the current
+   --  compilation environment, i.e. in the same directory where the ali and
+   --  object files will be written.
 
    function Full_Source_Name return File_Name_Type;
    function Current_Source_File_Stamp return Time_Stamp_Type;
@@ -342,20 +384,22 @@ package Osint is
    function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
    --  Returns the full name/time stamp of the source file whose simple name
    --  is N which should not include path information. Note that if the file
-   --  cannot be located No_File is returned for the first routine and an
-   --  all blank time stamp is returned for the second (this is not an error
-   --  situation). The full name includes the appropriate directory
-   --  information. The source file directory lookup penalty is incurred
-   --  every single time the routines are called unless you have previously
-   --  called Source_File_Data (Cache => True). See below.
+   --  cannot be located No_File is returned for the first routine and an all
+   --  blank time stamp is returned for the second (this is not an error
+   --  situation). The full name includes appropriate directory information.
+   --  The source file directory lookup penalty is incurred every single time
+   --  the routines are called unless you have previously called
+   --  Source_File_Data (Cache => True). See below.
+
+   function Current_File_Index return Int;
+   --  Return the index in its source file of the current main unit
 
    function Matching_Full_Source_Name
-     (N    : File_Name_Type;
-      T    : Time_Stamp_Type)
-      return File_Name_Type;
-   --  Same semantics than Full_Source_Name but will search on the source
-   --  path until a source file with time stamp matching T is found. If
-   --  none is found returns No_File.
+     (N : File_Name_Type;
+      T : Time_Stamp_Type) return File_Name_Type;
+   --  Same semantics than Full_Source_Name but will search on the source path
+   --  until a source file with time stamp matching T is found. If none is
+   --  found returns No_File.
 
    procedure Source_File_Data (Cache : Boolean);
    --  By default source file data (full source file name and time stamp)
@@ -363,9 +407,15 @@ package Osint is
    --  Source_File_Stamp (N) is made. This may be undesirable in certain
    --  applications as this is uselessly slow if source file data does not
    --  change during program execution. When this procedure is called with
-   --  Cache => True access to source file data does not encurr a penalty if
+   --  Cache => True access to source file data does not incur a penalty if
    --  this data was previously retrieved.
 
+   procedure Dump_Source_File_Names;
+   --  Prints out the names of all source files that have been read by
+   --  Read_Source_File, except those that come from the run-time library
+   --  (i.e. Include_Dir_Default_Prefix). The text is sent to whatever Output
+   --  is currently using (e.g. standard output or standard error).
+
    -------------------------------------------
    -- Representation of Library Information --
    -------------------------------------------
@@ -397,7 +447,9 @@ package Osint is
 
    --  Which of these three methods is chosen depends on the constraints of the
    --  host operating system. The interface described here is independent of
-   --  which of these approaches is used.
+   --  which of these approaches is used. Currently all versions of GNAT use
+   --  the third approach with a file name of xxx.ali where xxx is the source
+   --  file name.
 
    -------------------------------
    -- Library Information Input --
@@ -408,14 +460,13 @@ package Osint is
 
    function Read_Library_Info
      (Lib_File  : File_Name_Type;
-      Fatal_Err : Boolean := False)
-      return      Text_Buffer_Ptr;
+      Fatal_Err : Boolean := False) return Text_Buffer_Ptr;
    --  Allocates a Text_Buffer of appropriate length and reads in the entire
    --  source of the library information from the library information file
    --  whose name is given by the parameter Name.
    --
    --  See description of Read_Source_File for details on the format of the
-   --  returned text buffer (the format is identical). THe lower bound of
+   --  returned text buffer (the format is identical). The lower bound of
    --  the Text_Buffer is always zero
    --
    --  If the specified file cannot be opened, then the action depends on
@@ -441,7 +492,7 @@ package Osint is
    --  using Read_Library_Info, including appropriate directory information.
    --  Calling this routine entails no library file directory lookup
    --  penalty. Note that the object file corresponding to a library file
-   --  is not actually read. Its time stamp is fected when the flag
+   --  is not actually read. Its time stamp is affected when the flag
    --  Opt.Check_Object_Consistency is set.
 
    function Current_Library_File_Stamp return Time_Stamp_Type;
@@ -452,27 +503,39 @@ package Osint is
 
    function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
    function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
-   --  Returns the full name/time stamp of library file N. N should not
-   --  include path information. Note that if the file cannot be located
-   --  No_File is returned for the first routine and an all blank time stamp
-   --  is returned for the second (this is not an error situation). The
-   --  full name includes the appropriate directory information. The library
-   --  file directory lookup penalty is incurred every single time this
-   --  routine is called.
-
-   function Lib_File_Name (Source_File : File_Name_Type) return File_Name_Type;
+   --  Returns the full name/time stamp of library file N. N should not include
+   --  path information. Note that if the file cannot be located No_File is
+   --  returned for the first routine and an all blank time stamp is returned
+   --  for the second (this is not an error situation). The full name includes
+   --  the appropriate directory information. The library file directory lookup
+   --  penalty is incurred every single time this routine is called.
+
+   function Lib_File_Name
+     (Source_File : File_Name_Type;
+      Munit_Index : Nat := 0) return File_Name_Type;
    --  Given the name of a source file, returns the name of the corresponding
-   --  library information file. This may be the name of the object file, or
-   --  of a separate file used to store the library information. In either case
-   --  the returned result is suitable for use in a call to Read_Library_Info.
-   --  Note: this subprogram is in this section because it is used by the
-   --  compiler to determine the proper library information names to be placed
-   --  in the generated library information file.
+   --  library information file. This may be the name of the object file or of
+   --  a separate file used to store the library information. In the current
+   --  implementation, a separate file (the ALI file) is always used. In either
+   --  case the returned result is suitable for calling Read_Library_Info. The
+   --  Munit_Index is the unit index in multiple unit per file mode, or zero in
+   --  normal single unit per file mode (used to add ~nnn suffix). Note: this
+   --  subprogram is in this section because it is used by the compiler to
+   --  determine the proper library information names to be placed in the
+   --  generated library information file.
 
    -----------------
    -- Termination --
    -----------------
 
+   Current_Exit_Status : Integer := 0;
+   --  Exit status that is set with procedure OS_Exit_Through_Exception below
+   --  and can be used in exception handler for Types.Terminate_Program to call
+   --  Set_Exit_Status as the last action of the program.
+
+   procedure OS_Exit_Through_Exception (Status : Integer);
+   --  Set the Current_Exit_Status, then raise Types.Terminate_Program
+
    type Exit_Code_Type is (
       E_Success,    -- No warnings or errors
       E_Warnings,   -- Compiler warnings generated
@@ -484,9 +547,9 @@ package Osint is
 
    procedure Exit_Program (Exit_Code : Exit_Code_Type);
    pragma No_Return (Exit_Program);
-   --  A call to Exit_Program terminates execution with the given status.
-   --  A status of zero indicates normal completion, a non-zero status
-   --  indicates abnormal termination.
+   --  A call to Exit_Program terminates execution with the given status. A
+   --  status of zero indicates normal completion, a non-zero status indicates
+   --  abnormal termination.
 
    -------------------------
    -- Command Line Access --
@@ -508,10 +571,11 @@ package Osint is
    pragma Import (C, Len_Arg, "__gnat_len_arg");
    --  Get length of argument
 
-private
+   ALI_Default_Suffix : constant String_Ptr := new String'("ali");
+   ALI_Suffix         : String_Ptr          := ALI_Default_Suffix;
+   --  The suffixes used for the library files (also known as ALI files)
 
-   ALI_Suffix : constant String_Ptr := new String'("ali");
-   --  The suffix used for the library files (also known as ALI files).
+private
 
    Current_Main : File_Name_Type := No_File;
    --  Used to save a simple file name between calls to Next_Main_Source and
@@ -519,11 +583,11 @@ private
    --  No_File, that indicates that the file whose name was returned by the
    --  last call to Next_Main_Source (and stored here) is to be read.
 
-   Object_Suffix : constant String := Get_Object_Suffix.all;
-   --  The suffix used for the object files.
+   Target_Object_Suffix : constant String := Get_Target_Object_Suffix.all;
+   --  The suffix used for the target object files
 
    Output_FD : File_Descriptor;
-   --  The file descriptor for the current library info, tree or binder output
+   --  File descriptor for current library info, list, tree, or binder output
 
    Output_File_Name : File_Name_Type;
    --  File_Name_Type for name of open file whose FD is in Output_FD, the name
@@ -536,10 +600,15 @@ private
    type File_Name_Array_Ptr is access File_Name_Array;
    File_Names : File_Name_Array_Ptr :=
                   new File_Name_Array (1 .. Int (Argument_Count) + 2);
-   --  As arguments are scanned in Initialize, file names are stored
-   --  in this array. The string does not contain a terminating NUL.
-   --  The array is "extensible" because when using project files,
-   --  there may be more file names than argument on the command line.
+   --  As arguments are scanned, file names are stored in this array. The
+   --  strings do not have terminating NUL files. The array is extensible,
+   --  because when using project files, there may be more files than
+   --  arguments on the command line.
+
+   type File_Index_Array is array (Int range <>) of Int;
+   type File_Index_Array_Ptr is access File_Index_Array;
+   File_Indexes : File_Index_Array_Ptr :=
+                    new File_Index_Array (1 .. Int (Argument_Count) + 2);
 
    Current_File_Name_Index : Int := 0;
    --  The index in File_Names of the last file opened by Next_Main_Source
@@ -550,33 +619,39 @@ private
      (Fdesc : out File_Descriptor;
       Fmode : Mode);
    --  Create file whose name (NUL terminated) is in Name_Buffer (with the
-   --  length in Name_Len), and place the resulting descriptor in Fdesc.
-   --  Issue message and exit with fatal error if file cannot be created.
-   --  The Fmode parameter is set to either Text or Binary (see description
-   --  of GNAT.OS_Lib.Create_File).
+   --  length in Name_Len), and place the resulting descriptor in Fdesc. Issue
+   --  message and exit with fatal error if file cannot be created. The Fmode
+   --  parameter is set to either Text or Binary (for details see description
+   --  of System.OS_Lib.Create_File).
 
    type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
    --  Program currently running
    procedure Set_Program (P : Program_Type);
-   --  Indicates to the body of Osint the program currently running.
-   --  This procedure is called by the child packages of Osint.
-   --  A check is made that this procedure is not called several times.
+   --  Indicates to the body of Osint the program currently running. This
+   --  procedure is called by the child packages of Osint. A check is made
+   --  that this procedure is not called more than once.
 
    function More_Files return Boolean;
-   --  Implements More_Source_Files and More_Lib_Files.
+   --  Implements More_Source_Files and More_Lib_Files
 
    function Next_Main_File return File_Name_Type;
-   --  Implements Next_Main_Source and Next_Main_Lib_File.
+   --  Implements Next_Main_Source and Next_Main_Lib_File
 
    function Object_File_Name (N : File_Name_Type) return File_Name_Type;
-   --  Constructs the name of the object file corresponding to library
-   --  file N. If N is a full file name than the returned file name will
-   --  also be a full file name. Note that no lookup in the library file
-   --  directories is done for this file. This routine merely constructs
-   --  the name.
+   --  Constructs the name of the object file corresponding to library file N.
+   --  If N is a full file name than the returned file name will also be a full
+   --  file name. Note that no lookup in the library file directories is done
+   --  for this file. This routine merely constructs the name.
 
    procedure Write_Info (Info : String);
    --  Implementation of Write_Binder_Info, Write_Debug_Info and
    --  Write_Library_Info (identical)
 
+   procedure Write_With_Check (A : Address; N  : Integer);
+   --  Writes N bytes from buffer starting at address A to file whose FD is
+   --  stored in Output_FD, and whose file name is stored as a File_Name_Type
+   --  in Output_File_Name. A check is made for disk full, and if this is
+   --  detected, the file being written is deleted, and a fatal error is
+   --  signalled.
+
 end Osint;