1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2000-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 Atree; use Atree;
28 with Sinfo; use Sinfo;
29 with Fname.UF; use Fname.UF;
31 with Namet; use Namet;
32 with Uname; use Uname;
34 package body Impunit is
36 subtype File_Name_8 is String (1 .. 8);
37 type File_List is array (Nat range <>) of File_Name_8;
43 -- The following is a giant string list containing the names of all
44 -- non-implementation internal files, i.e. the complete list of files for
45 -- internal units which a program may legitimately WITH when operating in
46 -- either Ada 95 or Ada 05 mode.
48 -- Note that this list should match the list of units documented in the
49 -- "GNAT Library" section of the GNAT Reference Manual.
51 Non_Imp_File_Names_95 : constant File_List := (
53 ------------------------------------------------------
54 -- Ada Hierarchy Units from Ada-83 Reference Manual --
55 ------------------------------------------------------
57 "a-astaco", -- Ada.Asynchronous_Task_Control
58 "a-calend", -- Ada.Calendar
59 "a-chahan", -- Ada.Characters.Handling
60 "a-charac", -- Ada.Characters
61 "a-chlat1", -- Ada.Characters.Latin_1
62 "a-comlin", -- Ada.Command_Line
63 "a-decima", -- Ada.Decimal
64 "a-direio", -- Ada.Direct_IO
65 "a-dynpri", -- Ada.Dynamic_Priorities
66 "a-except", -- Ada.Exceptions
67 "a-finali", -- Ada.Finalization
68 "a-flteio", -- Ada.Float_Text_IO
69 "a-fwteio", -- Ada.Float_Wide_Text_IO
70 "a-inteio", -- Ada.Integer_Text_IO
71 "a-interr", -- Ada.Interrupts
72 "a-intnam", -- Ada.Interrupts.Names
73 "a-ioexce", -- Ada.IO_Exceptions
74 "a-iwteio", -- Ada.Integer_Wide_Text_IO
75 "a-ncelfu", -- Ada.Numerics.Complex_Elementary_Functions
76 "a-ngcefu", -- Ada.Numerics.Generic_Complex_Elementary_Functions
77 "a-ngcoty", -- Ada.Numerics.Generic_Complex_Types
78 "a-ngelfu", -- Ada.Numerics.Generic_Elementary_Functions
79 "a-nucoty", -- Ada.Numerics.Complex_Types
80 "a-nudira", -- Ada.Numerics.Discrete_Random
81 "a-nuelfu", -- Ada.Numerics.Elementary_Functions
82 "a-nuflra", -- Ada.Numerics.Float_Random
83 "a-numeri", -- Ada.Numerics
84 "a-reatim", -- Ada.Real_Time
85 "a-sequio", -- Ada.Sequential_IO
86 "a-stmaco", -- Ada.Strings.Maps.Constants
87 "a-storio", -- Ada.Storage_IO
88 "a-strbou", -- Ada.Strings.Bounded
89 "a-stream", -- Ada.Streams
90 "a-strfix", -- Ada.Strings.Fixed
91 "a-string", -- Ada.Strings
92 "a-strmap", -- Ada.Strings.Maps
93 "a-strunb", -- Ada.Strings.Unbounded
94 "a-ststio", -- Ada.Streams.Stream_IO
95 "a-stwibo", -- Ada.Strings.Wide_Bounded
96 "a-stwifi", -- Ada.Strings.Wide_Fixed
97 "a-stwima", -- Ada.Strings.Wide_Maps
98 "a-stwiun", -- Ada.Strings.Wide_Unbounded
99 "a-swmwco", -- Ada.Strings.Wide_Maps.Wide_Constants
100 "a-sytaco", -- Ada.Synchronous_Task_Control
101 "a-tags ", -- Ada.Tags
102 "a-tasatt", -- Ada.Task_Attributes
103 "a-taside", -- Ada.Task_Identification
104 "a-teioed", -- Ada.Text_IO.Editing
105 "a-textio", -- Ada.Text_IO
106 "a-ticoio", -- Ada.Text_IO.Complex_IO
107 "a-titest", -- Ada.Text_IO.Text_Streams
108 "a-unccon", -- Ada.Unchecked_Conversion
109 "a-uncdea", -- Ada.Unchecked_Deallocation
110 "a-witeio", -- Ada.Wide_Text_IO
111 "a-wtcoio", -- Ada.Wide_Text_IO.Complex_IO
112 "a-wtedit", -- Ada.Wide_Text_IO.Editing
113 "a-wttest", -- Ada.Wide_Text_IO.Text_Streams
115 -------------------------------------------------
116 -- RM Required Additions to Ada for GNAT Types --
117 -------------------------------------------------
119 "a-lfteio", -- Ada.Long_Float_Text_IO
120 "a-lfwtio", -- Ada.Long_Float_Wide_Text_IO
121 "a-liteio", -- Ada.Long_Integer_Text_IO
122 "a-liwtio", -- Ada.Long_Integer_Wide_Text_IO
123 "a-llftio", -- Ada.Long_Long_Float_Text_IO
124 "a-llfwti", -- Ada.Long_Long_Float_Wide_Text_IO
125 "a-llitio", -- Ada.Long_Long_Integer_Text_IO
126 "a-lliwti", -- Ada.Long_Long_Integer_Wide_Text_IO
127 "a-nlcefu", -- Ada.Long_Complex_Elementary_Functions
128 "a-nlcoty", -- Ada.Numerics.Long_Complex_Types
129 "a-nlelfu", -- Ada.Numerics.Long_Elementary_Functions
130 "a-nllcef", -- Ada.Long_Long_Complex_Elementary_Functions
131 "a-nllefu", -- Ada.Numerics.Long_Long_Elementary_Functions
132 "a-nllcty", -- Ada.Numerics.Long_Long_Complex_Types
133 "a-nscefu", -- Ada.Short_Complex_Elementary_Functions
134 "a-nscoty", -- Ada.Numerics.Short_Complex_Types
135 "a-nselfu", -- Ada.Numerics.Short_Elementary_Functions
136 "a-sfteio", -- Ada.Short_Float_Text_IO
137 "a-sfwtio", -- Ada.Short_Float_Wide_Text_IO
138 "a-siteio", -- Ada.Short_Integer_Text_IO
139 "a-siwtio", -- Ada.Short_Integer_Wide_Text_IO
140 "a-ssitio", -- Ada.Short_Short_Integer_Text_IO
141 "a-ssiwti", -- Ada.Short_Short_Integer_Wide_Text_IO
143 -----------------------------------
144 -- GNAT Defined Additions to Ada --
145 -----------------------------------
147 "a-chlat9", -- Ada.Characters.Latin_9
148 "a-clrefi", -- Ada.Command_Line.Response_File
149 "a-colien", -- Ada.Command_Line.Environment
150 "a-colire", -- Ada.Command_Line.Remove
151 "a-cwila1", -- Ada.Characters.Wide_Latin_1
152 "a-cwila9", -- Ada.Characters.Wide_Latin_9
153 "a-diocst", -- Ada.Direct_IO.C_Streams
154 "a-einuoc", -- Ada.Exceptions.Is_Null_Occurrence
155 "a-elchha", -- Ada.Exceptions.Last_Chance_Handler
156 "a-exctra", -- Ada.Exceptions.Traceback
157 "a-siocst", -- Ada.Sequential_IO.C_Streams
158 "a-ssicst", -- Ada.Streams.Stream_IO.C_Streams
159 "a-suteio", -- Ada.Strings.Unbounded.Text_IO
160 "a-swuwti", -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
161 "a-taidim", -- Ada.Task_Identification.Image
162 "a-tiocst", -- Ada.Text_IO.C_Streams
163 "a-wtcstr", -- Ada.Wide_Text_IO.C_Streams
165 -- Note: strictly the next two should be Ada 2005 units, but it seems
166 -- harmless (and useful) to make then available in Ada 95 mode, since
167 -- they only deal with Wide_Character, not Wide_Wide_Character.
169 "a-wichun", -- Ada.Wide_Characters.Unicode
170 "a-widcha", -- Ada.Wide_Characters
172 ---------------------------
173 -- GNAT Special IO Units --
174 ---------------------------
176 -- As further explained elsewhere (see Sem_Ch10), the internal
177 -- packages of Text_IO and Wide_Text_IO are actually implemented
178 -- as separate children, but this fact is intended to be hidden
179 -- from the user completely. Any attempt to WITH one of these
180 -- units will be diagnosed as an error later on, but for now we
181 -- do not consider these internal implementation units (if we did,
182 -- then we would get a junk warning which would be confusing and
183 -- unecessary, given that we generate a clear error message).
185 "a-tideio", -- Ada.Text_IO.Decimal_IO
186 "a-tienio", -- Ada.Text_IO.Enumeration_IO
187 "a-tifiio", -- Ada.Text_IO.Fixed_IO
188 "a-tiflio", -- Ada.Text_IO.Float_IO
189 "a-tiinio", -- Ada.Text_IO.Integer_IO
190 "a-tiinio", -- Ada.Text_IO.Integer_IO
191 "a-timoio", -- Ada.Text_IO.Modular_IO
192 "a-wtdeio", -- Ada.Wide_Text_IO.Decimal_IO
193 "a-wtenio", -- Ada.Wide_Text_IO.Enumeration_IO
194 "a-wtfiio", -- Ada.Wide_Text_IO.Fixed_IO
195 "a-wtflio", -- Ada.Wide_Text_IO.Float_IO
196 "a-wtinio", -- Ada.Wide_Text_IO.Integer_IO
197 "a-wtmoio", -- Ada.Wide_Text_IO.Modular_IO
199 ------------------------
200 -- GNAT Library Units --
201 ------------------------
203 "g-altive", -- GNAT.Altivec
204 "g-alvety", -- GNAT.Altivec.Vector_Types
205 "g-alvevi", -- GNAT.Altivec.Vector_Views
206 "g-alveop", -- GNAT.Altivec.Vector_Operations
207 "g-altcon", -- GNAT.Altivec.Conversions
208 "g-arrspl", -- GNAT.Array_Split
209 "g-awk ", -- GNAT.AWK
210 "g-boubuf", -- GNAT.Bounded_Buffers
211 "g-boumai", -- GNAT.Bounded_Mailboxes
212 "g-bubsor", -- GNAT.Bubble_Sort
213 "g-busora", -- GNAT.Bubble_Sort_A
214 "g-busorg", -- GNAT.Bubble_Sort_G
215 "g-bytswa", -- Gnat.Byte_Swapping
216 "g-calend", -- GNAT.Calendar
217 "g-casuti", -- GNAT.Case_Util
218 "g-catiio", -- GNAT.Calendar.Time_IO
219 "g-cgi ", -- GNAT.CGI
220 "g-cgicoo", -- GNAT.CGI.Cookie
221 "g-cgideb", -- GNAT.CGI.Debug
222 "g-comlin", -- GNAT.Command_Line
223 "g-comver", -- GNAT.Compiler_Version
224 "g-crc32 ", -- GNAT.CRC32
225 "g-ctrl_c", -- GNAT.Ctrl_C
226 "g-curexc", -- GNAT.Current_Exception
227 "g-debpoo", -- GNAT.Debug_Pools
228 "g-debuti", -- GNAT.Debug_Utilities
229 "g-diopit", -- GNAT.Directory_Operations.Iteration
230 "g-dirope", -- GNAT.Directory_Operations
231 "g-dynhta", -- GNAT.Dynamic_HTables
232 "g-dyntab", -- GNAT.Dynamic_Tables
233 "g-excact", -- GNAT.Exception_Actions
234 "g-except", -- GNAT.Exceptions
235 "g-exctra", -- GNAT.Exception_Traces
236 "g-expect", -- GNAT.Expect
237 "g-flocon", -- GNAT.Float_Control
238 "g-heasor", -- GNAT.Heap_Sort
239 "g-hesora", -- GNAT.Heap_Sort_A
240 "g-hesorg", -- GNAT.Heap_Sort_G
241 "g-htable", -- GNAT.Htable
243 "g-io_aux", -- GNAT.IO_Aux
244 "g-locfil", -- GNAT.Lock_Files
245 "g-md5 ", -- GNAT.MD5
246 "g-memdum", -- GNAT.Memory_Dump
247 "g-moreex", -- GNAT.Most_Recent_Exception
248 "g-os_lib", -- GNAT.Os_Lib
249 "g-pehage", -- GNAT.Perfect_Hash_Generators
250 "g-regexp", -- GNAT.Regexp
251 "g-regist", -- GNAT.Registry
252 "g-regpat", -- GNAT.Regpat
253 "g-semaph", -- GNAT.Semaphores
254 "g-sestin", -- GNAT.Secondary_Stack_Info
255 "g-sha1 ", -- GNAT.SHA1
256 "g-signal", -- GNAT.Signals
257 "g-socket", -- GNAT.Sockets
258 "g-souinf", -- GNAT.Source_Info
259 "g-speche", -- GNAT.Spell_Checker
260 "g-spipat", -- GNAT.Spitbol.Patterns
261 "g-spitbo", -- GNAT.Spitbol
262 "g-sptabo", -- GNAT.Spitbol.Table_Boolean
263 "g-sptain", -- GNAT.Spitbol.Table_Integer
264 "g-sptavs", -- GNAT.Spitbol.Table_Vstring
265 "g-string", -- GNAT.Strings
266 "g-strspl", -- GNAT.String_Split
267 "g-table ", -- GNAT.Table
268 "g-tasloc", -- GNAT.Task_Lock
269 "g-thread", -- GNAT.Threads
270 "g-traceb", -- GNAT.Traceback
271 "g-trasym", -- GNAT.Traceback.Symbolic
272 "g-utf_32", -- GNAT.UTF_32
273 "g-wistsp", -- GNAT.Wide_String_Split
275 -----------------------------------------------------
276 -- Interface Hierarchy Units from Reference Manual --
277 -----------------------------------------------------
279 "i-c ", -- Interfaces.C
280 "i-cobol ", -- Interfaces.Cobol
281 "i-cpoint", -- Interfaces.C.Pointers
282 "i-cstrin", -- Interfaces.C.Strings
283 "i-fortra", -- Interfaces.Fortran
285 ------------------------------------------
286 -- GNAT Defined Additions to Interfaces --
287 ------------------------------------------
289 "i-cexten", -- Interfaces.C.Extensions
290 "i-cpp ", -- Interfaces.CPP
291 "i-cstrea", -- Interfaces.C.Streams
292 "i-java ", -- Interfaces.Java
293 "i-pacdec", -- Interfaces.Packed_Decimal
294 "i-vxwoio", -- Interfaces.VxWorks.IO
295 "i-vxwork", -- Interfaces.VxWorks
297 --------------------------------------------------
298 -- System Hierarchy Units from Reference Manual --
299 --------------------------------------------------
301 "s-atacco", -- System.Address_To_Access_Conversions
302 "s-maccod", -- System.Machine_Code
303 "s-rpc ", -- System.Rpc
304 "s-stoele", -- System.Storage_Elements
305 "s-stopoo", -- System.Storage_Pools
307 --------------------------------------
308 -- GNAT Defined Additions to System --
309 --------------------------------------
311 "s-addima", -- System.Address_Image
312 "s-assert", -- System.Assertions
313 "s-memory", -- System.Memory
314 "s-os_lib", -- System.Os_Lib
315 "s-parint", -- System.Partition_Interface
316 "s-pooglo", -- System.Pool_Global
317 "s-pooloc", -- System.Pool_Local
318 "s-restri", -- System.Restrictions
319 "s-rident", -- System.Rident
320 "s-tasinf", -- System.Task_Info
321 "s-wchcnv", -- System.Wch_Cnv
322 "s-wchcon"); -- System.Wch_Con
328 -- The following units should be used only in Ada 05 mode
330 Non_Imp_File_Names_05 : constant File_List := (
332 --------------------------------------------------------
333 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
334 --------------------------------------------------------
336 "a-calari", -- Ada.Calendar.Arithmetic
337 "a-calfor", -- Ada.Calendar.Formatting
338 "a-catizo", -- Ada.Calendar.Time_Zones
339 "a-cdlili", -- Ada.Containers.Doubly_Linked_Lists
340 "a-cgarso", -- Ada.Containers.Generic_Array_Sort
341 "a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
342 "a-chacon", -- Ada.Characters.Conversions
343 "a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
344 "a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
345 "a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
346 "a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
347 "a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
348 "a-cohama", -- Ada.Containers.Hashed_Maps
349 "a-cohase", -- Ada.Containers.Hashed_Sets
350 "a-coinve", -- Ada.Containers.Indefinite_Vectors
351 "a-contai", -- Ada.Containers
352 "a-convec", -- Ada.Containers.Vectors
353 "a-coorma", -- Ada.Containers.Ordered_Maps
354 "a-coorse", -- Ada.Containers.Ordered_Sets
355 "a-coteio", -- Ada.Complex_Text_IO
356 "a-direct", -- Ada.Directories
357 "a-diroro", -- Ada.Dispatching.Round_Robin
358 "a-dispat", -- Ada.Dispatching
359 "a-envvar", -- Ada.Environment_Variables
360 "a-exetim", -- Ada.Execution_Time
361 "a-extiti", -- Ada.Execution_Time.Timers
362 "a-rttiev", -- Ada.Real_Time.Timing_Events
363 "a-ngcoar", -- Ada.Numerics.Generic_Complex_Arrays
364 "a-ngrear", -- Ada.Numerics.Generic_Real_Arrays
365 "a-nucoar", -- Ada.Numerics.Complex_Arrays
366 "a-nurear", -- Ada.Numerics.Real_Arrays
367 "a-stboha", -- Ada.Strings.Bounded.Hash
368 "a-stfiha", -- Ada.Strings.Fixed.Hash
369 "a-strhas", -- Ada.Strings.Hash
370 "a-stunha", -- Ada.Strings.Unbounded.Hash
371 "a-stwiha", -- Ada.Strings.Wide_Hash
372 "a-stzbou", -- Ada.Strings.Wide_Wide_Bounded
373 "a-stzfix", -- Ada.Strings.Wide_Wide_Fixed
374 "a-stzhas", -- Ada.Strings.Wide_Wide_Hash
375 "a-stzmap", -- Ada.Strings.Wide_Wide_Maps
376 "a-stzunb", -- Ada.Strings.Wide_Wide_Unbounded
377 "a-swbwha", -- Ada.Strings.Wide_Bounded.Wide_Hash
378 "a-swfwha", -- Ada.Strings.Wide_Fixed.Wide_Hash
379 "a-swuwha", -- Ada.Strings.Wide_Unbounded.Wide_Hash
380 "a-szbzha", -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
381 "a-szfzha", -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
382 "a-szmzco", -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
383 "a-szuzha", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
384 "a-taster", -- Ada.Task_Termination
385 "a-tgdico", -- Ada.Tags.Generic_Dispatching_Constructor
386 "a-tiboio", -- Ada.Text_IO.Bounded_IO
387 "a-tiunio", -- Ada.Text_IO.Unbounded_IO
388 "a-wichun", -- Ada.Wide_Characters.Unicode
389 "a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO
390 "a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO
391 "a-zchara", -- Ada.Wide_Wide_Characters
392 "a-ztcoio", -- Ada.Wide_Wide_Text_IO.Complex_IO
393 "a-ztedit", -- Ada.Wide_Wide_Text_IO.Editing
394 "a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams
395 "a-ztexio", -- Ada.Wide_Wide_Text_IO
396 "a-zzboio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
397 "a-zzunio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
399 ------------------------------------------------------
400 -- RM Required Additions to Ada 2005 for GNAT Types --
401 ------------------------------------------------------
403 "a-lcteio", -- Ada.Long_Complex_Text_IO
404 "a-lfztio", -- Ada.Long_Float_Wide_Wide_Text_IO
405 "a-liztio", -- Ada.Long_Integer_Wide_Wide_Text_IO
406 "a-llctio", -- Ada.Long_Long_Complex_Text_IO
407 "a-llfzti", -- Ada.Long_Long_Float_Wide_Wide_Text_IO
408 "a-llizti", -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
409 "a-nlcoar", -- Ada.Numerics.Long_Complex_Arrays
410 "a-nllcar", -- Ada.Numerics.Long_Long_Complex_Arrays
411 "a-nllrar", -- Ada.Numerics.Long_Long_Real_Arrays
412 "a-nlrear", -- Ada.Numerics.Long_Real_Arrays
413 "a-scteio", -- Ada.Short_Complex_Text_IO
414 "a-sfztio", -- Ada.Short_Float_Wide_Wide_Text_IO
415 "a-siztio", -- Ada.Short_Integer_Wide_Wide_Text_IO
416 "a-ssizti", -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
417 "a-ztcstr", -- Ada.Wide_Wide_Text_IO.C_Streams
419 ----------------------------------------
420 -- GNAT Defined Additions to Ada 2005 --
421 ----------------------------------------
423 "a-cgaaso", -- Ada.Containers.Generic_Anonymous_Array_Sort
424 "a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
425 "a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
426 "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
427 "a-coormu", -- Ada.Containers.Ordered_Multisets
428 "a-crdlli", -- Ada.Containers.Restricted_Doubly_Linked_Lists
429 "a-secain", -- Ada.Strings.Equal_Case_Insensitive
430 "a-shcain", -- Ada.Strings.Hash_Case_Insensitive
431 "a-slcain", -- Ada.Strings.Less_Case_Insensitive
432 "a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
433 "a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
435 ---------------------------
436 -- GNAT Special IO Units --
437 ---------------------------
439 -- See Ada 95 section for further information. These packages are for the
440 -- implementation of the Wide_Wide_Text_IO generic packages.
442 "a-ztdeio", -- Ada.Wide_Wide_Text_IO.Decimal_IO
443 "a-ztenio", -- Ada.Wide_Wide_Text_IO.Enumeration_IO
444 "a-ztfiio", -- Ada.Wide_Wide_Text_IO.Fixed_IO
445 "a-ztflio", -- Ada.Wide_Wide_Text_IO.Float_IO
446 "a-ztinio", -- Ada.Wide_Wide_Text_IO.Integer_IO
447 "a-ztmoio", -- Ada.Wide_Wide_Text_IO.Modular_IO
449 ------------------------
450 -- GNAT Library Units --
451 ------------------------
453 "g-zstspl"); -- GNAT.Wide_Wide_String_Split
455 ----------------------
456 -- Get_Kind_Of_Unit --
457 ----------------------
459 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
460 Fname : constant File_Name_Type := Unit_File_Name (U);
463 -- If length of file name is greater than 12, not predefined.
464 -- The value 12 here is an 8 char name with extension .ads.
466 if Length_Of_Name (Fname) > 12 then
467 return Not_Predefined_Unit;
470 -- Otherwise test file name
472 Get_Name_String (Fname);
474 -- Not predefined if file name does not start with a- g- s- i-
477 or else Name_Buffer (2) /= '-'
478 or else (Name_Buffer (1) /= 'a'
480 Name_Buffer (1) /= 'g'
482 Name_Buffer (1) /= 'i'
484 Name_Buffer (1) /= 's')
486 return Not_Predefined_Unit;
489 -- Not predefined if file name does not end in .ads. This can
490 -- happen when non-standard file names are being used.
492 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
493 return Not_Predefined_Unit;
496 -- Otherwise normalize file name to 8 characters
498 Name_Len := Name_Len - 4;
499 while Name_Len < 8 loop
500 Name_Len := Name_Len + 1;
501 Name_Buffer (Name_Len) := ' ';
504 -- See if name is in 95 list
506 for J in Non_Imp_File_Names_95'Range loop
507 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
512 -- See if name is in 05 list
514 for J in Non_Imp_File_Names_05'Range loop
515 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
520 -- Only remaining special possibilities are children of System.RPC and
521 -- System.Garlic and special files of the form System.Aux...
523 Get_Name_String (Unit_Name (U));
526 and then Name_Buffer (1 .. 11) = "system.rpc."
532 and then Name_Buffer (1 .. 14) = "system.garlic."
538 and then Name_Buffer (1 .. 10) = "system.aux"
543 -- All tests failed, this is definitely an implementation unit
545 return Implementation_Unit;
546 end Get_Kind_Of_Unit;
552 function Is_Known_Unit (Nam : Node_Id) return Boolean is
553 Unam : Unit_Name_Type;
554 Fnam : File_Name_Type;
557 -- If selector is not an identifier (e.g. it is a character literal or
558 -- some junk from a previous error), then definitely not a known unit.
560 if Nkind (Selector_Name (Nam)) /= N_Identifier then
564 -- Otherwise get corresponding file name
566 Unam := Get_Unit_Name (Nam);
567 Fnam := Get_File_Name (Unam, Subunit => False);
568 Get_Name_String (Fnam);
570 -- Remove extension from file name
572 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then
573 Name_Len := Name_Len - 4;
578 -- Pad name to 8 characters
580 while Name_Len < 8 loop
581 Name_Len := Name_Len + 1;
582 Name_Buffer (Name_Len) := ' ';
585 -- If length more than 8, definitely not a match
587 if Name_Len /= 8 then
591 -- If length is 8, search our tables
593 for J in Non_Imp_File_Names_95'Range loop
594 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
599 for J in Non_Imp_File_Names_05'Range loop
600 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
605 -- If not found, not known
609 -- A safety guard, if we get an exception during this processing then it
610 -- is most likely the result of a previous error, or a peculiar case we
611 -- have not thought of. Since this routine is only used for error message
612 -- refinement, we will just return False.