isolating the pure 'runtime' code in pyrun.swg, the API declarations are now in pyapi.swg
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6289 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
983d4abe42
commit
2c962d36f2
4 changed files with 135 additions and 139 deletions
132
Lib/python/pyapi.swg
Normal file
132
Lib/python/pyapi.swg
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* 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_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
/* Internal C/C++ API */
|
||||
#ifdef __cplusplus
|
||||
#define SWIG_new_array(size,Type) (new Type[(size)])
|
||||
#define SWIG_delete(cptr) delete cptr
|
||||
#define SWIG_delete_array(cptr) delete[] cptr
|
||||
#define SWIG_const_cast(a,Type) const_cast<Type >(a)
|
||||
#define SWIG_static_cast(a,Type) static_cast<Type >(a)
|
||||
#define SWIG_reinterpret_cast(a,Type) reinterpret_cast<Type >(a)
|
||||
#define SWIG_new_copy(ptr,Type) (new Type(*ptr))
|
||||
#define SWIG_numeric_cast(a,Type) static_cast<Type >(a)
|
||||
#else /* C case */
|
||||
#define SWIG_new_array(size,Type) ((Type*) malloc((size)*sizeof(Type)))
|
||||
#define SWIG_delete(cptr) free((char*)cptr)
|
||||
#define SWIG_delete_array(cptr) free((char*)cptr)
|
||||
#define SWIG_const_cast(a,Type) (Type)(a)
|
||||
#define SWIG_static_cast(a,Type) (Type)(a)
|
||||
#define SWIG_reinterpret_cast(a,Type) (Type)(a)
|
||||
#define SWIG_numeric_cast(a,Type) (Type)(a)
|
||||
#define SWIG_new_copy(ptr,Type) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type)))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
Exception handling in wrappers
|
||||
*/
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
|
||||
#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0)
|
||||
#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1)
|
||||
#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj)
|
||||
#define SWIG_null_ref(type) SWIG_Python_NullRef(type)
|
||||
|
||||
/*
|
||||
Contract support
|
||||
*/
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Constant declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Constant Types */
|
||||
#define SWIG_PY_INT 1
|
||||
#define SWIG_PY_FLOAT 2
|
||||
#define SWIG_PY_STRING 3
|
||||
#define SWIG_PY_POINTER 4
|
||||
#define SWIG_PY_BINARY 5
|
||||
|
||||
/* Constant information structure */
|
||||
typedef struct swig_const_info {
|
||||
int type;
|
||||
char *name;
|
||||
long lvalue;
|
||||
double dvalue;
|
||||
void *pvalue;
|
||||
swig_type_info **ptype;
|
||||
} swig_const_info;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
/*
|
||||
Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
|
||||
C/C++ pointers in the python side. Very useful for debugging, but
|
||||
not always safe.
|
||||
*/
|
||||
#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
|
||||
#define SWIG_COBJECT_TYPES
|
||||
#endif
|
||||
|
||||
/* Flags for pointer conversion */
|
||||
#define SWIG_POINTER_EXCEPTION 0x1
|
||||
#define SWIG_POINTER_DISOWN 0x2
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Alloc. memory flags
|
||||
* ----------------------------------------------------------------------------- */
|
||||
#define SWIG_OLDOBJ 1
|
||||
#define SWIG_NEWOBJ SWIG_OLDOBJ + 1
|
||||
#define SWIG_PYSTR SWIG_NEWOBJ + 1
|
||||
|
||||
|
||||
#ifdef SWIG_DISABLE_RUNTIME
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Lookup type pointer
|
||||
* ----------------------------------------------------------------------------- */
|
||||
static void
|
||||
SWIG_Python_LookupTypePointer(swig_type_info ***type_list_handle) {
|
||||
PyObject *module, *pointer;
|
||||
void *type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = PyCObject_Import("swig_runtime_data", "type_pointer");
|
||||
if (type_pointer) {
|
||||
*type_list_handle = (swig_type_info **) type_pointer;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
/* create a new module and variable */
|
||||
module = Py_InitModule("swig_runtime_data", NULL);
|
||||
pointer = PyCObject_FromVoidPtr((void *) (*type_list_handle), NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, "type_pointer", pointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* SWIG_DISABLE_RUNTIME */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -14,65 +14,6 @@
|
|||
#define SWIGSTATIC(a) static a
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
Alloc. memory flags
|
||||
*/
|
||||
#define SWIG_OLDOBJ 1
|
||||
#define SWIG_NEWOBJ SWIG_OLDOBJ + 1
|
||||
#define SWIG_PYSTR SWIG_NEWOBJ + 1
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* 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_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
/* Internal C/C++ API */
|
||||
#ifdef __cplusplus
|
||||
#define SWIG_new_array(size,Type) (new Type[(size)])
|
||||
#define SWIG_delete(cptr) delete cptr
|
||||
#define SWIG_delete_array(cptr) delete[] cptr
|
||||
#define SWIG_const_cast(a,Type) const_cast<Type >(a)
|
||||
#define SWIG_static_cast(a,Type) static_cast<Type >(a)
|
||||
#define SWIG_reinterpret_cast(a,Type) reinterpret_cast<Type >(a)
|
||||
#define SWIG_new_copy(ptr,Type) (new Type(*ptr))
|
||||
#define SWIG_numeric_cast(a,Type) static_cast<Type >(a)
|
||||
#else /* C case */
|
||||
#define SWIG_new_array(size,Type) ((Type*) malloc((size)*sizeof(Type)))
|
||||
#define SWIG_delete(cptr) free((char*)cptr)
|
||||
#define SWIG_delete_array(cptr) free((char*)cptr)
|
||||
#define SWIG_const_cast(a,Type) (Type)(a)
|
||||
#define SWIG_static_cast(a,Type) (Type)(a)
|
||||
#define SWIG_reinterpret_cast(a,Type) (Type)(a)
|
||||
#define SWIG_numeric_cast(a,Type) (Type)(a)
|
||||
#define SWIG_new_copy(ptr,Type) ((Type*)memcpy(malloc(sizeof(Type)),ptr,sizeof(Type)))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
Exception handling in wrappers
|
||||
*/
|
||||
#define SWIG_fail goto fail
|
||||
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
|
||||
#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0)
|
||||
#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1)
|
||||
#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj)
|
||||
#define SWIG_null_ref(type) SWIG_Python_NullRef(type)
|
||||
|
||||
/*
|
||||
Contract support
|
||||
*/
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,59 +12,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Constant declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Constant Types */
|
||||
#define SWIG_PY_INT 1
|
||||
#define SWIG_PY_FLOAT 2
|
||||
#define SWIG_PY_STRING 3
|
||||
#define SWIG_PY_POINTER 4
|
||||
#define SWIG_PY_BINARY 5
|
||||
|
||||
/* Constant information structure */
|
||||
typedef struct swig_const_info {
|
||||
int type;
|
||||
char *name;
|
||||
long lvalue;
|
||||
double dvalue;
|
||||
void *pvalue;
|
||||
swig_type_info **ptype;
|
||||
} swig_const_info;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer declarations
|
||||
* ----------------------------------------------------------------------------- */
|
||||
/*
|
||||
Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
|
||||
C/C++ pointers in the python side. Very useful for debugging, but
|
||||
not always safe.
|
||||
*/
|
||||
#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
|
||||
#define SWIG_COBJECT_TYPES
|
||||
#endif
|
||||
|
||||
/* Flags for pointer conversion */
|
||||
#define SWIG_POINTER_EXCEPTION 0x1
|
||||
#define SWIG_POINTER_DISOWN 0x2
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SWIG API.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* 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_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
|
||||
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
|
||||
|
|
@ -155,7 +102,7 @@ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
statichere PyTypeObject varlinktype = {
|
||||
static PyTypeObject varlinktype = {
|
||||
PyObject_HEAD_INIT(0)
|
||||
0, /* Number of items in variable part (ob_size) */
|
||||
(char *)"swigvarlink", /* Type name (tp_name) */
|
||||
|
|
@ -273,7 +220,6 @@ SWIG_Python_NullRef(const char *type)
|
|||
}
|
||||
}
|
||||
|
||||
/* add information about failing argument */
|
||||
SWIGRUNTIME(int)
|
||||
SWIG_Python_AddErrMesg(const char* mesg, int infront)
|
||||
{
|
||||
|
|
@ -303,6 +249,7 @@ SWIGRUNTIME(int)
|
|||
SWIG_Python_ArgFail(int argnum)
|
||||
{
|
||||
if (PyErr_Occurred()) {
|
||||
/* add information about failing argument */
|
||||
char mesg[256];
|
||||
sprintf(mesg, "argument number %d:", argnum);
|
||||
return SWIG_Python_AddErrMesg(mesg, 1);
|
||||
|
|
@ -599,31 +546,6 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SWIG_DISABLE_RUNTIME
|
||||
/* lookup type pointer */
|
||||
SWIGRUNTIME(void)
|
||||
SWIG_Python_LookupTypePointer(swig_type_info ***type_list_handle) {
|
||||
PyObject *module, *pointer;
|
||||
void *type_pointer;
|
||||
|
||||
/* first check if module already created */
|
||||
type_pointer = PyCObject_Import("swig_runtime_data", "type_pointer");
|
||||
if (type_pointer) {
|
||||
*type_list_handle = (swig_type_info **) type_pointer;
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
/* create a new module and variable */
|
||||
module = Py_InitModule("swig_runtime_data", NULL);
|
||||
pointer = PyCObject_FromVoidPtr((void *) (*type_list_handle), NULL);
|
||||
if (pointer && module) {
|
||||
PyModule_AddObject(module, "type_pointer", pointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* SWIG_DISABLE_RUNTIME */
|
||||
|
||||
|
||||
#endif /* SWIG_NOINCLUDE */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,5 @@
|
|||
|
||||
%}
|
||||
%insert(runtime) "common.swg"; /* Common type-checking code */
|
||||
%insert(runtime) "pyapi.swg"; /* SWIG/Pyton API */
|
||||
%insert(runtime) "pyrun.swg"; /* Python run-time code */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue