1-- C41306B.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 IF  F  IS A FUNCTION RETURNING AN ACCESS VALUE DESIGNATING
26--     A TASK OF A TYPE HAVING
27--     AN ENTRY  E ,  AN ENTRY CALL OF THE FORM
28--
29--                           F.ALL.E
30--
31--     IS PERMITTED.
32
33-- RM  02/02/82
34-- ABW 07/16/82
35-- EG  05/28/85
36
37WITH REPORT; USE REPORT;
38
39PROCEDURE C41306B IS
40
41BEGIN
42
43     TEST ( "C41306B" , "CHECK THAT IF  F  IS A FUNCTION RETURNING" &
44                        " AN ACCESS VALUE DESIGNATING"              &
45                        " A TASK OF A TYPE HAVING AN ENTRY  E ,  AN" &
46                        " ENTRY CALL OF THE FORM  F.ALL.E  IS"       &
47                        " PERMITTED" );
48
49
50     -------------------------------------------------------------------
51
52     DECLARE
53
54          X  : INTEGER  :=  0 ;
55
56          TASK TYPE  T  IS
57               ENTRY  E ;
58          END  T ;
59
60          TYPE  A_T  IS  ACCESS T ;
61
62          TASK BODY  T  IS
63          BEGIN
64               ACCEPT  E  DO
65                    X := IDENT_INT(17) ;
66               END  E ;
67          END  T ;
68
69          FUNCTION  F1  RETURN  A_T  IS
70               A_T_VAR1 : A_T := NEW T ;
71          BEGIN
72               RETURN  A_T_VAR1 ;
73          END  F1 ;
74
75          FUNCTION F2 (A, B : BOOLEAN) RETURN A_T IS
76               A_T_VAR2 : A_T := NEW T;
77          BEGIN
78               IF A AND B THEN
79                    NULL;
80               END IF;
81               RETURN A_T_VAR2;
82          END F2;
83
84     BEGIN
85
86          F1.ALL.E ;  --  THE ELABOR. OF  F1 (BODY)  ACTIVATES THE TASK,
87                      --      WHICH  PROCEEDS TO WAIT FOR ENTRY  E  TO
88                      --      BE CALLED.
89
90                      --  THE CALLED ENTRY CAUSES  X  TO BE SET TO  17 .
91
92          IF  X /= 17
93          THEN
94               FAILED( "WRONG VALUE FOR GLOBAL VARIABLE   (1)" );
95          END IF;
96
97          X := 0;
98          F2(TRUE, TRUE).ALL.E;    -- THE ELABORATION OF F2 (BODY)
99                                   -- ACTIVATES THE TASK, WHICH
100                                   -- PROCEEDS TO WAIT FOR THE
101                                   -- ENTRY E TO BE CALLED.
102
103                                   -- THE CALLED ENTRY CAUSES X TO BE
104                                   -- SET TO 17.
105
106          IF X /= 17 THEN
107               FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (2)");
108          END IF;
109
110     END ;
111
112     -------------------------------------------------------------------
113
114     DECLARE
115
116          X  : INTEGER  :=  0 ;
117
118          TASK TYPE  T  IS
119               ENTRY  E ;
120          END  T ;
121
122          TYPE  A_T  IS  ACCESS T ;
123
124          TASK BODY  T  IS
125          BEGIN
126               ACCEPT  E  DO
127                    X := IDENT_INT(17) ;
128               END  E ;
129          END  T ;
130
131          FUNCTION  F3  RETURN  A_T  IS
132          BEGIN
133               RETURN  NEW T ;
134          END  F3;
135
136          FUNCTION F4 (C, D : BOOLEAN) RETURN A_T IS
137          BEGIN
138               IF C AND D THEN
139                    NULL;
140               END IF;
141               RETURN NEW T;
142          END F4;
143
144     BEGIN
145
146          F3.ALL.E ;  --  THE ELABOR. OF  F3 (BODY)  ACTIVATES THE TASK,
147                      --      WHICH  PROCEEDS TO WAIT FOR ENTRY  E  TO
148                      --      BE CALLED.
149
150                      --  THE CALLED ENTRY CAUSES  X  TO BE SET TO  17 .
151
152          IF  X /= 17
153          THEN
154               FAILED( "WRONG VALUE FOR GLOBAL VARIABLE   (3)" );
155          END IF;
156
157          X := 0;
158          F4(TRUE, TRUE).ALL.E;    -- THE ELABORATION OF F4 (BODY)
159                                   -- ACTIVATES THE TASK, WHICH
160                                   -- PROCEEDS TO WAIT FOR THE
161                                   -- ENTRY E TO BE CALLED.
162
163                                   -- THE CALLED ENTRY CAUSES X TO BE
164                                   -- SET TO 17.
165
166          IF X /= 17 THEN
167               FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (4)");
168          END IF;
169
170     END ;
171
172     -------------------------------------------------------------------
173
174     DECLARE
175
176          X  : INTEGER  :=  0 ;
177
178          TASK TYPE  T  IS
179               ENTRY  E ;
180          END  T ;
181
182          TYPE  A_T  IS  ACCESS T ;
183
184          TASK BODY  T  IS
185          BEGIN
186               ACCEPT  E  DO
187                    X := IDENT_INT(17) ;
188               END  E ;
189          END  T ;
190
191     BEGIN
192
193          DECLARE
194
195               F3 : A_T := NEW T;
196
197          BEGIN
198
199               F3.ALL.E;
200
201                      --  THE CALLED ENTRY CAUSES  X  TO BE SET TO  17 .
202
203               IF  X /= 17 THEN
204                    FAILED( "WRONG VALUE FOR GLOBAL VARIABLE   (5)" );
205               END IF;
206
207          END;
208
209     END ;
210
211     -------------------------------------------------------------------
212
213
214     RESULT;
215
216
217END C41306B;
218