1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 with Output; use Output;
28 with Targparm; use Targparm;
32 ----------------------
33 -- Is_Internal_Unit --
34 ----------------------
36 -- Note: the reason we do not use the Fname package for this function
37 -- is that it would drag too much junk into the binder.
39 function Is_Internal_Unit return Boolean is
41 return Is_Predefined_Unit
43 and then (Name_Buffer (1 .. 5) = "gnat%"
45 Name_Buffer (1 .. 5) = "gnat."))
49 and then (Name_Buffer (1 .. 4) = "dec%"
51 Name_Buffer (1 .. 4) = "dec."));
55 ------------------------
56 -- Is_Predefined_Unit --
57 ------------------------
59 -- Note: the reason we do not use the Fname package for this function
60 -- is that it would drag too much junk into the binder.
62 function Is_Predefined_Unit return Boolean is
65 and then Name_Buffer (1 .. 4) = "ada.")
68 and then Name_Buffer (1 .. 7) = "system.")
70 or else (Name_Len > 10
71 and then Name_Buffer (1 .. 11) = "interfaces.")
74 and then Name_Buffer (1 .. 4) = "ada%")
77 and then Name_Buffer (1 .. 9) = "calendar%")
80 and then Name_Buffer (1 .. 10) = "direct_io%")
82 or else (Name_Len > 10
83 and then Name_Buffer (1 .. 11) = "interfaces%")
85 or else (Name_Len > 13
86 and then Name_Buffer (1 .. 14) = "io_exceptions%")
88 or else (Name_Len > 12
89 and then Name_Buffer (1 .. 13) = "machine_code%")
91 or else (Name_Len > 13
92 and then Name_Buffer (1 .. 14) = "sequential_io%")
95 and then Name_Buffer (1 .. 7) = "system%")
98 and then Name_Buffer (1 .. 8) = "text_io%")
100 or else (Name_Len > 20
101 and then Name_Buffer (1 .. 21) = "unchecked_conversion%")
103 or else (Name_Len > 22
104 and then Name_Buffer (1 .. 23) = "unchecked_deallocation%")
106 or else (Name_Len > 4
107 and then Name_Buffer (1 .. 5) = "gnat%")
109 or else (Name_Len > 4
110 and then Name_Buffer (1 .. 5) = "gnat.");
111 end Is_Predefined_Unit;
117 function Uname_Less (U1, U2 : Unit_Name_Type) return Boolean is
119 Get_Name_String (U1);
122 U1_Name : constant String (1 .. Name_Len) :=
123 Name_Buffer (1 .. Name_Len);
124 Min_Length : Natural;
127 Get_Name_String (U2);
129 if Name_Len < U1_Name'Last then
130 Min_Length := Name_Len;
132 Min_Length := U1_Name'Last;
135 for I in 1 .. Min_Length loop
136 if U1_Name (I) > Name_Buffer (I) then
138 elsif U1_Name (I) < Name_Buffer (I) then
143 return U1_Name'Last < Name_Len;
147 ---------------------
148 -- Write_Unit_Name --
149 ---------------------
151 procedure Write_Unit_Name (U : Unit_Name_Type) is
154 Write_Str (Name_Buffer (1 .. Name_Len - 2));
156 if Name_Buffer (Name_Len) = 's' then
157 Write_Str (" (spec)");
159 Write_Str (" (body)");
162 Name_Len := Name_Len + 5;