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 sequence of statements of the triggering alternative
28 -- of an asynchronous select statement is executed if the triggering
29 -- statement is a protected entry call, and the entry is accepted
30 -- immediately. Check that the corresponding entry body is executed
31 -- before the sequence of statements of the triggering alternative.
32 -- Check that the abortable part is not executed.
35 -- Declare a main procedure containing an asynchronous select with a
36 -- protected entry call as triggering statement. Declare a protected
37 -- procedure which sets the protected entry's barrier true. Force the
38 -- entry call to be accepted immediately by calling this protected
39 -- procedure prior to the asynchronous select. Since the entry call
40 -- is accepted immediately, the abortable part should never start. When
41 -- entry call completes, the sequence of statements of the triggering
42 -- alternative should execute.
46 -- 06 Dec 94 SAIC ACVC 2.0
51 package C974006_0
is -- Automated teller machine abstraction.
54 -- Flag for testing purposes:
56 Entry_Body_Executed
: Boolean := False;
59 type Key_Enum
is (None
, Cancel
, Deposit
, Withdraw
);
61 type Card_Number_Type
is private;
62 type Card_PIN_Type
is private;
63 type ATM_Card_Type
is private;
66 Transaction_Canceled
: exception;
69 protected type ATM_Keyboard_Protected
is
73 Last_Key_Pressed
: Key_Enum
:= None
;
74 end ATM_Keyboard_Protected
;
77 procedure Read_Card
(Card
: in out ATM_Card_Type
);
79 procedure Validate_Card
(Card
: in ATM_Card_Type
);
81 procedure Perform_Transaction
(Card
: in ATM_Card_Type
);
85 type Card_Number_Type
is range 1 .. 9999;
86 type Card_PIN_Type
is range 100 .. 999;
88 type ATM_Card_Type
is record
89 Number
: Card_Number_Type
;
96 --==================================================================--
100 package body C974006_0
is
103 protected body ATM_Keyboard_Protected
is
105 entry Cancel_Pressed
when (Last_Key_Pressed
= Cancel
) is
107 Entry_Body_Executed
:= True;
110 procedure Read_Key
is
112 -- Simulate a procedure which processes user keyboard input, and
113 -- which is called by some interrupt handler.
114 Last_Key_Pressed
:= Cancel
;
117 end ATM_Keyboard_Protected
;
120 procedure Read_Card
(Card
: in out ATM_Card_Type
) is
127 procedure Validate_Card
(Card
: in ATM_Card_Type
) is
129 Report
.Failed
("Abortable part executed");
133 procedure Perform_Transaction
(Card
: in ATM_Card_Type
) is
135 Report
.Failed
("Triggering alternative sequence of statements " &
136 "not fully executed");
137 end Perform_Transaction
;
143 --==================================================================--
148 with C974006_0
; -- Automated teller machine abstraction.
153 Card_Data
: ATM_Card_Type
;
157 Report
.Test
("C974006", "ATC: trigger is protected entry call" &
158 " and completes first");
160 Read_Card
(Card_Data
);
163 Keyboard
: C974006_0
.ATM_Keyboard_Protected
;
166 -- Simulate the situation where the user hits cancel before the
167 -- validation process can start:
168 Keyboard
.Read_Key
; -- Force Keyboard.Cancel_Pressed to
169 -- be accepted immediately.
172 -- Asynchronous select is tested here --
176 Keyboard
.Cancel_Pressed
; -- Entry call is accepted immediately,
177 -- so abortable part does NOT start.
179 if not Entry_Body_Executed
then -- Executes after entry completes.
180 Report
.Failed
("Triggering alternative sequence of statements " &
181 "executed before triggering statement complete");
184 raise Transaction_Canceled
; -- Control passes to exception
187 Validate_Card
(Card_Data
); -- Should not be executed.
189 Perform_Transaction
(Card_Data
); -- Should not be reached.
191 when Transaction_Canceled
=>