OSDN Git Service

2007-02-13 Seongbae Park <seongbae.park@gmail.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-2006, 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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       --  Note: strictly the next two should be Ada 2005 units, but it seems
161       --  harmless (and useful) to make then available in Ada 95 mode, since
162       --  they only deal with Wide_Character, not Wide_Wide_Character.
163
164      "a-wichun",    -- Ada.Wide_Characters.Unicode
165      "a-widcha",    -- Ada.Wide_Characters
166
167    ---------------------------
168    -- GNAT Special IO Units --
169    ---------------------------
170
171    --  As further explained elsewhere (see Sem_Ch10), the internal
172    --  packages of Text_IO and Wide_Text_IO are actually implemented
173    --  as separate children, but this fact is intended to be hidden
174    --  from the user completely. Any attempt to WITH one of these
175    --  units will be diagnosed as an error later on, but for now we
176    --  do not consider these internal implementation units (if we did,
177    --  then we would get a junk warning which would be confusing and
178    --  unecessary, given that we generate a clear error message).
179
180      "a-tideio",    -- Ada.Text_IO.Decimal_IO
181      "a-tienio",    -- Ada.Text_IO.Enumeration_IO
182      "a-tifiio",    -- Ada.Text_IO.Fixed_IO
183      "a-tiflio",    -- Ada.Text_IO.Float_IO
184      "a-tiinio",    -- Ada.Text_IO.Integer_IO
185      "a-tiinio",    -- Ada.Text_IO.Integer_IO
186      "a-timoio",    -- Ada.Text_IO.Modular_IO
187      "a-wtdeio",    -- Ada.Wide_Text_IO.Decimal_IO
188      "a-wtenio",    -- Ada.Wide_Text_IO.Enumeration_IO
189      "a-wtfiio",    -- Ada.Wide_Text_IO.Fixed_IO
190      "a-wtflio",    -- Ada.Wide_Text_IO.Float_IO
191      "a-wtinio",    -- Ada.Wide_Text_IO.Integer_IO
192      "a-wtmoio",    -- Ada.Wide_Text_IO.Modular_IO
193
194    ------------------------
195    -- GNAT Library Units --
196    ------------------------
197
198      "g-altive",    -- GNAT.Altivec
199      "g-alvety",    -- GNAT.Altivec.Vector_Types
200      "g-alvevi",    -- GNAT.Altivec.Vector_Views
201      "g-alveop",    -- GNAT.Altivec.Vector_Operations
202      "g-altcon",    -- GNAT.Altivec.Conversions
203      "g-arrspl",    -- GNAT.Array_Split
204      "g-awk   ",    -- GNAT.AWK
205      "g-boubuf",    -- GNAT.Bounded_Buffers
206      "g-boumai",    -- GNAT.Bounded_Mailboxes
207      "g-bubsor",    -- GNAT.Bubble_Sort
208      "g-busora",    -- GNAT.Bubble_Sort_A
209      "g-busorg",    -- GNAT.Bubble_Sort_G
210      "g-calend",    -- GNAT.Calendar
211      "g-casuti",    -- GNAT.Case_Util
212      "g-catiio",    -- GNAT.Calendar.Time_IO
213      "g-cgi   ",    -- GNAT.CGI
214      "g-cgicoo",    -- GNAT.CGI.Cookie
215      "g-cgideb",    -- GNAT.CGI.Debug
216      "g-comlin",    -- GNAT.Command_Line
217      "g-comver",    -- GNAT.Compiler_Version
218      "g-crc32 ",    -- GNAT.CRC32
219      "g-ctrl_c",    -- GNAT.Ctrl_C
220      "g-curexc",    -- GNAT.Current_Exception
221      "g-debpoo",    -- GNAT.Debug_Pools
222      "g-debuti",    -- GNAT.Debug_Utilities
223      "g-diopit",    -- GNAT.Directory_Operations.Iteration
224      "g-dirope",    -- GNAT.Directory_Operations
225      "g-dynhta",    -- GNAT.Dynamic_HTables
226      "g-dyntab",    -- GNAT.Dynamic_Tables
227      "g-excact",    -- GNAT.Exception_Actions
228      "g-except",    -- GNAT.Exceptions
229      "g-exctra",    -- GNAT.Exception_Traces
230      "g-expect",    -- GNAT.Expect
231      "g-flocon",    -- GNAT.Float_Control
232      "g-heasor",    -- GNAT.Heap_Sort
233      "g-hesora",    -- GNAT.Heap_Sort_A
234      "g-hesorg",    -- GNAT.Heap_Sort_G
235      "g-htable",    -- GNAT.Htable
236      "g-io    ",    -- GNAT.IO
237      "g-io_aux",    -- GNAT.IO_Aux
238      "g-locfil",    -- GNAT.Lock_Files
239      "g-md5   ",    -- GNAT.MD5
240      "g-memdum",    -- GNAT.Memory_Dump
241      "g-moreex",    -- GNAT.Most_Recent_Exception
242      "g-os_lib",    -- GNAT.Os_Lib
243      "g-pehage",    -- GNAT.Perfect_Hash_Generators
244      "g-regexp",    -- GNAT.Regexp
245      "g-regist",    -- GNAT.Registry
246      "g-regpat",    -- GNAT.Regpat
247      "g-semaph",    -- GNAT.Semaphores
248      "g-sestin",    -- GNAT.Secondary_Stack_Info
249      "g-signal",    -- GNAT.Signals
250      "g-socket",    -- GNAT.Sockets
251      "g-souinf",    -- GNAT.Source_Info
252      "g-speche",    -- GNAT.Spell_Checker
253      "g-spipat",    -- GNAT.Spitbol.Patterns
254      "g-spitbo",    -- GNAT.Spitbol
255      "g-sptabo",    -- GNAT.Spitbol.Table_Boolean
256      "g-sptain",    -- GNAT.Spitbol.Table_Integer
257      "g-sptavs",    -- GNAT.Spitbol.Table_Vstring
258      "g-string",    -- GNAT.Strings
259      "g-strspl",    -- GNAT.String_Split
260      "g-table ",    -- GNAT.Table
261      "g-tasloc",    -- GNAT.Task_Lock
262      "g-thread",    -- GNAT.Threads
263      "g-traceb",    -- GNAT.Traceback
264      "g-trasym",    -- GNAT.Traceback.Symbolic
265      "g-utf_32",    -- GNAT.UTF_32
266      "g-wistsp",    -- GNAT.Wide_String_Split
267
268    -----------------------------------------------------
269    -- Interface Hierarchy Units from Reference Manual --
270    -----------------------------------------------------
271
272      "i-c     ",    -- Interfaces.C
273      "i-cobol ",    -- Interfaces.Cobol
274      "i-cpoint",    -- Interfaces.C.Pointers
275      "i-cstrin",    -- Interfaces.C.Strings
276      "i-fortra",    -- Interfaces.Fortran
277
278    ------------------------------------------
279    -- GNAT Defined Additions to Interfaces --
280    ------------------------------------------
281
282      "i-cexten",    -- Interfaces.C.Extensions
283      "i-cpp   ",    -- Interfaces.CPP
284      "i-cstrea",    -- Interfaces.C.Streams
285      "i-jalaob",    -- Interfaces.Java.Lang.Object
286      "i-jalasy",    -- Interfaces.Java.Lang.System
287      "i-jalath",    -- Interfaces.Java.Lang.Thread
288      "i-java  ",    -- Interfaces.Java
289      "i-javlan",    -- Interfaces.Java.Lang
290      "i-os2err",    -- Interfaces.Os2lib.Errors
291      "i-os2lib",    -- Interfaces.Os2lib
292      "i-os2syn",    -- Interfaces.Os2lib.Synchronization
293      "i-os2thr",    -- Interfaces.Os2lib.Threads
294      "i-pacdec",    -- Interfaces.Packed_Decimal
295      "i-vthrea",    -- Interfaces.Vthreads
296      "i-vxwoio",    -- Interfaces.VxWorks.IO
297      "i-vxwork",    -- Interfaces.VxWorks
298
299    --------------------------------------------------
300    -- System Hierarchy Units from Reference Manual --
301    --------------------------------------------------
302
303      "s-atacco",    -- System.Address_To_Access_Conversions
304      "s-maccod",    -- System.Machine_Code
305      "s-rpc   ",    -- System.Rpc
306      "s-stoele",    -- System.Storage_Elements
307      "s-stopoo",    -- System.Storage_Pools
308
309    --------------------------------------
310    -- GNAT Defined Additions to System --
311    --------------------------------------
312
313      "s-addima",    -- System.Address_Image
314      "s-assert",    -- System.Assertions
315      "s-memory",    -- System.Memory
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
324
325    --------------------
326    -- Ada 2005 Units --
327    --------------------
328
329    --  The following units should be used only in Ada 05 mode
330
331    Non_Imp_File_Names_05 : constant File_List := (
332
333    --------------------------------------------------------
334    -- Ada Hierarchy Units from Ada 2005 Reference Manual --
335    --------------------------------------------------------
336
337      "a-calari",    -- Ada.Calendar.Arithmetic
338      "a-calfor",    -- Ada.Calendar.Formatting
339      "a-catizo",    -- Ada.Calendar.Time_Zones
340      "a-cdlili",    -- Ada.Containers.Doubly_Linked_Lists
341      "a-cgarso",    -- Ada.Containers.Generic_Array_Sort
342      "a-cgcaso",    -- Ada.Containers.Generic_Constrained_Array_Sort
343      "a-chacon",    -- Ada.Characters.Conversions
344      "a-cidlli",    -- Ada.Containers.Indefinite_Doubly_Linked_Lists
345      "a-cihama",    -- Ada.Containers.Indefinite_Hashed_Maps
346      "a-cihase",    -- Ada.Containers.Indefinite_Hashed_Sets
347      "a-ciorma",    -- Ada.Containers.Indefinite_Ordered_Maps
348      "a-ciorse",    -- Ada.Containers.Indefinite_Ordered_Sets
349      "a-cohama",    -- Ada.Containers.Hashed_Maps
350      "a-cohase",    -- Ada.Containers.Hashed_Sets
351      "a-coinve",    -- Ada.Containers.Indefinite_Vectors
352      "a-contai",    -- Ada.Containers
353      "a-convec",    -- Ada.Containers.Vectors
354      "a-coorma",    -- Ada.Containers.Ordered_Maps
355      "a-coorse",    -- Ada.Containers.Ordered_Sets
356      "a-coteio",    -- Ada.Complex_Text_IO
357      "a-direct",    -- Ada.Directories
358      "a-diroro",    -- Ada.Dispatching.Round_Robin
359      "a-dispat",    -- Ada.Dispatching
360      "a-envvar",    -- Ada.Environment_Variables
361      "a-rttiev",    -- Ada.Real_Time.Timing_Events
362      "a-stboha",    -- Ada.Strings.Bounded.Hash
363      "a-stfiha",    -- Ada.Strings.Fixed.Hash
364      "a-strhas",    -- Ada.Strings.Hash
365      "a-stunha",    -- Ada.Strings.Unbounded.Hash
366      "a-stwiha",    -- Ada.Strings.Wide_Hash
367      "a-stzbou",    -- Ada.Strings.Wide_Wide_Bounded
368      "a-stzfix",    -- Ada.Strings.Wide_Wide_Fixed
369      "a-stzhas",    -- Ada.Strings.Wide_Wide_Hash
370      "a-stzmap",    -- Ada.Strings.Wide_Wide_Maps
371      "a-stzunb",    -- Ada.Strings.Wide_Wide_Unbounded
372      "a-swbwha",    -- Ada.Strings.Wide_Bounded.Wide_Hash
373      "a-swfwha",    -- Ada.Strings.Wide_Fixed.Wide_Hash
374      "a-swuwha",    -- Ada.Strings.Wide_Unbounded.Wide_Hash
375      "a-szbzha",    -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash
376      "a-szfzha",    -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash
377      "a-szmzco",    -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants
378      "a-szuzha",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
379      "a-taster",    -- Ada.Task_Termination
380      "a-tgdico",    -- Ada.Tags.Generic_Dispatching_Constructor
381      "a-tiboio",    -- Ada.Text_IO.Bounded_IO
382      "a-tiunio",    -- Ada.Text_IO.Unbounded_IO
383      "a-wichun",    -- Ada.Wide_Characters.Unicode
384      "a-wwboio",    -- Ada.Wide_Text_IO.Wide_Bounded_IO
385      "a-wwunio",    -- Ada.Wide_Text_IO.Wide_Unbounded_IO
386      "a-zchara",    -- Ada.Wide_Wide_Characters
387      "a-ztcoio",    -- Ada.Wide_Wide_Text_IO.Complex_IO
388      "a-ztedit",    -- Ada.Wide_Wide_Text_IO.Editing
389      "a-zttest",    -- Ada.Wide_Wide_Text_IO.Text_Streams
390      "a-ztexio",    -- Ada.Wide_Wide_Text_IO
391      "a-zzboio",    -- Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO
392      "a-zzunio",    -- Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO
393
394    ------------------------------------------------------
395    -- RM Required Additions to Ada 2005 for GNAT Types --
396    ------------------------------------------------------
397
398      "a-lcteio",    -- Ada.Long_Complex_Text_IO
399      "a-lfztio",    -- Ada.Long_Float_Wide_Wide_Text_IO
400      "a-liztio",    -- Ada.Long_Integer_Wide_Wide_Text_IO
401      "a-llctio",    -- Ada.Long_Long_Complex_Text_IO
402      "a-llfzti",    -- Ada.Long_Long_Float_Wide_Wide_Text_IO
403      "a-llizti",    -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
404      "a-scteio",    -- Ada.Short_Complex_Text_IO
405      "a-sfztio",    -- Ada.Short_Float_Wide_Wide_Text_IO
406      "a-siztio",    -- Ada.Short_Integer_Wide_Wide_Text_IO
407      "a-ssizti",    -- Ada.Short_Short_Integer_Wide_Wide_Text_IO
408      "a-ztcstr",    -- Ada.Wide_Wide_Text_IO.C_Streams
409
410    ----------------------------------------
411    -- GNAT Defined Additions to Ada 2005 --
412    ----------------------------------------
413
414      "a-cgaaso",    -- Ada.Containers.Generic_Anonymous_Array_Sort
415      "a-chzla1",    -- Ada.Characters.Wide_Wide_Latin_1
416      "a-chzla9",    -- Ada.Characters.Wide_Wide_Latin_9
417      "a-ciormu",    -- Ada.Containers.Indefinite_Ordered_Multisets
418      "a-coormu",    -- Ada.Containers.Ordered_Multisets
419      "a-crdlli",    -- Ada.Containers.Restricted_Doubly_Linked_Lists
420      "a-secain",    -- Ada.Strings.Equal_Case_Insensitive
421      "a-shcain",    -- Ada.Strings.Hash_Case_Insensitive
422      "a-slcain",    -- Ada.Strings.Less_Case_Insensitive
423      "a-szuzti",    -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
424      "a-zchuni",    -- Ada.Wide_Wide_Characters.Unicode
425
426    ---------------------------
427    -- GNAT Special IO Units --
428    ---------------------------
429
430    --  See Ada 95 section for further information. These packages are for the
431    --  implementation of the Wide_Wide_Text_IO generic packages.
432
433      "a-ztdeio",    -- Ada.Wide_Wide_Text_IO.Decimal_IO
434      "a-ztenio",    -- Ada.Wide_Wide_Text_IO.Enumeration_IO
435      "a-ztfiio",    -- Ada.Wide_Wide_Text_IO.Fixed_IO
436      "a-ztflio",    -- Ada.Wide_Wide_Text_IO.Float_IO
437      "a-ztinio",    -- Ada.Wide_Wide_Text_IO.Integer_IO
438      "a-ztmoio",    -- Ada.Wide_Wide_Text_IO.Modular_IO
439
440    ------------------------
441    -- GNAT Library Units --
442    ------------------------
443
444      "g-zstspl");   -- GNAT.Wide_Wide_String_Split
445
446    ----------------------
447    -- Get_Kind_Of_Unit --
448    ----------------------
449
450    function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit is
451       Fname : constant File_Name_Type := Unit_File_Name (U);
452
453    begin
454       --  If length of file name is greater than 12, not predefined.
455       --  The value 12 here is an 8 char name with extension .ads.
456
457       if Length_Of_Name (Fname) > 12 then
458          return Not_Predefined_Unit;
459       end if;
460
461       --  Otherwise test file name
462
463       Get_Name_String (Fname);
464
465       --  Not predefined if file name does not start with a- g- s- i-
466
467       if Name_Len < 3
468         or else Name_Buffer (2) /= '-'
469         or else (Name_Buffer (1) /= 'a'
470                    and then
471                  Name_Buffer (1) /= 'g'
472                    and then
473                  Name_Buffer (1) /= 'i'
474                    and then
475                  Name_Buffer (1) /= 's')
476       then
477          return Not_Predefined_Unit;
478       end if;
479
480       --  Not predefined if file name does not end in .ads. This can
481       --  happen when non-standard file names are being used.
482
483       if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
484          return Not_Predefined_Unit;
485       end if;
486
487       --  Otherwise normalize file name to 8 characters
488
489       Name_Len := Name_Len - 4;
490       while Name_Len < 8 loop
491          Name_Len := Name_Len + 1;
492          Name_Buffer (Name_Len) := ' ';
493       end loop;
494
495       --  See if name is in 95 list
496
497       for J in Non_Imp_File_Names_95'Range loop
498          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J) then
499             return Ada_95_Unit;
500          end if;
501       end loop;
502
503       --  See if name is in 05 list
504
505       for J in Non_Imp_File_Names_05'Range loop
506          if Name_Buffer (1 .. 8) = Non_Imp_File_Names_05 (J) then
507             return Ada_05_Unit;
508          end if;
509       end loop;
510
511       --  Only remaining special possibilities are children of System.RPC and
512       --  System.Garlic and special files of the form System.Aux...
513
514       Get_Name_String (Unit_Name (U));
515
516       if Name_Len > 12
517         and then Name_Buffer (1 .. 11) = "system.rpc."
518       then
519          return Ada_95_Unit;
520       end if;
521
522       if Name_Len > 15
523         and then Name_Buffer (1 .. 14) = "system.garlic."
524       then
525          return Ada_95_Unit;
526       end if;
527
528       if Name_Len > 11
529         and then Name_Buffer (1 .. 10) = "system.aux"
530       then
531          return Ada_95_Unit;
532       end if;
533
534       --  All tests failed, this is definitely an implementation unit
535
536       return Implementation_Unit;
537    end Get_Kind_Of_Unit;
538
539 end Impunit;