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-rannum", -- GNAT.Random_Numbers
251 "g-regexp", -- GNAT.Regexp
252 "g-regist", -- GNAT.Registry
253 "g-regpat", -- GNAT.Regpat
254 "g-semaph", -- GNAT.Semaphores
255 "g-sestin", -- GNAT.Secondary_Stack_Info
256 "g-sha1 ", -- GNAT.SHA1
257 "g-signal", -- GNAT.Signals
258 "g-socket", -- GNAT.Sockets
259 "g-souinf", -- GNAT.Source_Info
260 "g-speche", -- GNAT.Spell_Checker
261 "g-spipat", -- GNAT.Spitbol.Patterns
262 "g-spitbo", -- GNAT.Spitbol
263 "g-sptabo", -- GNAT.Spitbol.Table_Boolean
264 "g-sptain", -- GNAT.Spitbol.Table_Integer
265 "g-sptavs", -- GNAT.Spitbol.Table_Vstring
266 "g-string", -- GNAT.Strings
267 "g-strspl", -- GNAT.String_Split
268 "g-table ", -- GNAT.Table
269 "g-tasloc", -- GNAT.Task_Lock
270 "g-thread", -- GNAT.Threads
271 "g-traceb", -- GNAT.Traceback
272 "g-trasym", -- GNAT.Traceback.Symbolic
273 "g-utf_32", -- GNAT.UTF_32
274 "g-wistsp", -- GNAT.Wide_String_Split
276 -----------------------------------------------------
277 -- Interface Hierarchy Units from Reference Manual --
278 -----------------------------------------------------
280 "i-c ", -- Interfaces.C
281 "i-cobol ", -- Interfaces.Cobol
282 "i-cpoint", -- Interfaces.C.Pointers
283 "i-cstrin", -- Interfaces.C.Strings
284 "i-fortra", -- Interfaces.Fortran
286 ------------------------------------------
287 -- GNAT Defined Additions to Interfaces --
288 ------------------------------------------
290 "i-cexten", -- Interfaces.C.Extensions
291 "i-cpp ", -- Interfaces.CPP
292 "i-cstrea", -- Interfaces.C.Streams
293 "i-java ", -- Interfaces.Java
294 "i-pacdec", -- Interfaces.Packed_Decimal
295 "i-vxwoio", -- Interfaces.VxWorks.IO
296 "i-vxwork", -- Interfaces.VxWorks
298 --------------------------------------------------
299 -- System Hierarchy Units from Reference Manual --
300 --------------------------------------------------
302 "s-atacco", -- System.Address_To_Access_Conversions
303 "s-maccod", -- System.Machine_Code
304 "s-rpc ", -- System.Rpc
305 "s-stoele", -- System.Storage_Elements
306 "s-stopoo", -- System.Storage_Pools
308 --------------------------------------
309 -- GNAT Defined Additions to System --
310 --------------------------------------
312 "s-addima", -- System.Address_Image
313 "s-assert", -- System.Assertions
314 "s-memory", -- System.Memory
315 "s-os_lib", -- System.Os_Lib
316 "s-parint", -- System.Partition_Interface
317 "s-pooglo", -- System.Pool_Global
318 "s-pooloc", -- System.Pool_Local
319 "s-restri", -- System.Restrictions
320 "s-rident", -- System.Rident
321 "s-tasinf", -- System.Task_Info
322 "s-wchcnv", -- System.Wch_Cnv
323 "s-wchcon"); -- System.Wch_Con
329 -- The following units should be used only in Ada 05 mode
331 Non_Imp_File_Names_05 : constant File_List := (
333 --------------------------------------------------------
334 -- Ada Hierarchy Units from Ada 2005 Reference Manual --
335 --------------------------------------------------------
337 "a-assert", -- Ada.Assertions
338 "a-calari", -- Ada.Calendar.Arithmetic
339 "a-calfor", -- Ada.Calendar.Formatting
340 "a-catizo", -- Ada.Calendar.Time_Zones
341 "a-cdlili", -- Ada.Containers.Doubly_Linked_Lists
342 "a-cgarso", -- Ada.Containers.Generic_Array_Sort
343 "a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
344 "a-chacon", -- Ada.Characters.Conversions
345 "a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
346 "a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
347 "a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
348 "a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
349 "a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
350 "a-cohama", -- Ada.Containers.Hashed_Maps
351 "a-cohase", -- Ada.Containers.Hashed_Sets
352 "a-coinve", -- Ada.Containers.Indefinite_Vectors
353 "a-contai", -- Ada.Containers
354 "a-convec", -- Ada.Containers.Vectors
355 "a-coorma", -- Ada.Containers.Ordered_Maps
356 "a-coorse", -- Ada.Containers.Ordered_Sets
357 "a-coteio", -- Ada.Complex_Text_IO
358 "a-direct", -- Ada.Directories
359 "a-diroro", -- Ada.Dispatching.Round_Robin
360 "a-dispat", -- Ada.Dispatching
361 "a-envvar", -- Ada.Environment_Variables
362 "a-exetim", -- Ada.Execution_Time
363 "a-extiti", -- Ada.Execution_Time.Timers
364 "a-rttiev", -- Ada.Real_Time.Timing_Events
365 "a-ngcoar", -- Ada.Numerics.Generic_Complex_Arrays
366 "a-ngrear", -- Ada.Numerics.Generic_Real_Arrays
367 "a-nucoar", -- Ada.Numerics.Complex_Arrays
368 "a-nurear", -- Ada.Numerics.Real_Arrays
369 "a-stboha", -- Ada.Strings.Bounded.Hash
370 "a-stfiha", -- Ada.Strings.Fixed.Hash
371 "a-strhas", -- Ada.Strings.Hash
372 "a-stunha", -- Ada.Strings.Unbounded.Hash
373 "a-stwiha", -- Ada.Strings.Wide_Hash
374 "a-stzbou", -- Ada.Strings.Wide_Wide_Bounded
375 "a-stzfix", -- Ada.Strings.Wide_Wide_Fixed
376 "a-stzhas", -- Ada.Strings.Wide_Wide_Hash
377 "a-stzmap", -- Ada.Strings.Wide_Wide_Maps
378 "a-stzunb", -- Ada.Strings.Wide_Wide_Unbounded
379 "a-swbwha", -- Ada.Strings.Wide_Bounded.Wide_Hash
380 "a-swfwha", -- Ada.Strings.Wide_Fixed.Wide_Hash
381 "a-swuwha", -- Ada.Strings.Wide_Unbounded.Wide_Hash
382 "a-szbzha", -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
383 "a-szfzha", -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
384 "a-szmzco", -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
385 "a-szuzha", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
386 "a-taster", -- Ada.Task_Termination
387 "a-tgdico", -- Ada.Tags.Generic_Dispatching_Constructor
388 "a-tiboio", -- Ada.Text_IO.Bounded_IO
389 "a-tiunio", -- Ada.Text_IO.Unbounded_IO
390 "a-wichun", -- Ada.Wide_Characters.Unicode
391 "a-wwboio", -- Ada.Wide_Text_IO.Wide_Bounded_IO
392 "a-wwunio", -- Ada.Wide_Text_IO.Wide_Unbounded_IO
393 "a-zchara", -- Ada.Wide_Wide_Characters
394 "a-ztcoio", -- Ada.Wide_Wide_Text_IO.Complex_IO
395 "a-ztedit", -- Ada.Wide_Wide_Text_IO.Editing
396 "a-zttest", -- Ada.Wide_Wide_Text_IO.Text_Streams
397 "a-ztexio", -- Ada.Wide_Wide_Text_IO
398 "a-zzboio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
399 "a-zzunio", -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
401 ------------------------------------------------------
402 -- RM Required Additions to Ada 2005 for GNAT Types --
403 ------------------------------------------------------
405 "a-lcteio", -- Ada.Long_Complex_Text_IO
406 "a-lfztio", -- Ada.Long_Float_Wide_Wide_Text_IO
407 "a-liztio", -- Ada.Long_Integer_Wide_Wide_Text_IO
408 "a-llctio", -- Ada.Long_Long_Complex_Text_IO
409 "a-llfzti", -- Ada.Long_Long_Float_Wide_Wide_Text_IO
410 "a-llizti", -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
411 "a-nlcoar", -- Ada.Numerics.Long_Complex_Arrays
412 "a-nllcar", -- Ada.Numerics.Long_Long_Complex_Arrays
413 "a-nllrar", -- Ada.Numerics.Long_Long_Real_Arrays
414 "a-nlrear", -- Ada.Numerics.Long_Real_Arrays
415 "a-scteio", -- Ada.Short_Complex_Text_IO
416 "a-sfztio", -- Ada.Short_Float_Wide_Wide_Text_IO
417 "a-siztio", -- Ada.Short_Integer_Wide_Wide_Text_IO
418 "a-ssizti", -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
419 "a-ztcstr", -- Ada.Wide_Wide_Text_IO.C_Streams
421 ----------------------------------------
422 -- GNAT Defined Additions to Ada 2005 --
423 ----------------------------------------
425 "a-cgaaso", -- Ada.Containers.Generic_Anonymous_Array_Sort
426 "a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
427 "a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
428 "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
429 "a-coormu", -- Ada.Containers.Ordered_Multisets
430 "a-crdlli", -- Ada.Containers.Restricted_Doubly_Linked_Lists
431 "a-secain", -- Ada.Strings.Equal_Case_Insensitive
432 "a-shcain", -- Ada.Strings.Hash_Case_Insensitive
433 "a-slcain", -- Ada.Strings.Less_Case_Insensitive
434 "a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
435 "a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
437 ---------------------------
438 -- GNAT Special IO Units --
439 ---------------------------
441 -- See Ada 95 section for further information. These packages are for the
442 -- implementation of the Wide_Wide_Text_IO generic packages.
444 "a-ztdeio", -- Ada.Wide_Wide_Text_IO.Decimal_IO
445 "a-ztenio", -- Ada.Wide_Wide_Text_IO.Enumeration_IO
446 "a-ztfiio", -- Ada.Wide_Wide_Text_IO.Fixed_IO
447 "a-ztflio", -- Ada.Wide_Wide_Text_IO.Float_IO
448 "a-ztinio", -- Ada.Wide_Wide_Text_IO.Integer_IO
449 "a-ztmoio", -- Ada.Wide_Wide_Text_IO.Modular_IO
451 ------------------------
452 -- GNAT Library Units --
453 ------------------------
455 "g-zstspl"); -- GNAT.Wide_Wide_String_Split
457 ----------------------
458 -- Get_Kind_Of_Unit --
459 ----------------------
461 function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
462 Fname : constant File_Name_Type := Unit_File_Name (U);
465 -- If length of file name is greater than 12, not predefined.
466 -- The value 12 here is an 8 char name with extension .ads.
468 if Length_Of_Name (Fname) > 12 then
469 return Not_Predefined_Unit;
472 -- Otherwise test file name
474 Get_Name_String (Fname);
476 -- Not predefined if file name does not start with a- g- s- i-
479 or else Name_Buffer (2) /= '-'
480 or else (Name_Buffer (1) /= 'a'
482 Name_Buffer (1) /= 'g'
484 Name_Buffer (1) /= 'i'
486 Name_Buffer (1) /= 's')
488 return Not_Predefined_Unit;
491 -- Not predefined if file name does not end in .ads. This can
492 -- happen when non-standard file names are being used.
494 if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
495 return Not_Predefined_Unit;
498 -- Otherwise normalize file name to 8 characters
500 Name_Len := Name_Len - 4;
501 while Name_Len < 8 loop
502 Name_Len := Name_Len + 1;
503 Name_Buffer (Name_Len) := ' ';
506 -- See if name is in 95 list
508 for J in Non_Imp_File_Names_95'Range loop
509 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
514 -- See if name is in 05 list
516 for J in Non_Imp_File_Names_05'Range loop
517 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
522 -- Only remaining special possibilities are children of System.RPC and
523 -- System.Garlic and special files of the form System.Aux...
525 Get_Name_String (Unit_Name (U));
528 and then Name_Buffer (1 .. 11) = "system.rpc."
534 and then Name_Buffer (1 .. 14) = "system.garlic."
540 and then Name_Buffer (1 .. 10) = "system.aux"
545 -- All tests failed, this is definitely an implementation unit
547 return Implementation_Unit;
548 end Get_Kind_Of_Unit;
554 function Is_Known_Unit (Nam : Node_Id) return Boolean is
555 Unam : Unit_Name_Type;
556 Fnam : File_Name_Type;
559 -- If selector is not an identifier (e.g. it is a character literal or
560 -- some junk from a previous error), then definitely not a known unit.
562 if Nkind (Selector_Name (Nam)) /= N_Identifier then
566 -- Otherwise get corresponding file name
568 Unam := Get_Unit_Name (Nam);
569 Fnam := Get_File_Name (Unam, Subunit => False);
570 Get_Name_String (Fnam);
572 -- Remove extension from file name
574 if Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then
575 Name_Len := Name_Len - 4;
580 -- Pad name to 8 characters
582 while Name_Len < 8 loop
583 Name_Len := Name_Len + 1;
584 Name_Buffer (Name_Len) := ' ';
587 -- If length more than 8, definitely not a match
589 if Name_Len /= 8 then
593 -- If length is 8, search our tables
595 for J in Non_Imp_File_Names_95'Range loop
596 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
601 for J in Non_Imp_File_Names_05'Range loop
602 if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
607 -- If not found, not known
611 -- A safety guard, if we get an exception during this processing then it
612 -- is most likely the result of a previous error, or a peculiar case we
613 -- have not thought of. Since this routine is only used for error message
614 -- refinement, we will just return False.