annotate gcc/ada/fname-uf.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- F N A M E . U F --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This child package contains the routines to translate a unit name to
kono
parents:
diff changeset
27 -- a file name taking into account Source_File_Name pragmas. It also
kono
parents:
diff changeset
28 -- contains the auxiliary routines used to record data from the pragmas.
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 -- Note: the reason we split this into a child unit is that the routines
kono
parents:
diff changeset
31 -- for unit name translation have a significant number of additional
kono
parents:
diff changeset
32 -- dependencies, including osint, and hence sdefault. There are a number
kono
parents:
diff changeset
33 -- of tools that use utility subprograms in the Fname parent, but do not
kono
parents:
diff changeset
34 -- need the functionality in this child package (and certainly do not want
kono
parents:
diff changeset
35 -- to deal with the extra dependencies).
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 with Casing; use Casing;
kono
parents:
diff changeset
38 with Types; use Types;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 package Fname.UF is
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 -----------------
kono
parents:
diff changeset
43 -- Subprograms --
kono
parents:
diff changeset
44 -----------------
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 type Expected_Unit_Type is (Expect_Body, Expect_Spec, Unknown);
kono
parents:
diff changeset
47 -- Return value from Get_Expected_Unit_Type
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 function Get_Expected_Unit_Type
kono
parents:
diff changeset
50 (Fname : File_Name_Type) return Expected_Unit_Type;
kono
parents:
diff changeset
51 -- If possible, determine whether the given file name corresponds to a unit
kono
parents:
diff changeset
52 -- that is a spec or body (e.g. by examining the extension). If this cannot
kono
parents:
diff changeset
53 -- be determined with the file naming conventions in use, then the returned
kono
parents:
diff changeset
54 -- value is set to Unknown.
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 function Get_File_Name
kono
parents:
diff changeset
57 (Uname : Unit_Name_Type;
kono
parents:
diff changeset
58 Subunit : Boolean;
kono
parents:
diff changeset
59 May_Fail : Boolean := False) return File_Name_Type;
kono
parents:
diff changeset
60 -- This function returns the file name that corresponds to a given unit
kono
parents:
diff changeset
61 -- name, Uname. The Subunit parameter is set True for subunits, and false
kono
parents:
diff changeset
62 -- for all other kinds of units. The caller must ensure that the unit name
kono
parents:
diff changeset
63 -- meets the requirements given in package Uname.
kono
parents:
diff changeset
64 --
kono
parents:
diff changeset
65 -- When May_Fail is True, if the file cannot be found, this function
kono
parents:
diff changeset
66 -- returns No_File. When it is False, if the file cannot be found,
kono
parents:
diff changeset
67 -- a file name compatible with one pattern Source_File_Name pragma is
kono
parents:
diff changeset
68 -- returned.
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 function Get_Unit_Index (Uname : Unit_Name_Type) return Nat;
kono
parents:
diff changeset
71 -- If there is a specific Source_File_Name pragma for this unit, then
kono
parents:
diff changeset
72 -- return the corresponding unit index value. Return 0 if no index given.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 procedure Initialize;
kono
parents:
diff changeset
75 -- Initialize internal tables. This is called automatically when the
kono
parents:
diff changeset
76 -- package body is elaborated, so an explicit call to Initialize is
kono
parents:
diff changeset
77 -- only required if it is necessary to reinitialize the source file
kono
parents:
diff changeset
78 -- name pragma tables.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 procedure Lock;
kono
parents:
diff changeset
81 -- Lock tables before calling back end
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 function File_Name_Of_Spec (Name : Name_Id) return File_Name_Type;
kono
parents:
diff changeset
84 -- Returns the file name that corresponds to the spec of a given unit
kono
parents:
diff changeset
85 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
kono
parents:
diff changeset
86 -- rather just a normal form name in lower case, e.g. "xyz.def".
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 function File_Name_Of_Body (Name : Name_Id) return File_Name_Type;
kono
parents:
diff changeset
89 -- Returns the file name that corresponds to the body of a given unit
kono
parents:
diff changeset
90 -- name. The unit name here is not encoded as a Unit_Name_Type, but is
kono
parents:
diff changeset
91 -- rather just a normal form name in lower case, e.g. "xyz.def".
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 procedure Set_File_Name
kono
parents:
diff changeset
94 (U : Unit_Name_Type;
kono
parents:
diff changeset
95 F : File_Name_Type;
kono
parents:
diff changeset
96 Index : Nat);
kono
parents:
diff changeset
97 -- Make association between given unit name, U, and the given file name,
kono
parents:
diff changeset
98 -- F. This is the routine called to process a Source_File_Name pragma.
kono
parents:
diff changeset
99 -- Index is the value from the index parameter of the pragma if present
kono
parents:
diff changeset
100 -- and zero if no index parameter is present.
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 procedure Set_File_Name_Pattern
kono
parents:
diff changeset
103 (Pat : String_Ptr;
kono
parents:
diff changeset
104 Typ : Character;
kono
parents:
diff changeset
105 Dot : String_Ptr;
kono
parents:
diff changeset
106 Cas : Casing_Type);
kono
parents:
diff changeset
107 -- This is called to process a Source_File_Name pragma whose first
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
108 -- argument is a file name pattern string. Pat is this pattern string,
111
kono
parents:
diff changeset
109 -- which contains an asterisk to correspond to the unit. Typ is one of
kono
parents:
diff changeset
110 -- 'b'/'s'/'u' for body/spec/subunit, Dot is the separator string
kono
parents:
diff changeset
111 -- for child/subunit names, and Cas is one of Lower/Upper/Mixed
kono
parents:
diff changeset
112 -- indicating the required case for the file name.
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 end Fname.UF;