1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- L I B . L I S T --
|
6 |
|
|
-- --
|
7 |
|
|
-- B o d y --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
12 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
13 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
15 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
16 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
17 |
|
|
-- --
|
18 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
21 |
|
|
-- --
|
22 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
23 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
24 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
25 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
26 |
|
|
-- --
|
27 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
separate (Lib)
|
33 |
|
|
procedure List (File_Names_Only : Boolean := False) is
|
34 |
|
|
|
35 |
|
|
Num_Units : constant Nat := Int (Units.Last) - Int (Units.First) + 1;
|
36 |
|
|
-- Number of units in file table
|
37 |
|
|
|
38 |
|
|
Sorted_Units : Unit_Ref_Table (1 .. Num_Units);
|
39 |
|
|
-- Table of unit numbers that we will sort
|
40 |
|
|
|
41 |
|
|
Unit_Hed : constant String := "Unit name ";
|
42 |
|
|
Unit_Und : constant String := "--------- ";
|
43 |
|
|
Unit_Bln : constant String := " ";
|
44 |
|
|
File_Hed : constant String := "File name ";
|
45 |
|
|
File_Und : constant String := "--------- ";
|
46 |
|
|
File_Bln : constant String := " ";
|
47 |
|
|
Time_Hed : constant String := "Time stamp";
|
48 |
|
|
Time_Und : constant String := "----------";
|
49 |
|
|
|
50 |
|
|
Unit_Length : constant Natural := Unit_Hed'Length;
|
51 |
|
|
File_Length : constant Natural := File_Hed'Length;
|
52 |
|
|
|
53 |
|
|
begin
|
54 |
|
|
-- First step is to make a sorted table of units
|
55 |
|
|
|
56 |
|
|
for J in 1 .. Num_Units loop
|
57 |
|
|
Sorted_Units (J) := Unit_Number_Type (Int (Units.First) + J - 1);
|
58 |
|
|
end loop;
|
59 |
|
|
|
60 |
|
|
Sort (Sorted_Units);
|
61 |
|
|
|
62 |
|
|
-- Now we can generate the unit table listing
|
63 |
|
|
|
64 |
|
|
Write_Eol;
|
65 |
|
|
|
66 |
|
|
if not File_Names_Only then
|
67 |
|
|
Write_Str (Unit_Hed);
|
68 |
|
|
Write_Str (File_Hed);
|
69 |
|
|
Write_Str (Time_Hed);
|
70 |
|
|
Write_Eol;
|
71 |
|
|
|
72 |
|
|
Write_Str (Unit_Und);
|
73 |
|
|
Write_Str (File_Und);
|
74 |
|
|
Write_Str (Time_Und);
|
75 |
|
|
Write_Eol;
|
76 |
|
|
Write_Eol;
|
77 |
|
|
end if;
|
78 |
|
|
|
79 |
|
|
for R in Sorted_Units'Range loop
|
80 |
|
|
if File_Names_Only then
|
81 |
|
|
if not Is_Internal_File_Name
|
82 |
|
|
(File_Name (Source_Index (Sorted_Units (R))))
|
83 |
|
|
then
|
84 |
|
|
Write_Name (Full_File_Name (Source_Index (Sorted_Units (R))));
|
85 |
|
|
Write_Eol;
|
86 |
|
|
end if;
|
87 |
|
|
|
88 |
|
|
else
|
89 |
|
|
Write_Unit_Name (Unit_Name (Sorted_Units (R)));
|
90 |
|
|
|
91 |
|
|
if Name_Len > (Unit_Length - 1) then
|
92 |
|
|
Write_Eol;
|
93 |
|
|
Write_Str (Unit_Bln);
|
94 |
|
|
else
|
95 |
|
|
for J in Name_Len + 1 .. Unit_Length loop
|
96 |
|
|
Write_Char (' ');
|
97 |
|
|
end loop;
|
98 |
|
|
end if;
|
99 |
|
|
|
100 |
|
|
Write_Name (Full_File_Name (Source_Index (Sorted_Units (R))));
|
101 |
|
|
|
102 |
|
|
if Name_Len > (File_Length - 1) then
|
103 |
|
|
Write_Eol;
|
104 |
|
|
Write_Str (Unit_Bln);
|
105 |
|
|
Write_Str (File_Bln);
|
106 |
|
|
else
|
107 |
|
|
for J in Name_Len + 1 .. File_Length loop
|
108 |
|
|
Write_Char (' ');
|
109 |
|
|
end loop;
|
110 |
|
|
end if;
|
111 |
|
|
|
112 |
|
|
Write_Str (String (Time_Stamp (Source_Index (Sorted_Units (R)))));
|
113 |
|
|
Write_Eol;
|
114 |
|
|
end if;
|
115 |
|
|
end loop;
|
116 |
|
|
|
117 |
|
|
Write_Eol;
|
118 |
|
|
end List;
|