| 1 |
------------------------------------------------------------------------------ |
| 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-2025, 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. See the GNU General Public License -- |
| 17 |
-- for more details. You should have received a copy of the GNU General -- |
| 18 |
-- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
separate (Lib) |
| 27 |
procedure List (File_Names_Only : Boolean := False) is |
| 28 |
|
| 29 |
Num_Units : constant Nat := Int (Units.Last) - Int (Units.First) + 1; |
| 30 |
-- Number of units in file table |
| 31 |
|
| 32 |
Sorted_Units : Unit_Ref_Table (1 .. Num_Units); |
| 33 |
-- Table of unit numbers that we will sort |
| 34 |
|
| 35 |
Unit_Hed : constant String := "Unit name "; |
| 36 |
Unit_Und : constant String := "--------- "; |
| 37 |
Unit_Bln : constant String := " "; |
| 38 |
File_Hed : constant String := "File name "; |
| 39 |
File_Und : constant String := "--------- "; |
| 40 |
File_Bln : constant String := " "; |
| 41 |
Time_Hed : constant String := "Time stamp"; |
| 42 |
Time_Und : constant String := "----------"; |
| 43 |
|
| 44 |
Unit_Length : constant Natural := Unit_Hed'Length; |
| 45 |
File_Length : constant Natural := File_Hed'Length; |
| 46 |
|
| 47 |
begin |
| 48 |
-- First step is to make a sorted table of units |
| 49 |
|
| 50 |
for J in 1 .. Num_Units loop |
| 51 |
Sorted_Units (J) := Unit_Number_Type (Int (Units.First) + J - 1); |
| 52 |
end loop; |
| 53 |
|
| 54 |
Sort (Sorted_Units); |
| 55 |
|
| 56 |
-- Now we can generate the unit table listing |
| 57 |
|
| 58 |
Write_Eol; |
| 59 |
|
| 60 |
if not File_Names_Only then |
| 61 |
Write_Str (Unit_Hed); |
| 62 |
Write_Str (File_Hed); |
| 63 |
Write_Str (Time_Hed); |
| 64 |
Write_Eol; |
| 65 |
|
| 66 |
Write_Str (Unit_Und); |
| 67 |
Write_Str (File_Und); |
| 68 |
Write_Str (Time_Und); |
| 69 |
Write_Eol; |
| 70 |
Write_Eol; |
| 71 |
end if; |
| 72 |
|
| 73 |
for R in Sorted_Units'Range loop |
| 74 |
if File_Names_Only then |
| 75 |
if not Is_Internal_Unit (Sorted_Units (R)) then |
| 76 |
Write_Name (Full_File_Name (Source_Index (Sorted_Units (R)))); |
| 77 |
Write_Eol; |
| 78 |
end if; |
| 79 |
|
| 80 |
else |
| 81 |
Write_Unit_Name (Unit_Name (Sorted_Units (R))); |
| 82 |
|
| 83 |
if Name_Len > Unit_Length - 1 then |
| 84 |
Write_Eol; |
| 85 |
Write_Str (Unit_Bln); |
| 86 |
else |
| 87 |
for J in Name_Len + 1 .. Unit_Length loop |
| 88 |
Write_Char (' '); |
| 89 |
end loop; |
| 90 |
end if; |
| 91 |
|
| 92 |
Write_Name (Full_File_Name (Source_Index (Sorted_Units (R)))); |
| 93 |
|
| 94 |
if Name_Len > File_Length - 1 then |
| 95 |
Write_Eol; |
| 96 |
Write_Str (Unit_Bln); |
| 97 |
Write_Str (File_Bln); |
| 98 |
else |
| 99 |
for J in Name_Len + 1 .. File_Length loop |
| 100 |
Write_Char (' '); |
| 101 |
end loop; |
| 102 |
end if; |
| 103 |
|
| 104 |
Write_Str (String (Time_Stamp (Source_Index (Sorted_Units (R))))); |
| 105 |
Write_Eol; |
| 106 |
end if; |
| 107 |
end loop; |
| 108 |
|
| 109 |
Write_Eol; |
| 110 |
end List; |