| 1 |
%{ |
| 2 |
/** |
| 3 |
* This is a workaround for a minor swig bug when building on gcc 4.6.1 and above. |
| 4 |
* Prior to gcc 4.6.1 the STL headers like vector, string, etc. used to |
| 5 |
* automatically pull in the cstddef header but starting with gcc 4.6.1 they no |
| 6 |
* longer do. This leads to swig generated a file that does not compile so we |
| 7 |
* explicitly include cstddef so the swig generated file will compile. |
| 8 |
*/ |
| 9 |
#include <cstddef> |
| 10 |
%} |
| 11 |
%module(directors="1") fifechan |
| 12 |
%begin %{ |
| 13 |
#define SWIG_PYTHON_2_UNICODE |
| 14 |
%} |
| 15 |
|
| 16 |
%include "std_string.i" |
| 17 |
%include "std_vector.i" |
| 18 |
|
| 19 |
@CMAKE_SWIG_IMPORTS_FCHAN@ |
| 20 |
|
| 21 |
/* Signed. */ |
| 22 |
typedef signed char int8_t; |
| 23 |
typedef short int int16_t; |
| 24 |
typedef int int32_t; |
| 25 |
#if defined(SWIGWORDSIZE64) |
| 26 |
typedef long int int64_t; |
| 27 |
#else |
| 28 |
typedef long long int int64_t; |
| 29 |
#endif |
| 30 |
|
| 31 |
/* Unsigned. */ |
| 32 |
typedef unsigned char uint8_t; |
| 33 |
typedef unsigned short int uint16_t; |
| 34 |
typedef unsigned int uint32_t; |
| 35 |
#if defined(SWIGWORDSIZE64) |
| 36 |
typedef unsigned long int uint64_t; |
| 37 |
#else |
| 38 |
typedef unsigned long long int uint64_t; |
| 39 |
#endif |
| 40 |
|
| 41 |
/*%include "exception.i" |
| 42 |
|
| 43 |
%{ |
| 44 |
#define _FCN_EXC_HANDLER() \ |
| 45 |
catch (fcn::Exception& _e) { \ |
| 46 |
PyErr_Clear(); \ |
| 47 |
char _err_line[12]; \ |
| 48 |
sprintf(_err_line, ":%u", _e.getLine()); \ |
| 49 |
std::string _err_msg = "Caught a gcn exception thrown in " + _e.getFilename() + _err_line + " in function " + _e.getFunction() + ": " + _e.getMessage(); \ |
| 50 |
SWIG_exception(SWIG_RuntimeError, _err_msg.c_str()); \ |
| 51 |
} |
| 52 |
%} |
| 53 |
|
| 54 |
%exception { |
| 55 |
try { |
| 56 |
$$action |
| 57 |
} |
| 58 |
_FCN_EXC_HANDLER() |
| 59 |
} |
| 60 |
*/ |
| 61 |
|
| 62 |
@CMAKE_SWIG_INCLUSIONS_FCHAN@ |