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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
34 with Types
; use Types
;
38 -----------------------------
39 -- Dummy Table Definitions --
40 -----------------------------
42 -- The following table was used in old versions of the compiler. We retain
43 -- the declarations here for compatibility with old tree files. The new
44 -- version of the compiler does not use this table, and will write out a
45 -- dummy empty table for Tree_Write.
47 type SFN_Entry
is record
52 package SFN_Table
is new Table
.Table
(
53 Table_Component_Type
=> SFN_Entry
,
54 Table_Index_Type
=> Int
,
56 Table_Initial
=> Alloc
.SFN_Table_Initial
,
57 Table_Increment
=> Alloc
.SFN_Table_Increment
,
58 Table_Name
=> "Fname_Dummy_Table");
60 ---------------------------
61 -- Is_Internal_File_Name --
62 ---------------------------
64 function Is_Internal_File_Name
65 (Fname
: File_Name_Type
;
66 Renamings_Included
: Boolean := True) return Boolean
69 if Is_Predefined_File_Name
(Fname
, Renamings_Included
) then
72 -- Once Is_Predefined_File_Name has been called and returns False,
73 -- Name_Buffer contains Fname and Name_Len is set to 8.
75 elsif Name_Buffer
(1 .. 2) = "g-"
76 or else Name_Buffer
(1 .. 8) = "gnat "
83 end Is_Internal_File_Name
;
85 -----------------------------
86 -- Is_Predefined_File_Name --
87 -----------------------------
89 -- This should really be a test of unit name, given the possibility of
90 -- pragma Source_File_Name setting arbitrary file names for any files???
92 -- Once Is_Predefined_File_Name has been called and returns False,
93 -- Name_Buffer contains Fname and Name_Len is set to 8. This is used
94 -- only by Is_Internal_File_Name, and is not part of the official
95 -- external interface of this function.
97 function Is_Predefined_File_Name
98 (Fname
: File_Name_Type
;
99 Renamings_Included
: Boolean := True) return Boolean
102 Get_Name_String
(Fname
);
103 return Is_Predefined_File_Name
(Renamings_Included
);
104 end Is_Predefined_File_Name
;
106 function Is_Predefined_File_Name
107 (Renamings_Included
: Boolean := True) return Boolean
109 subtype Str8
is String (1 .. 8);
111 Predef_Names
: constant array (1 .. 11) of Str8
:=
113 "interfac", -- Interfaces
116 -- Remaining entries are only considered if Renamings_Included true
118 "calendar", -- Calendar
119 "machcode", -- Machine_Code
120 "unchconv", -- Unchecked_Conversion
121 "unchdeal", -- Unchecked_Deallocation
122 "directio", -- Direct_IO
123 "ioexcept", -- IO_Exceptions
124 "sequenio", -- Sequential_IO
125 "text_io "); -- Text_IO
127 Num_Entries
: constant Natural :=
128 3 + 8 * Boolean'Pos (Renamings_Included
);
131 -- Remove extension (if present)
133 if Name_Len
> 4 and then Name_Buffer
(Name_Len
- 3) = '.' then
134 Name_Len
:= Name_Len
- 4;
137 -- Definitely false if longer than 12 characters (8.3)
142 -- Definitely predefined if prefix is a- i- or s- followed by letter
145 and then Name_Buffer
(2) = '-'
146 and then (Name_Buffer
(1) = 'a'
148 Name_Buffer
(1) = 'i'
150 Name_Buffer
(1) = 's')
151 and then (Name_Buffer
(3) in 'a' .. 'z'
153 Name_Buffer
(3) in 'A' .. 'Z')
158 -- Otherwise check against special list, first padding to 8 characters
160 while Name_Len
< 8 loop
161 Name_Len
:= Name_Len
+ 1;
162 Name_Buffer
(Name_Len
) := ' ';
165 for J
in 1 .. Num_Entries
loop
166 if Name_Buffer
(1 .. 8) = Predef_Names
(J
) then
171 -- Note: when we return False here, the Name_Buffer contains the
172 -- padded file name. This is not defined for clients of the package,
173 -- but is used by Is_Internal_File_Name.
176 end Is_Predefined_File_Name
;
182 procedure Tree_Read
is
191 procedure Tree_Write
is
193 SFN_Table
.Tree_Write
;