1 /* Passing from fortran to C by value, using VALUE. This is identical
2 to c_by_val_1.c, which performs the same function for %VAL.
4 Contributed by Paul Thomas <pault@gcc.gnu.org> */
6 typedef struct { float r, i; } complex;
7 extern float *f_to_f__ (float, float*);
8 extern int *i_to_i__ (int, int*);
9 extern void c_to_c__ (complex*, complex, complex*);
10 extern void abort (void);
12 /* In f_to_f and i_to_i we return the second argument, so that we do
13 not have to worry about keeping track of memory allocation between
14 fortran and C. All three functions check that the argument passed
15 by value is the same as that passed by reference. Then the passed
16 by value argument is modified so that the caller can check that
17 its version has not changed.*/
20 f_to_f__(float a1, float *a2)
22 if ( a1 != *a2 ) abort();
29 i_to_i__(int i1, int *i2)
31 if ( i1 != *i2 ) abort();
38 c_to_c__(complex *retval, complex c1, complex *c2)
40 if ( c1.r != c2->r ) abort();
41 if ( c1.i != c2->i ) abort();
44 retval->r = c2->r * 4.0;
45 retval->i = c2->i * 4.0;