3 -- Grant of Unlimited Rights
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
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.
27 -- Check that the abortable part of an asynchronous select statement
28 -- is not started if the triggering statement is a task entry call, and
29 -- the entry call is not queued.
31 -- Check that the sequence of statements of the triggering alternative
32 -- is executed after the abortable part is left.
35 -- Declare a main procedure containing an asynchronous select with a task
36 -- entry call as triggering statement. Ensure that the task is waiting
37 -- at the accept statement so the rendezvous is executed immediately (the
38 -- entry call is not queued).
42 -- 06 Dec 94 SAIC ACVC 2.0
46 package C974008_0
is -- Automated teller machine abstraction.
49 -- Flags for testing purposes:
51 Triggering_Statement_Completed
: Boolean := False;
52 Count
: Integer := 1234; -- Global to defeat
55 type Key_Enum
is (None
, Cancel
, Deposit
, Withdraw
);
57 type Card_Number_Type
is private;
58 type Card_PIN_Type
is private;
59 type ATM_Card_Type
is private;
62 Transaction_Canceled
: exception;
65 task type ATM_Keyboard_Task
is
67 end ATM_Keyboard_Task
;
70 procedure Read_Card
(Card
: in out ATM_Card_Type
);
73 procedure Perform_Transaction
(Card
: in ATM_Card_Type
);
77 type Card_Number_Type
is range 1 .. 9999;
78 type Card_PIN_Type
is range 100 .. 999;
80 type ATM_Card_Type
is record
81 Number
: Card_Number_Type
;
88 --==================================================================--
92 package body C974008_0
is
95 procedure Listen_For_Input
(Key
: out Key_Enum
) is
97 -- Simulate the situation where the user presses the cancel key
98 -- before the card is validated
100 -- press the cancel key immediately
103 end Listen_For_Input
;
107 -- One of these gets created as "Keyboard" for each transaction
109 task body ATM_Keyboard_Task
is
110 Key_Pressed
: Key_Enum
:= None
;
112 -- NOTE: Normal usage for this routine would be the loop with
113 -- the select statement included. This particular test
114 -- requires that the task be waiting at the accept
115 -- for the call. To ensure that this is the case the
116 -- extraneous commands are commented out (we leave them
117 -- in this form to show the reader the surrounds to the
118 -- fragment of code remaining)
122 Listen_For_Input
(Key_Pressed
);
125 -- when (Key_Pressed = Cancel) => -- Guard is now
126 accept Cancel_Pressed
do -- true, so accept
127 Triggering_Statement_Completed
:= True; -- queued entry
128 end Cancel_Pressed
; -- call.
130 -- User has cancelled the transaction so we exit the
131 -- loop and allow the task to terminate
134 -- Key_Pressed := None;
140 Report
.Failed
("Unexpected Exception in ATM_Keyboard_Task");
141 end ATM_Keyboard_Task
;
145 procedure Read_Card
(Card
: in out ATM_Card_Type
) is
152 procedure Perform_Transaction
(Card
: in ATM_Card_Type
) is
154 Report
.Failed
("Triggering alternative sequence of statements " &
156 if not Triggering_Statement_Completed
then
157 Report
.Failed
("Triggering statement did not complete");
159 end Perform_Transaction
;
165 --==================================================================--
171 with C974008_0
; -- Automated teller machine abstraction.
176 Card_Data
: ATM_Card_Type
;
178 begin -- Main program.
180 Report
.Test
("C974008", "Asynchronous Select: Trigger is a call to a " &
181 "waiting task entry and completes immediately");
183 Read_Card
(Card_Data
);
186 -- Create the task for this transaction
187 Keyboard
: C974008_0
.ATM_Keyboard_Task
;
190 -- Ensure task is waiting at the accept
191 -- This is the time required to activate another task and allow it
192 -- to run to its first accept statement.
194 delay ImpDef
.Switch_To_New_Task
;
197 -- Asynchronous select is tested here --
201 Keyboard
.Cancel_Pressed
; -- Entry call is executed immediately
203 raise Transaction_Canceled
; -- This is executed after Validate_Card
207 -- In other similar tests Validate_Card is called here. In this
208 -- test we just check to see if the abortable part is called at
209 -- all. Since the triggering call is not queued the abortable
210 -- part should not be started
212 Report
.Failed
("Abortable part started");
216 Perform_Transaction
(Card_Data
); -- Should not be reached.
218 when Transaction_Canceled
=>
220 if not Triggering_Statement_Completed
then
221 Report
.Failed
("Triggering alternative sequence of statements " &
222 "executed but triggering statement not complete");