bh: thuban/libraries/thuban wxproj.cpp,1.6,1.7
cvs@intevation.de
cvs at intevation.de
Tue Apr 5 23:12:26 CEST 2005
Author: bh
Update of /thubanrepository/thuban/libraries/thuban
In directory doto:/tmp/cvs-serv30130/libraries/thuban
Modified Files:
wxproj.cpp
Log Message:
Make it work with a wxPython.h from
wxPython 2.4 as well. Also, remove a now obsolete comment.
Index: wxproj.cpp
===================================================================
RCS file: /thubanrepository/thuban/libraries/thuban/wxproj.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- wxproj.cpp 5 Apr 2005 17:26:58 -0000 1.6
+++ wxproj.cpp 5 Apr 2005 21:12:24 -0000 1.7
@@ -42,15 +42,37 @@
#include "swigPtrConvertHack.h"
#endif
-/* We only need this prototype from the above (big) include:
- *
- * bool wxPyConvertSwigPtr( PyObject* obj, void **ptr, const wxChar* className);
- *
- * but it is a macro involving a large struct and static variables, so we
- * can't just get along with a prototype.
- * Trouble is this file is not installed by default on Debian.
+/* Compatibility code to cope with wxPython.h from wxPython 2.4.
+ *
+ * Instead of wxPyConvertSwigPtr there's SWIG_GetPtrObj which has almost
+ * the same interface but is a little different. So we define our own
+ * wxPyConvertSwigPtr if we're being compiled with wxPython 2.4. We
+ * determine that by checking whether a macro wxPyConvertSwigPtr is
+ * defined.
+ *
+ * In wxPython 2.5 the last parameter, type, is of type wxChar* which
+ * may be a wchar_t* and thus incompatible with char* and it's value is
+ * slightly different (the one in 2.4 needs a few more characters
+ * appended and prefixed). Fortunately, it's is always passed via wxT,
+ * a macro that we only use for the type parameter. So redefine it to
+ * do nothing but add the pre- and suffixes necessary for 2.4.
*/
+#ifndef wxPyConvertSwigPtr
+bool
+wxPyConvertSwigPtr(PyObject *obj, void **ptr, char *type)
+{
+ /* import the API ptr if it hasn't been imported yet */
+ if (wxPyCoreAPIPtr == NULL)
+ wxPyCoreAPI_IMPORT();
+ return SWIG_GetPtrObj(obj, ptr, type) == 0;
+}
+#undef wxT
+#define wxT(a) ("_" a "_p")
+#endif
+
+
+/* pyshapelib api pointer */
static PyShapeLibAPI * pyshapelib_api;
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)