New Makefile/Setup files supporting multiple dynamic extension modules
for unix systems. Fixes for the wxGLCanvas demo to work around a strange bug in gtk. SWIG support routines now compiled separately instead of being bundled in wx.cpp. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -98,6 +98,14 @@ data transfer.
|
||||
|
||||
Added access methods to wxGridEvent.
|
||||
|
||||
New Makefile/Setup files supporting multiple dynamic extension modules
|
||||
for unix systems.
|
||||
|
||||
Fixes for the wxGLCanvas demo to work around a strange bug in gtk.
|
||||
|
||||
SWIG support routines now compiled separately instead of being bundled
|
||||
in wx.cpp.
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -19,8 +19,13 @@ else:
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestGLCanvas(nb)
|
||||
return win
|
||||
#win = TestGLCanvas(nb)
|
||||
#return win
|
||||
win = wxFrame(frame, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
canvas = TestGLCanvas(win)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +145,7 @@ overview = """\
|
||||
def _test():
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = wxFrame(NULL, -1, "HELP ME!!")
|
||||
frame = wxFrame(NULL, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
win = TestGLCanvas(frame)
|
||||
frame.Show(TRUE)
|
||||
self.SetTopWindow(frame)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
# -*- makefile -*-
|
||||
# Universal Unix Makefile for Python extensions
|
||||
# =============================================
|
||||
|
||||
@@ -190,7 +191,7 @@ endif
|
||||
# === Fixed rules ===
|
||||
|
||||
# Default target. This builds shared libraries only
|
||||
default: sharedmods
|
||||
default: $(HELPERLIB) sharedmods
|
||||
|
||||
# Build everything
|
||||
all: static sharedmods
|
||||
@@ -350,11 +351,12 @@ $(GENCODEDIR)/%.py : %.i
|
||||
|
||||
|
||||
# This one must leave out the -c flag so we define the whole rule
|
||||
$(GENCODEDIR)/wx.cpp $(GENCODEDIR)/wx.py : wx.i my_typemaps.i _defs.i _extras.py
|
||||
swig $(SWIGFLAGS) -o $(GENCODEDIR)/wx.cpp wx.i
|
||||
#$(GENCODEDIR)/wx.cpp $(GENCODEDIR)/wx.py : wx.i my_typemaps.i _defs.i _extras.py
|
||||
# swig $(SWIGFLAGS) -o $(GENCODEDIR)/wx.cpp wx.i
|
||||
|
||||
|
||||
# define some dependencies
|
||||
$(GENCODEDIR)/wx.cpp $(GENCODEDIR)/wx.py : wx.i my_typemaps.i _defs.i _extras.py
|
||||
$(GENCODEDIR)/windows.cpp $(GENCODEDIR)/windows.py : windows.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/windows2.cpp $(GENCODEDIR)/windows2.py : windows2.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/windows3.cpp $(GENCODEDIR)/windows3.py : windows3.i my_typemaps.i _defs.i
|
||||
@@ -376,12 +378,18 @@ $(GENCODEDIR)/glcanvas.cpp $(GENCODEDIR)/glcanvas.py : glcanvas.i my_typemap
|
||||
$(GENCODEDIR)/helpers.cpp:
|
||||
ln -s `pwd`/helpers.cpp $@
|
||||
|
||||
$(GENCODEDIR)/libpy.c:
|
||||
ln -s `pwd`/libpy.c $@
|
||||
|
||||
$(GENCODEDIR)/libptr.c:
|
||||
ln -s `pwd`/libptr.c $@
|
||||
|
||||
$(GENCODEDIR)/_glcanvas.cpp:
|
||||
-cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.cpp $@
|
||||
-cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.h ./glcanvas.h
|
||||
|
||||
|
||||
wxInstall : sharedmods $(PYMODULES)
|
||||
wxInstall : $(HELPERLIB) sharedmods $(PYMODULES)
|
||||
if test ! -d $(TARGETDIR) ; then \
|
||||
mkdir $(TARGETDIR) ; else true ; fi
|
||||
if [ "$(SHAREDMODS)" != "" ]; then \
|
||||
@@ -410,8 +418,24 @@ wxInstall : sharedmods $(PYMODULES)
|
||||
python $(LIBDEST)/compileall.py -l $(TARGETDIR); \
|
||||
python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\
|
||||
fi
|
||||
ifdef HELPERLIB
|
||||
cp lib$(WXPYLIB)$(SO) $(WXPYLIBDIR)
|
||||
@echo ---------------------------------------------------------
|
||||
@echo You may have to run ldconfig, or set an environment
|
||||
@echo variable in order for $(WXPYLIBDIR)/lib$(WXPYLIB)$(SO)
|
||||
@echo to be found at runtime. See your man pages for ld.so or
|
||||
@echo equivalent.
|
||||
@echo ---------------------------------------------------------
|
||||
endif
|
||||
|
||||
ifdef HELPERLIB
|
||||
helpers.o: $(srcdir)/helpers.cpp; $(CCC) $(CCSHARED) $(C_DEFINES) $(C_FLAGS) $(CFLAGS) -c $(srcdir)/helpers.cpp
|
||||
libpy.o: $(srcdir)/libpy.c; $(CC) $(CCSHARED) $(C_DEFINES) $(C_FLAGS) $(CFLAGS) -c $(srcdir)/libpy.c
|
||||
libptr.o: $(srcdir)/libptr.c; $(CC) $(CCSHARED) $(C_DEFINES) $(C_FLAGS) $(CFLAGS) -c $(srcdir)/libptr.c
|
||||
|
||||
$(HELPERLIB) : helpers.o libpy.o libptr.o
|
||||
$(LDSHARED) helpers.o libpy.o libptr.o $(C_DEFINES) $(C_FLAGS) -Xlinker $(WX_CONFIG_LIBS) -o $@
|
||||
endif
|
||||
|
||||
|
||||
lib : libwxPython.a
|
||||
@@ -427,3 +451,6 @@ tgz:
|
||||
rpm:
|
||||
cd ../distrib; ./makerpm $(WXP_VERSION)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
# -*- makefile -*-
|
||||
## This file gives the details of what is needed to build this extension
|
||||
## module so the Makefile can be created.
|
||||
|
||||
@@ -14,6 +15,7 @@ WX_CONFIG_CFLAGS=`wx-config --cflags`
|
||||
WX_CONFIG_LIBS=`wx-config --libs`
|
||||
|
||||
|
||||
|
||||
## Depending on how your Python was built, you may have to set this
|
||||
## value to use the C++ driver to link with instead of the default
|
||||
## C driver. For example:
|
||||
@@ -33,13 +35,40 @@ MY_LINKCC=$(CCC)
|
||||
TARGETDIR=$(BINLIBDEST)/site-packages/wxPython
|
||||
|
||||
|
||||
wxc wx.cpp helpers.cpp windows.cpp events.cpp misc.cpp misc2.cpp gdi.cpp \
|
||||
##----------------------------------------------------------------------
|
||||
## To build wxPython as separate extension modules, uncomment and use
|
||||
## these variable definitions and Setup rules.
|
||||
##
|
||||
WXPYLIB = wxPyHelpers
|
||||
WXPYLIBDIR = /usr/local/lib
|
||||
HELPERLIB = lib$(WXPYLIB)$(SO)
|
||||
C_DEFINES = -DSWIG_GLOBAL -DWXP_USE_THREAD -DSEPARATE
|
||||
C_FLAGS = -I. $(WX_CONFIG_CFLAGS)
|
||||
C_LIBS = -L. -l$(WXPYLIB) $(WX_CONFIG_LIBS)
|
||||
|
||||
wxc wx.cpp windows.cpp events.cpp misc.cpp misc2.cpp gdi.cpp \
|
||||
mdi.cpp controls.cpp controls2.cpp windows2.cpp cmndlgs.cpp \
|
||||
frames.cpp stattool.cpp windows3.cpp image.cpp printfw.cpp \
|
||||
utils.cpp \
|
||||
## comment out the next line to disable wxGLCanvas
|
||||
_glcanvas.cpp glcanvas.cpp -DWITH_GLCANVAS -lGL -lGLU \
|
||||
-I. $(WX_CONFIG_CFLAGS) -I/usr/local/lib/glib/include \
|
||||
-DSWIG_GLOBAL -DWXP_USE_THREAD $(SEPARATE) -Xlinker $(WX_CONFIG_LIBS)
|
||||
$(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
|
||||
|
||||
utilsc utils.cpp \
|
||||
$(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
|
||||
|
||||
glcanvasc _glcanvas.cpp glcanvas.cpp -DWITH_GLCANVAS -lMesaGL -lMesaGLU \
|
||||
$(C_DEFINES) $(C_FLAGS) -Xlinker $(C_LIBS)
|
||||
|
||||
|
||||
##----------------------------------------------------------------------
|
||||
## To build wxPython as one big extension module, comment out the above
|
||||
## rules and definitions, and then uncomment this single Setup rule.
|
||||
##
|
||||
#wxc helpers.cpp libpy.c libptr.c \
|
||||
# wx.cpp windows.cpp events.cpp misc.cpp misc2.cpp gdi.cpp \
|
||||
# mdi.cpp controls.cpp controls2.cpp windows2.cpp cmndlgs.cpp \
|
||||
# frames.cpp stattool.cpp windows3.cpp image.cpp printfw.cpp \
|
||||
# utils.cpp \
|
||||
# ## comment out the next line to disable wxGLCanvas
|
||||
# _glcanvas.cpp glcanvas.cpp -DWITH_GLCANVAS -lGL -lGLU \
|
||||
# -I. $(WX_CONFIG_CFLAGS) -I/usr/local/lib/glib/include \
|
||||
# -DSWIG_GLOBAL -DWXP_USE_THREAD $(SEPARATE) -Xlinker $(WX_CONFIG_LIBS)
|
||||
|
||||
##-Xlinker -Bstatic
|
||||
|
@@ -36,11 +36,11 @@
|
||||
|
||||
|
||||
%{
|
||||
#ifdef SEPARATE
|
||||
static wxString wxPyEmptyStr("");
|
||||
static wxPoint wxPyDefaultPosition(-1, -1);
|
||||
static wxSize wxPyDefaultSize(-1, -1);
|
||||
#endif
|
||||
//#ifdef SEPARATE
|
||||
// static wxString wxPyEmptyStr("");
|
||||
// static wxPoint wxPyDefaultPosition(-1, -1);
|
||||
// static wxSize wxPyDefaultSize(-1, -1);
|
||||
//#endif
|
||||
%}
|
||||
|
||||
%pragma(python) code = "import wx"
|
||||
@@ -64,11 +64,11 @@ public:
|
||||
void SetColour(const char *colour);
|
||||
void SwapBuffers();
|
||||
|
||||
// void SetupPixelFormat();
|
||||
// void SetupPalette(const wxPalette& palette);
|
||||
// wxPalette CreateDefaultPalette();
|
||||
void SetupPixelFormat();
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
|
||||
// wxPalette* GetPalette();
|
||||
wxPalette* GetPalette();
|
||||
wxWindow* GetWindow();
|
||||
};
|
||||
|
||||
|
@@ -116,11 +116,11 @@ extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
|
||||
|
||||
static char* wxStringErrorMsg = "string type is required for parameter";
|
||||
|
||||
#ifdef SEPARATE
|
||||
static wxString wxPyEmptyStr("");
|
||||
static wxPoint wxPyDefaultPosition(-1, -1);
|
||||
static wxSize wxPyDefaultSize(-1, -1);
|
||||
#endif
|
||||
//#ifdef SEPARATE
|
||||
// static wxString wxPyEmptyStr("");
|
||||
// static wxPoint wxPyDefaultPosition(-1, -1);
|
||||
// static wxSize wxPyDefaultSize(-1, -1);
|
||||
//#endif
|
||||
static PyObject *_wrap_glArrayElementEXT(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
GLint _arg0;
|
||||
@@ -7810,6 +7810,118 @@ static PyObject *_wrap_wxGLContext_SwapBuffers(PyObject *self, PyObject *args) {
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetupPixelFormat(_swigobj) (_swigobj->SetupPixelFormat())
|
||||
static PyObject *_wrap_wxGLContext_SetupPixelFormat(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
char * _argc0 = 0;
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTuple(args,"s:wxGLContext_SetupPixelFormat",&_argc0))
|
||||
return NULL;
|
||||
if (_argc0) {
|
||||
if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetupPixelFormat. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
wxGLContext_SetupPixelFormat(_arg0);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_SetupPalette(_swigobj,_swigarg0) (_swigobj->SetupPalette(_swigarg0))
|
||||
static PyObject *_wrap_wxGLContext_SetupPalette(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
wxGLContext * _arg0;
|
||||
wxPalette * _arg1;
|
||||
char * _argc0 = 0;
|
||||
char * _argc1 = 0;
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTuple(args,"ss:wxGLContext_SetupPalette",&_argc0,&_argc1))
|
||||
return NULL;
|
||||
if (_argc0) {
|
||||
if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_SetupPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_argc1) {
|
||||
if (SWIG_GetPtr(_argc1,(void **) &_arg1,"_wxPalette_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGLContext_SetupPalette. Expected _wxPalette_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
wxGLContext_SetupPalette(_arg0,*_arg1);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_CreateDefaultPalette(_swigobj) (_swigobj->CreateDefaultPalette())
|
||||
static PyObject *_wrap_wxGLContext_CreateDefaultPalette(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLContext * _arg0;
|
||||
char * _argc0 = 0;
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTuple(args,"s:wxGLContext_CreateDefaultPalette",&_argc0))
|
||||
return NULL;
|
||||
if (_argc0) {
|
||||
if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_CreateDefaultPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = new wxPalette (wxGLContext_CreateDefaultPalette(_arg0));
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetPalette(_swigobj) (_swigobj->GetPalette())
|
||||
static PyObject *_wrap_wxGLContext_GetPalette(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
wxPalette * _result;
|
||||
wxGLContext * _arg0;
|
||||
char * _argc0 = 0;
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTuple(args,"s:wxGLContext_GetPalette",&_argc0))
|
||||
return NULL;
|
||||
if (_argc0) {
|
||||
if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxGLContext_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGLContext_GetPalette. Expected _wxGLContext_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = (wxPalette *)wxGLContext_GetPalette(_arg0);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} SWIG_MakePtr(_ptemp, (char *) _result,"_wxPalette_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxGLContext_GetWindow(_swigobj) (_swigobj->GetWindow())
|
||||
static PyObject *_wrap_wxGLContext_GetWindow(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
@@ -8041,6 +8153,10 @@ static PyMethodDef glcanvascMethods[] = {
|
||||
{ "wxGLCanvas_SetCurrent", _wrap_wxGLCanvas_SetCurrent, 1 },
|
||||
{ "new_wxGLCanvas", _wrap_new_wxGLCanvas, 1 },
|
||||
{ "wxGLContext_GetWindow", _wrap_wxGLContext_GetWindow, 1 },
|
||||
{ "wxGLContext_GetPalette", _wrap_wxGLContext_GetPalette, 1 },
|
||||
{ "wxGLContext_CreateDefaultPalette", _wrap_wxGLContext_CreateDefaultPalette, 1 },
|
||||
{ "wxGLContext_SetupPalette", _wrap_wxGLContext_SetupPalette, 1 },
|
||||
{ "wxGLContext_SetupPixelFormat", _wrap_wxGLContext_SetupPixelFormat, 1 },
|
||||
{ "wxGLContext_SwapBuffers", _wrap_wxGLContext_SwapBuffers, 1 },
|
||||
{ "wxGLContext_SetColour", _wrap_wxGLContext_SetColour, 1 },
|
||||
{ "wxGLContext_SetCurrent", _wrap_wxGLContext_SetCurrent, 1 },
|
||||
|
@@ -47,6 +47,21 @@ class wxGLContextPtr :
|
||||
def SwapBuffers(self):
|
||||
val = glcanvasc.wxGLContext_SwapBuffers(self.this)
|
||||
return val
|
||||
def SetupPixelFormat(self):
|
||||
val = glcanvasc.wxGLContext_SetupPixelFormat(self.this)
|
||||
return val
|
||||
def SetupPalette(self,arg0):
|
||||
val = glcanvasc.wxGLContext_SetupPalette(self.this,arg0.this)
|
||||
return val
|
||||
def CreateDefaultPalette(self):
|
||||
val = glcanvasc.wxGLContext_CreateDefaultPalette(self.this)
|
||||
val = wxPalettePtr(val)
|
||||
val.thisown = 1
|
||||
return val
|
||||
def GetPalette(self):
|
||||
val = glcanvasc.wxGLContext_GetPalette(self.this)
|
||||
val = wxPalettePtr(val)
|
||||
return val
|
||||
def GetWindow(self):
|
||||
val = glcanvasc.wxGLContext_GetWindow(self.this)
|
||||
val = wxWindowPtr(val)
|
||||
|
@@ -21,73 +21,6 @@
|
||||
#define SWIGPYTHON
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/***********************************************************************
|
||||
* $Header$
|
||||
* swig_lib/python/python.cfg
|
||||
*
|
||||
* This file contains coded needed to add variable linking to the
|
||||
* Python interpreter. C variables are added as a new kind of Python
|
||||
* datatype.
|
||||
*
|
||||
* Also contains supporting code for building python under Windows
|
||||
* and things like that.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.15 1999/07/31 07:55:17 RD
|
||||
* wxPython 2.1b1:
|
||||
*
|
||||
* Added the missing wxWindow.GetUpdateRegion() method.
|
||||
*
|
||||
* Made a new change in SWIG (update your patches everybody) that
|
||||
* provides a fix for global shadow objects that get an exception in
|
||||
* their __del__ when their extension module has already been deleted.
|
||||
* It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about
|
||||
* line 496 if you want to do it by hand.
|
||||
*
|
||||
* It is now possible to run through MainLoop more than once in any one
|
||||
* process. The cleanup that used to happen as MainLoop completed (and
|
||||
* prevented it from running again) has been delayed until the wxc module
|
||||
* is being unloaded by Python.
|
||||
*
|
||||
* wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added
|
||||
* wxWindow.PopupMenuXY to be consistent with some other methods.
|
||||
*
|
||||
* Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace.
|
||||
*
|
||||
* You can now provide your own app.MainLoop method. See
|
||||
* wxPython/demo/demoMainLoop.py for an example and some explaination.
|
||||
*
|
||||
* Got the in-place-edit for the wxTreeCtrl fixed and added some demo
|
||||
* code to show how to use it.
|
||||
*
|
||||
* Put the wxIcon constructor back in for GTK as it now has one that
|
||||
* matches MSW's.
|
||||
*
|
||||
* Added wxGrid.GetCells
|
||||
*
|
||||
* Added wxSystemSettings static methods as functions with names like
|
||||
* wxSystemSettings_GetSystemColour.
|
||||
*
|
||||
* Removed wxPyMenu since using menu callbacks have been depreciated in
|
||||
* wxWindows. Use wxMenu and events instead.
|
||||
*
|
||||
* Added alternate wxBitmap constructor (for MSW only) as
|
||||
* wxBitmapFromData(data, type, width, height, depth = 1)
|
||||
*
|
||||
* Added a helper function named wxPyTypeCast that can convert shadow
|
||||
* objects of one type into shadow objects of another type. (Like doing
|
||||
* a down-cast.) See the implementation in wx.py for some docs.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "Python.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
@@ -103,496 +36,18 @@ extern "C" {
|
||||
# define SWIGEXPORT(a,b) a b
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#ifdef __cplusplus
|
||||
#define SWIGSTATIC extern "C"
|
||||
#else
|
||||
#define SWIGSTATIC
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGSTATIC
|
||||
#define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
PyObject *(*get_attr)(void);
|
||||
int (*set_attr)(PyObject *);
|
||||
} swig_globalvar;
|
||||
|
||||
typedef struct swig_varlinkobject {
|
||||
PyObject_HEAD
|
||||
swig_globalvar **vars;
|
||||
int nvars;
|
||||
int maxvars;
|
||||
} swig_varlinkobject;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
swig_varlink_repr()
|
||||
|
||||
Function for python repr method
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
static PyObject *
|
||||
swig_varlink_repr(swig_varlinkobject *v)
|
||||
{
|
||||
v = v;
|
||||
return PyString_FromString("<Global variables>");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
swig_varlink_print()
|
||||
|
||||
Print out all of the global variable names
|
||||
--------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags)
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
flags = flags;
|
||||
fprintf(fp,"Global variables { ");
|
||||
while (v->vars[i]) {
|
||||
fprintf(fp,"%s", v->vars[i]->name);
|
||||
i++;
|
||||
if (v->vars[i]) fprintf(fp,", ");
|
||||
}
|
||||
fprintf(fp," }\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
swig_varlink_getattr
|
||||
|
||||
This function gets the value of a variable and returns it as a
|
||||
PyObject. In our case, we'll be looking at the datatype and
|
||||
converting into a number or string
|
||||
-------------------------------------------------------------------- */
|
||||
|
||||
static PyObject *
|
||||
swig_varlink_getattr(swig_varlinkobject *v, char *n)
|
||||
{
|
||||
int i = 0;
|
||||
char temp[128];
|
||||
|
||||
while (v->vars[i]) {
|
||||
if (strcmp(v->vars[i]->name,n) == 0) {
|
||||
return (*v->vars[i]->get_attr)();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
sprintf(temp,"C global variable %s not found.", n);
|
||||
PyErr_SetString(PyExc_NameError,temp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
swig_varlink_setattr()
|
||||
|
||||
This function sets the value of a variable.
|
||||
------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
|
||||
{
|
||||
char temp[128];
|
||||
int i = 0;
|
||||
while (v->vars[i]) {
|
||||
if (strcmp(v->vars[i]->name,n) == 0) {
|
||||
return (*v->vars[i]->set_attr)(p);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
sprintf(temp,"C global variable %s not found.", n);
|
||||
PyErr_SetString(PyExc_NameError,temp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
statichere PyTypeObject varlinktype = {
|
||||
/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"varlink", /* Type name */
|
||||
sizeof(swig_varlinkobject), /* Basic size */
|
||||
0, /* Itemsize */
|
||||
0, /* Deallocator */
|
||||
(printfunc) swig_varlink_print, /* Print */
|
||||
(getattrfunc) swig_varlink_getattr, /* get attr */
|
||||
(setattrfunc) swig_varlink_setattr, /* Set attr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc) swig_varlink_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_mapping*/
|
||||
0, /* tp_hash */
|
||||
};
|
||||
|
||||
/* Create a variable linking object for use later */
|
||||
|
||||
SWIGSTATIC PyObject *
|
||||
SWIG_newvarlink(void)
|
||||
{
|
||||
swig_varlinkobject *result = 0;
|
||||
result = PyMem_NEW(swig_varlinkobject,1);
|
||||
varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
|
||||
result->ob_type = &varlinktype;
|
||||
/* _Py_NewReference(result); Does not seem to be necessary */
|
||||
result->nvars = 0;
|
||||
result->maxvars = 64;
|
||||
result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *));
|
||||
result->vars[0] = 0;
|
||||
result->ob_refcnt = 0;
|
||||
Py_XINCREF((PyObject *) result);
|
||||
return ((PyObject*) result);
|
||||
}
|
||||
|
||||
SWIGSTATIC void
|
||||
SWIG_addvarlink(PyObject *p, char *name,
|
||||
PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p))
|
||||
{
|
||||
swig_varlinkobject *v;
|
||||
v= (swig_varlinkobject *) p;
|
||||
|
||||
if (v->nvars >= v->maxvars -1) {
|
||||
v->maxvars = 2*v->maxvars;
|
||||
v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
|
||||
if (v->vars == NULL) {
|
||||
fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar));
|
||||
v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1);
|
||||
strcpy(v->vars[v->nvars]->name,name);
|
||||
v->vars[v->nvars]->get_attr = get_attr;
|
||||
v->vars[v->nvars]->set_attr = set_attr;
|
||||
v->nvars++;
|
||||
v->vars[v->nvars] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* swigptr.swg
|
||||
*
|
||||
* This file contains supporting code for the SWIG run-time type checking
|
||||
* mechanism. The following functions are available :
|
||||
*
|
||||
* SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *));
|
||||
*
|
||||
* Registers a new type-mapping with the type-checker. origtype is the
|
||||
* original datatype and newtype is an equivalent type. cast is optional
|
||||
* pointer to a function to cast pointer values between types (this
|
||||
* is typically used to cast pointers from derived classes to base classes in C++)
|
||||
*
|
||||
* SWIG_MakePtr(char *buffer, void *ptr, char *typestring);
|
||||
*
|
||||
* Makes a pointer string from a pointer and typestring. The result is returned
|
||||
* in buffer which is assumed to hold enough space for the result.
|
||||
*
|
||||
* char * SWIG_GetPtr(char *buffer, void **ptr, char *type)
|
||||
*
|
||||
* Gets a pointer value from a string. If there is a type-mismatch, returns
|
||||
* a character string to the received type. On success, returns NULL.
|
||||
*
|
||||
*
|
||||
* You can remap these functions by making a file called "swigptr.swg" in
|
||||
* your the same directory as the interface file you are wrapping.
|
||||
*
|
||||
* These functions are normally declared static, but this file can be
|
||||
* can be used in a multi-module environment by redefining the symbol
|
||||
* SWIGSTATIC.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#include "Python.h"
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
#define SWIGSTATIC extern "C"
|
||||
#else
|
||||
#define SWIGSTATIC
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGSTATIC
|
||||
#define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
|
||||
/* SWIG pointer structure */
|
||||
|
||||
typedef struct SwigPtrType {
|
||||
char *name; /* Datatype name */
|
||||
int len; /* Length (used for optimization) */
|
||||
void *(*cast)(void *); /* Pointer casting function */
|
||||
struct SwigPtrType *next; /* Linked list pointer */
|
||||
} SwigPtrType;
|
||||
|
||||
/* Pointer cache structure */
|
||||
|
||||
typedef struct {
|
||||
int stat; /* Status (valid) bit */
|
||||
SwigPtrType *tp; /* Pointer to type structure */
|
||||
char name[256]; /* Given datatype name */
|
||||
char mapped[256]; /* Equivalent name */
|
||||
} SwigCacheType;
|
||||
|
||||
/* Some variables */
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
/* This value may be adjusted dynamically */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static int SwigStart[256]; /* Starting positions of types */
|
||||
|
||||
/* Pointer table */
|
||||
static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
|
||||
|
||||
/* Cached values */
|
||||
|
||||
#define SWIG_CACHESIZE 8
|
||||
#define SWIG_CACHEMASK 0x7
|
||||
static SwigCacheType SwigCache[SWIG_CACHESIZE];
|
||||
static int SwigCacheIndex = 0;
|
||||
static int SwigLastCache = 0;
|
||||
|
||||
/* Sort comparison function */
|
||||
static int swigsort(const void *data1, const void *data2) {
|
||||
SwigPtrType *d1 = (SwigPtrType *) data1;
|
||||
SwigPtrType *d2 = (SwigPtrType *) data2;
|
||||
return strcmp(d1->name,d2->name);
|
||||
}
|
||||
|
||||
/* Binary Search function */
|
||||
static int swigcmp(const void *key, const void *data) {
|
||||
char *k = (char *) key;
|
||||
SwigPtrType *d = (SwigPtrType *) data;
|
||||
return strncmp(k,d->name,d->len);
|
||||
}
|
||||
|
||||
/* Register a new datatype with the type-checker */
|
||||
|
||||
SWIGSTATIC
|
||||
void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
|
||||
int i;
|
||||
SwigPtrType *t = 0,*t1;
|
||||
|
||||
/* Allocate the pointer table if necessary */
|
||||
|
||||
if (!SwigPtrTable) {
|
||||
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
/* Grow the table */
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
|
||||
}
|
||||
for (i = 0; i < SwigPtrN; i++)
|
||||
if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
|
||||
t = &SwigPtrTable[i];
|
||||
break;
|
||||
}
|
||||
if (!t) {
|
||||
t = &SwigPtrTable[SwigPtrN];
|
||||
t->name = origtype;
|
||||
t->len = strlen(t->name);
|
||||
t->cast = 0;
|
||||
t->next = 0;
|
||||
SwigPtrN++;
|
||||
}
|
||||
|
||||
/* Check for existing entry */
|
||||
|
||||
while (t->next) {
|
||||
if ((strcmp(t->name,newtype) == 0)) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
|
||||
/* Now place entry (in sorted order) */
|
||||
|
||||
t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
|
||||
t1->name = newtype;
|
||||
t1->len = strlen(t1->name);
|
||||
t1->cast = cast;
|
||||
t1->next = 0;
|
||||
t->next = t1;
|
||||
SwigPtrSort = 0;
|
||||
}
|
||||
|
||||
/* Make a pointer value string */
|
||||
|
||||
SWIGSTATIC
|
||||
void SWIG_MakePtr(char *_c, const void *_ptr, char *type) {
|
||||
static char _hex[16] =
|
||||
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
unsigned long _p, _s;
|
||||
char _result[20], *_r; /* Note : a 64-bit hex number = 16 digits */
|
||||
_r = _result;
|
||||
_p = (unsigned long) _ptr;
|
||||
if (_p > 0) {
|
||||
while (_p > 0) {
|
||||
_s = _p & 0xf;
|
||||
*(_r++) = _hex[_s];
|
||||
_p = _p >> 4;
|
||||
}
|
||||
*_r = '_';
|
||||
while (_r >= _result)
|
||||
*(_c++) = *(_r--);
|
||||
} else {
|
||||
strcpy (_c, "NULL");
|
||||
}
|
||||
if (_ptr)
|
||||
strcpy (_c, type);
|
||||
}
|
||||
|
||||
/* Define for backwards compatibility */
|
||||
|
||||
#define _swig_make_hex SWIG_MakePtr
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
SWIGSTATIC
|
||||
char *SWIG_GetPtr(char *_c, void **ptr, char *_t)
|
||||
{
|
||||
unsigned long _p;
|
||||
char temp_type[256];
|
||||
char *name;
|
||||
int i, len;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
int start, end;
|
||||
_p = 0;
|
||||
|
||||
/* Pointer values must start with leading underscore */
|
||||
if (*_c == '_') {
|
||||
_c++;
|
||||
/* Extract hex value from pointer */
|
||||
while (*_c) {
|
||||
if ((*_c >= '0') && (*_c <= '9'))
|
||||
_p = (_p << 4) + (*_c - '0');
|
||||
else if ((*_c >= 'a') && (*_c <= 'f'))
|
||||
_p = (_p << 4) + ((*_c - 'a') + 10);
|
||||
else
|
||||
break;
|
||||
_c++;
|
||||
}
|
||||
|
||||
if (_t) {
|
||||
if (strcmp(_t,_c)) {
|
||||
if (!SwigPtrSort) {
|
||||
qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
|
||||
for (i = 0; i < 256; i++) {
|
||||
SwigStart[i] = SwigPtrN;
|
||||
}
|
||||
for (i = SwigPtrN-1; i >= 0; i--) {
|
||||
SwigStart[(int) (SwigPtrTable[i].name[1])] = i;
|
||||
}
|
||||
for (i = 255; i >= 1; i--) {
|
||||
if (SwigStart[i-1] > SwigStart[i])
|
||||
SwigStart[i-1] = SwigStart[i];
|
||||
}
|
||||
SwigPtrSort = 1;
|
||||
for (i = 0; i < SWIG_CACHESIZE; i++)
|
||||
SwigCache[i].stat = 0;
|
||||
}
|
||||
|
||||
/* First check cache for matches. Uses last cache value as starting point */
|
||||
cache = &SwigCache[SwigLastCache];
|
||||
for (i = 0; i < SWIG_CACHESIZE; i++) {
|
||||
if (cache->stat) {
|
||||
if (strcmp(_t,cache->name) == 0) {
|
||||
if (strcmp(_c,cache->mapped) == 0) {
|
||||
cache->stat++;
|
||||
*ptr = (void *) _p;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
/* We have a type mismatch. Will have to look through our type
|
||||
mapping table to figure out whether or not we can accept this datatype */
|
||||
|
||||
start = SwigStart[(int) _t[1]];
|
||||
end = SwigStart[(int) _t[1]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
while (start < end) {
|
||||
if (swigcmp(_t,sp) == 0) break;
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
if (start >= end) sp = 0;
|
||||
/* Try to find a match for this */
|
||||
if (sp) {
|
||||
while (swigcmp(_t,sp) == 0) {
|
||||
name = sp->name;
|
||||
len = sp->len;
|
||||
tp = sp->next;
|
||||
/* Try to find entry for our given datatype */
|
||||
while(tp) {
|
||||
if (tp->len >= 255) {
|
||||
return _c;
|
||||
}
|
||||
strcpy(temp_type,tp->name);
|
||||
strncat(temp_type,_t+len,255-tp->len);
|
||||
if (strcmp(_c,temp_type) == 0) {
|
||||
|
||||
strcpy(SwigCache[SwigCacheIndex].mapped,_c);
|
||||
strcpy(SwigCache[SwigCacheIndex].name,_t);
|
||||
SwigCache[SwigCacheIndex].stat = 1;
|
||||
SwigCache[SwigCacheIndex].tp = tp;
|
||||
SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
|
||||
|
||||
/* Get pointer value */
|
||||
*ptr = (void *) _p;
|
||||
if (tp->cast) *ptr = (*(tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
tp = tp->next;
|
||||
}
|
||||
sp++;
|
||||
/* Hmmm. Didn't find it this time */
|
||||
}
|
||||
}
|
||||
/* Didn't find any sort of match for this data.
|
||||
Get the pointer value and return the received type */
|
||||
*ptr = (void *) _p;
|
||||
return _c;
|
||||
} else {
|
||||
/* Found a match on the first try. Return pointer value */
|
||||
*ptr = (void *) _p;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else {
|
||||
/* No type specified. Good luck */
|
||||
*ptr = (void *) _p;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else {
|
||||
if (strcmp (_c, "NULL") == 0) {
|
||||
*ptr = (void *) 0;
|
||||
return (char *) 0;
|
||||
}
|
||||
*ptr = (void *) 0;
|
||||
return _c;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compatibility mode */
|
||||
|
||||
#define _swig_get_hex SWIG_GetPtr
|
||||
|
||||
#define SWIG_init initwxc
|
||||
|
||||
@@ -1996,6 +1451,34 @@ static PyObject *_wrap_wxPyApp_SetVendorName(PyObject *self, PyObject *args) {
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxPyApp_GetStdIcon(_swigobj,_swigarg0) (_swigobj->GetStdIcon(_swigarg0))
|
||||
static PyObject *_wrap_wxPyApp_GetStdIcon(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
wxIcon * _result;
|
||||
wxPyApp * _arg0;
|
||||
int _arg1;
|
||||
char * _argc0 = 0;
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTuple(args,"si:wxPyApp_GetStdIcon",&_argc0,&_arg1))
|
||||
return NULL;
|
||||
if (_argc0) {
|
||||
if (SWIG_GetPtr(_argc0,(void **) &_arg0,"_wxPyApp_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyApp_GetStdIcon. Expected _wxPyApp_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = new wxIcon (wxPyApp_GetStdIcon(_arg0,_arg1));
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxIcon_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new___wxPyCleanup() (new __wxPyCleanup())
|
||||
static PyObject *_wrap_new___wxPyCleanup(PyObject *self, PyObject *args) {
|
||||
PyObject * _resultobj;
|
||||
@@ -2043,6 +1526,7 @@ static PyObject *_wrap_delete___wxPyCleanup(PyObject *self, PyObject *args) {
|
||||
static PyMethodDef wxcMethods[] = {
|
||||
{ "delete___wxPyCleanup", _wrap_delete___wxPyCleanup, 1 },
|
||||
{ "new___wxPyCleanup", _wrap_new___wxPyCleanup, 1 },
|
||||
{ "wxPyApp_GetStdIcon", _wrap_wxPyApp_GetStdIcon, 1 },
|
||||
{ "wxPyApp_SetVendorName", _wrap_wxPyApp_SetVendorName, 1 },
|
||||
{ "wxPyApp_SetTopWindow", _wrap_wxPyApp_SetTopWindow, 1 },
|
||||
{ "wxPyApp_SetPrintMode", _wrap_wxPyApp_SetPrintMode, 1 },
|
||||
|
@@ -92,6 +92,11 @@ class wxPyAppPtr(wxEvtHandlerPtr):
|
||||
def SetVendorName(self,arg0):
|
||||
val = wxc.wxPyApp_SetVendorName(self.this,arg0)
|
||||
return val
|
||||
def GetStdIcon(self,arg0):
|
||||
val = wxc.wxPyApp_GetStdIcon(self.this,arg0)
|
||||
val = wxIconPtr(val)
|
||||
val.thisown = 1
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxPyApp instance>"
|
||||
class wxPyApp(wxPyAppPtr):
|
||||
|
321
utils/wxPython/src/libptr.c
Normal file
321
utils/wxPython/src/libptr.c
Normal file
@@ -0,0 +1,321 @@
|
||||
/*****************************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* swigptr.swg
|
||||
*
|
||||
* This file contains supporting code for the SWIG run-time type checking
|
||||
* mechanism. The following functions are available :
|
||||
*
|
||||
* SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *));
|
||||
*
|
||||
* Registers a new type-mapping with the type-checker. origtype is the
|
||||
* original datatype and newtype is an equivalent type. cast is optional
|
||||
* pointer to a function to cast pointer values between types (this
|
||||
* is typically used to cast pointers from derived classes to base classes in C++)
|
||||
*
|
||||
* SWIG_MakePtr(char *buffer, void *ptr, char *typestring);
|
||||
*
|
||||
* Makes a pointer string from a pointer and typestring. The result is returned
|
||||
* in buffer which is assumed to hold enough space for the result.
|
||||
*
|
||||
* char * SWIG_GetPtr(char *buffer, void **ptr, char *type)
|
||||
*
|
||||
* Gets a pointer value from a string. If there is a type-mismatch, returns
|
||||
* a character string to the received type. On success, returns NULL.
|
||||
*
|
||||
*
|
||||
* You can remap these functions by making a file called "swigptr.swg" in
|
||||
* your the same directory as the interface file you are wrapping.
|
||||
*
|
||||
* These functions are normally declared static, but this file can be
|
||||
* can be used in a multi-module environment by redefining the symbol
|
||||
* SWIGSTATIC.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#ifdef __cplusplus
|
||||
#define SWIGSTATIC extern "C"
|
||||
#else
|
||||
#define SWIGSTATIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGSTATIC
|
||||
#define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
|
||||
/* SWIG pointer structure */
|
||||
|
||||
typedef struct SwigPtrType {
|
||||
char *name; /* Datatype name */
|
||||
int len; /* Length (used for optimization) */
|
||||
void *(*cast)(void *); /* Pointer casting function */
|
||||
struct SwigPtrType *next; /* Linked list pointer */
|
||||
} SwigPtrType;
|
||||
|
||||
/* Pointer cache structure */
|
||||
|
||||
typedef struct {
|
||||
int stat; /* Status (valid) bit */
|
||||
SwigPtrType *tp; /* Pointer to type structure */
|
||||
char name[256]; /* Given datatype name */
|
||||
char mapped[256]; /* Equivalent name */
|
||||
} SwigCacheType;
|
||||
|
||||
/* Some variables */
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
/* This value may be adjusted dynamically */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static int SwigStart[256]; /* Starting positions of types */
|
||||
|
||||
/* Pointer table */
|
||||
static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
|
||||
|
||||
/* Cached values */
|
||||
|
||||
#define SWIG_CACHESIZE 8
|
||||
#define SWIG_CACHEMASK 0x7
|
||||
static SwigCacheType SwigCache[SWIG_CACHESIZE];
|
||||
static int SwigCacheIndex = 0;
|
||||
static int SwigLastCache = 0;
|
||||
|
||||
/* Sort comparison function */
|
||||
static int swigsort(const void *data1, const void *data2) {
|
||||
SwigPtrType *d1 = (SwigPtrType *) data1;
|
||||
SwigPtrType *d2 = (SwigPtrType *) data2;
|
||||
return strcmp(d1->name,d2->name);
|
||||
}
|
||||
|
||||
/* Binary Search function */
|
||||
static int swigcmp(const void *key, const void *data) {
|
||||
char *k = (char *) key;
|
||||
SwigPtrType *d = (SwigPtrType *) data;
|
||||
return strncmp(k,d->name,d->len);
|
||||
}
|
||||
|
||||
/* Register a new datatype with the type-checker */
|
||||
|
||||
SWIGSTATIC
|
||||
void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
|
||||
int i;
|
||||
SwigPtrType *t = 0,*t1;
|
||||
|
||||
/* Allocate the pointer table if necessary */
|
||||
|
||||
if (!SwigPtrTable) {
|
||||
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
/* Grow the table */
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
|
||||
}
|
||||
for (i = 0; i < SwigPtrN; i++)
|
||||
if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
|
||||
t = &SwigPtrTable[i];
|
||||
break;
|
||||
}
|
||||
if (!t) {
|
||||
t = &SwigPtrTable[SwigPtrN];
|
||||
t->name = origtype;
|
||||
t->len = strlen(t->name);
|
||||
t->cast = 0;
|
||||
t->next = 0;
|
||||
SwigPtrN++;
|
||||
}
|
||||
|
||||
/* Check for existing entry */
|
||||
|
||||
while (t->next) {
|
||||
if ((strcmp(t->name,newtype) == 0)) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
|
||||
/* Now place entry (in sorted order) */
|
||||
|
||||
t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
|
||||
t1->name = newtype;
|
||||
t1->len = strlen(t1->name);
|
||||
t1->cast = cast;
|
||||
t1->next = 0;
|
||||
t->next = t1;
|
||||
SwigPtrSort = 0;
|
||||
}
|
||||
|
||||
/* Make a pointer value string */
|
||||
|
||||
SWIGSTATIC
|
||||
void SWIG_MakePtr(char *_c, const void *_ptr, char *type) {
|
||||
static char _hex[16] =
|
||||
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
unsigned long _p, _s;
|
||||
char _result[20], *_r; /* Note : a 64-bit hex number = 16 digits */
|
||||
_r = _result;
|
||||
_p = (unsigned long) _ptr;
|
||||
if (_p > 0) {
|
||||
while (_p > 0) {
|
||||
_s = _p & 0xf;
|
||||
*(_r++) = _hex[_s];
|
||||
_p = _p >> 4;
|
||||
}
|
||||
*_r = '_';
|
||||
while (_r >= _result)
|
||||
*(_c++) = *(_r--);
|
||||
} else {
|
||||
strcpy (_c, "NULL");
|
||||
}
|
||||
if (_ptr)
|
||||
strcpy (_c, type);
|
||||
}
|
||||
|
||||
/* Define for backwards compatibility */
|
||||
|
||||
#define _swig_make_hex SWIG_MakePtr
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
SWIGSTATIC
|
||||
char *SWIG_GetPtr(char *_c, void **ptr, char *_t)
|
||||
{
|
||||
unsigned long _p;
|
||||
char temp_type[256];
|
||||
char *name;
|
||||
int i, len;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
int start, end;
|
||||
_p = 0;
|
||||
|
||||
/* Pointer values must start with leading underscore */
|
||||
if (*_c == '_') {
|
||||
_c++;
|
||||
/* Extract hex value from pointer */
|
||||
while (*_c) {
|
||||
if ((*_c >= '0') && (*_c <= '9'))
|
||||
_p = (_p << 4) + (*_c - '0');
|
||||
else if ((*_c >= 'a') && (*_c <= 'f'))
|
||||
_p = (_p << 4) + ((*_c - 'a') + 10);
|
||||
else
|
||||
break;
|
||||
_c++;
|
||||
}
|
||||
|
||||
if (_t) {
|
||||
if (strcmp(_t,_c)) {
|
||||
if (!SwigPtrSort) {
|
||||
qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
|
||||
for (i = 0; i < 256; i++) {
|
||||
SwigStart[i] = SwigPtrN;
|
||||
}
|
||||
for (i = SwigPtrN-1; i >= 0; i--) {
|
||||
SwigStart[(int) (SwigPtrTable[i].name[1])] = i;
|
||||
}
|
||||
for (i = 255; i >= 1; i--) {
|
||||
if (SwigStart[i-1] > SwigStart[i])
|
||||
SwigStart[i-1] = SwigStart[i];
|
||||
}
|
||||
SwigPtrSort = 1;
|
||||
for (i = 0; i < SWIG_CACHESIZE; i++)
|
||||
SwigCache[i].stat = 0;
|
||||
}
|
||||
|
||||
/* First check cache for matches. Uses last cache value as starting point */
|
||||
cache = &SwigCache[SwigLastCache];
|
||||
for (i = 0; i < SWIG_CACHESIZE; i++) {
|
||||
if (cache->stat) {
|
||||
if (strcmp(_t,cache->name) == 0) {
|
||||
if (strcmp(_c,cache->mapped) == 0) {
|
||||
cache->stat++;
|
||||
*ptr = (void *) _p;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
/* We have a type mismatch. Will have to look through our type
|
||||
mapping table to figure out whether or not we can accept this datatype */
|
||||
|
||||
start = SwigStart[(int) _t[1]];
|
||||
end = SwigStart[(int) _t[1]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
while (start < end) {
|
||||
if (swigcmp(_t,sp) == 0) break;
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
if (start >= end) sp = 0;
|
||||
/* Try to find a match for this */
|
||||
if (sp) {
|
||||
while (swigcmp(_t,sp) == 0) {
|
||||
name = sp->name;
|
||||
len = sp->len;
|
||||
tp = sp->next;
|
||||
/* Try to find entry for our given datatype */
|
||||
while(tp) {
|
||||
if (tp->len >= 255) {
|
||||
return _c;
|
||||
}
|
||||
strcpy(temp_type,tp->name);
|
||||
strncat(temp_type,_t+len,255-tp->len);
|
||||
if (strcmp(_c,temp_type) == 0) {
|
||||
|
||||
strcpy(SwigCache[SwigCacheIndex].mapped,_c);
|
||||
strcpy(SwigCache[SwigCacheIndex].name,_t);
|
||||
SwigCache[SwigCacheIndex].stat = 1;
|
||||
SwigCache[SwigCacheIndex].tp = tp;
|
||||
SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
|
||||
|
||||
/* Get pointer value */
|
||||
*ptr = (void *) _p;
|
||||
if (tp->cast) *ptr = (*(tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
tp = tp->next;
|
||||
}
|
||||
sp++;
|
||||
/* Hmmm. Didn't find it this time */
|
||||
}
|
||||
}
|
||||
/* Didn't find any sort of match for this data.
|
||||
Get the pointer value and return the received type */
|
||||
*ptr = (void *) _p;
|
||||
return _c;
|
||||
} else {
|
||||
/* Found a match on the first try. Return pointer value */
|
||||
*ptr = (void *) _p;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else {
|
||||
/* No type specified. Good luck */
|
||||
*ptr = (void *) _p;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else {
|
||||
if (strcmp (_c, "NULL") == 0) {
|
||||
*ptr = (void *) 0;
|
||||
return (char *) 0;
|
||||
}
|
||||
*ptr = (void *) 0;
|
||||
return _c;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compatibility mode */
|
||||
|
||||
#define _swig_get_hex SWIG_GetPtr
|
||||
|
216
utils/wxPython/src/libpy.c
Normal file
216
utils/wxPython/src/libpy.c
Normal file
@@ -0,0 +1,216 @@
|
||||
/***********************************************************************
|
||||
* $Header$
|
||||
* swig_lib/python/python.cfg
|
||||
*
|
||||
* This file contains coded needed to add variable linking to the
|
||||
* Python interpreter. C variables are added as a new kind of Python
|
||||
* datatype.
|
||||
*
|
||||
* Also contains supporting code for building python under Windows
|
||||
* and things like that.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.1 1999/08/04 05:25:58 RD
|
||||
* New Makefile/Setup files supporting multiple dynamic extension modules
|
||||
* for unix systems.
|
||||
*
|
||||
* Fixes for the wxGLCanvas demo to work around a strange bug in gtk.
|
||||
*
|
||||
* SWIG support routines now compiled separately instead of being bundled
|
||||
* in wx.cpp.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "Python.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a,b) __declspec(dllexport) a b
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a,b) a _export b
|
||||
# else
|
||||
# define SWIGEXPORT(a,b) a b
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a,b) a b
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#ifdef __cplusplus
|
||||
#define SWIGSTATIC extern "C"
|
||||
#else
|
||||
#define SWIGSTATIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGSTATIC
|
||||
#define SWIGSTATIC static
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
PyObject *(*get_attr)(void);
|
||||
int (*set_attr)(PyObject *);
|
||||
} swig_globalvar;
|
||||
|
||||
typedef struct swig_varlinkobject {
|
||||
PyObject_HEAD
|
||||
swig_globalvar **vars;
|
||||
int nvars;
|
||||
int maxvars;
|
||||
} swig_varlinkobject;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
swig_varlink_repr()
|
||||
|
||||
Function for python repr method
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
static PyObject *
|
||||
swig_varlink_repr(swig_varlinkobject *v)
|
||||
{
|
||||
v = v;
|
||||
return PyString_FromString("<Global variables>");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
swig_varlink_print()
|
||||
|
||||
Print out all of the global variable names
|
||||
--------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags)
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
flags = flags;
|
||||
fprintf(fp,"Global variables { ");
|
||||
while (v->vars[i]) {
|
||||
fprintf(fp,"%s", v->vars[i]->name);
|
||||
i++;
|
||||
if (v->vars[i]) fprintf(fp,", ");
|
||||
}
|
||||
fprintf(fp," }\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
swig_varlink_getattr
|
||||
|
||||
This function gets the value of a variable and returns it as a
|
||||
PyObject. In our case, we'll be looking at the datatype and
|
||||
converting into a number or string
|
||||
-------------------------------------------------------------------- */
|
||||
|
||||
static PyObject *
|
||||
swig_varlink_getattr(swig_varlinkobject *v, char *n)
|
||||
{
|
||||
int i = 0;
|
||||
char temp[128];
|
||||
|
||||
while (v->vars[i]) {
|
||||
if (strcmp(v->vars[i]->name,n) == 0) {
|
||||
return (*v->vars[i]->get_attr)();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
sprintf(temp,"C global variable %s not found.", n);
|
||||
PyErr_SetString(PyExc_NameError,temp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
swig_varlink_setattr()
|
||||
|
||||
This function sets the value of a variable.
|
||||
------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
|
||||
{
|
||||
char temp[128];
|
||||
int i = 0;
|
||||
while (v->vars[i]) {
|
||||
if (strcmp(v->vars[i]->name,n) == 0) {
|
||||
return (*v->vars[i]->set_attr)(p);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
sprintf(temp,"C global variable %s not found.", n);
|
||||
PyErr_SetString(PyExc_NameError,temp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
statichere PyTypeObject varlinktype = {
|
||||
/* PyObject_HEAD_INIT(&PyType_Type) Note : This doesn't work on some machines */
|
||||
PyObject_HEAD_INIT(0)
|
||||
0,
|
||||
"varlink", /* Type name */
|
||||
sizeof(swig_varlinkobject), /* Basic size */
|
||||
0, /* Itemsize */
|
||||
0, /* Deallocator */
|
||||
(printfunc) swig_varlink_print, /* Print */
|
||||
(getattrfunc) swig_varlink_getattr, /* get attr */
|
||||
(setattrfunc) swig_varlink_setattr, /* Set attr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc) swig_varlink_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_mapping*/
|
||||
0, /* tp_hash */
|
||||
};
|
||||
|
||||
/* Create a variable linking object for use later */
|
||||
|
||||
SWIGSTATIC PyObject *
|
||||
SWIG_newvarlink(void)
|
||||
{
|
||||
swig_varlinkobject *result = 0;
|
||||
result = PyMem_NEW(swig_varlinkobject,1);
|
||||
varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
|
||||
result->ob_type = &varlinktype;
|
||||
/* _Py_NewReference(result); Does not seem to be necessary */
|
||||
result->nvars = 0;
|
||||
result->maxvars = 64;
|
||||
result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *));
|
||||
result->vars[0] = 0;
|
||||
result->ob_refcnt = 0;
|
||||
Py_XINCREF((PyObject *) result);
|
||||
return ((PyObject*) result);
|
||||
}
|
||||
|
||||
SWIGSTATIC void
|
||||
SWIG_addvarlink(PyObject *p, char *name,
|
||||
PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p))
|
||||
{
|
||||
swig_varlinkobject *v;
|
||||
v= (swig_varlinkobject *) p;
|
||||
|
||||
if (v->nvars >= v->maxvars -1) {
|
||||
v->maxvars = 2*v->maxvars;
|
||||
v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
|
||||
if (v->vars == NULL) {
|
||||
fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar));
|
||||
v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1);
|
||||
strcpy(v->vars[v->nvars]->name,name);
|
||||
v->vars[v->nvars]->get_attr = get_attr;
|
||||
v->vars[v->nvars]->set_attr = set_attr;
|
||||
v->nvars++;
|
||||
v->vars[v->nvars] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user