| 1 | /* ----------------------------------------------------------------------------- |
| 2 | * python.swg |
| 3 | * |
| 4 | * Python configuration module. |
| 5 | * ----------------------------------------------------------------------------- */ |
| 6 | |
| 7 | /* Python.h has to appear first */ |
| 8 | |
| 9 | %insert(runtime) %{ |
| 10 | #include "Python.h" |
| 11 | %} |
| 12 | |
| 13 | %insert(runtime) "precommon.swg"; |
| 14 | %insert(runtime) "common.swg"; /* Common type-checking code */ |
| 15 | %insert(runtime) "pyrun.swg"; /* Python run-time code */ |
| 16 | |
| 17 | /* Special directive for shadow code */ |
| 18 | |
| 19 | #define %shadow %insert("shadow") |
| 20 | #define %pythoncode %insert("python") |
| 21 | |
| 22 | %include "pymacros.swg" |
| 23 | |
| 24 | |
| 25 | /* ----------------------------------------------------------------------------- |
| 26 | * SWIGTYPE typemaps |
| 27 | * ----------------------------------------------------------------------------- */ |
| 28 | |
| 29 | %include "pyswigtype.swg" |
| 30 | |
| 31 | |
| 32 | /* ----------------------------------------------------------------------------- |
| 33 | * Check for local fragment defintions |
| 34 | * ----------------------------------------------------------------------------- */ |
| 35 | |
| 36 | %include "my_fragments.i" |
| 37 | |
| 38 | |
| 39 | /* ----------------------------------------------------------------------------- |
| 40 | * Typemap specializations |
| 41 | * ----------------------------------------------------------------------------- */ |
| 42 | |
| 43 | %include "pyinout.swg" |
| 44 | %include "pyvoid.swg" |
| 45 | %include "pyobject.swg" |
| 46 | %include "pystrbase.swg" |
| 47 | %include "pystrings.swg" |
| 48 | %include "pyvaltypes.swg" |
| 49 | %include "pyptrtypes.swg" |
| 50 | %include "pyprimtypes.swg" |
| 51 | %include "pymisctypes.swg" |
| 52 | %include "pyenum.swg" |
| 53 | |
| 54 | /* ------------------------------------------------------------ |
| 55 | * Overloaded operator support |
| 56 | * ------------------------------------------------------------ */ |
| 57 | %include "pyopers.swg" |
| 58 | |
| 59 | /* ------------------------------------------------------------ |
| 60 | * Warnings for Python keywords |
| 61 | * ------------------------------------------------------------ */ |
| 62 | %include "pythonkw.swg" |
| 63 | |
| 64 | /* ------------------------------------------------------------ |
| 65 | * The start of the Python initialization function |
| 66 | * ------------------------------------------------------------ */ |
| 67 | |
| 68 | %init %{ |
| 69 | #ifdef __cplusplus |
| 70 | extern "C" |
| 71 | #endif |
| 72 | SWIGEXPORT(void) SWIG_init(void) { |
| 73 | static PyObject *SWIG_globals = 0; |
| 74 | static int typeinit = 0; |
| 75 | PyObject *m, *d; |
| 76 | int i; |
| 77 | if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); |
| 78 | m = Py_InitModule((char *) SWIG_name, SwigMethods); |
| 79 | d = PyModule_GetDict(m); |
| 80 | |
| 81 | if (!typeinit) { |
| 82 | for (i = 0; swig_types_initial[i]; i++) { |
| 83 | swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); |
| 84 | } |
| 85 | typeinit = 1; |
| 86 | } |
| 87 | SWIG_InstallConstants(d,swig_const_table); |
| 88 | %} |
| 89 | |
| 90 | |