1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 with Output
; use Output
;
39 procedure List
(File_Names_Only
: Boolean := False) is
41 Num_Units
: constant Nat
:= Int
(Units
.Last
) - Int
(Units
.First
) + 1;
42 -- Number of units in file table
44 Sorted_Units
: Unit_Ref_Table
(1 .. Num_Units
);
45 -- Table of unit numbers that we will sort
48 -- Compilation unit node for current unit
50 Unit_Hed
: constant String := "Unit name ";
51 Unit_Und
: constant String := "--------- ";
52 Unit_Bln
: constant String := " ";
53 File_Hed
: constant String := "File name ";
54 File_Und
: constant String := "--------- ";
55 File_Bln
: constant String := " ";
56 Time_Hed
: constant String := "Time stamp";
57 Time_Und
: constant String := "----------";
59 Unit_Length
: constant Natural := Unit_Hed
'Length;
60 File_Length
: constant Natural := File_Hed
'Length;
63 -- First step is to make a sorted table of units
65 for J
in 1 .. Num_Units
loop
66 Sorted_Units
(J
) := Unit_Number_Type
(Int
(Units
.First
) + J
- 1);
71 -- Now we can generate the unit table listing
75 if not File_Names_Only
then
88 for R
in Sorted_Units
'Range loop
89 Unit_Node
:= Cunit
(Sorted_Units
(R
));
91 if File_Names_Only
then
92 if not Is_Internal_File_Name
93 (File_Name
(Source_Index
(Sorted_Units
(R
))))
95 Write_Name
(Full_File_Name
(Source_Index
(Sorted_Units
(R
))));
100 Write_Unit_Name
(Unit_Name
(Sorted_Units
(R
)));
102 if Name_Len
> (Unit_Length
- 1) then
104 Write_Str
(Unit_Bln
);
106 for J
in Name_Len
+ 1 .. Unit_Length
loop
111 Write_Name
(Full_File_Name
(Source_Index
(Sorted_Units
(R
))));
113 if Name_Len
> (File_Length
- 1) then
115 Write_Str
(Unit_Bln
);
116 Write_Str
(File_Bln
);
118 for J
in Name_Len
+ 1 .. File_Length
loop
123 Write_Str
(String (Time_Stamp
(Source_Index
(Sorted_Units
(R
)))));