Properly regenerate gcc/configure.
[official-gcc.git] / gcc / ada / fname-uf.ads
blob7f7e37bf8102737229afc584fbeae3d9911dcb14
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-2007, 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 ------------------------------------------------------------------------------
26 -- This child package contains the routines to translate a unit name to
27 -- a file name taking into account Source_File_Name pragmas. It also
28 -- contains the auxiliary routines used to record data from the pragmas.
30 -- Note: the reason we split this into a child unit is that the routines
31 -- for unit name translation have a significant number of additional
32 -- dependencies, including osint, and hence sdefault. There are a number
33 -- of tools that use utility subprograms in the Fname parent, but do not
34 -- need the functionality in this child package (and certainly do not want
35 -- to deal with the extra dependencies).
37 with Casing; use Casing;
38 with Types; use Types;
40 package Fname.UF is
42 -----------------
43 -- Subprograms --
44 -----------------
46 type Expected_Unit_Type is (Expect_Body, Expect_Spec, Unknown);
47 -- Return value from Get_Expected_Unit_Type
49 function Get_Expected_Unit_Type
50 (Fname : File_Name_Type) return Expected_Unit_Type;
51 -- If possible, determine whether the given file name corresponds to a unit
52 -- that is a spec or body (e.g. by examining the extension). If this cannot
53 -- be determined with the file naming conventions in use, then the returned
54 -- value is set to Unknown.
56 function Get_File_Name
57 (Uname : Unit_Name_Type;
58 Subunit : Boolean;
59 May_Fail : Boolean := False) return File_Name_Type;
60 -- This function returns the file name that corresponds to a given unit
61 -- name, Uname. The Subunit parameter is set True for subunits, and false
62 -- for all other kinds of units. The caller must ensure that the unit name
63 -- meets the requirements given in package Uname.
65 -- When May_Fail is True, if the file cannot be found, this function
66 -- returns No_File. When it is False, if the file cannot be found,
67 -- a file name compatible with one pattern Source_File_Name pragma is
68 -- returned.
70 function Get_Unit_Index (Uname : Unit_Name_Type) return Nat;
71 -- If there is a specific Source_File_Name pragma for this unit, then
72 -- return the corresponding unit index value. Return 0 if no index given.
74 procedure Initialize;
75 -- Initialize internal tables. This is called automatically when the
76 -- package body is elaborated, so an explicit call to Initialize is
77 -- only required if it is necessary to reinitialize the source file
78 -- name pragma tables.
80 procedure Lock;
81 -- Lock tables before calling back end
83 function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type;
84 -- Returns the file name that corresponds to the spec of a given unit
85 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
86 -- rather just a normal form name in lower case, e.g. "xyz.def".
88 function File_Name_Of_Body (Name : Name_Id) return File_Name_Type;
89 -- Returns the file name that corresponds to the body of a given unit
90 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
91 -- rather just a normal form name in lower case, e.g. "xyz.def".
93 procedure Set_File_Name
94 (U : Unit_Name_Type;
95 F : File_Name_Type;
96 Index : Nat);
97 -- Make association between given unit name, U, and the given file name,
98 -- F. This is the routine called to process a Source_File_Name pragma.
99 -- Index is the value from the index parameter of the pragma if present
100 -- and zero if no index parameter is present.
102 procedure Set_File_Name_Pattern
103 (Pat : String_Ptr;
104 Typ : Character;
105 Dot : String_Ptr;
106 Cas : Casing_Type);
107 -- This is called to process a Source_File_Name pragma whose first
108 -- argument is a file name pattern string. Pat is this pattern string,
109 -- which contains an asterisk to correspond to the unit. Typ is one of
110 -- 'b'/'s'/'u' for body/spec/subunit, Dot is the separator string
111 -- for child/subunit names, and Cas is one of Lower/Upper/Mixed
112 -- indicating the required case for the file name.
114 end Fname.UF;