From: Marcelo M. <mar...@us...> - 2004-10-02 18:46:15
|
Update of /cvsroot/swig/SWIG/Lib/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29632 Modified Files: pymacros.swg pyrun.swg pyruntime.swg Added Files: pyapi.swg Log Message: isolating the pure 'runtime' code in pyrun.swg, the API declarations are now in pyapi.swg Index: pyruntime.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/pyruntime.swg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pyruntime.swg 2 Oct 2004 17:54:38 -0000 1.2 --- pyruntime.swg 2 Oct 2004 18:44:48 -0000 1.3 *************** *** 25,27 **** --- 25,28 ---- %} %insert(runtime) "common.swg"; /* Common type-checking code */ + %insert(runtime) "pyapi.swg"; /* SWIG/Pyton API */ %insert(runtime) "pyrun.swg"; /* Python run-time code */ --- NEW FILE: pyapi.swg --- #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 Index: pyrun.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/pyrun.swg,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** pyrun.swg 2 Oct 2004 17:54:38 -0000 1.34 --- pyrun.swg 2 Oct 2004 18:44:48 -0000 1.35 *************** *** 13,69 **** #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 --- 13,16 ---- *************** *** 156,160 **** } ! statichere PyTypeObject varlinktype = { PyObject_HEAD_INIT(0) 0, /* Number of items in variable part (ob_size) */ --- 103,107 ---- } ! static PyTypeObject varlinktype = { PyObject_HEAD_INIT(0) 0, /* Number of items in variable part (ob_size) */ *************** *** 274,278 **** } - /* add information about failing argument */ SWIGRUNTIME(int) SWIG_Python_AddErrMesg(const char* mesg, int infront) --- 221,224 ---- *************** *** 304,307 **** --- 250,254 ---- { if (PyErr_Occurred()) { + /* add information about failing argument */ char mesg[256]; sprintf(mesg, "argument number %d:", argnum); *************** *** 600,628 **** } } - - #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 */ --- 547,550 ---- Index: pymacros.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/python/pymacros.swg,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pymacros.swg 2 Oct 2004 17:54:38 -0000 1.8 --- pymacros.swg 2 Oct 2004 18:44:48 -0000 1.9 *************** *** 15,77 **** #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 %} --- 15,18 ---- |