massive typemap unification
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5bbd841acc
commit
7e5e4fd1f9
144 changed files with 6378 additions and 7248 deletions
|
|
@ -1,13 +1,41 @@
|
|||
/* Python.h has to appear first */
|
||||
%insert(runtime) %{
|
||||
#include <Python.h>
|
||||
|
||||
/* Add PyOS_snprintf for old Pythons */
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
#define PyOS_snprintf snprintf
|
||||
#endif
|
||||
|
||||
/* A crude PyString_FromFormat implementation for old Pythons */
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
|
||||
#ifndef SWIG_PYBUFFER_SIZE
|
||||
#define SWIG_PYBUFFER_SIZE 1024
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
PyString_FromFormat(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
char buf[SWIG_PYBUFFER_SIZE * 2];
|
||||
int res;
|
||||
va_start(ap, fmt);
|
||||
res = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
return (res < 0 || res >= sizeof(buf)) ? 0 : PyString_FromString(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Add PyObject_Del for old Pythons */
|
||||
#if PY_VERSION_HEX < 0x01060000
|
||||
#define PyObject_Del(op) PyMem_DEL((op))
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; /* Common C API type-checking code */
|
||||
%insert(runtime) "pyapi.swg"; /* SWIG/Pyton API */
|
||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||
%insert(runtime) "pyapi.swg"; /* Pyton API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
||||
|
||||
/* When using -nortti, tell directors to avoid RTTI */
|
||||
#ifdef SWIG_NORTTI
|
||||
%insert("runtime") %{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue