From 080b9cbc7f4d99ebea373624e7aa3ae7f6a79443 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 11 Feb 2006 19:46:49 +0000 Subject: [PATCH] Rearrainge things so the SWIG_VERSION values doesn't need to be written to the C++ wrapper file. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_core_api.i | 70 ++++++++++++++++++++++++++-------------- wxPython/src/_defs.i | 1 + 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/wxPython/src/_core_api.i b/wxPython/src/_core_api.i index 153124b842..b508c8a518 100644 --- a/wxPython/src/_core_api.i +++ b/wxPython/src/_core_api.i @@ -19,9 +19,54 @@ // Helper functions for dealing with SWIG objects and such. These are // located here so they know about the SWIG types and functions declared // in the wrapper code. +%} + +#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 ); +WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap ); // Maintains a hashmap of className to swig_type_info pointers. Given the @@ -100,29 +145,6 @@ bool wxPyConvertSwigPtr(PyObject* obj, void **ptr, } -// 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")); - -#if SWIG_VERSION < 0x010328 -#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 -#else // SWIG_VERSION >= 1.3.28 - robj = PySwigObject_New(ptr, swigType, 0); -#endif - return robj; -} // Python's PyInstance_Check does not return True for instances of new-style diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index 691a02987d..1ceba2c622 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -93,6 +93,7 @@ typedef unsigned long wxUIntPtr; #define %noautodoc %feature("noautodoc") #if SWIG_VERSION >= 0x010327 +#undef %kwargs #define %kwargs %feature("kwargs", "1") #define %nokwargs %feature("kwargs", "0") #else