2 program callc(input,output) ;
4 procedure rcsid ; begin writeln('$Id: callc.p,v 2.3 1994/06/24 12:36:41 ceriel Exp $') end ;
5 function kwad(val:integer) : integer ; extern ;
6 procedure cmain ; extern ;
7 procedure incs ; begin success:=success+1 end ;
8 procedure pptr( function ptwice(val:integer):integer ) ; extern ;
10 function ceval( function pinside(val:integer):real ): boolean ; extern ;
11 function outside(val:integer):real ;
16 var testval: integer ;
17 function inside(val:integer):real ;
19 if testval<>1234 then writeln('The static link is incorrect')
20 else success:=success+1 ;
25 if ceval(inside) then success:=success+1
26 else writeln('Calling inside through C doesn''t work');
27 if ceval(outside) then success:=success+1
28 else writeln('Calling outside through C doesn''t work')
31 procedure cptr( function pkwad(val:integer):integer ) ;
33 if ( pkwad(-2)<>4 ) and (pkwad(-8)<>64) then
34 writeln('Using C function pointers in Pascal doesn''t work')
38 function twice(val:integer) : integer ;
44 if (kwad(2)<>4) and (kwad(8)<>64) then
45 writeln('C cals don''t work')
59 then writeln('Only ',success,' tests passed')
60 else writeln('All tests passed')