Commit 3d2e1f12 by Robert Dewar Committed by Arnaud Charlet

gnatchop.adb: Minor reformatting

2008-08-01  Robert Dewar  <dewar@adacore.com>

	* gnatchop.adb: Minor reformatting

From-SVN: r138462
parent e3a6d737
...@@ -63,9 +63,9 @@ procedure Gnatchop is ...@@ -63,9 +63,9 @@ procedure Gnatchop is
-- Arguments used in Gnat_Cmd call -- Arguments used in Gnat_Cmd call
EOF : constant Character := Character'Val (26); EOF : constant Character := Character'Val (26);
-- Special character to signal end of file. Not required in input -- Special character to signal end of file. Not required in input files,
-- files, but properly treated if present. Not generated in output -- but properly treated if present. Not generated in output files except
-- files except as a result of copying input file. -- as a result of copying input file.
-------------------- --------------------
-- File arguments -- -- File arguments --
...@@ -152,8 +152,8 @@ procedure Gnatchop is ...@@ -152,8 +152,8 @@ procedure Gnatchop is
-- Index of unit in sorted unit list -- Index of unit in sorted unit list
Bufferg : String_Access; Bufferg : String_Access;
-- Pointer to buffer containing configuration pragmas to be -- Pointer to buffer containing configuration pragmas to be prepended.
-- prepended. Null if no pragmas to be prepended. -- Null if no pragmas to be prepended.
end record; end record;
-- The following table stores the unit offset information -- The following table stores the unit offset information
...@@ -1018,9 +1018,9 @@ procedure Gnatchop is ...@@ -1018,9 +1018,9 @@ procedure Gnatchop is
Contents := new String (1 .. Read_Ptr); Contents := new String (1 .. Read_Ptr);
Contents.all := Buffer (1 .. Read_Ptr); Contents.all := Buffer (1 .. Read_Ptr);
-- Things aren't simple on VMS due to the plethora of file types -- Things aren't simple on VMS due to the plethora of file types and
-- and organizations. It seems clear that there shouldn't be more -- organizations. It seems clear that there shouldn't be more bytes
-- bytes read than are contained in the file though. -- read than are contained in the file though.
if Hostparm.OpenVMS then if Hostparm.OpenVMS then
Success := Read_Ptr <= Length + 1; Success := Read_Ptr <= Length + 1;
...@@ -1249,7 +1249,6 @@ procedure Gnatchop is ...@@ -1249,7 +1249,6 @@ procedure Gnatchop is
F : constant String := File.Table (File_Num).Name.all; F : constant String := File.Table (File_Num).Name.all;
begin begin
if Is_Directory (F) then if Is_Directory (F) then
Error_Msg (F & " is a directory, cannot be chopped"); Error_Msg (F & " is a directory, cannot be chopped");
return False; return False;
...@@ -1277,7 +1276,6 @@ procedure Gnatchop is ...@@ -1277,7 +1276,6 @@ procedure Gnatchop is
end if; end if;
return False; return False;
end Scan_Arguments; end Scan_Arguments;
---------------- ----------------
...@@ -1636,11 +1634,11 @@ procedure Gnatchop is ...@@ -1636,11 +1634,11 @@ procedure Gnatchop is
-- Returns in OS_Name the proper name for the OS when used with the -- Returns in OS_Name the proper name for the OS when used with the
-- returned Encoding value. For example on Windows this will return the -- returned Encoding value. For example on Windows this will return the
-- UTF-8 encoded name into OS_Name and set Encoding to encoding=utf8 -- UTF-8 encoded name into OS_Name and set Encoding to encoding=utf8
-- (form parameter Stream_IO). -- (the form parameter for Stream_IO).
--
-- Name is the filename and W_Name the same filename in Unicode 16 bits -- Name is the filename and W_Name the same filename in Unicode 16 bits
-- (this corresponds to Win32 Unicode ISO/IEC 10646). N_Length and -- (this corresponds to Win32 Unicode ISO/IEC 10646). N_Length/E_Length
-- E_Length are the length returned in OS_Name and Encoding -- are the length returned in OS_Name/Encoding respectively.
-- respectively.
Info : Unit_Info renames Unit.Table (Num); Info : Unit_Info renames Unit.Table (Num);
Name : aliased constant String := Info.File_Name.all & ASCII.NUL; Name : aliased constant String := Info.File_Name.all & ASCII.NUL;
...@@ -1676,6 +1674,7 @@ procedure Gnatchop is ...@@ -1676,6 +1674,7 @@ procedure Gnatchop is
C_Name : aliased constant String := E_Name & ASCII.NUL; C_Name : aliased constant String := E_Name & ASCII.NUL;
OS_Encoding : constant String := Encoding (1 .. E_Length); OS_Encoding : constant String := Encoding (1 .. E_Length);
File : Stream_IO.File_Type; File : Stream_IO.File_Type;
begin begin
begin begin
if not Overwrite_Files and then Exists (E_Name) then if not Overwrite_Files and then Exists (E_Name) then
...@@ -1685,6 +1684,7 @@ procedure Gnatchop is ...@@ -1685,6 +1684,7 @@ procedure Gnatchop is
(File, Stream_IO.Out_File, E_Name, OS_Encoding); (File, Stream_IO.Out_File, E_Name, OS_Encoding);
Success := True; Success := True;
end if; end if;
exception exception
when Stream_IO.Name_Error | Stream_IO.Use_Error => when Stream_IO.Name_Error | Stream_IO.Use_Error =>
Error_Msg ("cannot create " & Info.File_Name.all); Error_Msg ("cannot create " & Info.File_Name.all);
...@@ -1705,7 +1705,6 @@ procedure Gnatchop is ...@@ -1705,7 +1705,6 @@ procedure Gnatchop is
if Success and then Info.Bufferg /= null then if Success and then Info.Bufferg /= null then
Write_Source_Reference_Pragma (Info, 1, File, EOL, Success); Write_Source_Reference_Pragma (Info, 1, File, EOL, Success);
String'Write (Stream_IO.Stream (File), Info.Bufferg.all); String'Write (Stream_IO.Stream (File), Info.Bufferg.all);
end if; end if;
...@@ -1742,10 +1741,9 @@ procedure Gnatchop is ...@@ -1742,10 +1741,9 @@ procedure Gnatchop is
-- Start of processing for gnatchop -- Start of processing for gnatchop
begin begin
-- Add the directory where gnatchop is invoked in front of the -- Add the directory where gnatchop is invoked in front of the path, if
-- path, if gnatchop is invoked with directory information. -- gnatchop is invoked with directory information. Only do this if the
-- Only do this if the platform is not VMS, where the notion of path -- platform is not VMS, where the notion of path does not really exist.
-- does not really exist.
if not Hostparm.OpenVMS then if not Hostparm.OpenVMS then
declare declare
...@@ -1758,12 +1756,10 @@ begin ...@@ -1758,12 +1756,10 @@ begin
Absolute_Dir : constant String := Absolute_Dir : constant String :=
Normalize_Pathname Normalize_Pathname
(Command (Command'First .. Index)); (Command (Command'First .. Index));
PATH : constant String := PATH : constant String :=
Absolute_Dir & Absolute_Dir
Path_Separator & & Path_Separator
Getenv ("PATH").all; & Getenv ("PATH").all;
begin begin
Setenv ("PATH", PATH); Setenv ("PATH", PATH);
end; end;
...@@ -1813,26 +1809,24 @@ begin ...@@ -1813,26 +1809,24 @@ begin
Sort_Units; Sort_Units;
-- Check if any duplicate files would be created. If so, emit -- Check if any duplicate files would be created. If so, emit a warning if
-- a warning if Overwrite_Files is true, otherwise generate an error. -- Overwrite_Files is true, otherwise generate an error.
if Report_Duplicate_Units and then not Overwrite_Files then if Report_Duplicate_Units and then not Overwrite_Files then
goto No_Files_Written; goto No_Files_Written;
end if; end if;
-- Check if any files exist, if so do not write anything -- Check if any files exist, if so do not write anything Because all files
-- Because all files have been parsed and checked already, -- have been parsed and checked already, there won't be any duplicates
-- there won't be any duplicates
if not Overwrite_Files and then Files_Exist then if not Overwrite_Files and then Files_Exist then
goto No_Files_Written; goto No_Files_Written;
end if; end if;
-- After this point, all source files are read in succession -- After this point, all source files are read in succession and chopped
-- and chopped into their destination files. -- into their destination files.
-- As the Source_File_Name pragmas are handled as logical file 0, -- Source_File_Name pragmas are handled as logical file 0 so write it first
-- write it first.
for F in 1 .. File.Last loop for F in 1 .. File.Last loop
if not Write_Chopped_Files (F) then if not Write_Chopped_Files (F) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment