1-- CC1005B.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 A GENERIC UNIT'S IDENTIFIER CAN BE USED IN ITS
27--     FORMAL PART:
28--
29--     (A) AS THE SELECTOR IN AN EXPANDED NAME TO DENOTE AN ENTITY IN THE
30--         VISIBLE PART OF A PACKAGE, OR TO DENOTE AN ENTITY IMMEDIATELY
31--         ENCLOSED IN A CONSTRUCT OTHER THAN THE CONSTRUCT IMMEDIATELY
32--         ENCLOSING THE GENERIC UNIT.
33--
34--     (B) AS A SELECTOR TO DENOTE A COMPONENT OF A RECORD OBJECT,
35--         AS THE NAME OF A RECORD OR DISCRIMINANT COMPONENT IN A RECORD
36--         AGGREGATE, AND AS THE NAME OF A FORMAL PARAMETER IN A
37--         FUNCTION CALL.
38
39-- HISTORY:
40--     BCB 08/03/88  CREATED ORIGINAL TEST.
41--     JRL 03/20/92  DELETED TEST IN BLOCK STATEMENT; CONSOLIDATED
42--                   WITH CC1005C.
43
44WITH REPORT; USE REPORT;
45
46PROCEDURE CC1005B IS
47
48     S : INTEGER := IDENT_INT(0);
49
50     PACKAGE CC1005B IS
51          I : INTEGER;
52          S : INTEGER := IDENT_INT(5);
53          GENERIC
54               S : INTEGER := IDENT_INT(10);
55               V : INTEGER := STANDARD.CC1005B.S;
56               W : INTEGER := STANDARD.CC1005B.CC1005B.S;
57          FUNCTION CC1005B RETURN INTEGER;
58     END CC1005B;
59
60     PACKAGE BODY CC1005B IS
61          FUNCTION CC1005B RETURN INTEGER IS
62          BEGIN
63               IF NOT EQUAL(V,0) THEN
64                    FAILED ("WRONG VALUE OF S USED IN ASSIGNMENT OF V");
65               END IF;
66
67               IF NOT EQUAL(W,5) THEN
68                    FAILED ("WRONG VALUE OF S USED IN ASSIGNMENT OF W");
69               END IF;
70
71               RETURN 0;
72          END CC1005B;
73
74          FUNCTION NEW_CC IS NEW CC1005B;
75
76     BEGIN
77          TEST ("CC1005B", "CHECK THAT A GENERIC UNIT'S IDENTIFIER " &
78                           "CAN BE USED IN ITS FORMAL PART: AS THE " &
79                           "SELECTOR IN AN EXPANDED NAME TO DENOTE " &
80                           "AN ENTITY IN THE VISIBLE PART OF A " &
81                           "PACKAGE, OR TO DENOTE AN ENTITY " &
82                           "IMMEDIATELY ENCLOSED IN A CONSTRUCT " &
83                           "OTHER THAN THE CONSTRUCT IMMEDIATELY " &
84                           "ENCLOSING THE GENERIC UNIT; AND AS A " &
85                           "SELECTOR TO DENOTE A COMPONENT OF A " &
86                           "RECORD OBJECT, AS THE NAME OF A RECORD " &
87                           "OR DISCRIMINANT COMPONENT IN A RECORD " &
88                           "AGGREGATE, AND AS THE NAME OF A FORMAL " &
89                           "PARAMETER IN A FUNCTION CALL");
90
91          I := NEW_CC;
92     END CC1005B;
93
94     FUNCTION F (P : INTEGER) RETURN INTEGER IS
95     BEGIN
96          RETURN P;
97     END F;
98
99BEGIN
100
101     BLOCK1:
102        DECLARE
103             TYPE REC IS RECORD
104                  P : INTEGER := IDENT_INT(0);
105             END RECORD;
106
107             TYPE REC2 (P : INTEGER) IS RECORD
108                  NULL;
109             END RECORD;
110
111             R : REC;
112
113             J : INTEGER;
114
115             GENERIC
116                  V : INTEGER := R.P;
117                  X : REC := (P => IDENT_INT(10));
118                  Y : REC2 := (P => IDENT_INT(15));
119                  Z : INTEGER := F(P => IDENT_INT(20));
120             FUNCTION P RETURN INTEGER;
121
122             FUNCTION P RETURN INTEGER IS
123             BEGIN
124                  IF NOT EQUAL(V,0) THEN
125                       FAILED ("WRONG VALUE OF P USED IN ASSIGNMENT " &
126                               "OF V");
127                  END IF;
128
129                  IF NOT EQUAL(X.P,10) THEN
130                       FAILED ("WRONG VALUE USED IN ASSIGNMENT OF X.P");
131                  END IF;
132
133                  IF NOT EQUAL(Y.P,15) THEN
134                       FAILED ("WRONG VALUE USED IN ASSIGNMENT OF Y.P");
135                  END IF;
136
137                  IF NOT EQUAL(Z,20) THEN
138                       FAILED ("WRONG VALUE OF P USED IN ASSIGNMENT " &
139                               "OF Z");
140                  END IF;
141
142                  RETURN 0;
143             END P;
144
145             FUNCTION NEW_P IS NEW P;
146        BEGIN
147             J := NEW_P;
148        END BLOCK1;
149
150     RESULT;
151END CC1005B;
152