1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                                F N A M E                                 --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1992-2021, 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 3,  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 COPYING3.  If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  This package, together with its child package Fname.UF define the
27--  association between source file names and unit names as defined
28--  (see package Uname for definition of format of unit names).
29
30with Namet; use Namet;
31
32package Fname is
33
34   --  Note: this package spec does not depend on the Uname spec in the Ada
35   --  sense, but the comments and description of the semantics do depend on
36   --  the conventions established by Uname.
37
38   ---------------------------
39   -- File Name Conventions --
40   ---------------------------
41
42   --  GNAT requires that there be a one to one correspondence between source
43   --  file names (as used in the Osint package interface) and unit names as
44   --  defined by the Uname package. This correspondence is defined by the
45   --  two subprograms defined here in the Fname package.
46
47   --   For full rules of file naming, see GNAT User's Guide. Note that the
48   --   naming rules are affected by the presence of Source_File_Name pragmas
49   --   that have been previously processed.
50
51   --  Note that the file name does *not* include the directory name. The
52   --  management of directories is provided by Osint, and full file names
53   --  are used only for error message purposes within GNAT itself.
54
55   -----------------
56   -- Subprograms --
57   -----------------
58
59   function Is_Predefined_File_Name
60     (Fname              : String;
61      Renamings_Included : Boolean := True) return Boolean;
62   function Is_Predefined_File_Name
63     (Fname              : File_Name_Type;
64      Renamings_Included : Boolean := True) return Boolean;
65   --  These functions determine if the given file name (which must be a simple
66   --  file name with no directory information) is the source or ALI file name
67   --  for one of the predefined library units (i.e. part of the Ada, System,
68   --  or Interface hierarchies). Note that units in the GNAT hierarchy are not
69   --  considered predefined (see Is_Internal_File_Name below).
70   --
71   --  The Renamings_Included parameter indicates whether annex J renamings
72   --  such as Text_IO are to be considered as predefined. If
73   --  Renamings_Included is True, then Text_IO will return True, otherwise
74   --  only children of Ada, Interfaces and System return True.
75
76   function Is_Predefined_Renaming_File_Name
77     (Fname : String) return Boolean;
78   function Is_Predefined_Renaming_File_Name
79     (Fname : File_Name_Type) return Boolean;
80   --  True if Fname is the file name for a predefined renaming (the same file
81   --  names that are included if Renamings_Included => True is passed to
82   --  Is_Predefined_File_Name).
83
84   function Is_Internal_File_Name
85     (Fname              : String;
86      Renamings_Included : Boolean := True) return Boolean;
87   function Is_Internal_File_Name
88     (Fname              : File_Name_Type;
89      Renamings_Included : Boolean := True) return Boolean;
90   --  Same as Is_Predefined_File_Name, except units in the GNAT hierarchy are
91   --  included.
92
93   function Is_GNAT_File_Name (Fname : String) return Boolean;
94   function Is_GNAT_File_Name (Fname : File_Name_Type) return Boolean;
95   --  True for units in the GNAT hierarchy
96
97end Fname;
98