1-- C64109D.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-- CHECK THAT ARRAYS THAT ARE COMPONENTS OF RECORDS ARE PASSED CORRECTLY
26-- TO SUBPROGRAMS.  SPECIFICALLY,
27--   (D) CHECK OBJECTS DESIGNATED BY ACCESS TYPES.
28
29-- CPP 8/20/84
30
31WITH REPORT;  USE REPORT;
32PROCEDURE C64109D IS
33
34BEGIN
35     TEST ("C64109D", "CHECK THAT ARRAYS WHICH ARE COMPONENTS OF " &
36           "RECORDS ARE PASSED CORRECTLY TO SUBPROGRAMS - " &
37           "OBJECTS DESIGNATED BY ACCESS TYPES");
38
39     DECLARE   -- (D)
40
41          SUBTYPE INDEX IS INTEGER RANGE 1..3;
42          TYPE ARRAY_TYPE IS ARRAY (INDEX RANGE <>) OF INTEGER;
43          SUBTYPE ARRAY_SUBTYPE IS ARRAY_TYPE(1..IDENT_INT(3));
44          TYPE NODE_TYPE;
45          TYPE ACCESS_TYPE IS ACCESS NODE_TYPE;
46          TYPE NODE_TYPE IS
47               RECORD
48                    A    : ARRAY_SUBTYPE;
49                    NEXT : ACCESS_TYPE;
50               END RECORD;
51          PTR : ACCESS_TYPE := NEW NODE_TYPE'
52                    (A => (IDENT_INT(1)..3 => IDENT_INT(5)),
53                     NEXT => NULL);
54          BOOL : BOOLEAN;
55
56          PROCEDURE P1 (ARR : ARRAY_TYPE) IS
57          BEGIN
58               IF ARR /= (5, 5, 5) THEN
59                    FAILED ("IN PARAM NOT PASSED CORRECTLY");
60               END IF;
61
62               IF ARR'FIRST /= IDENT_INT(1) OR ARR'LAST /= 3 THEN
63                    FAILED ("WRONG BOUNDS - IN PARAMETER");
64               END IF;
65          END P1;
66
67          FUNCTION F1 (ARR : ARRAY_TYPE) RETURN BOOLEAN IS
68          BEGIN
69               IF ARR /= (5, 5, 5) THEN
70                    FAILED ("IN PARAM NOT PASSED CORRECTLY TO FN");
71               END IF;
72
73               IF ARR'FIRST /= IDENT_INT(1) OR ARR'LAST /= 3 THEN
74                    FAILED ("WRONG BOUNDS - IN PARAMETER FOR FN");
75               END IF;
76
77               RETURN TRUE;
78          END F1;
79
80          PROCEDURE P2 (ARR : IN OUT ARRAY_SUBTYPE) IS
81          BEGIN
82               IF ARR /= (5, 5, 5) THEN
83                    FAILED ("IN OUT PARAM NOT PASSED CORRECTLY");
84               END IF;
85
86               IF ARR'FIRST /= IDENT_INT(1) OR ARR'LAST /= 3 THEN
87                    FAILED ("WRONG BOUNDS - IN OUT PARAMETER");
88               END IF;
89
90               ARR := (OTHERS => 6);
91          END P2;
92
93          PROCEDURE P3 (ARR : OUT ARRAY_TYPE) IS
94          BEGIN
95
96               IF ARR'FIRST /= IDENT_INT(1) OR ARR'LAST /= 3 THEN
97                    FAILED ("WRONG BOUNDS - OUT PARAMETER");
98               END IF;
99
100               ARR := (ARR'RANGE => 7);
101          END P3;
102
103     BEGIN     -- (D)
104
105          P1 (PTR.A);
106          IF PTR.A /= (5, 5, 5) THEN
107               FAILED ("IN PARAM CHANGED BY PROCEDURE");
108          END IF;
109
110          BOOL := F1 (PTR.A);
111          IF PTR.A /= (5, 5, 5) THEN
112               FAILED ("IN PARAM CHANGED BY FUNCTION");
113          END IF;
114
115          P2 (PTR.A);
116          IF PTR.A /= (6, 6, 6) THEN
117               FAILED ("IN OUT PARAM NOT RETURNED CORRECTLY");
118          END IF;
119
120          P3 (PTR.A);
121          IF PTR.A /= (7, 7, 7) THEN
122               FAILED ("OUT PARAM NOT RETURNED CORRECTLY");
123          END IF;
124
125     END; -- (D)
126
127     RESULT;
128END C64109D;
129