File: asis2-predicates.ads

package info (click to toggle)
adabrowse 4.0.3-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,368 kB
  • ctags: 252
  • sloc: ada: 29,770; makefile: 119; ansic: 4
file content (358 lines) | stat: -rw-r--r-- 11,992 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
-------------------------------------------------------------------------------
--
--  This unit is part of the @Asis2@ ASIS secondary library.
--
--  <STRONG>Copyright (c) 2003 by Thomas Wolf.</STRONG>
--  <BLOCKQUOTE>
--    AdaBrowse is free software; you can redistribute it and/or modify it
--    under the terms of the  GNU General Public License as published by the
--    Free Software  Foundation; either version 2, or (at your option) any
--    later version. AdaBrowse is distributed in the hope that it will be
--    useful, but <EM>without any warranty</EM>; without even the implied
--    warranty of <EM>merchantability or fitness for a particular purpose.</EM>
--    See the GNU General Public License for  more details. You should have
--    received a copy of the GNU General Public License with this distribution,
--    see file "<A HREF="GPL.txt">GPL.txt</A>". If not, write to the Free
--    Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
--    USA.
--  </BLOCKQUOTE>
--  <BLOCKQUOTE>
--    As a special exception from the GPL, if other files instantiate generics
--    from this unit, or you link this unit with other files to produce an
--    executable, this unit does not by itself cause the resulting executable
--    to be covered by the GPL. This exception does not however invalidate any
--    other reasons why the executable file might be covered by the GPL.
--  </BLOCKQUOTE>
--
--  <AUTHOR>
--     Thomas Wolf  (TW) <E_MAIL>
--  </AUTHOR>
--
--  <PURPOSE>
--    Useful predicates on @Asis.Element@. All predicates return @False@ if
--    called with inappropriate element kinds.
--
--    Whereever the following descriptions specify "a declaration of", this
--    also allows "a defining name in a declaration of".
--
--    Wherever the following descriptions specify "a declaration of a type" or
--    " a type declaration", this also allows "a type definition" of such a
--    type.
--
--    Mentions of "type" include generic formal types, "variable" includes
--    generic formal "in out" objects, and so on.
--
--    If @Element@ is an @Expression@, the predicates on types are also
--    applicable, they refer to the type of the expression. If the @Expression@
--    is a name (identifier, operator, enumeration literal, or selected
--    component), they refer to the referenced defining name.
--  </PURPOSE>
--
--  <HISTORY>
--   05-JUN-2003   TW  Initial version.
--   08-JUL-2003   TW  Added 'Is_Package'; changed 'Unique_Name' to really
--                     return the fully qualified name.
--   18-JUL-2003   TW  Removed the string operations, put into the @Asis2@
--                     library, changed the license.
--  </HISTORY>
-------------------------------------------------------------------------------

pragma License (Modified_GPL);

with Asis;

