summaryrefslogtreecommitdiff
path: root/test/regression/struct5.c
blob: 13a1aa5cce73b9afc53369ed79c597f5edfa7718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
typedef struct HPointStruct
{
  double x;
  double y;
  double z;
  double w;
}HPoint;

typedef struct ObjPointStruct
{
  double x;
  double y;
  double z;
  double tx;
  double ty;
  double tz;
}ObjPoint;

HPoint PointToHPoint(ObjPoint P);

HPoint PointToHPoint(ObjPoint P)
{
  HPoint res;
  res.x = P.x;
  res.y = P.y;
  res.z = P.z;
  res.w = 1;
  return res;
}

double test1(HPoint (*f)(ObjPoint), double x)
{
  ObjPoint P;
  HPoint HP;
  P.x = x;
  HP = f(P);
  return HP.x;
}

double test2(double x)
{
  return test1(PointToHPoint, x);
}