OSDN Git Service

PR bootstrap/11932
[pf3gnuchains/gcc-fork.git] / gcc / ada / fname-uf.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             F N A M E . U F                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2004 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, 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 --  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.
30
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).
37
38 with Casing; use Casing;
39
40 package Fname.UF is
41
42    -----------------
43    -- Subprograms --
44    -----------------
45
46    function Get_File_Name
47      (Uname    : Unit_Name_Type;
48       Subunit  : Boolean;
49       May_Fail : Boolean := False) 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.
55    --  When May_Fail is True, if the file cannot be found, this function
56    --  returns No_File. When it is False, if the file cannot be found,
57    --  a file name compatible with one pattern Source_File_Name pragma is
58    --  returned.
59
60    procedure Initialize;
61    --  Initialize internal tables. This is called automatically when the
62    --  package body is elaborated, so an explicit call to Initialize is
63    --  only required if it is necessary to reinitialize the source file
64    --  name pragma tables.
65
66    procedure Lock;
67    --  Lock tables before calling back end
68
69    function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type;
70    --  Returns the file name that corresponds to the spec of a given unit
71    --  name. The unit name here is not encoded as a Unit_Name_Type, but is
72    --  rather just a normal form name in lower case, e.g. "xyz.def".
73
74    function File_Name_Of_Body (Name : Name_Id) return File_Name_Type;
75    --  Returns the file name that corresponds to the body of a given unit
76    --  name. The unit name here is not encoded as a Unit_Name_Type, but is
77    --  rather just a normal form name in lower case, e.g. "xyz.def".
78
79    procedure Set_File_Name (U : Unit_Name_Type; F : File_Name_Type);
80    --  Make association between given unit name, U, and the given file name,
81    --  F. This is the routine called to process a Source_File_Name pragma.
82
83    procedure Set_File_Name_Pattern
84      (Pat : String_Ptr;
85       Typ : Character;
86       Dot : String_Ptr;
87       Cas : Casing_Type);
88    --  This is called to process a Source_File_Name pragma whose first
89    --  argument is a file name pattern string.  Pat is this pattern string,
90    --  which contains an asterisk to correspond to the unit. Typ is one of
91    --  'b'/'s'/'u' for body/spec/subunit, Dot is the separator string
92    --  for child/subunit names, and Cas is one of Lower/Upper/Mixed
93    --  indicating the required case for the file name.
94
95 end Fname.UF;