package Asis2.Predicates is

   pragma Elaborate_Body;

   ----------------------------------------------------------------------------
   --  Units

   function Is_Private
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is a declaration occurring in the private
   --  part of a (generic) package declaration, task or protected type
   --  declaration, or a single task or protected object declaration. Also
   --  returns @True@ if <CODE>Is_Unit (Element)</CODE> and it is a private
   --  library unit.

   function Is_Separate
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for separate body declarations and stubs.

   function Is_Unit
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is the declaration of a compilation unit
   --  (spec or body).

   function Is_Child
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if <CODE>Is_Unit (Element)</CODE> and it is not a
   --  root library unit.

   ----------------------------------------------------------------------------
   --  Items

   function Is_Package
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for all kinds of package declarations.

   function Is_Constant
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for constant and named number declarations.

   function Is_Variable
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for variable declarations and single task or protected
   --  object declarations.

   function Is_Type
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is a type declaration.

   function Is_Subtype
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is a subtype declaration.

   function Is_Procedure
     (Element : in Asis.Element)
     return Boolean;

   function Is_Function
     (Element : in Asis.Element)
     return Boolean;

   function Is_Subprogram
     (Element : in Asis.Element)
     return Boolean;
   --  <CODE>Is_Procedure (Element) <STRONG>or</STRONG>
   --  Is_Function (Element)</CODE>.

   function Is_Entry
     (Element : in Asis.Element)
     return Boolean;

   function Is_Pragma
     (Element : in Asis.Element)
     return Boolean;

   function Is_Clause
     (Element : in Asis.Element)
     return Boolean;

   ----------------------------------------------------------------------------
   --  Types, Variables, and Constants. See RM 3.2

   function Is_Elementary
     (Element : in Asis.Element)
     return Boolean;

   function Is_Scalar
     (Element : in Asis.Element)
     return Boolean;

   function Is_Discrete
     (Element : in Asis.Element)
     return Boolean;

   function Is_Enumeration
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of an enumeration
   --  type or a variable declaration whose type is an enumeration type.
   --  Includes subtypes and derived types, also includes character and boolean
   --  types.

   function Is_Integral
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of an integer
   --  type or a variable declaration whose type is an integer type.
   --  Includes subtypes and derived types.

   function Is_Signed
     (Element : in Asis.Element)
     return Boolean;

   function Is_Modular
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a modular
   --  type or a variable declaration whose type is a modular type.
   --  Includes subtypes and derived types.

   function Is_Real
     (Element : in Asis.Element)
     return Boolean;

   function Is_Float
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a modular
   --  type or a variable declaration whose type is a modular type.
   --  Includes subtypes and derived types.

   function Is_Fixed
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a modular
   --  type or a variable declaration whose type is a modular type.
   --  Includes subtypes and derived types.

   function Is_Ordinary_Fixed
     (Element : in Asis.Element)
     return Boolean;

   function Is_Decimal_Fixed
     (Element : in Asis.Element)
     return Boolean;

   function Is_Numeric
     (Element : in Asis.Element)
     return Boolean;

   function Is_Access
     (Element : in Asis.Element)
     return Boolean;
   --  <CODE>Is_Access_To_Object <STRONG>or</STRONG>
   --  Is_Access_To_Subprogram</CODE>.

   function Is_Access_To_Object
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of an access
   --  type or a variable declaration whose type is an access type. Includes
   --  subtypes and derived types.

   function Is_Access_To_Subprogram
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of an access
   --  type or a variable declaration whose type is an access type. Includes
   --  subtypes and derived types.

   function Is_Composite
     (Element : in Asis.Element)
     return Boolean;

   function Is_Array
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of an array
   --  type or a variable declaration whose type is an array type. Includes
   --  subtypes and derived types.

   function Is_Record
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a record
   --  type or a variable declaration whose type is a record type. Includes
   --  subtypes and derived types.

   function Is_Tagged
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a tagged type
   --  or a variable declaration whose type is tagged.
   --
   --  This includes types derived from tagged types, but not subtypes of
   --  tagged types!

   function Is_Task
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either a task type declaration, a single
   --  task declaration, or a defining name in a variable declaration whose
   --  type is a task type. Includes subtypes and derived types.

   function Is_Protected
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either a protected type declaration, a
   --  protected object declaration, or a defining name in a variable
   --  declaration whose type is a protected type. Includes subtypes and
   --  derived types.

   function Is_Limited
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a limited type
   --  or a variable declaration whose type is limited. Includes subtypes and
   --  derived types.

   function Is_Class_Wide
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a class-wide
   --  type or a variable declaration whose type is class-wide. Includes
   --  subtypes.

   function Is_Controlled
     (Element : in Asis.Element)
     return Boolean;
   --  Definition: a <EM>controlled type</EM> is a type derived from one of
   --  the two types declared in @Ada.Finalization@.
   --
   --  Returns @True@ if @Element@ is either the declaration of a controlled
   --  type or a variable declaration whose type is controlled. Includes
   --  subtypes.

   function Is_Private_Type
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is either the declaration of a private
   --  type or a variable declaration whose type is private.

   function Is_Incomplete
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ if @Element@ is the declaration of an incomplete type
   --  or a deferred constant.

   function Is_Aliased
     (Element : in Asis.Element)
     return Boolean;

   ----------------------------------------------------------------------------
   --  Generics, renamings, and other stuff.

   function Is_Exception
     (Element : in Asis.Element)
     return Boolean;

   function Is_Renaming
     (Element : in Asis.Element)
     return Boolean;

   function Is_Generic
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for generic subprogram and package declarations, their
   --  bodies, and generic formal types and objects.

   function Is_Generic_Formal
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for all generic formals.

   function Is_Instance
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for all instantiations of generic subprograms or
   --  packages.

   function Is_Abstract
     (Element : in Asis.Element)
     return Boolean;
   --  Returns @True@ for all abstract types and subprograms.

end Asis2.Predicates;