Use the preprocessor to rename external functions of the SWIG runtime
API to follow the naming convention SWIG_<language>_<function>. This should allow linking more than one interpreter into a program. Unify the pointer-conversion runtime API. [Python]: Add the function SWIG_MustGetPtr. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5246 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e4d0541300
commit
c21da2e306
1 changed files with 54 additions and 18 deletions
|
|
@ -38,17 +38,43 @@ typedef struct swig_const_info {
|
|||
swig_type_info **ptype;
|
||||
} swig_const_info;
|
||||
|
||||
/* Common SWIG API */
|
||||
#define SWIG_ConvertPtr(obj, pp, type, flags) \
|
||||
SWIG_Python_ConvertPtr(obj, pp, type, flags)
|
||||
#define SWIG_NewPointerObj(p, type, flags) \
|
||||
SWIG_Python_NewPointerObj(p, type, flags)
|
||||
#define SWIG_MustGetPtr(p, type, argnum, flags) \
|
||||
SWIG_Python_MustGetPtr(p, type, argnum, flags)
|
||||
|
||||
/* Python-specific SWIG API */
|
||||
#define SWIG_newvarlink() \
|
||||
SWIG_Python_newvarlink()
|
||||
#define SWIG_addvarlink(p, name, get_attr, set_attr) \
|
||||
SWIG_Python_addvarlink(p, name, get_attr, set_attr)
|
||||
#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
|
||||
SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
|
||||
#define SWIG_PackData(c, ptr, sz) \
|
||||
SWIG_Python_PackData(c, ptr, sz)
|
||||
#define SWIG_UnpackData(c, ptr, sz) \
|
||||
SWIG_Python_UnpackData(c, ptr, sz)
|
||||
#define SWIG_NewPackedObj(ptr, sz, type) \
|
||||
SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) \
|
||||
SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
|
||||
SWIGEXPORT(PyObject *) SWIG_newvarlink(void);
|
||||
SWIGEXPORT(void) SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
SWIGEXPORT(int) SWIG_ConvertPtr(PyObject *, void **, swig_type_info *, int);
|
||||
SWIGEXPORT(int) SWIG_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
|
||||
SWIGEXPORT(char *) SWIG_PackData(char *c, void *, int);
|
||||
SWIGEXPORT(char *) SWIG_UnpackData(char *c, void *, int);
|
||||
SWIGEXPORT(PyObject *) SWIG_NewPointerObj(void *, swig_type_info *,int own);
|
||||
SWIGEXPORT(PyObject *) SWIG_NewPackedObj(void *, int sz, swig_type_info *);
|
||||
SWIGEXPORT(void) SWIG_InstallConstants(PyObject *d, swig_const_info constants[]);
|
||||
SWIGEXPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
|
||||
SWIGEXPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
|
||||
SWIGEXPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
|
||||
|
||||
SWIGEXPORT(PyObject *) SWIG_Python_newvarlink(void);
|
||||
SWIGEXPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
SWIGEXPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
|
||||
SWIGEXPORT(char *) SWIG_Python_PackData(char *c, void *, int);
|
||||
SWIGEXPORT(char *) SWIG_Python_UnpackData(char *c, void *, int);
|
||||
SWIGEXPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
|
||||
SWIGEXPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
|
||||
#else
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -131,7 +157,7 @@ statichere PyTypeObject varlinktype = {
|
|||
|
||||
/* Create a variable linking object for use later */
|
||||
SWIGRUNTIME(PyObject *)
|
||||
SWIG_newvarlink(void) {
|
||||
SWIG_Python_newvarlink(void) {
|
||||
swig_varlinkobject *result = 0;
|
||||
result = PyMem_NEW(swig_varlinkobject,1);
|
||||
varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
|
||||
|
|
@ -143,7 +169,8 @@ SWIG_newvarlink(void) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME(void)
|
||||
SWIG_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
|
||||
SWIG_Python_addvarlink(PyObject *p, char *name,
|
||||
PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
|
||||
swig_varlinkobject *v;
|
||||
swig_globalvar *gv;
|
||||
v= (swig_varlinkobject *) p;
|
||||
|
|
@ -158,7 +185,7 @@ SWIG_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_
|
|||
|
||||
/* Pack binary data into a string */
|
||||
SWIGRUNTIME(char *)
|
||||
SWIG_PackData(char *c, void *ptr, int sz) {
|
||||
SWIG_Python_PackData(char *c, void *ptr, int sz) {
|
||||
static char hex[17] = "0123456789abcdef";
|
||||
int i;
|
||||
unsigned char *u = (unsigned char *) ptr;
|
||||
|
|
@ -173,7 +200,7 @@ SWIG_PackData(char *c, void *ptr, int sz) {
|
|||
|
||||
/* Unpack binary data from a string */
|
||||
SWIGRUNTIME(char *)
|
||||
SWIG_UnpackData(char *c, void *ptr, int sz) {
|
||||
SWIG_Python_UnpackData(char *c, void *ptr, int sz) {
|
||||
register unsigned char uu = 0;
|
||||
register int d;
|
||||
unsigned char *u = (unsigned char *) ptr;
|
||||
|
|
@ -196,7 +223,7 @@ SWIG_UnpackData(char *c, void *ptr, int sz) {
|
|||
|
||||
/* Convert a pointer value */
|
||||
SWIGRUNTIME(int)
|
||||
SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
|
||||
SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
char *c = 0;
|
||||
static PyObject *SWIG_this = 0;
|
||||
|
|
@ -286,9 +313,18 @@ type_error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Convert a pointer value, signal an exception on a type mismatch */
|
||||
SWIGRUNTIME(void *)
|
||||
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
|
||||
{
|
||||
void *result;
|
||||
SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Convert a packed value value */
|
||||
SWIGRUNTIME(int)
|
||||
SWIG_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
|
||||
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
|
||||
swig_type_info *tc;
|
||||
char *c = 0;
|
||||
|
||||
|
|
@ -321,7 +357,7 @@ type_error:
|
|||
|
||||
/* Create a new pointer object */
|
||||
SWIGRUNTIME(PyObject *)
|
||||
SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) {
|
||||
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
|
||||
PyObject *robj;
|
||||
if (!ptr) {
|
||||
Py_INCREF(Py_None);
|
||||
|
|
@ -359,7 +395,7 @@ SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME(PyObject *)
|
||||
SWIG_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
|
||||
SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
|
||||
char result[1024];
|
||||
char *r = result;
|
||||
if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
|
||||
|
|
@ -371,7 +407,7 @@ SWIG_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
|
|||
|
||||
/* Install Constants */
|
||||
SWIGRUNTIME(void)
|
||||
SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
||||
SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
|
||||
int i;
|
||||
PyObject *obj;
|
||||
for (i = 0; constants[i].type; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue