1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 -- This child package contains the routines to translate a unit name to
30 -- a file name taking into account Source_File_Name pragmas. It also
31 -- contains the auxiliary routines used to record data from the pragmas.
33 -- Note: the reason we split this into a child unit is that the routines
34 -- for unit name translation have a significant number of additional
35 -- dependencies, including osint, and hence sdefault. There are a number
36 -- of tools that use utility subprograms in the Fname parent, but do not
37 -- need the functionality in this child package (and certainly do not want
38 -- to deal with the extra dependencies).
40 with Casing
; use Casing
;
48 function Get_File_Name
49 (Uname
: Unit_Name_Type
;
51 return File_Name_Type
;
52 -- This function returns the file name that corresponds to a given unit
53 -- name, Uname. The Subunit parameter is set True for subunits, and
54 -- false for all other kinds of units. The caller is responsible for
55 -- ensuring that the unit name meets the requirements given in package
56 -- Uname and described above.
59 -- Initialize internal tables. This is called automatically when the
60 -- package body is elaborated, so an explicit call to Initialize is
61 -- only required if it is necessary to reinitialize the source file
62 -- name pragma tables.
65 -- Lock tables before calling back end
67 function File_Name_Of_Spec
(Name
: Name_Id
) return File_Name_Type
;
68 -- Returns the file name that corresponds to the spec of a given unit
69 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
70 -- rather just a normal form name in lower case, e.g. "xyz.def".
72 function File_Name_Of_Body
(Name
: Name_Id
) return File_Name_Type
;
73 -- Returns the file name that corresponds to the body of a given unit
74 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
75 -- rather just a normal form name in lower case, e.g. "xyz.def".
77 procedure Set_File_Name
(U
: Unit_Name_Type
; F
: File_Name_Type
);
78 -- Make association between given unit name, U, and the given file name,
79 -- F. This is the routine called to process a Source_File_Name pragma.
81 procedure Set_File_Name_Pattern
86 -- This is called to process a Source_File_Name pragma whose first
87 -- argument is a file name pattern string. Pat is this pattern string,
88 -- which contains an asterisk to correspond to the unit. Typ is one of
89 -- 'b'/'s'/'u' for body/spec/subunit, Dot is the separator string
90 -- for child/subunit names, and Cas is one of Lower/Upper/Mixed
91 -- indicating the required case for the file name.