This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Minor reformatting, add ??? remarks
- To: gcc-patches at gcc dot gnu dot org
- Subject: [Ada] Minor reformatting, add ??? remarks
- From: bosch at gnat dot com
- Date: Tue, 30 Oct 2001 19:25:39 -0500 (EST)
Comment-only, not bootstrapped. Checked in for Robert.
-Geert
2001-10-30 Robert Dewar <dewar@gnat.com>
* gnatdll.adb: Minor reformatting throughout. Many ??? added for
undocumented declarations.
*** gnatdll.adb 2001/10/13 12:44:00 1.7
--- gnatdll.adb 2001/10/13 14:29:59 1.8
***************
*** 26,33 ****
-- --
------------------------------------------------------------------------------
! -- GNATDLL is a Windows specific tool to build DLL.
! -- Both relocatable and non-relocatable DLL are supported
with Ada.Text_IO;
with Ada.Strings.Unbounded;
--- 26,33 ----
-- --
------------------------------------------------------------------------------
! -- GNATDLL is a Windows specific tool for building a DLL.
! -- Both relocatable and non-relocatable DLL's are supported
with Ada.Text_IO;
with Ada.Strings.Unbounded;
***************
*** 50,106 ****
use type OS_Lib.Argument_List;
procedure Syntax;
! -- print out usage.
procedure Check (Filename : String);
! -- check that filename exist.
procedure Parse_Command_Line;
! -- parse the command line arguments of gnatdll.
procedure Check_Context;
! -- check the context before runing any commands to build the library.
Syntax_Error : exception;
Context_Error : exception;
! Help : Boolean := False;
Version : constant String := Gnatvsn.Gnat_Version_String;
- -- default address for non relocatable DLL (Win32)
-
Default_DLL_Address : constant String := "0x11000000";
Lib_Filename : Unbounded_String := Null_Unbounded_String;
Def_Filename : Unbounded_String := Null_Unbounded_String;
List_Filename : Unbounded_String := Null_Unbounded_String;
DLL_Address : Unbounded_String :=
! To_Unbounded_String (Default_DLL_Address);
!
! -- list of objects to put inside the library
Objects_Files : Argument_List_Access := Null_Argument_List_Access;
!
! -- for each Ada files specified we keep record of the corresponding
! -- Ali. This list of ali is used to build the binder program.
!
! Ali_Files : Argument_List_Access := Null_Argument_List_Access;
!
! -- a list of options set in the command line.
! Options : Argument_List_Access := Null_Argument_List_Access;
! -- gnat linker and binder args options
Largs_Options : Argument_List_Access := Null_Argument_List_Access;
Bargs_Options : Argument_List_Access := Null_Argument_List_Access;
type Build_Mode_State is (Import_Lib, Dynamic_Lib, Nil);
Build_Mode : Build_Mode_State := Nil;
Must_Build_Relocatable : Boolean := True;
Build_Import : Boolean := True;
------------
-- Syntax --
--- 50,107 ----
use type OS_Lib.Argument_List;
procedure Syntax;
! -- Print out usage
procedure Check (Filename : String);
! -- Check that the file whose name is Filename exists
procedure Parse_Command_Line;
! -- Parse the command line arguments passed to gnatdll
procedure Check_Context;
! -- Check the context before runing any commands to build the library
Syntax_Error : exception;
Context_Error : exception;
+ -- What are these for ???
! Help : Boolean := False;
! -- What is this for ???
Version : constant String := Gnatvsn.Gnat_Version_String;
+ -- Why should it be necessary to make a copy of this
Default_DLL_Address : constant String := "0x11000000";
+ -- Default address for non relocatable DLL (Win32)
Lib_Filename : Unbounded_String := Null_Unbounded_String;
Def_Filename : Unbounded_String := Null_Unbounded_String;
List_Filename : Unbounded_String := Null_Unbounded_String;
DLL_Address : Unbounded_String :=
! To_Unbounded_String (Default_DLL_Address);
! -- What are the above ???
Objects_Files : Argument_List_Access := Null_Argument_List_Access;
! -- List of objects to put inside the library
! Ali_Files : Argument_List_Access := Null_Argument_List_Access;
! -- For each Ada file specified, we keep arecord of the corresponding
! -- ALI file. This list of SLI files is used to build the binder program.
! Options : Argument_List_Access := Null_Argument_List_Access;
! -- A list of options set in the command line.
Largs_Options : Argument_List_Access := Null_Argument_List_Access;
Bargs_Options : Argument_List_Access := Null_Argument_List_Access;
+ -- GNAT linker and binder args options
type Build_Mode_State is (Import_Lib, Dynamic_Lib, Nil);
+ -- Comments needed ???
Build_Mode : Build_Mode_State := Nil;
Must_Build_Relocatable : Boolean := True;
Build_Import : Boolean := True;
+ -- Comments needed
------------
-- Syntax --
***************
*** 168,202 ****
-- for each ali file in Afiles set put a corresponding object file in
-- Ofiles set.
- -- these are arbitrary limits, a better way will be to use linked list.
-
Max_Files : constant := 5_000;
Max_Options : constant := 100;
!
! -- objects files to put in the library
Ofiles : OS_Lib.Argument_List (1 .. Max_Files);
O : Positive := Ofiles'First;
!
! -- ali files.
Afiles : OS_Lib.Argument_List (1 .. Max_Files);
A : Positive := Afiles'First;
- -- gcc options.
-
Gopts : OS_Lib.Argument_List (1 .. Max_Options);
G : Positive := Gopts'First;
!
! -- largs options
Lopts : OS_Lib.Argument_List (1 .. Max_Options);
L : Positive := Lopts'First;
- -- bargs options
-
Bopts : OS_Lib.Argument_List (1 .. Max_Options);
B : Positive := Bopts'First;
--------------
-- Add_File --
--- 169,200 ----
-- for each ali file in Afiles set put a corresponding object file in
-- Ofiles set.
Max_Files : constant := 5_000;
Max_Options : constant := 100;
! -- These are arbitrary limits, a better way will be to use linked list.
! -- No, a better choice would be to use tables ???
! -- Limits on what???
Ofiles : OS_Lib.Argument_List (1 .. Max_Files);
O : Positive := Ofiles'First;
! -- List of object files to put in the library. O is the next entry
! -- to be used.
Afiles : OS_Lib.Argument_List (1 .. Max_Files);
A : Positive := Afiles'First;
+ -- List of ALI files. A is the next entry to be used.
Gopts : OS_Lib.Argument_List (1 .. Max_Options);
G : Positive := Gopts'First;
! -- List of gcc options. G is the next entry to be used.
Lopts : OS_Lib.Argument_List (1 .. Max_Options);
L : Positive := Lopts'First;
+ -- A list of -largs options (L is next entry to be used)
Bopts : OS_Lib.Argument_List (1 .. Max_Options);
B : Positive := Bopts'First;
+ -- A list of -bargs options (B is next entry to be used)
--------------
-- Add_File --
***************
*** 205,216 ****
procedure Add_File (Filename : in String) is
begin
-- others files are to be put inside the dynamic library
if Files.Is_Ali (Filename) then
Check (Filename);
! -- record it to generate the binder program when
-- building dynamic library
Afiles (A) := new String'(Filename);
--- 203,215 ----
procedure Add_File (Filename : in String) is
begin
-- others files are to be put inside the dynamic library
+ -- ??? this makes no sense, should it be "Other files ..."
if Files.Is_Ali (Filename) then
Check (Filename);
! -- Record it to generate the binder program when
-- building dynamic library
Afiles (A) := new String'(Filename);
***************
*** 220,232 ****
Check (Filename);
! -- just record this object file
Ofiles (O) := new String'(Filename);
O := O + 1;
else
! -- unknown file type
Exceptions.Raise_Exception
(Syntax_Error'Identity,
--- 219,231 ----
Check (Filename);
! -- Just record this object file
Ofiles (O) := new String'(Filename);
O := O + 1;
else
! -- Unknown file type
Exceptions.Raise_Exception
(Syntax_Error'Identity,
***************
*** 242,247 ****
--- 241,247 ----
File : Text_IO.File_Type;
Buffer : String (1 .. 500);
Last : Natural;
+
begin
Text_IO.Open (File, Text_IO.In_File, List_Filename);
***************
*** 265,272 ****
end loop;
end Ali_To_Object_List;
! begin
Initialize_Option_Scan ('-', False, "bargs largs");
-- scan gnatdll switches
--- 265,273 ----
end loop;
end Ali_To_Object_List;
! -- Start of processing for Parse_Command_Line
+ begin
Initialize_Option_Scan ('-', False, "bargs largs");
-- scan gnatdll switches
***************
*** 285,291 ****
G := G + 1;
when 'v' =>
! -- verbose mode on.
MDLL.Verbose := True;
if MDLL.Quiet then
--- 286,293 ----
G := G + 1;
when 'v' =>
!
! -- Turn verbose mode on
MDLL.Verbose := True;
if MDLL.Quiet then
***************
*** 295,302 ****
end if;
when 'q' =>
- -- quiet mode on.
MDLL.Quiet := True;
if MDLL.Verbose then
Exceptions.Raise_Exception
--- 297,305 ----
end if;
when 'q' =>
+ -- Turn quiet mode on
+
MDLL.Quiet := True;
if MDLL.Verbose then
Exceptions.Raise_Exception
***************
*** 312,318 ****
if Parameter = "" then
! -- default address for a relocatable dynamic library.
-- address for a non relocatable dynamic library.
DLL_Address := To_Unbounded_String (Default_DLL_Address);
--- 315,321 ----
if Parameter = "" then
! -- Default address for a relocatable dynamic library.
-- address for a non relocatable dynamic library.
DLL_Address := To_Unbounded_String (Default_DLL_Address);
***************
*** 329,335 ****
when 'd' =>
! -- build a non relocatable DLL.
Lib_Filename := To_Unbounded_String (Parameter);
--- 332,338 ----
when 'd' =>
! -- Build a non relocatable DLL
Lib_Filename := To_Unbounded_String (Parameter);
***************
*** 355,364 ****
raise Invalid_Switch;
end case;
-
end loop;
! -- get parameters
loop
declare
--- 358,366 ----
raise Invalid_Switch;
end case;
end loop;
! -- Get parameters
loop
declare
***************
*** 369,375 ****
end;
end loop;
! -- get largs parameters
Goto_Section ("largs");
--- 371,377 ----
end;
end loop;
! -- Get largs parameters
Goto_Section ("largs");
***************
*** 386,392 ****
end case;
end loop;
! -- get bargs parameters
Goto_Section ("bargs");
--- 388,394 ----
end case;
end loop;
! -- Get bargs parameters
Goto_Section ("bargs");
***************
*** 403,415 ****
end case;
end loop;
! -- if list filename has been specified parse it
if List_Filename /= Null_Unbounded_String then
Add_Files_From_List (To_String (List_Filename));
end if;
! -- check if the set of parameters are compatible.
if Build_Mode = Nil and then not Help and then not Verbose then
Exceptions.Raise_Exception
--- 405,417 ----
end case;
end loop;
! -- if list filename has been specified, parse it
if List_Filename /= Null_Unbounded_String then
Add_Files_From_List (To_String (List_Filename));
end if;
! -- Check if the set of parameters are compatible.
if Build_Mode = Nil and then not Help and then not Verbose then
Exceptions.Raise_Exception
***************
*** 417,424 ****
"nothing to do.");
end if;
! -- check if we want to build an import library (option -e and no file
! -- specified)
if Build_Mode = Dynamic_Lib
and then A = Afiles'First
--- 419,426 ----
"nothing to do.");
end if;
! -- Check if we want to build an import library (option -e and
! -- no file specified)
if Build_Mode = Dynamic_Lib
and then A = Afiles'First
***************
*** 470,485 ****
Check (To_String (Def_Filename));
! -- check that each object file specified exist
! -- raises Context_Error if it does not.
for F in Objects_Files'Range loop
Check (Objects_Files (F).all);
end loop;
end Check_Context;
! begin
if Ada.Command_Line.Argument_Count = 0 then
Help := True;
else
--- 472,488 ----
Check (To_String (Def_Filename));
! -- Check that each object file specified exists and raise exception
! -- Context_Error if it does not.
for F in Objects_Files'Range loop
Check (Objects_Files (F).all);
end loop;
end Check_Context;
! -- Start of processing for Gnatdll
+ begin
if Ada.Command_Line.Argument_Count = 0 then
Help := True;
else