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