Move the sources to trunk
[opencv] / interfaces / swig / python / nointpb.i
1 /* This file is to prevent problems with swig <= 1.3.25 which use
2    PyInt_AS_LONG and may cause some corruption on RedHat systems.
3
4    Include it in every .i file who generate a C/C++ file */
5
6 %runtime%{
7 /* define the PyAPI_FUNC macro if it doesn't exist, for example with Python
8    version below 2.3... But not really tested... */
9 #ifndef PyAPI_FUNC
10 #       define PyAPI_FUNC(RTYPE) RTYPE
11 #endif
12
13 /* remove the PyInt_AS_LONG if defined, as this cause problems on RedHat */
14 #ifdef PyInt_AS_LONG
15 #undef PyInt_AS_LONG
16 #endif
17
18 /* wrapper to the better function PyInt_AsLong, removing problems
19    with RedHat (I hope) */
20 static PyAPI_FUNC(long) PyInt_AS_LONG (PyObject *obj) {
21     return PyInt_AsLong (obj);
22 }
23
24 /* remove the PyFloat_AS_DOUBLE if defined, to prevent errors */
25 #ifdef PyFloat_AS_DOUBLE
26 #undef PyFloat_AS_DOUBLE
27 #endif
28
29 /* wrapper to the better function PyFloat_AS_DOUBLE, to prevent errors */
30 static PyAPI_FUNC(double) PyFloat_AS_DOUBLE (PyObject *obj) {
31     return PyFloat_AsDouble (obj);
32 }
33 %}
34