1 |
294 |
jeremybenn |
-- C41203A.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 THE NAME PART OF A SLICE MAY BE:
|
26 |
|
|
-- AN IDENTIFIER DENOTING A ONE DIMENSIONAL ARRAY OBJECT - N1;
|
27 |
|
|
-- AN IDENTIFIER DENOTING AN ACCESS OBJECT WHOSE VALUE
|
28 |
|
|
-- DESIGNATES A ONE DIMENSIONAL ARRAY OBJECT - N2;
|
29 |
|
|
-- A FUNCTION CALL DELIVERING A ONE DIMENSIONAL ARRAY OBJECT USING
|
30 |
|
|
-- A PREDEFINED FUNCTION - &,
|
31 |
|
|
-- A USER-DEFINED FUNCTION - F1;
|
32 |
|
|
-- A FUNCTION CALL DELIVERING AN ACCESS VALUE THAT
|
33 |
|
|
-- DESIGNATES A ONE DIMENSIONAL ARRAY - F2;
|
34 |
|
|
-- A SLICE - N3;
|
35 |
|
|
-- AN INDEXED COMPONENT DENOTING A ONE DIMENSIONAL ARRAY OBJECT
|
36 |
|
|
-- (ARRAY OF ARRAYS) - N4;
|
37 |
|
|
-- AN IDENTIFIER PREFIXED BY THE NAME OF THE INNERMOST UNIT
|
38 |
|
|
-- ENCLOSING ITS DECLARATION - C41203A.N1;
|
39 |
|
|
-- A RECORD COMPONENT (OF A RECORD CONTAINING ONE OR MORE
|
40 |
|
|
-- ARRAYS WHOSE BOUNDS DEPEND ON A DISCRIMINANT) - N5.
|
41 |
|
|
-- CHECK THAT THE APPROPRIATE SLICE IS ACCESSED (FOR
|
42 |
|
|
-- STATIC INDICES).
|
43 |
|
|
|
44 |
|
|
-- WKB 8/5/81
|
45 |
|
|
-- SPS 11/1/82
|
46 |
|
|
-- PWN 11/30/94 SUBTYPE QUALIFIED LITERALS FOR ADA 9X.
|
47 |
|
|
|
48 |
|
|
WITH REPORT;
|
49 |
|
|
USE REPORT;
|
50 |
|
|
PROCEDURE C41203A IS
|
51 |
|
|
|
52 |
|
|
TYPE T1 IS ARRAY (INTEGER RANGE <> ) OF INTEGER;
|
53 |
|
|
SUBTYPE A1 IS T1 (1..6);
|
54 |
|
|
N1 : A1 := (1,2,3,4,5,6);
|
55 |
|
|
|
56 |
|
|
BEGIN
|
57 |
|
|
TEST ("C41203A", "CHECK THAT THE NAME PART OF A SLICE MAY BE " &
|
58 |
|
|
"OF CERTAIN FORMS AND THAT THE APPROPRIATE " &
|
59 |
|
|
"SLICE IS ACCESSED (FOR STATIC INDICES)");
|
60 |
|
|
|
61 |
|
|
DECLARE
|
62 |
|
|
|
63 |
|
|
TYPE T2 IS ARRAY (INTEGER RANGE <> ) OF BOOLEAN;
|
64 |
|
|
SUBTYPE A2 IS T2 (1..6);
|
65 |
|
|
TYPE A3 IS ACCESS A1;
|
66 |
|
|
SUBTYPE SI IS INTEGER RANGE 1 .. 3;
|
67 |
|
|
TYPE A4 IS ARRAY (SI) OF A1;
|
68 |
|
|
TYPE R (LENGTH : INTEGER) IS
|
69 |
|
|
RECORD
|
70 |
|
|
S : STRING (1..LENGTH);
|
71 |
|
|
END RECORD;
|
72 |
|
|
|
73 |
|
|
N2 : A3 := NEW A1' (1,2,3,4,5,6);
|
74 |
|
|
N3 : T1 (1..7) := (1,2,3,4,5,6,7);
|
75 |
|
|
N4 : A4 := (1 => (1,2,3,4,5,6), 2 => (7,8,9,10,11,12),
|
76 |
|
|
3 => (13,14,15,16,17,18));
|
77 |
|
|
N5 : R(6) := (LENGTH => 6, S => "ABCDEF");
|
78 |
|
|
|
79 |
|
|
FUNCTION F1 RETURN A2 IS
|
80 |
|
|
BEGIN
|
81 |
|
|
RETURN (FALSE,FALSE,TRUE,FALSE,TRUE,TRUE);
|
82 |
|
|
END F1;
|
83 |
|
|
|
84 |
|
|
FUNCTION F2 RETURN A3 IS
|
85 |
|
|
BEGIN
|
86 |
|
|
RETURN N2;
|
87 |
|
|
END F2;
|
88 |
|
|
|
89 |
|
|
PROCEDURE P1 (X : IN T1; Y : IN OUT T1;
|
90 |
|
|
Z : OUT T1; W : IN STRING) IS
|
91 |
|
|
BEGIN
|
92 |
|
|
IF X /= (1,2) THEN
|
93 |
|
|
FAILED ("WRONG VALUE FOR IN PARAMETER - " & W);
|
94 |
|
|
END IF;
|
95 |
|
|
IF Y /= (3,4) THEN
|
96 |
|
|
FAILED ("WRONG VALUE FOR IN OUT PARAMETER - " & W);
|
97 |
|
|
END IF;
|
98 |
|
|
Y := (10,11);
|
99 |
|
|
Z := (12,13);
|
100 |
|
|
END P1;
|
101 |
|
|
|
102 |
|
|
PROCEDURE P2 (X : STRING) IS
|
103 |
|
|
BEGIN
|
104 |
|
|
IF X /= "BC" THEN
|
105 |
|
|
FAILED ("WRONG VALUE FOR IN PARAMETER - '&'");
|
106 |
|
|
END IF;
|
107 |
|
|
END P2;
|
108 |
|
|
|
109 |
|
|
PROCEDURE P3 (X : T2) IS
|
110 |
|
|
BEGIN
|
111 |
|
|
IF X /= (FALSE,TRUE,FALSE) THEN
|
112 |
|
|
FAILED ("WRONG VALUE FOR IN PARAMETER - F1");
|
113 |
|
|
END IF;
|
114 |
|
|
END P3;
|
115 |
|
|
|
116 |
|
|
PROCEDURE P5 (X : IN STRING; Y : IN OUT STRING;
|
117 |
|
|
Z : OUT STRING) IS
|
118 |
|
|
BEGIN
|
119 |
|
|
IF X /= "EF" THEN
|
120 |
|
|
FAILED ("WRONG VALUE FOR IN PARAMETER - N5");
|
121 |
|
|
END IF;
|
122 |
|
|
IF Y /= "CD" THEN
|
123 |
|
|
FAILED ("WRONG VALUE FOR IN OUT PARAMETER - N5");
|
124 |
|
|
END IF;
|
125 |
|
|
Y := "XY";
|
126 |
|
|
Z := "WZ";
|
127 |
|
|
END P5;
|
128 |
|
|
|
129 |
|
|
BEGIN
|
130 |
|
|
|
131 |
|
|
IF N1(1..2) /= (1,2) THEN
|
132 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - N1");
|
133 |
|
|
END IF;
|
134 |
|
|
N1(1..2) := (7,8);
|
135 |
|
|
IF N1 /= (7,8,3,4,5,6) THEN
|
136 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - N1");
|
137 |
|
|
END IF;
|
138 |
|
|
N1 := (1,2,3,4,5,6);
|
139 |
|
|
P1 (N1(1..2), N1(3..4), N1(5..6), "N1");
|
140 |
|
|
IF N1 /= (1,2,10,11,12,13) THEN
|
141 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N1");
|
142 |
|
|
END IF;
|
143 |
|
|
|
144 |
|
|
IF N2(4..6) /= (4,5,6) THEN
|
145 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - N2");
|
146 |
|
|
END IF;
|
147 |
|
|
N2(4..6) := (7,8,9);
|
148 |
|
|
IF N2.ALL /= (1,2,3,7,8,9) THEN
|
149 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - N2");
|
150 |
|
|
END IF;
|
151 |
|
|
N2.ALL := (1,2,5,6,3,4);
|
152 |
|
|
P1 (N2(1..2), N2(5..6), N2(3..4), "N2");
|
153 |
|
|
IF N2.ALL /= (1,2,12,13,10,11) THEN
|
154 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N2");
|
155 |
|
|
END IF;
|
156 |
|
|
|
157 |
|
|
IF "&" (STRING'("AB"), STRING'("CDEF"))(4..6) /= STRING'("DEF") THEN
|
158 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - '&'");
|
159 |
|
|
END IF;
|
160 |
|
|
P2 ("&" ("AB", "CD")(2..3));
|
161 |
|
|
|
162 |
|
|
IF F1(1..2) /= (FALSE,FALSE) THEN
|
163 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - F1");
|
164 |
|
|
END IF;
|
165 |
|
|
P3 (F1(2..4));
|
166 |
|
|
|
167 |
|
|
N2 := NEW A1' (1,2,3,4,5,6);
|
168 |
|
|
IF F2(2..6) /= (2,3,4,5,6) THEN
|
169 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - F2");
|
170 |
|
|
END IF;
|
171 |
|
|
F2(3..3) := (5 => 7);
|
172 |
|
|
IF N2.ALL /= (1,2,7,4,5,6) THEN
|
173 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - F2");
|
174 |
|
|
END IF;
|
175 |
|
|
N2.ALL := (5,6,1,2,3,4);
|
176 |
|
|
P1 (F2(3..4), F2(5..6), F2(1..2), "F2");
|
177 |
|
|
IF N2.ALL /= (12,13,1,2,10,11) THEN
|
178 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - F2");
|
179 |
|
|
END IF;
|
180 |
|
|
|
181 |
|
|
IF N3(2..7)(2..4) /= (2,3,4) THEN
|
182 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - N3");
|
183 |
|
|
END IF;
|
184 |
|
|
N3(2..7)(4..5) := (8,9);
|
185 |
|
|
IF N3 /= (1,2,3,8,9,6,7) THEN
|
186 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - N3");
|
187 |
|
|
END IF;
|
188 |
|
|
N3 := (5,3,4,1,2,6,7);
|
189 |
|
|
P1 (N3(2..7)(4..5), N3(2..7)(2..3), N3(2..7)(6..7), "N3");
|
190 |
|
|
IF N3 /= (5,10,11,1,2,12,13) THEN
|
191 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N3");
|
192 |
|
|
END IF;
|
193 |
|
|
|
194 |
|
|
IF N4(1)(3..5) /= (3,4,5) THEN
|
195 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - N4");
|
196 |
|
|
END IF;
|
197 |
|
|
N4(2)(1..3) := (21,22,23);
|
198 |
|
|
IF N4 /= ((1,2,3,4,5,6),(21,22,23,10,11,12),
|
199 |
|
|
(13,14,15,16,17,18)) THEN
|
200 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - N4");
|
201 |
|
|
END IF;
|
202 |
|
|
N4 := (1 => (18,19,20,21,22,23), 2 => (17,16,15,1,2,14),
|
203 |
|
|
3 => (7,3,4,5,6,8));
|
204 |
|
|
P1 (N4(2)(4..5), N4(3)(2..3), N4(1)(5..6), "N4");
|
205 |
|
|
IF N4 /= ((18,19,20,21,12,13),(17,16,15,1,2,14),
|
206 |
|
|
(7,10,11,5,6,8)) THEN
|
207 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N4");
|
208 |
|
|
END IF;
|
209 |
|
|
|
210 |
|
|
N1 := (1,2,3,4,5,6);
|
211 |
|
|
IF C41203A.N1(1..2) /= (1,2) THEN
|
212 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - C41203A.N1");
|
213 |
|
|
END IF;
|
214 |
|
|
C41203A.N1(1..2) := (7,8);
|
215 |
|
|
IF N1 /= (7,8,3,4,5,6) THEN
|
216 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - C41203A.N1");
|
217 |
|
|
END IF;
|
218 |
|
|
N1 := (1,2,3,4,5,6);
|
219 |
|
|
P1 (C41203A.N1(1..2), C41203A.N1(3..4), C41203A.N1(5..6),
|
220 |
|
|
"C41203A.N1");
|
221 |
|
|
IF N1 /= (1,2,10,11,12,13) THEN
|
222 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER " &
|
223 |
|
|
"- C41203A.N1");
|
224 |
|
|
END IF;
|
225 |
|
|
|
226 |
|
|
IF N5.S(1..5) /= "ABCDE" THEN
|
227 |
|
|
FAILED ("WRONG VALUE FOR EXPRESSION - N5");
|
228 |
|
|
END IF;
|
229 |
|
|
N5.S(4..6) := "PQR";
|
230 |
|
|
IF N5.S /= "ABCPQR" THEN
|
231 |
|
|
FAILED ("WRONG TARGET FOR ASSIGNMENT - N5");
|
232 |
|
|
END IF;
|
233 |
|
|
N5.S := "ABCDEF";
|
234 |
|
|
P5 (N5.S(5..6), N5.S(3..4), N5.S(1..2));
|
235 |
|
|
IF N5.S /= "WZXYEF" THEN
|
236 |
|
|
FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N5");
|
237 |
|
|
END IF;
|
238 |
|
|
END;
|
239 |
|
|
|
240 |
|
|
RESULT;
|
241 |
|
|
END C41203A;
|