Daily bump.
[official-gcc.git] / gcc / ada / lib-list.adb
blob0c900c6a691129c3a5280fc1983f62d7479abe00
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . L I S T --
6 -- --
7 -- B o d y --
8 -- --
9 -- $Revision: 1.32 $
10 -- --
11 -- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
12 -- --
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. --
23 -- --
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. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 -- --
34 ------------------------------------------------------------------------------
36 with Output; use Output;
38 separate (Lib)
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
47 Unit_Node : Node_Id;
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;
62 begin
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);
67 end loop;
69 Sort (Sorted_Units);
71 -- Now we can generate the unit table listing
73 Write_Eol;
75 if not File_Names_Only then
76 Write_Str (Unit_Hed);
77 Write_Str (File_Hed);
78 Write_Str (Time_Hed);
79 Write_Eol;
81 Write_Str (Unit_Und);
82 Write_Str (File_Und);
83 Write_Str (Time_Und);
84 Write_Eol;
85 Write_Eol;
86 end if;
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))))
94 then
95 Write_Name (Full_File_Name (Source_Index (Sorted_Units (R))));
96 Write_Eol;
97 end if;
99 else
100 Write_Unit_Name (Unit_Name (Sorted_Units (R)));
102 if Name_Len > (Unit_Length - 1) then
103 Write_Eol;
104 Write_Str (Unit_Bln);
105 else
106 for J in Name_Len + 1 .. Unit_Length loop
107 Write_Char (' ');
108 end loop;
109 end if;
111 Write_Name (Full_File_Name (Source_Index (Sorted_Units (R))));
113 if Name_Len > (File_Length - 1) then
114 Write_Eol;
115 Write_Str (Unit_Bln);
116 Write_Str (File_Bln);
117 else
118 for J in Name_Len + 1 .. File_Length loop
119 Write_Char (' ');
120 end loop;
121 end if;
123 Write_Str (String (Time_Stamp (Source_Index (Sorted_Units (R)))));
124 Write_Eol;
125 end if;
126 end loop;
128 Write_Eol;
129 end List;