| 1 |
double fabs (double); |
| 2 |
|
| 3 |
typedef struct ctype |
| 4 |
{ |
| 5 |
int i; |
| 6 |
double x; |
| 7 |
}ctype_t; |
| 8 |
|
| 9 |
int test_scalar_address(int *ptr) |
| 10 |
{ |
| 11 |
/* The value in Fortran should be initialized to 100. */ |
| 12 |
if(*ptr != 100) |
| 13 |
return 0; |
| 14 |
else |
| 15 |
return 1; |
| 16 |
} |
| 17 |
|
| 18 |
int test_array_address(int *int_array, int num_elements) |
| 19 |
{ |
| 20 |
int i = 0; |
| 21 |
|
| 22 |
for(i = 0; i < num_elements; i++) |
| 23 |
/* Fortran will init all of the elements to 100; verify that here. */ |
| 24 |
if(int_array[i] != 100) |
| 25 |
return 0; |
| 26 |
|
| 27 |
/* all elements were equal to 100 */ |
| 28 |
return 1; |
| 29 |
} |
| 30 |
|
| 31 |
int test_type_address(ctype_t *type_ptr) |
| 32 |
{ |
| 33 |
/* i was set to 100 by Fortran */ |
| 34 |
if(type_ptr->i != 100) |
| 35 |
return 0; |
| 36 |
|
| 37 |
/* x was set to 1.0d0 by Fortran */ |
| 38 |
if(fabs(type_ptr->x - 1.0) > 0.00000000) |
| 39 |
return 0; |
| 40 |
|
| 41 |
return 1; |
| 42 |
} |