Since I have made several changes to SWIG over the years to accomodate
special cases and other things in wxPython, and since I plan on making several more, I've decided to put the SWIG sources in wxPython's CVS instead of relying on maintaining patches. This effectivly becomes a fork of an obsolete version of SWIG, :-( but since SWIG 1.3 still doesn't have some things I rely on in 1.1, not to mention that my custom patches would all have to be redone, I felt that this is the easier road to take. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
131
wxPython/wxSWIG/Runtime/Makefile
Normal file
131
wxPython/wxSWIG/Runtime/Makefile
Normal file
@@ -0,0 +1,131 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile for producing SWIG runtime libraries.
|
||||
#
|
||||
# The SWIG runtime library consists of the pointer-type checker
|
||||
# and other support functions. Multi-file SWIG modules
|
||||
# generally link with these libraries.
|
||||
#
|
||||
# By default, the installation processs will attempt to
|
||||
# build shared libraries. If that doesn't work, a static
|
||||
# library is built instead.
|
||||
|
||||
prefix = /usr/local
|
||||
exec_prefix = ${prefix}
|
||||
CC = cc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
SO = .so
|
||||
CCSHARED =
|
||||
LDSHARED = ld -G
|
||||
DYN_LIBS = libswigtcl8$(SO) libswigtcl$(SO) libswigpl$(SO) libswigpy$(SO)
|
||||
STATIC_LIBS = libswigtcl8.a libswigtcl.a libswigpl.a libswigpy.a
|
||||
LIBS = $(STATIC_LIBS) $(DYN_LIBS)
|
||||
LIB_DIR = $(exec_prefix)/lib
|
||||
|
||||
INSTALL_DATA = ../install-sh -c -m 644
|
||||
INSTALL_SHLB = ../install-sh -c -m 555
|
||||
|
||||
all:
|
||||
@sh make.sh
|
||||
|
||||
|
||||
install:
|
||||
@echo "Installing runtime libraries"
|
||||
@for i in $(STATIC_LIBS); \
|
||||
do \
|
||||
if [ -f $$i ]; then \
|
||||
echo "Installing $$i in $(LIB_DIR)/$$i"; \
|
||||
$(INSTALL_DATA) $$i $(LIB_DIR)/$$i; \
|
||||
fi; \
|
||||
done;
|
||||
@for i in $(DYN_LIBS); \
|
||||
do \
|
||||
if [ -f $$i ]; then \
|
||||
echo "Installing $$i in $(LIB_DIR)/$$i"; \
|
||||
$(INSTALL_SHLB) $$i $(LIB_DIR)/$$i; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
|
||||
clean::
|
||||
rm -rf *.o *.a *$(SO) *.c *.swg *~ core
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Tcl runtime library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
TCL_INCLUDE = -I/usr/local/include
|
||||
TCL_LIB = -L/usr/local/lib
|
||||
|
||||
# Tcl 7.x shared
|
||||
|
||||
tcl_shared:
|
||||
../swig -tcl -co -o libtcl.c -I../swig_lib swigtcl.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_GLOBAL libtcl.c
|
||||
$(LDSHARED) libtcl.o -o libswigtcl$(SO)
|
||||
|
||||
# Tcl 7.x library
|
||||
|
||||
tcl_lib:
|
||||
../swig -tcl -co -o libtcl.c -I../swig_lib swigtcl.swg
|
||||
$(CC) -c -DSWIG_GLOBAL libtcl.c
|
||||
$(AR) cr libswigtcl.a libtcl.o
|
||||
|
||||
# Tcl 8.x shared
|
||||
|
||||
tcl8_shared:
|
||||
../swig -tcl -co -o libtcl8.c -I../swig_lib swigtcl8.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_GLOBAL $(TCL_INCLUDE) libtcl8.c
|
||||
$(LDSHARED) libtcl8.o -o libswigtcl8$(SO)
|
||||
|
||||
tcl8_lib:
|
||||
../swig -tcl -co -o libtcl8.c -I../swig_lib swigtcl8.swg
|
||||
$(CC) -c -DSWIG_GLOBAL $(TCL_INCLUDE) libtcl8.c
|
||||
$(AR) cr libswigtcl8.a libtcl8.o
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Python run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PYTHON_INCLUDE= -DHAVE_CONFIG_H -I/usr/local/include/python1.5 -I/usr/local/lib/python1.5/config
|
||||
PYTHON_LIB = /usr/local/lib/python1.5/config
|
||||
|
||||
# Python shared
|
||||
|
||||
py_shared:
|
||||
../swig -python -co -o libpy.c -I../swig_lib python.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_RUNTIME -DSWIG_GLOBAL $(PYTHON_INCLUDE) libpy.c
|
||||
$(LDSHARED) libpy.o -o libswigpy$(SO)
|
||||
|
||||
# Python library
|
||||
|
||||
py_lib:
|
||||
../swig -python -co -o libpy.c -I../swig_lib python.swg
|
||||
$(CC) -c -DSWIG_RUNTIME -DSWIG_GLOBAL $(PYTHON_INCLUDE) libpy.c
|
||||
$(AR) cr libswigpy.a libpy.o
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Perl run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PERL5_INCLUDE= -I/usr/local/lib/perl5/5.00503/sun4-solaris/CORE
|
||||
|
||||
# Perl shared
|
||||
|
||||
perl_shared:
|
||||
rm -f libperl.c libperl.swg
|
||||
../swig -perl5 -co -o libperl.swg -I../swig_lib perl5.swg
|
||||
cat perlrun.h >> libperl.c
|
||||
cat libperl.swg >> libperl.c
|
||||
$(CC) $(CCSHARED) -c -Dexplicit= -Dbool=char -DSWIG_GLOBAL $(PERL5_INCLUDE) libperl.c
|
||||
$(LDSHARED) libperl.o -o libswigpl$(SO)
|
||||
|
||||
# Perl library
|
||||
|
||||
perl_lib:
|
||||
rm -f libperl.c libperl.swg
|
||||
../swig -perl5 -co -o libperl.swg -I../swig_lib perl5.swg
|
||||
cat perlrun.h >> libperl.c
|
||||
cat libperl.swg >> libperl.c
|
||||
$(CC) -c -Dexplicit= -Dbool=char -DSWIG_GLOBAL $(PERL5_INCLUDE) libperl.c
|
||||
$(AR) cr libswigpl.a libperl.o
|
130
wxPython/wxSWIG/Runtime/Makefile.in
Normal file
130
wxPython/wxSWIG/Runtime/Makefile.in
Normal file
@@ -0,0 +1,130 @@
|
||||
# Makefile for producing SWIG runtime libraries.
|
||||
#
|
||||
# The SWIG runtime library consists of the pointer-type checker
|
||||
# and other support functions. Multi-file SWIG modules
|
||||
# generally link with these libraries.
|
||||
#
|
||||
# By default, the installation processs will attempt to
|
||||
# build shared libraries. If that doesn't work, a static
|
||||
# library is built instead.
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
SO = @SO@
|
||||
CCSHARED = @CCSHARED@
|
||||
LDSHARED = @LDSHARED@
|
||||
DYN_LIBS = libswigtcl8$(SO) libswigtcl$(SO) libswigpl$(SO) libswigpy$(SO)
|
||||
STATIC_LIBS = libswigtcl8.a libswigtcl.a libswigpl.a libswigpy.a
|
||||
LIBS = $(STATIC_LIBS) $(DYN_LIBS)
|
||||
LIB_DIR = $(exec_prefix)/lib
|
||||
|
||||
INSTALL_DATA = ../install-sh -c -m 644
|
||||
INSTALL_SHLB = ../install-sh -c -m 555
|
||||
|
||||
all:
|
||||
@sh make.sh
|
||||
|
||||
|
||||
install:
|
||||
@echo "Installing runtime libraries"
|
||||
@for i in $(STATIC_LIBS); \
|
||||
do \
|
||||
if [ -f $$i ]; then \
|
||||
echo "Installing $$i in $(LIB_DIR)/$$i"; \
|
||||
$(INSTALL_DATA) $$i $(LIB_DIR)/$$i; \
|
||||
fi; \
|
||||
done;
|
||||
@for i in $(DYN_LIBS); \
|
||||
do \
|
||||
if [ -f $$i ]; then \
|
||||
echo "Installing $$i in $(LIB_DIR)/$$i"; \
|
||||
$(INSTALL_SHLB) $$i $(LIB_DIR)/$$i; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
|
||||
clean::
|
||||
rm -rf *.o *.a *$(SO) *.c *.swg *~ core
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Tcl runtime library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
TCL_INCLUDE = @TCLINCLUDE@
|
||||
TCL_LIB = @TCLLIB@
|
||||
|
||||
# Tcl 7.x shared
|
||||
|
||||
tcl_shared:
|
||||
../swig -tcl -co -o libtcl.c -I../swig_lib swigtcl.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_GLOBAL libtcl.c
|
||||
$(LDSHARED) libtcl.o -o libswigtcl$(SO)
|
||||
|
||||
# Tcl 7.x library
|
||||
|
||||
tcl_lib:
|
||||
../swig -tcl -co -o libtcl.c -I../swig_lib swigtcl.swg
|
||||
$(CC) -c -DSWIG_GLOBAL libtcl.c
|
||||
$(AR) cr libswigtcl.a libtcl.o
|
||||
|
||||
# Tcl 8.x shared
|
||||
|
||||
tcl8_shared:
|
||||
../swig -tcl -co -o libtcl8.c -I../swig_lib swigtcl8.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_GLOBAL $(TCL_INCLUDE) libtcl8.c
|
||||
$(LDSHARED) libtcl8.o -o libswigtcl8$(SO)
|
||||
|
||||
tcl8_lib:
|
||||
../swig -tcl -co -o libtcl8.c -I../swig_lib swigtcl8.swg
|
||||
$(CC) -c -DSWIG_GLOBAL $(TCL_INCLUDE) libtcl8.c
|
||||
$(AR) cr libswigtcl8.a libtcl8.o
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Python run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PYTHON_INCLUDE= -DHAVE_CONFIG_H @PYINCLUDE@
|
||||
PYTHON_LIB = @PYLIB@
|
||||
|
||||
# Python shared
|
||||
|
||||
py_shared:
|
||||
../swig -python -co -o libpy.c -I../swig_lib python.swg
|
||||
$(CC) $(CCSHARED) -c -DSWIG_RUNTIME -DSWIG_GLOBAL $(PYTHON_INCLUDE) libpy.c
|
||||
$(LDSHARED) libpy.o -o libswigpy$(SO)
|
||||
|
||||
# Python library
|
||||
|
||||
py_lib:
|
||||
../swig -python -co -o libpy.c -I../swig_lib python.swg
|
||||
$(CC) -c -DSWIG_RUNTIME -DSWIG_GLOBAL $(PYTHON_INCLUDE) libpy.c
|
||||
$(AR) cr libswigpy.a libpy.o
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Perl run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PERL5_INCLUDE= -I@PERL5EXT@
|
||||
|
||||
# Perl shared
|
||||
|
||||
perl_shared:
|
||||
rm -f libperl.c libperl.swg
|
||||
../swig -perl5 -co -o libperl.swg -I../swig_lib perl5.swg
|
||||
cat perlrun.h >> libperl.c
|
||||
cat libperl.swg >> libperl.c
|
||||
$(CC) $(CCSHARED) -c -Dexplicit= -Dbool=char -DSWIG_GLOBAL $(PERL5_INCLUDE) libperl.c
|
||||
$(LDSHARED) libperl.o -o libswigpl$(SO)
|
||||
|
||||
# Perl library
|
||||
|
||||
perl_lib:
|
||||
rm -f libperl.c libperl.swg
|
||||
../swig -perl5 -co -o libperl.swg -I../swig_lib perl5.swg
|
||||
cat perlrun.h >> libperl.c
|
||||
cat libperl.swg >> libperl.c
|
||||
$(CC) -c -Dexplicit= -Dbool=char -DSWIG_GLOBAL $(PERL5_INCLUDE) libperl.c
|
||||
$(AR) cr libswigpl.a libperl.o
|
364
wxPython/wxSWIG/Runtime/libperl.c
Normal file
364
wxPython/wxSWIG/Runtime/libperl.c
Normal file
@@ -0,0 +1,364 @@
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
/* Definitions for compiling Perl extensions on a variety of machines */
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef PERL_OBJECT
|
||||
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
|
||||
#define MAGIC_CAST (int (CPerlObj::*)(SV *, MAGIC *))
|
||||
#define SWIGCLASS_STATIC
|
||||
#else
|
||||
#define MAGIC_PPERL
|
||||
#define MAGIC_CAST
|
||||
#define SWIGCLASS_STATIC static
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
|
||||
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
|
||||
#endif
|
||||
|
||||
/* Modifications for newer Perl 5.005 releases */
|
||||
|
||||
#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
|
||||
#ifndef PL_sv_yes
|
||||
#define PL_sv_yes sv_yes
|
||||
#endif
|
||||
#ifndef PL_sv_undef
|
||||
#define PL_sv_undef sv_undef
|
||||
#endif
|
||||
#ifndef PL_na
|
||||
#define PL_na na
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Pointer type-checking code
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
#ifndef PERL_OBJECT
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
#else
|
||||
#define SWIG_RegisterMapping(a,b,c) _SWIG_RegisterMapping(pPerl,a,b,c);
|
||||
extern void _SWIG_RegisterMapping(CPerlObj *,char *, char *, void *(*)(void *),int);
|
||||
#endif
|
||||
#ifndef PERL_OBJECT
|
||||
extern char *SWIG_GetPtr(SV *, void **, char *);
|
||||
#else
|
||||
extern char *_SWIG_GetPtr(CPerlObj *, SV *, void **, char *);
|
||||
#define SWIG_GetPtr(a,b,c) _SWIG_GetPtr(pPerl,a,b,c)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
|
||||
#else
|
||||
#define SWIGSTATICRUNTIME(a) static a
|
||||
#endif
|
||||
|
||||
/* These are internal variables. Should be static */
|
||||
|
||||
typedef struct SwigPtrType {
|
||||
char *name;
|
||||
int len;
|
||||
void *(*cast)(void *);
|
||||
struct SwigPtrType *next;
|
||||
} 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;
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
|
||||
static int SwigStart[256]; /* Table containing starting positions */
|
||||
|
||||
/* 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 */
|
||||
|
||||
#ifndef PERL_OBJECT
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
#else
|
||||
#define SWIG_RegisterMapping(a,b,c) _SWIG_RegisterMapping(pPerl, a,b,c)
|
||||
SWIGSTATICRUNTIME(void)
|
||||
_SWIG_RegisterMapping(CPerlObj *pPerl, char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
#endif
|
||||
|
||||
int i;
|
||||
SwigPtrType *t = 0, *t1;
|
||||
|
||||
if (!SwigPtrTable) {
|
||||
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrTable = (SwigPtrType *) realloc(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++;
|
||||
}
|
||||
while (t->next) {
|
||||
if (strcmp(t->name,newtype) == 0) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
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 */
|
||||
|
||||
SWIGSTATICRUNTIME(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);
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
#ifndef PERL_OBJECT
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPtr(SV *sv, void **ptr, char *_t)
|
||||
#else
|
||||
#define SWIG_GetPtr(a,b,c) _SWIG_GetPtr(pPerl,a,b,c)
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
_SWIG_GetPtr(CPerlObj *pPerl, SV *sv, void **ptr, char *_t)
|
||||
#endif
|
||||
{
|
||||
char temp_type[256];
|
||||
char *name,*_c;
|
||||
int len,i,start,end;
|
||||
IV tmp;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
|
||||
/* If magical, apply more magic */
|
||||
|
||||
if (SvGMAGICAL(sv))
|
||||
mg_get(sv);
|
||||
|
||||
/* Check to see if this is an object */
|
||||
if (sv_isobject(sv)) {
|
||||
SV *tsv = (SV*) SvRV(sv);
|
||||
if ((SvTYPE(tsv) == SVt_PVHV)) {
|
||||
MAGIC *mg;
|
||||
if (SvMAGICAL(tsv)) {
|
||||
mg = mg_find(tsv,'P');
|
||||
if (mg) {
|
||||
SV *rsv = mg->mg_obj;
|
||||
if (sv_isobject(rsv)) {
|
||||
tmp = SvIV((SV*)SvRV(rsv));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "Not a valid pointer value";
|
||||
}
|
||||
} else {
|
||||
tmp = SvIV((SV*)SvRV(sv));
|
||||
}
|
||||
if (!_t) {
|
||||
*(ptr) = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else if (! SvOK(sv)) { /* Check for undef */
|
||||
*(ptr) = (void *) 0;
|
||||
return (char *) 0;
|
||||
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
|
||||
*(ptr) = (void *) 0;
|
||||
if (!SvROK(sv))
|
||||
return (char *) 0;
|
||||
else
|
||||
return "Not a valid pointer value";
|
||||
} else { /* Don't know what it is */
|
||||
*(ptr) = (void *) 0;
|
||||
return "Not a valid pointer value";
|
||||
}
|
||||
if (_t) {
|
||||
/* Now see if the types match */
|
||||
|
||||
if (!sv_isa(sv,_t)) {
|
||||
_c = HvNAME(SvSTASH(SvRV(sv)));
|
||||
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[SwigPtrTable[i].name[0]] = 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 *) tmp;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
|
||||
start = SwigStart[_t[0]];
|
||||
end = SwigStart[_t[0]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
while (start < end) {
|
||||
if (swigcmp(_t,sp) == 0) break;
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
if (start > end) sp = 0;
|
||||
while (start <= end) {
|
||||
if (swigcmp(_t,sp) == 0) {
|
||||
name = sp->name;
|
||||
len = sp->len;
|
||||
tp = sp->next;
|
||||
while(tp) {
|
||||
if (tp->len >= 255) {
|
||||
return _c;
|
||||
}
|
||||
strcpy(temp_type,tp->name);
|
||||
strncat(temp_type,_t+len,255-tp->len);
|
||||
if (sv_isa(sv,temp_type)) {
|
||||
/* Get pointer value */
|
||||
*ptr = (void *) tmp;
|
||||
if (tp->cast) *ptr = (*(tp->cast))(*ptr);
|
||||
|
||||
strcpy(SwigCache[SwigCacheIndex].mapped,_c);
|
||||
strcpy(SwigCache[SwigCacheIndex].name,_t);
|
||||
SwigCache[SwigCacheIndex].stat = 1;
|
||||
SwigCache[SwigCacheIndex].tp = tp;
|
||||
SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
|
||||
return (char *) 0;
|
||||
}
|
||||
tp = tp->next;
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
/* Didn't find any sort of match for this data.
|
||||
Get the pointer value and return the received type */
|
||||
*ptr = (void *) tmp;
|
||||
return _c;
|
||||
} else {
|
||||
/* Found a match on the first try. Return pointer value */
|
||||
*ptr = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
*ptr = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
361
wxPython/wxSWIG/Runtime/libperl.swg
Normal file
361
wxPython/wxSWIG/Runtime/libperl.swg
Normal file
@@ -0,0 +1,361 @@
|
||||
/* Definitions for compiling Perl extensions on a variety of machines */
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef PERL_OBJECT
|
||||
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
|
||||
#define MAGIC_CAST (int (CPerlObj::*)(SV *, MAGIC *))
|
||||
#define SWIGCLASS_STATIC
|
||||
#else
|
||||
#define MAGIC_PPERL
|
||||
#define MAGIC_CAST
|
||||
#define SWIGCLASS_STATIC static
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
|
||||
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
|
||||
#endif
|
||||
|
||||
/* Modifications for newer Perl 5.005 releases */
|
||||
|
||||
#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
|
||||
#ifndef PL_sv_yes
|
||||
#define PL_sv_yes sv_yes
|
||||
#endif
|
||||
#ifndef PL_sv_undef
|
||||
#define PL_sv_undef sv_undef
|
||||
#endif
|
||||
#ifndef PL_na
|
||||
#define PL_na na
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Pointer type-checking code
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
#ifndef PERL_OBJECT
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
#else
|
||||
#define SWIG_RegisterMapping(a,b,c) _SWIG_RegisterMapping(pPerl,a,b,c);
|
||||
extern void _SWIG_RegisterMapping(CPerlObj *,char *, char *, void *(*)(void *),int);
|
||||
#endif
|
||||
#ifndef PERL_OBJECT
|
||||
extern char *SWIG_GetPtr(SV *, void **, char *);
|
||||
#else
|
||||
extern char *_SWIG_GetPtr(CPerlObj *, SV *, void **, char *);
|
||||
#define SWIG_GetPtr(a,b,c) _SWIG_GetPtr(pPerl,a,b,c)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
|
||||
#else
|
||||
#define SWIGSTATICRUNTIME(a) static a
|
||||
#endif
|
||||
|
||||
/* These are internal variables. Should be static */
|
||||
|
||||
typedef struct SwigPtrType {
|
||||
char *name;
|
||||
int len;
|
||||
void *(*cast)(void *);
|
||||
struct SwigPtrType *next;
|
||||
} 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;
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
|
||||
static int SwigStart[256]; /* Table containing starting positions */
|
||||
|
||||
/* 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 */
|
||||
|
||||
#ifndef PERL_OBJECT
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
#else
|
||||
#define SWIG_RegisterMapping(a,b,c) _SWIG_RegisterMapping(pPerl, a,b,c)
|
||||
SWIGSTATICRUNTIME(void)
|
||||
_SWIG_RegisterMapping(CPerlObj *pPerl, char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
#endif
|
||||
|
||||
int i;
|
||||
SwigPtrType *t = 0, *t1;
|
||||
|
||||
if (!SwigPtrTable) {
|
||||
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrTable = (SwigPtrType *) realloc(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++;
|
||||
}
|
||||
while (t->next) {
|
||||
if (strcmp(t->name,newtype) == 0) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
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 */
|
||||
|
||||
SWIGSTATICRUNTIME(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);
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
#ifndef PERL_OBJECT
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPtr(SV *sv, void **ptr, char *_t)
|
||||
#else
|
||||
#define SWIG_GetPtr(a,b,c) _SWIG_GetPtr(pPerl,a,b,c)
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
_SWIG_GetPtr(CPerlObj *pPerl, SV *sv, void **ptr, char *_t)
|
||||
#endif
|
||||
{
|
||||
char temp_type[256];
|
||||
char *name,*_c;
|
||||
int len,i,start,end;
|
||||
IV tmp;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
|
||||
/* If magical, apply more magic */
|
||||
|
||||
if (SvGMAGICAL(sv))
|
||||
mg_get(sv);
|
||||
|
||||
/* Check to see if this is an object */
|
||||
if (sv_isobject(sv)) {
|
||||
SV *tsv = (SV*) SvRV(sv);
|
||||
if ((SvTYPE(tsv) == SVt_PVHV)) {
|
||||
MAGIC *mg;
|
||||
if (SvMAGICAL(tsv)) {
|
||||
mg = mg_find(tsv,'P');
|
||||
if (mg) {
|
||||
SV *rsv = mg->mg_obj;
|
||||
if (sv_isobject(rsv)) {
|
||||
tmp = SvIV((SV*)SvRV(rsv));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "Not a valid pointer value";
|
||||
}
|
||||
} else {
|
||||
tmp = SvIV((SV*)SvRV(sv));
|
||||
}
|
||||
if (!_t) {
|
||||
*(ptr) = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
} else if (! SvOK(sv)) { /* Check for undef */
|
||||
*(ptr) = (void *) 0;
|
||||
return (char *) 0;
|
||||
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
|
||||
*(ptr) = (void *) 0;
|
||||
if (!SvROK(sv))
|
||||
return (char *) 0;
|
||||
else
|
||||
return "Not a valid pointer value";
|
||||
} else { /* Don't know what it is */
|
||||
*(ptr) = (void *) 0;
|
||||
return "Not a valid pointer value";
|
||||
}
|
||||
if (_t) {
|
||||
/* Now see if the types match */
|
||||
|
||||
if (!sv_isa(sv,_t)) {
|
||||
_c = HvNAME(SvSTASH(SvRV(sv)));
|
||||
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[SwigPtrTable[i].name[0]] = 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 *) tmp;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
|
||||
start = SwigStart[_t[0]];
|
||||
end = SwigStart[_t[0]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
while (start < end) {
|
||||
if (swigcmp(_t,sp) == 0) break;
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
if (start > end) sp = 0;
|
||||
while (start <= end) {
|
||||
if (swigcmp(_t,sp) == 0) {
|
||||
name = sp->name;
|
||||
len = sp->len;
|
||||
tp = sp->next;
|
||||
while(tp) {
|
||||
if (tp->len >= 255) {
|
||||
return _c;
|
||||
}
|
||||
strcpy(temp_type,tp->name);
|
||||
strncat(temp_type,_t+len,255-tp->len);
|
||||
if (sv_isa(sv,temp_type)) {
|
||||
/* Get pointer value */
|
||||
*ptr = (void *) tmp;
|
||||
if (tp->cast) *ptr = (*(tp->cast))(*ptr);
|
||||
|
||||
strcpy(SwigCache[SwigCacheIndex].mapped,_c);
|
||||
strcpy(SwigCache[SwigCacheIndex].name,_t);
|
||||
SwigCache[SwigCacheIndex].stat = 1;
|
||||
SwigCache[SwigCacheIndex].tp = tp;
|
||||
SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
|
||||
return (char *) 0;
|
||||
}
|
||||
tp = tp->next;
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
start++;
|
||||
}
|
||||
/* Didn't find any sort of match for this data.
|
||||
Get the pointer value and return the received type */
|
||||
*ptr = (void *) tmp;
|
||||
return _c;
|
||||
} else {
|
||||
/* Found a match on the first try. Return pointer value */
|
||||
*ptr = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
}
|
||||
*ptr = (void *) tmp;
|
||||
return (char *) 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
417
wxPython/wxSWIG/Runtime/libpy.c
Normal file
417
wxPython/wxSWIG/Runtime/libpy.c
Normal file
@@ -0,0 +1,417 @@
|
||||
/***********************************************************************
|
||||
* $Header$
|
||||
* swig_lib/python/python.cfg
|
||||
*
|
||||
* Contains variable linking and pointer type-checking code.
|
||||
************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
|
||||
#else
|
||||
#define SWIGSTATICRUNTIME(a) static a
|
||||
#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 */
|
||||
|
||||
SWIGSTATICRUNTIME(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);
|
||||
}
|
||||
|
||||
SWIGSTATICRUNTIME(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;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer type-checking
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* 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;
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static int SwigStart[256]; /* Starting positions of types */
|
||||
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);
|
||||
}
|
||||
|
||||
/* Register a new datatype with the type-checker */
|
||||
SWIGSTATICRUNTIME(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));
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* Check for existing entries */
|
||||
while (t->next) {
|
||||
if ((strcmp(t->name,newtype) == 0)) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
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 */
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_MakePtr(char *c, const void *ptr, char *type) {
|
||||
static char hex[17] = "0123456789abcdef";
|
||||
unsigned long p, s;
|
||||
char result[24], *r;
|
||||
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--);
|
||||
strcpy (c, type);
|
||||
} else {
|
||||
strcpy (c, "NULL");
|
||||
}
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPtr(char *c, void **ptr, char *t)
|
||||
{
|
||||
unsigned long p;
|
||||
char temp_type[256], *name;
|
||||
int i, len, start, end;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
register int d;
|
||||
|
||||
p = 0;
|
||||
/* Pointer values must start with leading underscore */
|
||||
if (*c != '_') {
|
||||
*ptr = (void *) 0;
|
||||
if (strcmp(c,"NULL") == 0) return (char *) 0;
|
||||
else c;
|
||||
}
|
||||
c++;
|
||||
/* Extract hex value from pointer */
|
||||
while (d = *c) {
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
p = (p << 4) + (d - '0');
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
p = (p << 4) + (d - ('a'-10));
|
||||
else
|
||||
break;
|
||||
c++;
|
||||
}
|
||||
*ptr = (void *) p;
|
||||
if ((!t) || (strcmp(t,c)==0)) return (char *) 0;
|
||||
|
||||
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 && (strcmp(t,cache->name) == 0) && (strcmp(c,cache->mapped) == 0)) {
|
||||
cache->stat++;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
/* Type mismatch. Look through type-mapping table */
|
||||
start = SwigStart[(int) t[1]];
|
||||
end = SwigStart[(int) t[1]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
|
||||
/* Try to find a match */
|
||||
while (start <= end) {
|
||||
if (strncmp(t,sp->name,sp->len) == 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++;
|
||||
start++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/* New object-based GetPointer function. This uses the Python abstract
|
||||
* object interface to automatically dereference the 'this' attribute
|
||||
* of shadow objects. */
|
||||
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
|
||||
PyObject *sobj = obj;
|
||||
char *str;
|
||||
if (!PyString_Check(obj)) {
|
||||
sobj = PyObject_GetAttrString(obj,"this");
|
||||
if (!sobj) return "";
|
||||
}
|
||||
str = PyString_AsString(sobj);
|
||||
return SWIG_GetPtr(str,ptr,type);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
249
wxPython/wxSWIG/Runtime/libtcl.c
Normal file
249
wxPython/wxSWIG/Runtime/libtcl.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* $Header$
|
||||
*
|
||||
* swigtcl.swg
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* swigptr.swg
|
||||
*****************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
#else
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
|
||||
#else
|
||||
#define SWIGSTATICRUNTIME(a) static a
|
||||
#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;
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static int SwigStart[256]; /* Starting positions of types */
|
||||
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);
|
||||
}
|
||||
|
||||
/* Register a new datatype with the type-checker */
|
||||
SWIGSTATICRUNTIME(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));
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* Check for existing entries */
|
||||
while (t->next) {
|
||||
if ((strcmp(t->name,newtype) == 0)) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
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 */
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_MakePtr(char *c, const void *ptr, char *type) {
|
||||
static char hex[17] = "0123456789abcdef";
|
||||
unsigned long p, s;
|
||||
char result[24], *r;
|
||||
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--);
|
||||
strcpy (c, type);
|
||||
} else {
|
||||
strcpy (c, "NULL");
|
||||
}
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPtr(char *c, void **ptr, char *t)
|
||||
{
|
||||
unsigned long p;
|
||||
char temp_type[256], *name;
|
||||
int i, len, start, end;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
register int d;
|
||||
|
||||
p = 0;
|
||||
/* Pointer values must start with leading underscore */
|
||||
if (*c != '_') {
|
||||
*ptr = (void *) 0;
|
||||
if (strcmp(c,"NULL") == 0) return (char *) 0;
|
||||
else c;
|
||||
}
|
||||
c++;
|
||||
/* Extract hex value from pointer */
|
||||
while (d = *c) {
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
p = (p << 4) + (d - '0');
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
p = (p << 4) + (d - ('a'-10));
|
||||
else
|
||||
break;
|
||||
c++;
|
||||
}
|
||||
*ptr = (void *) p;
|
||||
if ((!t) || (strcmp(t,c)==0)) return (char *) 0;
|
||||
|
||||
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 && (strcmp(t,cache->name) == 0) && (strcmp(c,cache->mapped) == 0)) {
|
||||
cache->stat++;
|
||||
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
|
||||
return (char *) 0;
|
||||
}
|
||||
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
|
||||
if (!SwigLastCache) cache = SwigCache;
|
||||
else cache++;
|
||||
}
|
||||
/* Type mismatch. Look through type-mapping table */
|
||||
start = SwigStart[(int) t[1]];
|
||||
end = SwigStart[(int) t[1]+1];
|
||||
sp = &SwigPtrTable[start];
|
||||
|
||||
/* Try to find a match */
|
||||
while (start <= end) {
|
||||
if (strncmp(t,sp->name,sp->len) == 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++;
|
||||
start++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
367
wxPython/wxSWIG/Runtime/libtcl8.c
Normal file
367
wxPython/wxSWIG/Runtime/libtcl8.c
Normal file
@@ -0,0 +1,367 @@
|
||||
/**************************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* swigtcl8.swg
|
||||
*
|
||||
* This file provides type-checked pointer support to Tcl 8.0.
|
||||
**********************************************************************/
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_GLOBAL
|
||||
#include <tcl.h>
|
||||
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
|
||||
#else
|
||||
#define SWIGSTATICRUNTIME(a) static a
|
||||
#endif
|
||||
|
||||
#ifdef SWIG_NOINCLUDE
|
||||
extern void SWIG_SetPointerObj(Tcl_Obj *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPointerObj(Tcl_Interp *, Tcl_Obj *, void **, char *);
|
||||
extern int SWIG_MakePtr(char *, const void *, char *);
|
||||
extern void SWIG_RegisterType();
|
||||
#else
|
||||
|
||||
/* These are internal variables. Should be static */
|
||||
|
||||
typedef struct SwigPtrType {
|
||||
char *name;
|
||||
int len;
|
||||
void *(*cast)(void *);
|
||||
struct SwigPtrType *next;
|
||||
} 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;
|
||||
|
||||
static int SwigPtrMax = 64; /* Max entries that can be currently held */
|
||||
static int SwigPtrN = 0; /* Current number of entries */
|
||||
static int SwigPtrSort = 0; /* Status flag indicating sort */
|
||||
static int SwigStart[256]; /* Array containing start locations (for searching) */
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
* SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *))
|
||||
*
|
||||
* Register a new type-mapping with the type-checking system.
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
|
||||
|
||||
int i;
|
||||
SwigPtrType *t = 0, *t1;
|
||||
|
||||
if (!SwigPtrTable) {
|
||||
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
|
||||
SwigPtrN = 0;
|
||||
}
|
||||
if (SwigPtrN >= SwigPtrMax) {
|
||||
SwigPtrMax = 2*SwigPtrMax;
|
||||
SwigPtrTable = (SwigPtrType *) realloc(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(origtype);
|
||||
t->cast = 0;
|
||||
t->next = 0;
|
||||
SwigPtrN++;
|
||||
}
|
||||
while (t->next) {
|
||||
if (strcmp(t->name,newtype) == 0) {
|
||||
if (cast) t->cast = cast;
|
||||
return;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
|
||||
t1->name = newtype;
|
||||
t1->len = strlen(newtype);
|
||||
t1->cast = cast;
|
||||
t1->next = 0;
|
||||
t->next = t1;
|
||||
SwigPtrSort = 0;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
* void SWIG_SetPointerObj(Tcl_Obj *objPtr, void *ptr, char *type)
|
||||
*
|
||||
* Sets a Tcl object to a pointer value.
|
||||
* ptr = void pointer value
|
||||
* type = string representing type
|
||||
*
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_SetPointerObj(Tcl_Obj *objPtr, 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 */
|
||||
char _temp[20], *_c;
|
||||
_r = _result;
|
||||
_p = (unsigned long) _ptr;
|
||||
if (_p > 0) {
|
||||
while (_p > 0) {
|
||||
_s = _p & 0xf;
|
||||
*(_r++) = _hex[_s];
|
||||
_p = _p >> 4;
|
||||
}
|
||||
*_r = '_';
|
||||
_c = &_temp[0];
|
||||
while (_r >= _result)
|
||||
*(_c++) = *(_r--);
|
||||
*_c = 0;
|
||||
Tcl_SetStringObj(objPtr,_temp,-1);
|
||||
} else {
|
||||
Tcl_SetStringObj(objPtr,"NULL",-1);
|
||||
}
|
||||
if (_ptr)
|
||||
Tcl_AppendToObj(objPtr,type,-1);
|
||||
}
|
||||
|
||||
/* This is for backwards compatibility */
|
||||
|
||||
SWIGSTATICRUNTIME(int)
|
||||
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;
|
||||
int l = 0;
|
||||
_r = _result;
|
||||
_p = (unsigned long) _ptr;
|
||||
if (_p > 0) {
|
||||
while (_p > 0) {
|
||||
_s = _p & 0xf;
|
||||
*(_r++) = _hex[_s];
|
||||
_p = _p >> 4;
|
||||
l++;
|
||||
}
|
||||
*_r = '_';
|
||||
l++;
|
||||
while (_r >= _result)
|
||||
*(_c++) = *(_r--);
|
||||
_r = type;
|
||||
while (*_r)
|
||||
*(_c++) = *(_r++);
|
||||
*(_c) = 0;
|
||||
} else {
|
||||
strcpy (_c, "NULL");
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
* char *SWIG_GetPointerObj(Tcl_Interp *interp, Tcl_Obj *objPtr, void **ptr, char *type)
|
||||
*
|
||||
* Attempts to extract a pointer value from our pointer type.
|
||||
* Upon failure, returns a string corresponding to the actual datatype.
|
||||
* Upon success, returns NULL and sets the pointer value in ptr.
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
SWIGSTATICRUNTIME(char *)
|
||||
SWIG_GetPointerObj(Tcl_Interp *interp, Tcl_Obj *objPtr, void **ptr, char *_t) {
|
||||
unsigned long _p;
|
||||
char temp_type[256];
|
||||
char *name;
|
||||
int i, len;
|
||||
SwigPtrType *sp,*tp;
|
||||
SwigCacheType *cache;
|
||||
int start, end;
|
||||
char *_c;
|
||||
_p = 0;
|
||||
|
||||
/* Extract the pointer value as a string */
|
||||
_c = Tcl_GetStringFromObj(objPtr, &i);
|
||||
|
||||
/* 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 */
|
||||
while (start <= end) {
|
||||
if (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++;
|
||||
start++;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
* void SWIG_RegisterType()
|
||||
*
|
||||
* Registers our new datatype with an interpreter.
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
SWIGSTATICRUNTIME(void)
|
||||
SWIG_RegisterType() {
|
||||
/* Does nothing at the moment */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
30
wxPython/wxSWIG/Runtime/make.sh
Normal file
30
wxPython/wxSWIG/Runtime/make.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
necho() {
|
||||
if [ "`echo -n`" = "-n" ]; then
|
||||
echo "${@}\c"
|
||||
else
|
||||
echo -n "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Script that attempts to produce different run-time libraries
|
||||
|
||||
TARGET='perl_lib perl_shared py_lib py_shared tcl_lib tcl_shared tcl8_lib tcl8_shared'
|
||||
|
||||
echo "Building the SWIG runtime libraries..."
|
||||
echo ""
|
||||
echo "*** Note : Some builds may fail due to uninstalled packages or"
|
||||
echo "unsupported features such as dynamic loading (don't panic)."
|
||||
echo ""
|
||||
|
||||
for i in ${TARGET}; do
|
||||
necho " Building ${i}";
|
||||
if make ${i} >/dev/null 2>&1; then
|
||||
# See if SWIG generated any errors at all
|
||||
echo " ....... OK.";
|
||||
else
|
||||
echo " ....... failed.";
|
||||
fi;
|
||||
done
|
||||
|
99
wxPython/wxSWIG/Runtime/makefile.vc
Normal file
99
wxPython/wxSWIG/Runtime/makefile.vc
Normal file
@@ -0,0 +1,99 @@
|
||||
# Modified for use with Microsoft Developer Studio V6.0
|
||||
# Bob Techentin, February 10, 1999
|
||||
#
|
||||
# Makefile for producing SWIG runtime libraries.
|
||||
#
|
||||
# The SWIG runtime library consists of the pointer-type checker
|
||||
# and other support functions. Multi-file SWIG modules
|
||||
# generally link with these libraries.
|
||||
#
|
||||
# The Windows version of the runtime libraries are static.
|
||||
# Note the "-" command prefix ignores errors during compiles
|
||||
# and links, because you might not have all languages.
|
||||
|
||||
!include <..\make_win.in>
|
||||
|
||||
SWIG_RUNTIME = $(prefix)/lib
|
||||
dSWIG_RUNTIME = $(dprefix)\lib
|
||||
|
||||
AR = lib.exe
|
||||
|
||||
|
||||
all: tcl_lib tcl8_lib py_lib perl_lib
|
||||
|
||||
|
||||
install:
|
||||
@echo "Installing runtime libraries"
|
||||
@if not exist $(dSWIG_RUNTIME) mkdir $(dSWIG_RUNTIME)
|
||||
if exist swigtcl.lib copy swigtcl.lib $(dSWIG_RUNTIME)
|
||||
if exist swigtcl8.lib copy swigtcl8.lib $(dSWIG_RUNTIME)
|
||||
if exist swigpy.lib copy swigpy.lib $(dSWIG_RUNTIME)
|
||||
if exist swigpl.lib copy swigpl.lib $(dSWIG_RUNTIME)
|
||||
|
||||
install95:
|
||||
@echo "Installing runtime libraries"
|
||||
@if not exist $(dSWIG_RUNTIME) mkdir $(dSWIG_RUNTIME)
|
||||
if exist swigtcl.lib copy swigtcl.lib $(dSWIG_RUNTIME) /Y
|
||||
if exist swigtcl8.lib copy swigtcl8.lib $(dSWIG_RUNTIME) /Y
|
||||
if exist swigpy.lib copy swigpy.lib $(dSWIG_RUNTIME) /Y
|
||||
if exist swigpl.lib copy swigpl.lib $(dSWIG_RUNTIME) /Y
|
||||
|
||||
clean::
|
||||
del /f *.obj
|
||||
del /f *.lib
|
||||
del /f *.c
|
||||
del /f *.swg
|
||||
del /f core
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Tcl runtime library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
TCL_INCLUDE = -Ic:\apps\TclPro1.1\include
|
||||
|
||||
# Tcl 7.x library
|
||||
|
||||
tcl_lib:
|
||||
-..\swig.exe -tcl -co -o libtcl.c -I..\swig_lib swigtcl.swg
|
||||
-$(CC) -c -DSWIG_GLOBAL libtcl.c
|
||||
-$(AR) /out:swigtcl.lib libtcl.obj
|
||||
|
||||
tcl8_lib:
|
||||
-..\swig.exe -tcl -co -o libtcl8.c -I..\swig_lib swigtcl8.swg
|
||||
-$(CC) -c -DSWIG_GLOBAL $(TCL_INCLUDE) libtcl8.c
|
||||
-$(AR) /out:swigtcl8.lib libtcl8.obj
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Python run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
PYTHON_INCLUDE = -Ic:\apps\python-1.5\Include -Ic:\apps\python-1.5 -Ic:\apps\python-1.5\PC
|
||||
|
||||
# Python library
|
||||
|
||||
py_lib:
|
||||
-..\swig.exe -python -co -o libpy.c -I../swig_lib python.swg
|
||||
-$(CC) -c -DSWIG_GLOBAL $(PYTHON_INCLUDE) libpy.c
|
||||
-$(AR) /out:swigpy.lib libpy.obj
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Perl run-time library
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# These are for Perl5.004
|
||||
PERL_INCLUDE = -Ic:\apps\perl\lib\CORE
|
||||
PERLFLAGS = /DWIN32 /DMSWIN32 /DWIN32IO_IS_STDIO
|
||||
|
||||
# Uncomment the following if you are using ActiveWare Perl for Win32
|
||||
#PERL_INCLUDE =-Id:\perl315 -Id:\perl315\inc
|
||||
#PERLFLAGS = /DWIN32 /DMSWIN32 /DPERL_OBJECT
|
||||
|
||||
# Perl library
|
||||
|
||||
perl_lib:
|
||||
-del /f libperl.c libperl.swg
|
||||
-..\swig.exe -perl5 -co -o libperl.swg -I..\swig_lib perl5.swg
|
||||
-copy perlrun.h+libperl.swg libperl.c
|
||||
-$(CC) -c -Dexplicit= -Dbool=char -DSWIG_GLOBAL $(PERFLAGS) $(PERL_INCLUDE) libperl.c
|
||||
-$(AR) /out:swigpl.lib libperl.obj
|
||||
|
3
wxPython/wxSWIG/Runtime/perlrun.h
Normal file
3
wxPython/wxSWIG/Runtime/perlrun.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
Reference in New Issue
Block a user