| 1 |
double fabs(double); |
| 2 |
|
| 3 |
void test_coms(void); |
| 4 |
|
| 5 |
extern void abort(void); |
| 6 |
|
| 7 |
struct {double r, s; } com; /* refers to the common block "com" */ |
| 8 |
double single; /* refers to the common block "single" */ |
| 9 |
long int mycom; /* refers to the common block "MYCOM" */ |
| 10 |
long long int mycom2; /* refers to the common block "MYCOM2" */ |
| 11 |
struct {int i, j; } f03_com2; /* refers to the common block "com2" */ |
| 12 |
|
| 13 |
int main(int argc, char **argv) |
| 14 |
{ |
| 15 |
com.r = 1.0; |
| 16 |
com.s = 2.0; |
| 17 |
single = 1.0; |
| 18 |
mycom = 1; |
| 19 |
mycom2 = 2; |
| 20 |
f03_com2.i = 1; |
| 21 |
f03_com2.j = 2; |
| 22 |
|
| 23 |
/* change the common block variables in F90 */ |
| 24 |
test_coms(); |
| 25 |
|
| 26 |
if(fabs(com.r - 1.1) > 0.00000000) |
| 27 |
abort(); |
| 28 |
if(fabs(com.s - 2.1) > 0.00000000) |
| 29 |
abort(); |
| 30 |
if(fabs(single - 1.1) > 0.00000000) |
| 31 |
abort(); |
| 32 |
if(mycom != 2) |
| 33 |
abort(); |
| 34 |
if(mycom2 != 3) |
| 35 |
abort(); |
| 36 |
if(f03_com2.i != 2) |
| 37 |
abort(); |
| 38 |
if(f03_com2.j != 3) |
| 39 |
abort(); |
| 40 |
|
| 41 |
return 0; |
| 42 |
}/* end main() */ |