1 /* sub.c == sub.C */           /* anonymous ftp@zebra.desy.de */
2 /* An example from cfortran.h package. Requires sub_f.f       */
3 /* Burkhard Burow  burow@desy.de                 1990 - 1997. */
4 
5 #include <stdio.h>
6 #include <stdlib.h>    /* EXIT_SUCCESS */
7 #include "cfortran.h"
8 
PROTOCCALLSFSUB4(FUNARG,funarg,ROUTINE,INT,INT,PINT)9    PROTOCCALLSFSUB4(FUNARG,funarg, ROUTINE, INT, INT, PINT)
10 #define FUNARG(F,A,B,C) \
11         CCALLSFSUB4(FUNARG,funarg, ROUTINE, INT, INT, PINT, F, A, B, C)
12 
13 #ifdef __cplusplus
14 #define Ellipsis ...
15 #else
16 #define Ellipsis
17 #endif
18 
19 int Cfun(int (*f)(Ellipsis), int a, int b) {int c; f(&a,&b,&c); return c;}
20 #undef  ROUTINE_1
21 #define ROUTINE_1  (int (*)(Ellipsis))
FCALLSCFUN3(INT,Cfun,CFUN,cfun,ROUTINE,INT,INT)22 FCALLSCFUN3(INT,Cfun,CFUN,cfun, ROUTINE, INT, INT)
23 
24 main() {
25 int c;
26 FUNARG(C_FUNCTION(CFUN,cfun),1,2,c);
27 printf("\nFUNARG(CFUN,1,2,c) returns with c=%d\n",c);
28 return EXIT_SUCCESS;
29 }
30