1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2009, 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 ------------------------------------------------------------------------------
33 with Hostparm
; use Hostparm
;
35 with Types
; use Types
;
39 -----------------------------
40 -- Dummy Table Definitions --
41 -----------------------------
43 -- The following table was used in old versions of the compiler. We retain
44 -- the declarations here for compatibility with old tree files. The new
45 -- version of the compiler does not use this table, and will write out a
46 -- dummy empty table for Tree_Write.
48 type SFN_Entry
is record
53 package SFN_Table
is new Table
.Table
(
54 Table_Component_Type
=> SFN_Entry
,
55 Table_Index_Type
=> Int
,
57 Table_Initial
=> Alloc
.SFN_Table_Initial
,
58 Table_Increment
=> Alloc
.SFN_Table_Increment
,
59 Table_Name
=> "Fname_Dummy_Table");
61 ---------------------------
62 -- Is_Internal_File_Name --
63 ---------------------------
65 function Is_Internal_File_Name
66 (Fname
: File_Name_Type
;
67 Renamings_Included
: Boolean := True) return Boolean
70 if Is_Predefined_File_Name
(Fname
, Renamings_Included
) then
73 -- Once Is_Predefined_File_Name has been called and returns False,
74 -- Name_Buffer contains Fname and Name_Len is set to 8.
76 elsif Name_Buffer
(1 .. 2) = "g-"
77 or else Name_Buffer
(1 .. 8) = "gnat "
83 (Name_Buffer
(1 .. 4) = "dec-"
84 or else Name_Buffer
(1 .. 8) = "dec ")
91 end Is_Internal_File_Name
;
93 -----------------------------
94 -- Is_Predefined_File_Name --
95 -----------------------------
97 -- This should really be a test of unit name, given the possibility of
98 -- pragma Source_File_Name setting arbitrary file names for any files???
100 -- Once Is_Predefined_File_Name has been called and returns False,
101 -- Name_Buffer contains Fname and Name_Len is set to 8. This is used
102 -- only by Is_Internal_File_Name, and is not part of the official
103 -- external interface of this function.
105 function Is_Predefined_File_Name
106 (Fname
: File_Name_Type
;
107 Renamings_Included
: Boolean := True) return Boolean
110 Get_Name_String
(Fname
);
111 return Is_Predefined_File_Name
(Renamings_Included
);
112 end Is_Predefined_File_Name
;
114 function Is_Predefined_File_Name
115 (Renamings_Included
: Boolean := True) return Boolean
117 subtype Str8
is String (1 .. 8);
119 Predef_Names
: constant array (1 .. 11) of Str8
:=
121 "interfac", -- Interfaces
124 -- Remaining entries are only considered if Renamings_Included true
126 "calendar", -- Calendar
127 "machcode", -- Machine_Code
128 "unchconv", -- Unchecked_Conversion
129 "unchdeal", -- Unchecked_Deallocation
130 "directio", -- Direct_IO
131 "ioexcept", -- IO_Exceptions
132 "sequenio", -- Sequential_IO
133 "text_io "); -- Text_IO
135 Num_Entries
: constant Natural :=
136 3 + 8 * Boolean'Pos (Renamings_Included
);
139 -- Remove extension (if present)
141 if Name_Len
> 4 and then Name_Buffer
(Name_Len
- 3) = '.' then
142 Name_Len
:= Name_Len
- 4;
145 -- Definitely false if longer than 12 characters (8.3)
150 -- Definitely predefined if prefix is a- i- or s- followed by letter
153 and then Name_Buffer
(2) = '-'
154 and then (Name_Buffer
(1) = 'a'
156 Name_Buffer
(1) = 'i'
158 Name_Buffer
(1) = 's')
159 and then (Name_Buffer
(3) in 'a' .. 'z'
161 Name_Buffer
(3) in 'A' .. 'Z')
166 -- Otherwise check against special list, first padding to 8 characters
168 while Name_Len
< 8 loop
169 Name_Len
:= Name_Len
+ 1;
170 Name_Buffer
(Name_Len
) := ' ';
173 for J
in 1 .. Num_Entries
loop
174 if Name_Buffer
(1 .. 8) = Predef_Names
(J
) then
179 -- Note: when we return False here, the Name_Buffer contains the
180 -- padded file name. This is not defined for clients of the package,
181 -- but is used by Is_Internal_File_Name.
184 end Is_Predefined_File_Name
;
190 procedure Tree_Read
is
199 procedure Tree_Write
is
201 SFN_Table
.Tree_Write
;