summaryrefslogtreecommitdiff
path: root/Examples/test-suite/ccomplextest.i
blob: c631dc02e25cf135e3ff9b4a5f58b579e49e18e9 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%module ccomplextest

%include <complex.i>

%{
#include <complex.h>

#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199001L
#define HAS_C99_COMPLEX_FOR_TESTING 1
#else
/* c99 complex not supported - super hack tests to just test plain floating point numbers */
/* some pre c99 compilers (gcc-4.x) don't define _Complex but do define complex */
#define _Complex
#if !defined(complex)
#  define complex
#endif
#define conj
#define conjf
#define creal
#define cimag
#if defined(I)
#  undef I
#  define I 1
#endif
#define HAS_C99_COMPLEX_FOR_TESTING 0
#endif
%}

%inline
{
  int has_c99_complex(void) {
    return HAS_C99_COMPLEX_FOR_TESTING;
  }

  complex double Conj(complex double a)
  {
    return conj(a);
  }


  complex float Conjf(complex float a)
  {
    return conjf(a);
  }


  double complex Conj1(double complex a)
  {
    return conj(a);
  }


  float complex Conjf1(float complex a)
  {
    return conjf(a);
  }


  _Complex double Conj2(_Complex double a)
  {
    return conj(a);
  }


  _Complex float Conjf2(_Complex float a)
  {
    return conjf(a);
  }


  double _Complex Conj3(double _Complex a)
  {
    return conj(a);
  }


  float _Complex Conjf3(float _Complex a)
  {
    return conjf(a);
  }
}