From b702ab768f4b9736647b4ba0de79dac64e7c60c8 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 13 Feb 2006 19:12:31 +0000 Subject: [PATCH] a little reorg and cleanup from the last two revisions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_core_api.i | 93 ++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/wxPython/src/_core_api.i b/wxPython/src/_core_api.i index 1761c48813..0669d1fcbb 100644 --- a/wxPython/src/_core_api.i +++ b/wxPython/src/_core_api.i @@ -20,55 +20,6 @@ // located here so they know about the SWIG types and functions declared // in the wrapper code. -static -swig_type_info* wxPyFindSwigType(const wxChar* className); - -%} - - -#if SWIG_VERSION < 0x010328 -%{ -// Make a SWIGified pointer object suitable for a .this attribute -PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { - - PyObject* robj = NULL; - - swig_type_info* swigType = wxPyFindSwigType(className); - wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); - -#ifdef SWIG_COBJECT_TYPES - robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name); -#else - { - char result[1024]; - robj = SWIG_PackVoidPtr(result, ptr, swigType->name, sizeof(result)) ? - PyString_FromString(result) : 0; - } -#endif - return robj; -} -%} - -#else // SWIG_VERSION >= 1.3.28 -%{ -// Make a SWIGified pointer object suitable for a .this attribute -PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { - - PyObject* robj = NULL; - - swig_type_info* swigType = wxPyFindSwigType(className); - wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); - - robj = PySwigObject_New(ptr, swigType, 0); - return robj; -} -%} -#endif - - - - -%{ #include WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap ); @@ -148,9 +99,51 @@ bool wxPyConvertSwigPtr(PyObject* obj, void **ptr, return SWIG_Python_ConvertPtr(obj, ptr, swigType, SWIG_POINTER_EXCEPTION) != -1; } +%} + + +#if SWIG_VERSION < 0x010328 +%{ +// Make a SWIGified pointer object suitable for a .this attribute +PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { + + PyObject* robj = NULL; + + swig_type_info* swigType = wxPyFindSwigType(className); + wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); + +#ifdef SWIG_COBJECT_TYPES + robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name); +#else + { + char result[1024]; + robj = SWIG_PackVoidPtr(result, ptr, swigType->name, sizeof(result)) ? + PyString_FromString(result) : 0; + } +#endif + return robj; +} +%} + +#else // SWIG_VERSION >= 1.3.28 +%{ +// Make a SWIGified pointer object suitable for a .this attribute +PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { + + PyObject* robj = NULL; + + swig_type_info* swigType = wxPyFindSwigType(className); + wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); + + robj = PySwigObject_New(ptr, swigType, 0); + return robj; +} +%} +#endif +%{ // Python's PyInstance_Check does not return True for instances of new-style // classes. This should get close enough for both new and old classes but I // should re-evaluate the need for doing instance checks... @@ -159,7 +152,6 @@ bool wxPyInstance_Check(PyObject* obj) { } - // This one checks if the object is an instance of a SWIG proxy class (it has // a .this attribute, and the .this attribute is a PySwigObject.) bool wxPySwigInstance_Check(PyObject* obj) { @@ -177,7 +169,6 @@ bool wxPySwigInstance_Check(PyObject* obj) { PyErr_Clear(); return false; } - // Export a C API in a struct. Other modules will be able to load this from