mips.h (set_volatile): Delete.
[official-gcc.git] / gcc / ada / uname.ads
blobadbbf42b1f06572a0471969dbb85d0bb6692b855
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- U N A M E --
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 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, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 with Namet; use Namet;
35 with Types; use Types;
37 package Uname is
39 ---------------------------
40 -- Unit Name Conventions --
41 ---------------------------
43 -- Units are associated with a unique ASCII name as follows. First we
44 -- have the fully expanded name of the unit, with lower case letters
45 -- (except for the use of upper case letters for encoding upper half
46 -- and wide characters, as described in Namet), and periods. Following
47 -- this is one of the following suffixes:
49 -- %s for package/subprogram/generic declarations (specs)
50 -- %b for package/subprogram/generic bodies and subunits
52 -- Unit names are stored in the names table, and referred to by the
53 -- corresponding Name_Id values. The subtype Unit_Name, which is a
54 -- synonym for Name_Id, is used to indicate that a Name_Id value that
55 -- holds a unit name (as defined above) is expected.
57 -- Note: as far as possible the conventions for unit names are encapsulated
58 -- in this package. The one exception is that package Fname, which provides
59 -- conversion routines from unit names to file names must be aware of the
60 -- precise conventions that are used.
62 -------------------
63 -- Display Names --
64 -------------------
66 -- For display purposes, unit names are printed out with the suffix
67 -- " (body)" for a body and " (spec)" for a spec. These formats are
68 -- used for the Write_Unit_Name and Get_Unit_Name_String subprograms.
70 -----------------
71 -- Subprograms --
72 -----------------
74 function Get_Body_Name (N : Unit_Name_Type) return Unit_Name_Type;
75 -- Given the name of a spec, this function returns the name of the
76 -- corresponding body, i.e. characters %s replaced by %b
78 function Get_Parent_Body_Name (N : Unit_Name_Type) return Unit_Name_Type;
79 -- Given the name of a subunit, returns the name of the parent body
81 function Get_Parent_Spec_Name (N : Unit_Name_Type) return Unit_Name_Type;
82 -- Given the name of a child unit spec or body, returns the unit name
83 -- of the parent spec. Returns No_Name if the given name is not the name
84 -- of a child unit.
86 procedure Get_External_Unit_Name_String (N : Unit_Name_Type);
87 -- Given the name of a body or spec unit, this procedure places in
88 -- Name_Buffer the name of the unit with periods replaced by double
89 -- underscores. The spec/body indication is eliminated. The length
90 -- of the stored name is placed in Name_Len. All letters are lower
91 -- case, corresponding to the string used in external names.
93 function Get_Spec_Name (N : Unit_Name_Type) return Unit_Name_Type;
94 -- Given the name of a body, this function returns the name of the
95 -- corresponding spec, i.e. characters %b replaced by %s
97 function Get_Unit_Name (N : Node_Id) return Unit_Name_Type;
98 -- This procedure returns the unit name that corresponds to the given node,
99 -- which is one of the following:
101 -- N_Subprogram_Declaration (spec) cases
102 -- N_Package_Declaration
103 -- N_Generic_Declaration
104 -- N_With_Clause
105 -- N_Function_Instantiation
106 -- N_Package_Instantiation
107 -- N_Procedure_Instantiation
108 -- N_Pragma (Elaborate case)
110 -- N_Package_Body (body) cases
111 -- N_Subprogram_Body
112 -- N_Identifier
113 -- N_Selected_Component
115 -- N_Subprogram_Body_Stub (subunit) cases
116 -- N_Package_Body_Stub
117 -- N_Task_Body_Stub
118 -- N_Protected_Body_Stub
119 -- N_Subunit
121 procedure Get_Unit_Name_String
122 (N : Unit_Name_Type;
123 Suffix : Boolean := True);
124 -- Places the display name of the unit in Name_Buffer and sets Name_Len to
125 -- the length of the stored name, i.e. it uses the same interface as the
126 -- Get_Name_String routine in the Namet package. The name is decoded and
127 -- contains an indication of spec or body if Boolean parameter Suffix is
128 -- True.
130 function Is_Body_Name (N : Unit_Name_Type) return Boolean;
131 -- Returns True iff the given name is the unit name of a body (i.e. if
132 -- it ends with the characters %b).
134 function Is_Child_Name (N : Unit_Name_Type) return Boolean;
135 -- Returns True iff the given name is a child unit name (of either a
136 -- body or a spec).
138 function Is_Spec_Name (N : Unit_Name_Type) return Boolean;
139 -- Returns True iff the given name is the unit name of a specification
140 -- (i.e. if it ends with the characters %s).
142 function Name_To_Unit_Name (N : Name_Id) return Unit_Name_Type;
143 -- Given the Id of the Ada name of a unit, this function returns the
144 -- corresponding unit name of the spec (by appending %s to the name).
146 function New_Child
147 (Old : Unit_Name_Type;
148 Newp : Unit_Name_Type) return Unit_Name_Type;
149 -- Old is a child unit name (for either a body or spec). Newp is the
150 -- unit name of the actual parent (this may be different from the
151 -- parent in old). The returned unit name is formed by taking the
152 -- parent name from Newp and the child unit name from Old, with the
153 -- result being a body or spec depending on Old. For example:
155 -- Old = A.B.C (body)
156 -- Newp = A.R (spec)
157 -- result = A.R.C (body)
159 -- See spec of Load_Unit for extensive discussion of why this routine
160 -- needs to be used (the call in the body of Load_Unit is the only one).
162 function Uname_Ge (Left, Right : Unit_Name_Type) return Boolean;
163 function Uname_Gt (Left, Right : Unit_Name_Type) return Boolean;
164 function Uname_Le (Left, Right : Unit_Name_Type) return Boolean;
165 function Uname_Lt (Left, Right : Unit_Name_Type) return Boolean;
166 -- These functions perform lexicographic ordering of unit names. The
167 -- ordering is suitable for printing, and is not quite a straightforward
168 -- comparison of the names, since the convention is that specs appear
169 -- before bodies. Note that the standard = and /= operators work fine
170 -- because all unit names are hashed into the name table, so if two names
171 -- are the same, they always have the same Name_Id value.
173 procedure Write_Unit_Name (N : Unit_Name_Type);
174 -- Given a unit name, this procedure writes the display name to the
175 -- standard output file. Name_Buffer and Name_Len are set as described
176 -- above for the Get_Unit_Name_String call on return.
178 end Uname;