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 Address clauses are supported for imported subprograms.
30 -- This test imports a simple C function and specifies it's location.
32 -- The implementation may choose to implement
33 -- Impdef.CD30005_1_Foreign_Address so as to dynamically call a C
34 -- function that returns the appropriate address for the external
35 -- function identified by Impdef.CD30005_1_External_Name.
39 -- CD300051.C -- the C function: (included below for reference)
41 -- SPECIAL REQUIREMENTS:
42 -- The file CD300051.C must be compiled with a C compiler.
43 -- Implementation dialects of C may require alteration of the C program
44 -- syntax. The program is included here for reference:
46 -- int _cd30005_1( Value )
53 -- Implementations may require special linkage commands to include the
56 -- APPLICABILITY CRITERIA:
57 -- This test is not applicable to implementations not providing an interface
58 -- to C language units. OTHERWISE:
60 -- All implementations must attempt to compile this test.
62 -- For implementations validating against Systems Programming Annex (C):
63 -- this test must execute and report PASSED.
65 -- For implementations not validating against Annex C:
66 -- this test may report compile time errors at one or more points
67 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
68 -- Otherwise, the test must execute and report PASSED.
72 -- 22 JUL 95 SAIC Initial version
73 -- 30 APR 96 SAIC Added commentary for 2.1
74 -- 09 MAY 96 SAIC Changed reporting for 2.1
75 -- 04 NOV 96 SAIC Added use type System.Address
76 -- 16 FEB 98 EDS Modified documentation.
77 -- 29 JUN 98 EDS Modified main program name.
80 ----------------------------------------------------------------- CD30005_0
85 -- Check that Address clauses are supported for imported subprograms.
87 type External_Func_Ref is access function(N:Integer) return Integer;
88 pragma Convention( C, External_Func_Ref );
91 function CD30005_1( I: Integer ) return Integer;
93 pragma Import( C, CD30005_1,
94 Impdef.CD30005_1_External_Name ); -- N/A => ERROR.
96 for CD30005_1'Address use
97 Impdef.CD30005_1_Foreign_Address; -- ANX-C RQMT.
99 procedure TC_Check_Imports;
103 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
106 with System.Storage_Elements;
107 with System.Address_To_Access_Conversions;
108 package body CD30005_0 is
110 use type System.Address;
112 procedure TC_Check_Imports is
113 S : External_Func_Ref := CD30005_1'Access;
119 Report.Failed("C program returned" & Integer'Image(K));
124 Report.Failed("C program returned" & Integer'Image(I));
127 if CD30005_1'Address /= Impdef.CD30005_1_Foreign_Address then
128 Report.Failed("Address not that specified");
131 end TC_Check_Imports;
135 ------------------------------------------------------------------- CD300050
140 procedure CD300050 is
142 begin -- Main test procedure.
144 Report.Test ("CD30005",
145 "Check that Address clauses are supported for imported " &
148 -- Check that Address clauses are supported for imported subprograms.
150 CD30005_0.TC_Check_Imports;