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