Debian Codegraph @

gcc/testsuite/ada/acats/tests/c3/c3a00122.am

raw
1 -- C3A00122.AM
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 --
26 -- OBJECTIVE:
27 -- Check that an access-to-subprogram object can be used to invoke a
28 -- subprogram when the subprogram body had been declared and implemented
29 -- as a subunit.
30 --
31 -- TEST DESCRIPTION:
32 -- Declare an access to procedure type in a main program. Declare
33 -- three different log subprogram body stubs that can be referred to by
34 -- the access to procedure type.
35 --
36 -- Complete bodies of the log procedures.
37 --
38 -- In the main program, each procedure will be called indirectly by
39 -- dereferencing the access value.
40 --
41 -- TEST FILES:
42 -- The following files comprise this test:
43 --
44 -- C3A00120.A
45 -- C3A00121.A
46 -- => C3A00122.AM
47 --
48 --
49 -- CHANGE HISTORY:
50 -- 06 Dec 94 SAIC ACVC 2.0
51 --
52 --!
53
54 with Report;
55
56 with C3A0012_0;
57
58 procedure C3A00122 is
59
60 function "="( A,B: C3A0012_0.Call_Kind ) return Boolean
61 renames C3A0012_0."=";
62
63 Log_Access : C3A0012_0.Log_Procedure_Ptr;
64 Theta : Float := 0.0;
65 Method : C3A0012_0.Call_Kind := C3A0012_0.No_Call_Made;
66
67
68
69 function Due_Process( LA: C3A0012_0.Log_Procedure_Ptr )
70 return C3A0012_0.Call_Kind is
71 Result : C3A0012_0.Call_Kind := C3A0012_0.No_Call_Made;
72 begin
73 LA( Theta, Result );
74 return Result;
75 end Due_Process;
76
77 begin
78
79 Report.Test ("C3A0012", "Check that an access to a subprogram object " &
80 "can be used to select and invoke an operation with " &
81 "appropriate arguments");
82
83 Log_Access := C3A0012_0.Log_Calc_Fast'Access;
84
85 -- Invoking Log procedure designated by access value
86 Method := Due_Process( Log_Access );
87
88 If Method /= C3A0012_0.Fast_Call then
89 Report.Failed ("Incorrect Log_Calc_Fast result");
90 end if;
91
92 Log_Access := C3A0012_0.Log_Calc_Acc'Access;
93
94 -- Invoking Log procedure designated by access value
95 Method := Due_Process( Log_Access );
96
97 If Method /= C3A0012_0.Accurate_Call then
98 Report.Failed ("Incorrect Log_Calc_Acc result");
99 end if;
100
101 Log_Access := C3A0012_0.Log_Calc_Table'Access;
102
103 -- Invoking Log procedure designated by access value
104 Method := Due_Process( Log_Access );
105
106 If Method /= C3A0012_0.Table_Lookup_Call then
107 Report.Failed ("Incorrect Log_Calc_Table result");
108 end if;
109
110 Report.Result;
111
112 end C3A00122;
113