OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [uname.ads] - Blame information for rev 711

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                                U N A M E                                 --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2009  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
with Namet; use Namet;
33
with Types; use Types;
34
 
35
package Uname is
36
 
37
   ---------------------------
38
   -- Unit Name Conventions --
39
   ---------------------------
40
 
41
   --  Units are associated with a unique ASCII name as follows. First we have
42
   --  the fully expanded name of the unit, with lower case letters (except
43
   --  for the use of upper case letters for encoding upper half and wide
44
   --  characters, as described in Namet), and periods. Following this is one
45
   --  of the following suffixes:
46
 
47
   --    %s  for package/subprogram/generic declarations (specs)
48
   --    %b  for package/subprogram/generic bodies and subunits
49
 
50
   --  Unit names are stored in the names table, and referred to by the
51
   --  corresponding Name_Id values. The type Unit_Name_Type, derived from
52
   --  Name_Id, is used to indicate that a Name_Id value that holds a unit name
53
   --  (as defined above) is expected.
54
 
55
   --  Note: as far as possible the conventions for unit names are encapsulated
56
   --  in this package. The one exception is that package Fname, which provides
57
   --  conversion routines from unit names to file names must be aware of the
58
   --  precise conventions that are used.
59
 
60
   -------------------
61
   -- Display Names --
62
   -------------------
63
 
64
   --  For display purposes, unit names are printed out with the suffix
65
   --  " (body)" for a body and " (spec)" for a spec. These formats are
66
   --  used for the Write_Unit_Name and Get_Unit_Name_String subprograms.
67
 
68
   -----------------
69
   -- Subprograms --
70
   -----------------
71
 
72
   function Get_Body_Name (N : Unit_Name_Type) return Unit_Name_Type;
73
   --  Given the name of a spec, this function returns the name of the
74
   --  corresponding body, i.e. characters %s replaced by %b
75
 
76
   function Get_Parent_Body_Name (N : Unit_Name_Type) return Unit_Name_Type;
77
   --  Given the name of a subunit, returns the name of the parent body
78
 
79
   function Get_Parent_Spec_Name (N : Unit_Name_Type) return Unit_Name_Type;
80
   --  Given the name of a child unit spec or body, returns the unit name
81
   --  of the parent spec. Returns No_Name if the given name is not the name
82
   --  of a child unit.
83
 
84
   procedure Get_External_Unit_Name_String (N : Unit_Name_Type);
85
   --  Given the name of a body or spec unit, this procedure places in
86
   --  Name_Buffer the name of the unit with periods replaced by double
87
   --  underscores. The spec/body indication is eliminated. The length
88
   --  of the stored name is placed in Name_Len. All letters are lower
89
   --  case, corresponding to the string used in external names.
90
 
91
   function Get_Spec_Name (N : Unit_Name_Type) return Unit_Name_Type;
92
   --  Given the name of a body, this function returns the name of the
93
   --  corresponding spec, i.e. characters %b replaced by %s
94
 
95
   function Get_Unit_Name (N : Node_Id) return Unit_Name_Type;
96
   --  This procedure returns the unit name that corresponds to the given node,
97
   --  which is one of the following:
98
   --
99
   --    N_Subprogram_Declaration         (spec) cases
100
   --    N_Package_Declaration
101
   --    N_Generic_Declaration
102
   --    N_With_Clause
103
   --    N_Function_Instantiation
104
   --    N_Package_Instantiation
105
   --    N_Procedure_Instantiation
106
   --    N_Pragma (Elaborate case)
107
   --
108
   --    N_Package_Body                   (body) cases
109
   --    N_Subprogram_Body
110
   --    N_Identifier
111
   --    N_Selected_Component
112
   --
113
   --    N_Subprogram_Body_Stub           (subunit) cases
114
   --    N_Package_Body_Stub
115
   --    N_Task_Body_Stub
116
   --    N_Protected_Body_Stub
117
   --    N_Subunit
118
 
119
   procedure Get_Unit_Name_String
120
     (N      : Unit_Name_Type;
121
      Suffix : Boolean := True);
122
   --  Places the display name of the unit in Name_Buffer and sets Name_Len to
123
   --  the length of the stored name, i.e. it uses the same interface as the
124
   --  Get_Name_String routine in the Namet package. The name is decoded and
125
   --  contains an indication of spec or body if Boolean parameter Suffix is
126
   --  True.
127
 
128
   function Is_Body_Name (N : Unit_Name_Type) return Boolean;
129
   --  Returns True iff the given name is the unit name of a body (i.e. if
130
   --  it ends with the characters %b).
131
 
132
   function Is_Child_Name (N : Unit_Name_Type) return Boolean;
133
   --  Returns True iff the given name is a child unit name (of either a
134
   --  body or a spec).
135
 
136
   function Is_Spec_Name (N : Unit_Name_Type) return Boolean;
137
   --  Returns True iff the given name is the unit name of a specification
138
   --  (i.e. if it ends with the characters %s).
139
 
140
   function Name_To_Unit_Name (N : Name_Id) return Unit_Name_Type;
141
   --  Given the Id of the Ada name of a unit, this function returns the
142
   --  corresponding unit name of the spec (by appending %s to the name).
143
 
144
   function New_Child
145
     (Old  : Unit_Name_Type;
146
      Newp : Unit_Name_Type) return Unit_Name_Type;
147
   --   Old is a child unit name (for either a body or spec). Newp is the unit
148
   --   name of the actual parent (this may be different from the parent in
149
   --   old). The returned unit name is formed by taking the parent name from
150
   --   Newp and the child unit name from Old, with the result being a body or
151
   --   spec depending on Old. For example:
152
   --
153
   --     Old    = A.B.C (body)
154
   --     Newp   = A.R (spec)
155
   --     result = A.R.C (body)
156
   --
157
   --   See spec of Load_Unit for extensive discussion of why this routine
158
   --   needs to be used (the call in the body of Load_Unit is the only one).
159
 
160
   function Uname_Ge (Left, Right : Unit_Name_Type) return Boolean;
161
   function Uname_Gt (Left, Right : Unit_Name_Type) return Boolean;
162
   function Uname_Le (Left, Right : Unit_Name_Type) return Boolean;
163
   function Uname_Lt (Left, Right : Unit_Name_Type) return Boolean;
164
   --  These functions perform lexicographic ordering of unit names. The
165
   --  ordering is suitable for printing, and is not quite a straightforward
166
   --  comparison of the names, since the convention is that specs appear
167
   --  before bodies. Note that the standard = and /= operators work fine
168
   --  because all unit names are hashed into the name table, so if two names
169
   --  are the same, they always have the same Name_Id value.
170
 
171
   procedure Write_Unit_Name (N : Unit_Name_Type);
172
   --  Given a unit name, this procedure writes the display name to the
173
   --  standard output file. Name_Buffer and Name_Len are set as described
174
   --  above for the Get_Unit_Name_String call on return.
175
 
176
end Uname;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.