| 1 |
void abort (void); |
| 2 |
void exit (int); |
| 3 |
|
| 4 |
typedef struct { |
| 5 |
int a, b, c, d, e, f; |
| 6 |
} A; |
| 7 |
|
| 8 |
void foo (A *v, int w, int x, int *y, int *z) |
| 9 |
{ |
| 10 |
} |
| 11 |
|
| 12 |
void |
| 13 |
bar (A *v, int x, int y, int w, int h) |
| 14 |
{ |
| 15 |
if (v->a != x || v->b != y) { |
| 16 |
int oldw = w; |
| 17 |
int oldh = h; |
| 18 |
int e = v->e; |
| 19 |
int f = v->f; |
| 20 |
int dx, dy; |
| 21 |
foo(v, 0, 0, &w, &h); |
| 22 |
dx = (oldw - w) * (double) e/2.0; |
| 23 |
dy = (oldh - h) * (double) f/2.0; |
| 24 |
x += dx; |
| 25 |
y += dy; |
| 26 |
v->a = x; |
| 27 |
v->b = y; |
| 28 |
v->c = w; |
| 29 |
v->d = h; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
int main () |
| 34 |
{ |
| 35 |
A w = { 100, 110, 20, 30, -1, -1 }; |
| 36 |
bar (&w,400,420,50,70); |
| 37 |
if (w.d != 70) |
| 38 |
abort(); |
| 39 |
exit(0); |
| 40 |
} |