git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5835 626c5289-ae23-0410-ae9c-e8d60b6d4f22
88 lines
2.6 KiB
Text
88 lines
2.6 KiB
Text
/* -----------------------------------------------------------------------------
|
|
* python.swg
|
|
*
|
|
* Python configuration module.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
/* Python.h has to appear first */
|
|
|
|
%insert(runtime) %{
|
|
#include "Python.h"
|
|
%}
|
|
|
|
%insert(runtime) "precommon.swg";
|
|
%insert(runtime) "common.swg"; /* Common type-checking code */
|
|
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
|
|
|
/* Special directive for shadow code */
|
|
|
|
#define %shadow %insert("shadow")
|
|
#define %pythoncode %insert("python")
|
|
|
|
%include "pymacros.swg"
|
|
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* SWIGTYPE typemaps
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
%include "pyswigtype.swg"
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* Typemap specializations
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
%include "pyinout.swg"
|
|
%include "pyvoid.swg"
|
|
%include "pyobject.swg"
|
|
%include "pystrings.swg"
|
|
%include "pywstrings.swg"
|
|
%include "pyvaltypes.swg"
|
|
%include "pyptrtypes.swg"
|
|
%include "pyprimtypes.swg"
|
|
%include "pymisctypes.swg"
|
|
|
|
/* ------------------------------------------------------------
|
|
* Enums
|
|
* ------------------------------------------------------------ */
|
|
%apply int { enum SWIGTYPE };
|
|
/* this doesn't work now, you need to redefined it for each enum. */
|
|
%apply const int& { const enum SWIGTYPE& };
|
|
|
|
|
|
/* ------------------------------------------------------------
|
|
* Overloaded operator support
|
|
* ------------------------------------------------------------ */
|
|
%include "pyopers.swg"
|
|
|
|
/* ------------------------------------------------------------
|
|
* Warnings for Python keywords
|
|
* ------------------------------------------------------------ */
|
|
%include "pythonkw.swg"
|
|
|
|
/* ------------------------------------------------------------
|
|
* The start of the Python initialization function
|
|
* ------------------------------------------------------------ */
|
|
|
|
%init %{
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
#endif
|
|
SWIGEXPORT(void) SWIG_init(void) {
|
|
static PyObject *SWIG_globals = 0;
|
|
static int typeinit = 0;
|
|
PyObject *m, *d;
|
|
int i;
|
|
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
|
|
m = Py_InitModule((char *) SWIG_name, SwigMethods);
|
|
d = PyModule_GetDict(m);
|
|
|
|
if (!typeinit) {
|
|
for (i = 0; swig_types_initial[i]; i++) {
|
|
swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
|
|
}
|
|
typeinit = 1;
|
|
}
|
|
SWIG_InstallConstants(d,swig_const_table);
|
|
%}
|
|
|