1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2014, 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 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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Output
; use Output
;
30 ----------------------
31 -- Is_Internal_Unit --
32 ----------------------
34 -- Note: the reason we do not use the Fname package for this function
35 -- is that it would drag too much junk into the binder.
37 function Is_Internal_Unit
return Boolean is
39 return Is_Predefined_Unit
40 or else (Name_Len
> 4 and then (Name_Buffer
(1 .. 5) = "gnat%"
42 Name_Buffer
(1 .. 5) = "gnat."));
45 ------------------------
46 -- Is_Predefined_Unit --
47 ------------------------
49 -- Note: the reason we do not use the Fname package for this function
50 -- is that it would drag too much junk into the binder.
52 function Is_Predefined_Unit
return Boolean is
53 L
: Natural renames Name_Len
;
54 B
: String renames Name_Buffer
;
56 return (L
> 3 and then B
(1 .. 4) = "ada.")
57 or else (L
> 6 and then B
(1 .. 7) = "system.")
58 or else (L
> 10 and then B
(1 .. 11) = "interfaces.")
59 or else (L
> 3 and then B
(1 .. 4) = "ada%")
60 or else (L
> 8 and then B
(1 .. 9) = "calendar%")
61 or else (L
> 9 and then B
(1 .. 10) = "direct_io%")
62 or else (L
> 10 and then B
(1 .. 11) = "interfaces%")
63 or else (L
> 13 and then B
(1 .. 14) = "io_exceptions%")
64 or else (L
> 12 and then B
(1 .. 13) = "machine_code%")
65 or else (L
> 13 and then B
(1 .. 14) = "sequential_io%")
66 or else (L
> 6 and then B
(1 .. 7) = "system%")
67 or else (L
> 7 and then B
(1 .. 8) = "text_io%")
68 or else (L
> 20 and then B
(1 .. 21) = "unchecked_conversion%")
69 or else (L
> 22 and then B
(1 .. 23) = "unchecked_deallocation%")
70 or else (L
> 4 and then B
(1 .. 5) = "gnat%")
71 or else (L
> 4 and then B
(1 .. 5) = "gnat.");
72 end Is_Predefined_Unit
;
78 function Uname_Less
(U1
, U2
: Unit_Name_Type
) return Boolean is
83 U1_Name
: constant String (1 .. Name_Len
) :=
84 Name_Buffer
(1 .. Name_Len
);
90 if Name_Len
< U1_Name
'Last then
91 Min_Length
:= Name_Len
;
93 Min_Length
:= U1_Name
'Last;
96 for J
in 1 .. Min_Length
loop
97 if U1_Name
(J
) > Name_Buffer
(J
) then
99 elsif U1_Name
(J
) < Name_Buffer
(J
) then
104 return U1_Name
'Last < Name_Len
;
108 ---------------------
109 -- Write_Unit_Name --
110 ---------------------
112 procedure Write_Unit_Name
(U
: Unit_Name_Type
) is
115 Write_Str
(Name_Buffer
(1 .. Name_Len
- 2));
117 if Name_Buffer
(Name_Len
) = 's' then
118 Write_Str
(" (spec)");
120 Write_Str
(" (body)");
123 Name_Len
:= Name_Len
+ 5;