1 |
294 |
jeremybenn |
-- CC3016I.ADA
|
2 |
|
|
|
3 |
|
|
-- Grant of Unlimited Rights
|
4 |
|
|
--
|
5 |
|
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
6 |
|
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
7 |
|
|
-- unlimited rights in the software and documentation contained herein.
|
8 |
|
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
9 |
|
|
-- this public release, the Government intends to confer upon all
|
10 |
|
|
-- recipients unlimited rights equal to those held by the Government.
|
11 |
|
|
-- These rights include rights to use, duplicate, release or disclose the
|
12 |
|
|
-- released technical data and computer software in whole or in part, in
|
13 |
|
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
14 |
|
|
-- to do so.
|
15 |
|
|
--
|
16 |
|
|
-- DISCLAIMER
|
17 |
|
|
--
|
18 |
|
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
19 |
|
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
20 |
|
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
21 |
|
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
22 |
|
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
23 |
|
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
24 |
|
|
--*
|
25 |
|
|
-- OBJECTIVE:
|
26 |
|
|
-- CHECK THAT AN INSTANTIATED PACKAGE HAS THE PROPERTIES REQUIRED
|
27 |
|
|
-- OF A PACKAGE.
|
28 |
|
|
|
29 |
|
|
-- CHECK THAT IF THE DESIGNATED TYPE OF AN ACCESS TYPE IS A GENERIC
|
30 |
|
|
-- FORMAL TYPE, OR IS A TYPE DERIVED DIRECTLY OR INDIRECTLY FROM A
|
31 |
|
|
-- GENERIC FORMAL TYPE, THE OPERATIONS DECLARED FOR THE ACCESS TYPE
|
32 |
|
|
-- IN THE TEMPLATE ARE DETERMINED BY THE DECLARATION OF THE FORMAL
|
33 |
|
|
-- TYPE. THE OPERATIONS DECLARED FOR ACCESS TYPE IN THE INSTANCE
|
34 |
|
|
-- ARE DETERMINED BY THE ACTUAL TYPE DENOTED BY THE FORMAL PARAMETER.
|
35 |
|
|
-- SEE AI-00398.
|
36 |
|
|
|
37 |
|
|
-- HISTORY:
|
38 |
|
|
-- DAS 8 OCT 90 INITIAL VERSION.
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
WITH REPORT; USE REPORT;
|
42 |
|
|
|
43 |
|
|
PROCEDURE CC3016I IS
|
44 |
|
|
BEGIN
|
45 |
|
|
TEST("CC3016I", "CHECK THAT AN INSTANTIATED PACKAGE HAS THE " &
|
46 |
|
|
"PROPERTIES REQUIRED OF A PACKAGE.");
|
47 |
|
|
|
48 |
|
|
EXAMPLE_5A:
|
49 |
|
|
DECLARE
|
50 |
|
|
GENERIC
|
51 |
|
|
TYPE T5A (D : POSITIVE) IS PRIVATE;
|
52 |
|
|
PACKAGE GP5A IS
|
53 |
|
|
TYPE NT5A IS NEW T5A;
|
54 |
|
|
X : NT5A (D => 5);
|
55 |
|
|
Y : POSITIVE := X.D; -- REFERS TO DISCRIMINANT OF NT5A
|
56 |
|
|
END GP5A;
|
57 |
|
|
|
58 |
|
|
TYPE REC (A : POSITIVE) IS
|
59 |
|
|
RECORD
|
60 |
|
|
D : POSITIVE := 7;
|
61 |
|
|
END RECORD;
|
62 |
|
|
PACKAGE P5A IS NEW GP5A (T5A => REC);
|
63 |
|
|
-- P5A.Y INITIALIZED WITH VALUE USING COMPONENT SELECTION
|
64 |
|
|
-- OPERATION FOR THE DISCRIMINANT, I.E. FOR PARENT TYPE
|
65 |
|
|
-- T5A WHICH DENOTES REC.
|
66 |
|
|
|
67 |
|
|
W1 : POSITIVE := P5A.X.D; -- VALUE IS 7
|
68 |
|
|
W2 : POSITIVE := P5A.X.A; -- VALUE IS 5
|
69 |
|
|
W3 : POSITIVE := P5A.Y; -- VALUE IS 5;
|
70 |
|
|
BEGIN
|
71 |
|
|
IF ( ( W1 /= 7 ) OR ( W2 /= 5 ) OR (W3 /= 5 ) ) THEN
|
72 |
|
|
FAILED ("INCORRECT COMPONENT SELECTION - ACCESS");
|
73 |
|
|
END IF;
|
74 |
|
|
END EXAMPLE_5A;
|
75 |
|
|
|
76 |
|
|
RESULT;
|
77 |
|
|
|
78 |
|
|
END CC3016I;
|