1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2000 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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, 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 -- This child package contains the routines to translate a unit name to
28 -- a file name taking into account Source_File_Name pragmas. It also
29 -- contains the auxiliary routines used to record data from the pragmas.
31 -- Note: the reason we split this into a child unit is that the routines
32 -- for unit name translation have a significant number of additional
33 -- dependencies, including osint, and hence sdefault. There are a number
34 -- of tools that use utility subprograms in the Fname parent, but do not
35 -- need the functionality in this child package (and certainly do not want
36 -- to deal with the extra dependencies).
38 with Casing
; use Casing
;
46 function Get_File_Name
47 (Uname
: Unit_Name_Type
;
49 return File_Name_Type
;
50 -- This function returns the file name that corresponds to a given unit
51 -- name, Uname. The Subunit parameter is set True for subunits, and
52 -- false for all other kinds of units. The caller is responsible for
53 -- ensuring that the unit name meets the requirements given in package
54 -- Uname and described above.
57 -- Initialize internal tables. This is called automatically when the
58 -- package body is elaborated, so an explicit call to Initialize is
59 -- only required if it is necessary to reinitialize the source file
60 -- name pragma tables.
63 -- Lock tables before calling back end
65 function File_Name_Of_Spec
(Name
: Name_Id
) return File_Name_Type
;
66 -- Returns the file name that corresponds to the spec of a given unit
67 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
68 -- rather just a normal form name in lower case, e.g. "xyz.def".
70 function File_Name_Of_Body
(Name
: Name_Id
) return File_Name_Type
;
71 -- Returns the file name that corresponds to the body of a given unit
72 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
73 -- rather just a normal form name in lower case, e.g. "xyz.def".
75 procedure Set_File_Name
(U
: Unit_Name_Type
; F
: File_Name_Type
);
76 -- Make association between given unit name, U, and the given file name,
77 -- F. This is the routine called to process a Source_File_Name pragma.
79 procedure Set_File_Name_Pattern
84 -- This is called to process a Source_File_Name pragma whose first
85 -- argument is a file name pattern string. Pat is this pattern string,
86 -- which contains an asterisk to correspond to the unit. Typ is one of
87 -- 'b'/'s'/'u' for body/spec/subunit, Dot is the separator string
88 -- for child/subunit names, and Cas is one of Lower/Upper/Mixed
89 -- indicating the required case for the file name.