OSDN Git Service

2005-03-29 Ed Falis <falis@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / impunit.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              I M P U N I T                               --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --           Copyright (C) 2000-2005 Free Software Foundation, Inc.         --
10 --                                                                          --
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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 with Lib;   use Lib;
28 with Namet; use Namet;
29
30 package body Impunit is
31
32    subtype File_Name_8 is String (1 .. 8);
33    type File_List is array (Nat range <>) of File_Name_8;
34
35    ------------------
36    -- Ada 95 Units --
37    ------------------
38
39    --  The following is a giant string list containing the names of all
40    --  non-implementation internal files, i.e. the complete list of files for
41    --  internal units which a program may legitimately WITH when operating in
42    --  either Ada 95 or Ada 05 mode.
43
44    --  Note that this list should match the list of units documented in the
45    --  "GNAT Library" section of the GNAT Reference Manual.
46
47    Non_Imp_File_Names_95 : constant File_List := (
48
49    ------------------------------------------------------
50    -- Ada Hierarchy Units from Ada-83 Reference Manual --
51    ------------------------------------------------------
52
53      "a-astaco",    -- Ada.Asynchronous_Task_Control
54      "a-calend",    -- Ada.Calendar
55      "a-chahan",    -- Ada.Characters.Handling
56      "a-charac",    -- Ada.Characters
57      "a-chlat1",    -- Ada.Characters.Latin_1
58      "a-comlin",    -- Ada.Command_Line
59      "a-decima",    -- Ada.Decimal
60      "a-direio",    -- Ada.Direct_IO
61      "a-dynpri",    -- Ada.Dynamic_Priorities
62      "a-except",    -- Ada.Exceptions
63      "a-finali",    -- Ada.Finalization
64      "a-flteio",    -- Ada.Float_Text_IO
65      "a-fwteio",    -- Ada.Float_Wide_Text_IO
66      "a-inteio",    -- Ada.Integer_Text_IO
67      "a-interr",    -- Ada.Interrupts
68      "a-intnam",    -- Ada.Interrupts.Names
69      "a-ioexce",    -- Ada.IO_Exceptions
70      "a-iwteio",    -- Ada.Integer_Wide_Text_IO
71      "a-ncelfu",    -- Ada.Numerics.Complex_Elementary_Functions
72      "a-ngcefu",    -- Ada.Numerics.Generic_Complex_Elementary_Functions
73      "a-ngcoty",    -- Ada.Numerics.Generic_Complex_Types
74      "a-ngelfu",    -- Ada.Numerics.Generic_Elementary_Functions
75      "a-nucoty",    -- Ada.Numerics.Complex_Types
76      "a-nudira",    -- Ada.Numerics.Discrete_Random
77      "a-nuelfu",    -- Ada.Numerics.Elementary_Functions
78      "a-nuflra",    -- Ada.Numerics.Float_Random
79      "a-numeri",    -- Ada.Numerics
80      "a-reatim",    -- Ada.Real_Time
81      "a-sequio",    -- Ada.Sequential_IO
82      "a-stmaco",    -- Ada.Strings.Maps.Constants
83      "a-storio",    -- Ada.Storage_IO
84      "a-strbou",    -- Ada.Strings.Bounded
85      "a-stream",    -- Ada.Streams
86      "a-strfix",    -- Ada.Strings.Fixed
87      "a-string",    -- Ada.Strings
88      "a-strmap",    -- Ada.Strings.Maps
89      "a-strunb",    -- Ada.Strings.Unbounded
90      "a-ststio",    -- Ada.Streams.Stream_IO
91      "a-stwibo",    -- Ada.Strings.Wide_Bounded
92      "a-stwifi",    -- Ada.Strings.Wide_Fixed
93      "a-stwima",    -- Ada.Strings.Wide_Maps
94      "a-stwiun",    -- Ada.Strings.Wide_Unbounded
95      "a-swmwco",    -- Ada.Strings.Wide_Maps.Wide_Constants
96      "a-sytaco",    -- Ada.Synchronous_Task_Control
97      "a-tags  ",    -- Ada.Tags
98      "a-tasatt",    -- Ada.Task_Attributes
99      "a-taside",    -- Ada.Task_Identification
100      "a-teioed",    -- Ada.Text_IO.Editing
101      "a-textio",    -- Ada.Text_IO
102      "a-ticoio",    -- Ada.Text_IO.Complex_IO
103      "a-titest",    -- Ada.Text_IO.Text_Streams
104      "a-unccon",    -- Ada.Unchecked_Conversion
105      "a-uncdea",    -- Ada.Unchecked_Deallocation
106      "a-witeio",    -- Ada.Wide_Text_IO
107      "a-wtcoio",    -- Ada.Wide_Text_IO.Complex_IO
108      "a-wtedit",    -- Ada.Wide_Text_IO.Editing
109      "a-wttest",    -- Ada.Wide_Text_IO.Text_Streams
110
111    -------------------------------------------------
112    -- RM Required Additions to Ada for GNAT Types --
113    -------------------------------------------------
114
115      "a-lfteio",    -- Ada.Long_Float_Text_IO
116      "a-lfwtio",    -- Ada.Long_Float_Wide_Text_IO
117      "a-liteio",    -- Ada.Long_Integer_Text_IO
118      "a-liwtio",    -- Ada.Long_Integer_Wide_Text_IO
119      "a-llftio",    -- Ada.Long_Long_Float_Text_IO
120      "a-llfwti",    -- Ada.Long_Long_Float_Wide_Text_IO
121      "a-llitio",    -- Ada.Long_Long_Integer_Text_IO
122      "a-lliwti",    -- Ada.Long_Long_Integer_Wide_Text_IO
123      "a-nlcefu",    -- Ada.Long_Complex_Elementary_Functions
124      "a-nlcoty",    -- Ada.Numerics.Long_Complex_Types
125      "a-nlelfu",    -- Ada.Numerics.Long_Elementary_Functions
126      "a-nllcef",    -- Ada.Long_Long_Complex_Elementary_Functions
127      "a-nllefu",    -- Ada.Numerics.Long_Long_Elementary_Functions
128      "a-nllcty",    -- Ada.Numerics.Long_Long_Complex_Types
129      "a-nscefu",    -- Ada.Short_Complex_Elementary_Functions
130      "a-nscoty",    -- Ada.Numerics.Short_Complex_Types
131      "a-nselfu",    -- Ada.Numerics.Short_Elementary_Functions
132      "a-sfteio",    -- Ada.Short_Float_Text_IO
133      "a-sfwtio",    -- Ada.Short_Float_Wide_Text_IO
134      "a-siteio",    -- Ada.Short_Integer_Text_IO
135      "a-siwtio",    -- Ada.Short_Integer_Wide_Text_IO
136      "a-ssitio",    -- Ada.Short_Short_Integer_Text_IO
137      "a-ssiwti",    -- Ada.Short_Short_Integer_Wide_Text_IO
138
139    -----------------------------------
140    -- GNAT Defined Additions to Ada --
141    -----------------------------------
142
143      "a-chlat9",    -- Ada.Characters.Latin_9
144      "a-colien",    -- Ada.Command_Line.Environment
145      "a-colire",    -- Ada.Command_Line.Remove
146      "a-cwila1",    -- Ada.Characters.Wide_Latin_1
147      "a-cwila9",    -- Ada.Characters.Wide_Latin_9
148      "a-diocst",    -- Ada.Direct_IO.C_Streams
149      "a-einuoc",    -- Ada.Exceptions.Is_Null_Occurrence
150      "a-elchha",    -- Ada.Exceptions.Last_Chance_Handler
151      "a-exctra",    -- Ada.Exceptions.Traceback
152      "a-siocst",    -- Ada.Sequential_IO.C_Streams
153      "a-ssicst",    -- Ada.Streams.Stream_IO.C_Streams
154      "a-suteio",    -- Ada.Strings.Unbounded.Text_IO
155      "a-swuwti",    -- Ada.Strings.Wide_Unbounded.Wide_Text_IO
156      "a-taidim",    -- Ada.Task_Identification.Image
157      "a-tiocst",    -- Ada.Text_IO.C_Streams
158      "a-wtcstr",    -- Ada.Wide_Text_IO.C_Streams
159
160    ---------------------------
161    -- GNAT Special IO Units --
162    ---------------------------
163
164    --  As further explained elsewhere (see Sem_Ch10), the internal
165    --  packages of Text_IO and Wide_Text_IO are actually implemented
166    --  as separate children, but this fact is intended to be hidden
167    --  from the user completely. Any attempt to WITH one of these
168    --  units will be diagnosed as an error later on, but for now we
169    --  do not consider these internal implementation units (if we did,
170    --  then we would get a junk warning which would be confusing and
171    --  unecessary, given that we generate a clear error message).
172
173      "a-tideio",    -- Ada.Text_IO.Decimal_IO
174      "a-tienio",    -- Ada.Text_IO.Enumeration_IO
175      "a-tifiio",    -- Ada.Text_IO.Fixed_IO
176      "a-tiflio",    -- Ada.Text_IO.Float_IO
177      "a-tiinio",    -- Ada.Text_IO.Integer_IO
178      "a-tiinio",    -- Ada.Text_IO.Integer_IO
179      "a-timoio",    -- Ada.Text_IO.Modular_IO
180      "a-wtdeio",    -- Ada.Wide_Text_IO.Decimal_IO
181      "a-wtenio",    -- Ada.Wide_Text_IO.Enumeration_IO
182      "a-wtfiio",    -- Ada.Wide_Text_IO.Fixed_IO
183      "a-wtflio",    -- Ada.Wide_Text_IO.Float_IO
184      "a-wtinio",    -- Ada.Wide_Text_IO.Integer_IO
185      "a-wtmoio",    -- Ada.Wide_Text_IO.Modular_IO
186
187    ------------------------
188    -- GNAT Library Units --
189    ------------------------
190
191      "g-arrspl",    -- GNAT.Array_Split
192      "g-awk   ",    -- GNAT.AWK
193      "g-boubuf",    -- GNAT.Bounded_Buffers
194      "g-boumai",    -- GNAT.Bounded_Mailboxes
195      "g-bubsor",    -- GNAT.Bubble_Sort
196      "g-busora",    -- GNAT.Bubble_Sort_A
197      "g-busorg",    -- GNAT.Bubble_Sort_G
198      "g-calend",    -- GNAT.Calendar
199      "g-casuti",    -- GNAT.Case_Util
200      "g-catiio",    -- GNAT.Calendar.Time_IO
201      "g-cgi   ",    -- GNAT.CGI
202      "g-cgicoo",    -- GNAT.CGI.Cookie
203      "g-cgideb",    -- GNAT.CGI.Debug
204      "g-comlin",    -- GNAT.Command_Line
205      "g-comver",    -- GNAT.Compiler_Version
206      "g-crc32 ",    -- GNAT.CRC32
207      "g-ctrl_c",    -- GNAT.Ctrl_C
208      "g-curexc",    -- GNAT.Current_Exception
209      "g-debpoo",    -- GNAT.Debug_Pools
210      "g-debuti",    -- GNAT.Debug_Utilities
211      "g-diopit",    -- GNAT.Directory_Operations.Iteration
212      "g-dirope",    -- GNAT.Directory_Operations
213      "g-dynhta",    -- GNAT.Dynamic_HTables
214      "g-dyntab",    -- GNAT.Dynamic_Tables
215      "g-excact",    -- GNAT.Exception_Actions
216      "g-except",    -- GNAT.Exceptions
217      "g-exctra",    -- GNAT.Exception_Traces
218      "g-expect",    -- GNAT.Expect
219      "g-flocon",    -- GNAT.Float_Control
220      "g-heasor",    -- GNAT.Heap_Sort
221      "g-hesora",    -- GNAT.Heap_Sort_A
222      "g-hesorg",    -- GNAT.Heap_Sort_G
223      "g-htable",    -- GNAT.Htable
224      "g-io    ",    -- GNAT.IO
225      "g-io_aux",    -- GNAT.IO_Aux
226      "g-locfil",    -- GNAT.Lock_Files
227      "g-md5   ",    -- GNAT.MD5
228      "g-memdum",    -- GNAT.Memory_Dump
229      "g-moreex",    -- GNAT.Most_Recent_Exception
230      "g-os_lib",    -- GNAT.Os_Lib
231      "g-pehage",    -- GNAT.Perfect_Hash_Generators
232      "g-regexp",    -- GNAT.Regexp
233      "g-regist",    -- GNAT.Registry
234      "g-regpat",    -- GNAT.Regpat
235      "g-semaph",    -- GNAT.Semaphores
236      "g-sestin",    -- GNAT.Secondary_Stack_Info
237      "g-signal",    -- GNAT.Signals
238      "g-socket",    -- GNAT.Sockets
239      "g-souinf",    -- GNAT.Source_Info
240      "g-speche",    -- GNAT.Spell_Checker
241      "g-spipat",    -- GNAT.Spitbol.Patterns
242      "g-spitbo",    -- GNAT.Spitbol
243      "g-sptabo",    -- GNAT.Spitbol.Table_Boolean
244      "g-sptain",    -- GNAT.Spitbol.Table_Integer
245      "g-sptavs",    -- GNAT.Spitbol.Table_Vstring
246      "g-string",    -- GNAT.Strings
247      "g-strspl",    -- GNAT.String_Split
248      "g-table ",    -- GNAT.Table
249      "g-tasloc",    -- GNAT.Task_Lock
250      "g-thread",    -- GNAT.Threads
251      "g-traceb",    -- GNAT.Traceback
252      "g-trasym",    -- GNAT.Traceback.Symbolic
253      "g-utf_32",    -- GNAT.UTF_32
254      "g-wistsp",    -- GNAT.Wide_String_Split
255
256    -----------------------------------------------------
257    -- Interface Hierarchy Units from Reference Manual --
258    -----------------------------------------------------
259
260      "i-c     ",    -- Interfaces.C
261      "i-cobol ",    -- Interfaces.Cobol
262      "i-cpoint",    -- Interfaces.C.Pointers
263      "i-cstrin",    -- Interfaces.C.Strings
264      "i-fortra",    -- Interfaces.Fortran
265
266    ------------------------------------------
267    -- GNAT Defined Additions to Interfaces --
268    ------------------------------------------
269
270      "i-cexten",    -- Interfaces.C.Extensions
271      "i-cpp   ",    -- Interfaces.CPP
272      "i-cstrea",    -- Interfaces.C.Streams
273      "i-jalaob",    -- Interfaces.Java.Lang.Object
274      "i-jalasy",    -- Interfaces.Java.Lang.System
275      "i-jalath",    -- Interfaces.Java.Lang.Thread
276      "i-java  ",    -- Interfaces.Java
277      "i-javlan",    -- Interfaces.Java.Lang
278      "i-os2err",    -- Interfaces.Os2lib.Errors
279      "i-os2lib",    -- Interfaces.Os2lib
280      "i-os2syn",    -- Interfaces.Os2lib.Synchronization
281      "i-os2thr",    -- Interfaces.Os2lib.Threads
282      "i-pacdec",    -- Interfaces.Packed_Decimal
283      "i-vthrea",    -- Interfaces.Vthreads
284      "i-vxwoio",    -- Interfaces.VxWorks.IO
285      "i-vxwork",    -- Interfaces.VxWorks
286
287    --------------------------------------------------
288    -- System Hierarchy Units from Reference Manual --
289    --------------------------------------------------
290
291      "s-atacco",    -- System.Address_To_Access_Conversions
292      "s-maccod",    -- System.Machine_Code
293      "s-rpc   ",    -- System.Rpc
294      "s-stoele",    -- System.Storage_Elements
295      "s-stopoo",    -- System.Storage_Pools
296
297    --------------------------------------
298    -- GNAT Defined Additions to System --
299    --------------------------------------
300
301      "s-addima",    -- System.Address_Image
302      "s-assert",    -- System.Assertions
303      "s-memory",    -- System.Memory
304      "s-parint",    -- System.Partition_Interface
305      "s-pooglo",    -- System.Pool_Global
306      "s-pooloc",    -- System.Pool_Local
307      "s-restri",    -- System.Restrictions
308      "s-rident",    -- System.Rident
309      "s-tasinf",    -- System.Task_Info
310      "s-wchcnv",    -- System.Wch_Cnv
311      "s-wchcon");   -- System.Wch_Con
312
313    --------------------
314    -- Ada 2005 Units --
315    --------------------
316
317    --  The following units should be used only in Ada 05 mode
318
319    Non_Imp_File_Names_05 : constant File_List := (
320
321    --------------------------------------------------------
322    -- Ada Hierarchy Units from Ada 2005 Reference Manual --
323    --------------------------------------------------------
324
325      "a-cdlili",    -- Ada.Containers.Doubly_Linked_Lists
326      "a-cgaaso",    -- Ada.Containers.Generic_Anonymous_Array_Sort
327      "a-cgarso",    -- Ada.Containers.Generic_Array_Sort
328      "a-cgcaso",    -- Ada.Containers.Generic_Constrained_Array_Sort
329      "a-chtgke",    -- Ada.Containers.Hash_Tables.Generic_Keys
330      "a-chtgop",    -- Ada.Containers.Hash_Tables.Generic_Operations
331      "a-cidlli",    -- Ada.Containers.Indefinite_Doubly_Linked_Lists
332      "a-cihama",    -- Ada.Containers.Indefinite_Hashed_Maps
333      "a-cihase",    -- Ada.Containers.Indefinite_Hashed_Sets
334      "a-ciorma",    -- Ada.Containers.Indefinite_Ordered_Maps
335      "a-ciormu",    -- Ada.Containers.Indefinite_Ordered_Multisets
336      "a-ciorse",    -- Ada.Containers.Indefinite_Ordered_Sets
337      "a-cohama",    -- Ada.Containers.Hashed_Maps
338      "a-cohase",    -- Ada.Containers.Hashed_Sets
339      "a-cohata",    -- Ada.Containers.Hash_Tables
340      "a-coinve",    -- Ada.Containers.Indefinite_Vectors
341      "a-contai",    -- Ada.Containers
342      "a-convec",    -- Ada.Containers.Vectors
343      "a-coorma",    -- Ada.Containers.Ordered_Maps
344      "a-coormu",    -- Ada.Containers.Ordered_Multisets
345      "a-coorse",    -- Ada.Containers.Ordered_Sets
346      "a-coprnu",    -- Ada.Containers.Prime_Numbers
347      "a-crbltr",    -- Ada.Containers.Red_Black_Trees
348      "a-crbtgk",    -- Ada.Containers.Red_Black_Trees.Generic_Keys
349      "a-crbtgo",    -- Ada.Containers.Red_Black_Trees.Generic_Operations
350      "a-direct",    -- Ada.Directories
351      "a-rbtgso",    -- Ada.Containers.Red_Black_Trees.Generic_Set_Operations
352      "a-secain",    -- Ada.Strings.Equal_Case_Insensitive
353      "a-shcain",    -- Ada.Strings.Hash_Case_Insensitive
354      "a-slcain",    -- Ada.Strings.Less_Case_Insensitive
355      "a-strhas",    -- Ada.Strings.Hash
356      "a-stunha",    -- Ada.Strings.Unbounded.Hash
357      "a-stwiha",    -- Ada.Strings.Wide_Hash
358      "a-stzbou",    -- Ada.Strings.Wide_Wide_Bounded
359      "a-stzfix",    -- Ada.Strings.Wide_Wide_Fixed
360      "a-stzhas",    -- Ada.Strings.Wide_Wide_Hash
361      "a-stzmap",    -- Ada.Strings.Wide_Wide_Maps
362      "a-stzunb",    -- Ada.Strings.Wide_Wide_Unbounded
363      "a-swunha",    -- Ada.Strings.Wide_Unbounded.Hash
364      "a-szmzco",    -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants;
365      "a-szunha",    -- Ada.Strings.Wide_Wide_Unbounded.Hash
366      "a-tgdico",    -- Ada.Tags.Generic_Dispatching_Constructor;
367      "a-tiunio",    -- Ada.Text_IO.Unbounded_IO;
368      "a-wwunio",    -- Ada.Wide_Text_IO.Wide_Unbounded_IO;
369      "a-zttest",    -- Ada.Wide_Wide_Text_IO.Text_Streams
370      "a-ztexio",    -- Ada.Wide_Wide_Text_IO
371      "a-zzunio",    -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
372
373    ------------------------------------------------------
374    -- RM Required Additions to Ada 2005 for GNAT Types --
375    ------------------------------------------------------
376
377      "a-lfztio",    -- Ada.Long_Float_Wide_Wide_Text_IO
378      "a-liztio",    -- Ada.Long_Integer_Wide_Wide_Text_IO
379      "a-llfzti",    -- Ada.Long_Long_Float_Wide_Wide_Text_IO
380      "a-llizti",    -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
381      "a-sfztio",    -- Ada.Short_Float_Wide_Wide_Text_IO
382      "a-siztio",    -- Ada.Short_Integer_Wide_Wide_Text_IO
383      "a-ssizti",    -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
384      "a-ztcstr",    -- Ada.Wide_Wide_Text_IO.C_Streams
385
386    ----------------------------------------
387    -- GNAT Defined Additions to Ada 2005 --
388    ----------------------------------------
389
390      "a-chzla1",    -- Ada.Characters.Wide_Wide_Latin_1
391      "a-chzla9",    -- Ada.Characters.Wide_Wide_Latin_9
392      "a-szuzti",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
393
394    ---------------------------
395    -- GNAT Special IO Units --
396    ---------------------------
397
398    --  See Ada 95 section for further information. These packages are for the
399    --  implementation of the Wide_Wide_Text_IO generic packages.
400
401      "a-ztdeio",    -- Ada.Wide_Wide_Text_IO.Decimal_IO
402      "a-ztenio",    -- Ada.Wide_Wide_Text_IO.Enumeration_IO
403      "a-ztfiio",    -- Ada.Wide_Wide_Text_IO.Fixed_IO
404      "a-ztflio",    -- Ada.Wide_Wide_Text_IO.Float_IO
405      "a-ztinio",    -- Ada.Wide_Wide_Text_IO.Integer_IO
406      "a-ztmoio",    -- Ada.Wide_Wide_Text_IO.Modular_IO
407
408    ------------------------
409    -- GNAT Library Units --
410    ------------------------
411
412      "g-zstspl");   -- GNAT.Wide_Wide_String_Split
413
414    ----------------------
415    -- Get_Kind_Of_Unit --
416    ----------------------
417
418    function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
419       Fname : constant File_Name_Type := Unit_File_Name (U);
420
421    begin
422       --  If length of file name is greater than 12, not predefined.
423       --  The value 12 here is an 8 char name with extension .ads.
424
425       if Length_Of_Name (Fname) > 12 then
426          return Not_Predefined_Unit;
427       end if;
428
429       --  Otherwise test file name
430
431       Get_Name_String (Fname);
432
433       --  Not predefined if file name does not start with a- g- s- i-
434
435       if Name_Len < 3
436         or else Name_Buffer (2) /= '-'
437         or else (Name_Buffer (1) /= 'a'
438                    and then
439                  Name_Buffer (1) /= 'g'
440                    and then
441                  Name_Buffer (1) /= 'i'
442                    and then
443                  Name_Buffer (1) /= 's')
444       then
445          return Not_Predefined_Unit;
446       end if;
447
448       --  Not predefined if file name does not end in .ads. This can
449       --  happen when non-standard file names are being used.
450
451       if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
452          return Not_Predefined_Unit;
453       end if;
454
455       --  Otherwise normalize file name to 8 characters
456
457       Name_Len := Name_Len - 4;
458       while Name_Len < 8 loop
459          Name_Len := Name_Len + 1;
460          Name_Buffer (Name_Len) := ' ';
461       end loop;
462
463       --  See if name is in 95 list
464
465       for J in Non_Imp_File_Names_95'Range loop
466          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
467             return Ada_95_Unit;
468          end if;
469       end loop;
470
471       --  See if name is in 05 list
472
473       for J in Non_Imp_File_Names_05'Range loop
474          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
475             return Ada_05_Unit;
476          end if;
477       end loop;
478
479       --  Only remaining special possibilities are children of System.RPC and
480       --  System.Garlic and special files of the form System.Aux...
481
482       Get_Name_String (Unit_Name (U));
483
484       if Name_Len > 12
485         and then Name_Buffer (1 .. 11) = "system.rpc."
486       then
487          return Ada_95_Unit;
488       end if;
489
490       if Name_Len > 15
491         and then Name_Buffer (1 .. 14) = "system.garlic."
492       then
493          return Ada_95_Unit;
494       end if;
495
496       if Name_Len > 11
497         and then Name_Buffer (1 .. 10) = "system.aux"
498       then
499          return Ada_95_Unit;
500       end if;
501
502       --  All tests failed, this is definitely an implementation unit
503
504       return Implementation_Unit;
505    end Get_Kind_Of_Unit;
506
507 end Impunit;