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 access to subprogram may be stored within record
28 -- objects, and that the access to subprogram can subsequently
32 -- Declare an access to procedure type in a package specification.
33 -- Declare two different procedures that can be referred to by the
34 -- access to procedure type. Declare a record with the access to
35 -- procedure type as a component. Use the access to procedure type to
36 -- initialize the component of a record.
38 -- In the main program, declare an operation. An access value
39 -- designating this operation is passed as a parameter to be
40 -- stored in the record.
44 -- 06 Dec 94 SAIC ACVC 2.0
50 Default_Call
: Boolean := False;
55 -- Type accesses to procedures Push and Default_Response
56 type Button_Response_Ptr
is access procedure
59 procedure Push
(B
: access Button
);
61 procedure Set_Response
(B
: access Button
;
62 R
: in Button_Response_Ptr
);
64 procedure Default_Response
(B
: access Button
);
66 Emergency_Call
: Boolean := False;
68 procedure Emergency
(B
: access C3A0005_0
.Button
);
72 Response
: Button_Response_Ptr
73 := Default_Response
'Access;
79 -----------------------------------------------------------------------------
82 package body C3A0005_0
is
84 procedure Push
(B
: access Button
) is
86 TCTouch
.Touch
( 'P' ); --------------------------------------------- P
87 -- Invoking subprogram designated by access value
92 procedure Set_Response
(B
: access Button
;
93 R
: in Button_Response_Ptr
) is
95 TCTouch
.Touch
( 'S' ); --------------------------------------------- S
96 -- Set procedure value in record
101 procedure Default_Response
(B
: access Button
) is
103 TCTouch
.Touch
( 'D' ); --------------------------------------------- D
104 Default_Call
:= True;
105 end Default_Response
;
108 procedure Emergency
(B
: access C3A0005_0
.Button
) is
110 TCTouch
.Touch
( 'E' ); --------------------------------------------- E
111 Emergency_Call
:= True;
117 -----------------------------------------------------------------------------
126 Big_Red_Button
: aliased C3A0005_0
.Button
;
130 Report
.Test
("C3A0005", "Check that access to subprogram may be "
131 & "stored within data structures, and that the "
132 & "access to subprogram can subsequently be called");
134 C3A0005_0
.Push
(Big_Red_Button
'Access);
135 TCTouch
.Validate
("PD", "Using default value");
136 TCTouch
.Assert
( C3A0005_0
.Default_Call
, "Default Call" );
138 -- set Emergency value in Button.Response
139 C3A0005_0
.Set_Response
(Big_Red_Button
'Access, C3A0005_0
.Emergency
'Access);
141 C3A0005_0
.Push
(Big_Red_Button
'Access);
142 TCTouch
.Validate
("SPE", "After set to Emergency value");
143 TCTouch
.Assert
( C3A0005_0
.Emergency_Call
, "Emergency Call");