1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
-- C95089A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT ALL PERMITTED FORMS OF VARIABLE NAMES ARE PERMITTED
-- AS ACTUAL PARAMETERS.
-- GLH 7/25/85
WITH REPORT; USE REPORT;
PROCEDURE C95089A IS
SUBTYPE INT IS INTEGER RANGE 1..3;
TYPE REC (N : INT) IS
RECORD
S : STRING (1..N);
END RECORD;
TYPE PTRSTR IS ACCESS STRING;
R1, R2, R3 : REC (3);
S1, S2, S3 : STRING (1..3);
PTRTBL : ARRAY (1..3) OF PTRSTR;
TASK T1 IS
ENTRY E1 (S1 : IN STRING; S2: IN OUT STRING;
S3 : OUT STRING);
END T1;
TASK BODY T1 IS
BEGIN
LOOP
SELECT
ACCEPT E1 (S1 : IN STRING; S2: IN OUT STRING;
S3 : OUT STRING) DO
S3 := S2;
S2 := S1;
END E1;
OR
TERMINATE;
END SELECT;
END LOOP;
END T1;
TASK T2 IS
ENTRY E2 (C1 : IN CHARACTER; C2 : IN OUT CHARACTER;
C3 : OUT CHARACTER);
END T2;
TASK BODY T2 IS
BEGIN
LOOP
SELECT
ACCEPT E2 (C1 : IN CHARACTER; C2 : IN OUT CHARACTER;
C3 : OUT CHARACTER) DO
C3 := C2;
C2 := C1;
END E2;
OR
TERMINATE;
END SELECT;
END LOOP;
END T2;
FUNCTION F1 (X : INT) RETURN PTRSTR IS
BEGIN
RETURN PTRTBL (X);
END F1;
FUNCTION "+" (S1, S2 : STRING) RETURN PTRSTR IS
BEGIN
RETURN PTRTBL (CHARACTER'POS(S1(1))-CHARACTER'POS('A')+1);
END "+";
BEGIN
TEST ("C95089A", "CHECK THAT ALL PERMITTED FORMS OF VARIABLE " &
"NAMES ARE PERMITTED AS ACTUAL PARAMETERS");
S1 := "AAA";
S2 := "BBB";
T1.E1 (S1, S2, S3);
IF S2 /= "AAA" OR S3 /= "BBB" THEN
FAILED ("SIMPLE VARIABLE AS AN ACTUAL PARAMETER NOT WORKING");
END IF;
S1 := "AAA";
S2 := "BBB";
S3 := IDENT_STR ("CCC");
T2.E2 (S1(1), S2(IDENT_INT(1)), S3(1));
IF S2 /= "ABB" OR S3 /= "BCC" THEN
FAILED ("INDEXED COMPONENT AS AN ACTUAL PARAMETER NOT " &
"WORKING");
END IF;
R1.S := "AAA";
R2.S := "BBB";
T1.E1 (R1.S, R2.S, R3.S);
IF R2.S /= "AAA" OR R3.S /= "BBB" THEN
FAILED ("SELECTED COMPONENT AS AN ACTUAL PARAMETER " &
"NOT WORKING");
END IF;
S1 := "AAA";
S2 := "BBB";
T1.E1 (S1(1..IDENT_INT(2)), S2(1..2),
S3(IDENT_INT(1)..IDENT_INT(2)));
IF S2 /= "AAB" OR S3 /= "BBC" THEN
FAILED ("SLICE AS AN ACTUAL PARAMETER NOT WORKING");
END IF;
PTRTBL(1) := NEW STRING'("AAA");
PTRTBL(2) := NEW STRING'("BBB");
PTRTBL(3) := NEW STRING'("CCC");
T1.E1 (F1(1).ALL, F1(2).ALL, F1(IDENT_INT(3)).ALL);
IF PTRTBL(2).ALL /= "AAA" OR PTRTBL(3).ALL /= "BBB" THEN
FAILED ("SELECTED COMPONENT OF FUNCTION VALUE AS AN ACTUAL " &
"PARAMETER NOT WORKING");
END IF;
PTRTBL(1) := NEW STRING'("AAA");
PTRTBL(2) := NEW STRING'("BBB");
PTRTBL(3) := NEW STRING'("CCC");
S1 := IDENT_STR("AAA");
S2 := IDENT_STR("BBB");
S3 := IDENT_STR("CCC");
T1.E1 ("+"(S1,S1).ALL, "+"(S2,S2).ALL, "+"(S3,S3).ALL);
IF PTRTBL(2).ALL /= "AAA" OR PTRTBL(3).ALL /= "BBB" THEN
FAILED ("SELECTED COMPONENT OF OVERLOADED OPERATOR " &
"FUNCTION VALUE AS AN ACTUAL PARAMETER NOT WORKING");
END IF;
PTRTBL(1) := NEW STRING'("AAA");
PTRTBL(2) := NEW STRING'("BBB");
PTRTBL(3) := NEW STRING'("CCC");
T2.E2 (F1(1)(1), F1(IDENT_INT(2))(1), F1(3)(IDENT_INT(1)));
IF PTRTBL(2).ALL /= "ABB" OR PTRTBL(3).ALL /= "BCC" THEN
FAILED ("INDEXED COMPONENT OF FUNCTION VALUE AS AN ACTUAL " &
"PARAMETER NOT WORKING");
END IF;
PTRTBL(1) := NEW STRING'("AAA");
PTRTBL(2) := NEW STRING'("BBB");
PTRTBL(3) := NEW STRING'("CCC");
T1.E1 (F1(1)(2..3), F1(2)(IDENT_INT(2)..3),
F1(3)(2..IDENT_INT(3)));
IF PTRTBL(2).ALL /= "BAA" OR PTRTBL(3).ALL /= "CBB" THEN
FAILED ("SLICE OF FUNCTION VALUE AS AN ACTUAL PARAMETER " &
"NOT WORKING");
END IF;
RESULT;
END C95089A;
|