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 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
35 with Hostparm
; use Hostparm
;
37 with Types
; use Types
;
41 -----------------------------
42 -- Dummy Table Definitions --
43 -----------------------------
45 -- The following table was used in old versions of the compiler. We retain
46 -- the declarations here for compatibility with old tree files. The new
47 -- version of the compiler does not use this table, and will write out a
48 -- dummy empty table for Tree_Write.
50 type SFN_Entry
is record
55 package SFN_Table
is new Table
.Table
(
56 Table_Component_Type
=> SFN_Entry
,
57 Table_Index_Type
=> Int
,
59 Table_Initial
=> Alloc
.SFN_Table_Initial
,
60 Table_Increment
=> Alloc
.SFN_Table_Increment
,
61 Table_Name
=> "Fname_Dummy_Table");
63 ---------------------------
64 -- Is_Internal_File_Name --
65 ---------------------------
67 function Is_Internal_File_Name
68 (Fname
: File_Name_Type
;
69 Renamings_Included
: Boolean := True) return Boolean
72 if Is_Predefined_File_Name
(Fname
, Renamings_Included
) then
75 -- Once Is_Predefined_File_Name has been called and returns False,
76 -- Name_Buffer contains Fname and Name_Len is set to 8.
78 elsif Name_Buffer
(1 .. 2) = "g-"
79 or else Name_Buffer
(1 .. 8) = "gnat "
85 (Name_Buffer
(1 .. 4) = "dec-"
86 or else Name_Buffer
(1 .. 8) = "dec ")
93 end Is_Internal_File_Name
;
95 -----------------------------
96 -- Is_Predefined_File_Name --
97 -----------------------------
99 -- This should really be a test of unit name, given the possibility of
100 -- pragma Source_File_Name setting arbitrary file names for any files???
102 -- Once Is_Predefined_File_Name has been called and returns False,
103 -- Name_Buffer contains Fname and Name_Len is set to 8. This is used
104 -- only by Is_Internal_File_Name, and is not part of the official
105 -- external interface of this function.
107 function Is_Predefined_File_Name
108 (Fname
: File_Name_Type
;
109 Renamings_Included
: Boolean := True) return Boolean
112 Get_Name_String
(Fname
);
113 return Is_Predefined_File_Name
(Renamings_Included
);
114 end Is_Predefined_File_Name
;
116 function Is_Predefined_File_Name
117 (Renamings_Included
: Boolean := True) return Boolean
119 subtype Str8
is String (1 .. 8);
121 Predef_Names
: constant array (1 .. 11) of Str8
:=
123 "interfac", -- Interfaces
126 -- Remaining entries are only considered if Renamings_Included true
128 "calendar", -- Calendar
129 "machcode", -- Machine_Code
130 "unchconv", -- Unchecked_Conversion
131 "unchdeal", -- Unchecked_Deallocation
132 "directio", -- Direct_IO
133 "ioexcept", -- IO_Exceptions
134 "sequenio", -- Sequential_IO
135 "text_io "); -- Text_IO
137 Num_Entries
: constant Natural :=
138 3 + 8 * Boolean'Pos (Renamings_Included
);
141 -- Remove extension (if present)
143 if Name_Len
> 4 and then Name_Buffer
(Name_Len
- 3) = '.' then
144 Name_Len
:= Name_Len
- 4;
147 -- Definitely false if longer than 12 characters (8.3)
152 -- Definitely predefined if prefix is a- i- or s- followed by letter
155 and then Name_Buffer
(2) = '-'
156 and then (Name_Buffer
(1) = 'a'
158 Name_Buffer
(1) = 'i'
160 Name_Buffer
(1) = 's')
161 and then (Name_Buffer
(3) in 'a' .. 'z'
163 Name_Buffer
(3) in 'A' .. 'Z')
168 -- Otherwise check against special list, first padding to 8 characters
170 while Name_Len
< 8 loop
171 Name_Len
:= Name_Len
+ 1;
172 Name_Buffer
(Name_Len
) := ' ';
175 for J
in 1 .. Num_Entries
loop
176 if Name_Buffer
(1 .. 8) = Predef_Names
(J
) then
181 -- Note: when we return False here, the Name_Buffer contains the
182 -- padded file name. This is not defined for clients of the package,
183 -- but is used by Is_Internal_File_Name.
186 end Is_Predefined_File_Name
;
192 procedure Tree_Read
is
201 procedure Tree_Write
is
203 SFN_Table
.Tree_Write
;