aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2008-01-04 11:59:00 +0000
committerThomas Grill <xovo@users.sourceforge.net>2008-01-04 11:59:00 +0000
commitb9bddf9e90aad64a237dbbb29342b6bd66a92bcc (patch)
tree6aef87b3c73b63df08f2e7545f799df99f611567 /externals/grill/py
parent447335814bd329b12ef2d9064e055f3cdfbf61dd (diff)
compilation fixes for Python 2.5, OSX
cross-platform fixes more cross-platform and version fixes compilation fixes for Python 2.5 svn path=/trunk/; revision=9122
Diffstat (limited to 'externals/grill/py')
-rw-r--r--externals/grill/py/build/config-mac.def3
-rw-r--r--externals/grill/py/build/gnumake-mac-gcc.inc5
-rw-r--r--externals/grill/py/py.xcodeproj/project.pbxproj57
-rw-r--r--externals/grill/py/source/pybase.cpp6
-rw-r--r--externals/grill/py/source/pybuffer.cpp151
-rw-r--r--externals/grill/py/source/pyprefix.h8
-rw-r--r--externals/grill/py/source/pysymbol.cpp37
7 files changed, 150 insertions, 117 deletions
diff --git a/externals/grill/py/build/config-mac.def b/externals/grill/py/build/config-mac.def
index 43f31fa6..3ecd7219 100644
--- a/externals/grill/py/build/config-mac.def
+++ b/externals/grill/py/build/config-mac.def
@@ -1,3 +1,6 @@
+# which major python version?
+PYTHONVER=23
+
# uncomment if numpy/numarray/numeric support should be compiled in
# for info see http://numeric.scipy.org
PY_NUMPY=1
diff --git a/externals/grill/py/build/gnumake-mac-gcc.inc b/externals/grill/py/build/gnumake-mac-gcc.inc
index 775a8762..d077c84e 100644
--- a/externals/grill/py/build/gnumake-mac-gcc.inc
+++ b/externals/grill/py/build/gnumake-mac-gcc.inc
@@ -1,12 +1,13 @@
DEFS += -DPY_EXPORTS
-LIBS += -framework Python
+LIBS += -F/Library/Frameworks -framework Python
ifdef PY_NUMARRAY
DEFS += -DPY_NUMARRAY
endif
ifdef PY_NUMPY
DEFS += -DPY_NUMPY
-INCPATH += -I/Library/Python/2.3/site-packages/numpy/core/include
+INCPATH += -I/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/core/include
+#INCPATH += -F/System/Library/Frameworks -I/Library/Python/2.3/site-packages/numpy/core/include
endif
ifdef PY_NUMERIC
DEFS += -DPY_NUMERIC
diff --git a/externals/grill/py/py.xcodeproj/project.pbxproj b/externals/grill/py/py.xcodeproj/project.pbxproj
index 30e3c783..29d99ee7 100644
--- a/externals/grill/py/py.xcodeproj/project.pbxproj
+++ b/externals/grill/py/py.xcodeproj/project.pbxproj
@@ -32,7 +32,6 @@
E90E52F60809258A001341AC /* pyext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E90E51E508091989001341AC /* pyext.cpp */; };
E90E52F70809258A001341AC /* pysymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E90E51E808091989001341AC /* pysymbol.cpp */; };
E90E52F80809258A001341AC /* register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E90E51EA08091989001341AC /* register.cpp */; };
- E90E535B08092593001341AC /* Python.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E90E51FB080919EC001341AC /* Python.framework */; };
E90E535D08092593001341AC /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E90E521108091CA5001341AC /* ApplicationServices.framework */; };
E90E535E08092593001341AC /* vecLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E90E52D208091F79001341AC /* vecLib.framework */; };
E926B6D8089F76D90034D534 /* pyatom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E90043820887A302008AEAFC /* pyatom.cpp */; };
@@ -61,8 +60,6 @@
E926B818089F782F0034D534 /* MaxAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E926B817089F782F0034D534 /* MaxAPI.framework */; };
E926B81A089F78400034D534 /* MaxAudioAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E926B819089F78400034D534 /* MaxAudioAPI.framework */; };
E926B833089F7CB50034D534 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E90E521108091CA5001341AC /* ApplicationServices.framework */; };
- E9D6763108FC619F0039A6F6 /* libflext-pd_d.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9D6762F08FC61860039A6F6 /* libflext-pd_d.dylib */; };
- E9D6763208FC619F0039A6F6 /* libflext-pd.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9D6763008FC61860039A6F6 /* libflext-pd.dylib */; };
E9D6763308FC61A40039A6F6 /* libflext-max_d.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9D6762D08FC61860039A6F6 /* libflext-max_d.dylib */; };
E9D6763408FC61A40039A6F6 /* libflext-max.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E9D6762E08FC61860039A6F6 /* libflext-max.dylib */; };
/* End PBXBuildFile section */
@@ -96,7 +93,6 @@
E90E52D208091F79001341AC /* vecLib.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vecLib.framework; path = /System/Library/Frameworks/vecLib.framework; sourceTree = "<absolute>"; };
E90E52E608092505001341AC /* py.pd_darwin */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = py.pd_darwin; sourceTree = BUILT_PRODUCTS_DIR; };
E926B6D3089F75950034D534 /* py.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = py.mxo; sourceTree = BUILT_PRODUCTS_DIR; };
- E926B6D4089F75950034D534 /* py-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "py-Info.plist"; path = "/Users/thomas/Develop/pdmax/py/py-Info.plist"; sourceTree = "<absolute>"; };
E926B817089F782F0034D534 /* MaxAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MaxAPI.framework; path = /Library/Frameworks/MaxAPI.framework; sourceTree = "<absolute>"; };
E926B819089F78400034D534 /* MaxAudioAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MaxAudioAPI.framework; path = /Library/Frameworks/MaxAudioAPI.framework; sourceTree = "<absolute>"; };
E9D6762D08FC61860039A6F6 /* libflext-max_d.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libflext-max_d.dylib"; path = "/usr/local/lib/libflext-max_d.dylib"; sourceTree = "<absolute>"; };
@@ -110,9 +106,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- E9D6763108FC619F0039A6F6 /* libflext-pd_d.dylib in Frameworks */,
- E9D6763208FC619F0039A6F6 /* libflext-pd.dylib in Frameworks */,
- E90E535B08092593001341AC /* Python.framework in Frameworks */,
E90E535D08092593001341AC /* ApplicationServices.framework in Frameworks */,
E90E535E08092593001341AC /* vecLib.framework in Frameworks */,
);
@@ -141,7 +134,6 @@
08FB77ADFE841716C02AAC07 /* Source */,
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
19C28FB4FE9D528D11CA2CBB /* Products */,
- E926B6D4089F75950034D534 /* py-Info.plist */,
);
name = py;
sourceTree = "<group>";
@@ -346,6 +338,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXECUTABLE_EXTENSION = pd_darwin;
+ FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
GCC_ALTIVEC_EXTENSIONS = YES;
GCC_MODEL_CPU = G4;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -371,6 +364,8 @@
"-undefined",
dynamic_lookup,
"-lflext-pd_d",
+ "-framework",
+ Python,
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = py;
@@ -472,20 +467,21 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = source/pyprefix.h;
GCC_PREPROCESSOR_DEFINITIONS = (
+ "$(inherited)",
"FLEXT_SYS=1",
- FLEXT_DEBUG,
- FLEXT_THREADS,
+ FLEXT_SHARED,
);
GENERATE_PKGINFO_FILE = YES;
HEADER_SEARCH_PATHS = (
- "$(flext)/source",
- "$(MaxSDK)/max-includes",
- "$(MaxSDK)/msp-includes",
+ "$(inherited)",
+ "$(maxsdk)/max-includes",
+ "$(maxsdk)/msp-includes",
);
- INFOPLIST_FILE = "py-Info.plist";
+ INFOPLIST_FILE = "source/py-Info.plist";
LIBRARY_SEARCH_PATHS = (
- "$(MaxSDK)/max-includes",
- "$(MaxSDK)/msp-includes",
+ "$(inherited)",
+ "$(maxsdk)/max-includes",
+ "$(maxsdk)/msp-includes",
);
LIBRARY_STYLE = STATIC;
OPTIMIZATION_CFLAGS = "-O0";
@@ -513,19 +509,21 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = source/pyprefix.h;
GCC_PREPROCESSOR_DEFINITIONS = (
+ "$(inherited)",
"FLEXT_SYS=1",
FLEXT_SHARED,
);
GENERATE_PKGINFO_FILE = YES;
HEADER_SEARCH_PATHS = (
- "$(flext)/source",
- "$(MaxSDK)/max-includes",
- "$(MaxSDK)/msp-includes",
+ "$(inherited)",
+ "$(maxsdk)/max-includes",
+ "$(maxsdk)/msp-includes",
);
- INFOPLIST_FILE = "py-Info.plist";
+ INFOPLIST_FILE = "source/py-Info.plist";
LIBRARY_SEARCH_PATHS = (
- "$(MaxSDK)/max-includes",
- "$(MaxSDK)/msp-includes",
+ "$(inherited)",
+ "$(maxsdk)/max-includes",
+ "$(maxsdk)/msp-includes",
);
OTHER_CFLAGS = "";
OTHER_REZFLAGS = "";
@@ -584,7 +582,12 @@
PY_NUMPY,
PY_USE_GIL,
);
- HEADER_SEARCH_PATHS = "/Library/Python/2.3/site-packages/numpy/core/include/";
+ HEADER_SEARCH_PATHS = (
+ "/Library/Python/2.3/site-packages/numpy/core/include/",
+ "$(lockfree)",
+ "$(flext)/source",
+ );
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Development;
};
@@ -602,7 +605,12 @@
PY_NUMPY,
PY_USE_GIL,
);
- HEADER_SEARCH_PATHS = "/Library/Python/2.3/site-packages/numpy/core/include/";
+ HEADER_SEARCH_PATHS = (
+ "/Library/Python/2.3/site-packages/numpy/core/include/",
+ "$(lockfree)",
+ "$(flext)/source",
+ );
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Deployment;
};
@@ -610,6 +618,7 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = PY_NUMPY;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Default;
};
diff --git a/externals/grill/py/source/pybase.cpp b/externals/grill/py/source/pybase.cpp
index c22a1143..033219e4 100644
--- a/externals/grill/py/source/pybase.cpp
+++ b/externals/grill/py/source/pybase.cpp
@@ -6,7 +6,7 @@ For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
$LastChangedRevision: 26 $
-$LastChangedDate: 2008-01-03 17:20:03 +0100 (Thu, 03 Jan 2008) $
+$LastChangedDate: 2008-01-03 18:00:03 +0100 (Thu, 03 Jan 2008) $
$LastChangedBy: thomas $
*/
@@ -678,7 +678,7 @@ void pybase::Reload()
if(reg) {
PyObject *key;
- int pos = 0;
+ Py_ssize_t pos = 0;
while(PyDict_Next(reg,&pos,&key,NULL)) {
pybase *th = (pybase *)PyLong_AsLong(key);
FLEXT_ASSERT(th);
@@ -697,7 +697,7 @@ void pybase::Reload()
SetRegistry(REGNAME,reg);
PyObject *key;
- int pos = 0;
+ Py_ssize_t pos = 0;
while(PyDict_Next(reg,&pos,&key,NULL)) {
pybase *th = (pybase *)PyLong_AsLong(key);
FLEXT_ASSERT(th);
diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp
index c4c8585b..82414e11 100644
--- a/externals/grill/py/source/pybuffer.cpp
+++ b/externals/grill/py/source/pybuffer.cpp
@@ -6,7 +6,7 @@ For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
$LastChangedRevision: 26 $
-$LastChangedDate: 2008-01-03 17:20:03 +0100 (Thu, 03 Jan 2008) $
+$LastChangedDate: 2008-01-04 12:24:43 +0100 (Fri, 04 Jan 2008) $
$LastChangedBy: thomas $
*/
@@ -189,44 +189,32 @@ static PyMethodDef buffer_methods[] = {
// support the buffer protocol
-#if PY_VERSION_HEX >= 0x02050000
static Py_ssize_t buffer_readbuffer(PyObject *obj, Py_ssize_t segment, void **ptrptr)
-#else
-static int buffer_readbuffer(PyObject *obj, int segment, void **ptrptr)
-#endif
{
flext::buffer *b = ((pySamplebuffer *)obj)->buf;
ptrptr[0] = b->Data();
return b->Channels()*b->Frames()*sizeof(t_sample);
}
-#if PY_VERSION_HEX >= 0x02050000
static Py_ssize_t buffer_writebuffer(PyObject *obj, Py_ssize_t segment, void **ptrptr)
-#else
-static int buffer_writebuffer(PyObject *obj, int segment, void **ptrptr)
-#endif
{
flext::buffer *b = ((pySamplebuffer *)obj)->buf;
ptrptr[0] = b->Data();
return b->Channels()*b->Frames()*sizeof(t_sample);
}
-#if PY_VERSION_HEX >= 0x02050000
static Py_ssize_t buffer_segcount(PyObject *obj, Py_ssize_t *lenp)
-#else
-static int buffer_segcount(PyObject *obj, int *lenp)
-#endif
{
flext::buffer *b = ((pySamplebuffer *)obj)->buf;
if(lenp) lenp[0] = b->Channels()*b->Frames()*sizeof(t_sample);
return 1;
}
-#if PY_VERSION_HEX >= 0x02050000
-static Py_ssize_t buffer_charbuffer(PyObject *obj, Py_ssize_t segment, char **ptrptr)
-#else
-static int buffer_charbuffer(PyObject *obj, int segment, const char **ptrptr)
+static Py_ssize_t buffer_charbuffer(PyObject *obj, Py_ssize_t segment,
+#if PY_VERSION_HEX < 0x02050000
+ const
#endif
+ char **ptrptr)
{
flext::buffer *b = ((pySamplebuffer *)obj)->buf;
ptrptr[0] = (char *)b->Data();
@@ -240,13 +228,15 @@ static PyBufferProcs buffer_as_buffer = {
buffer_charbuffer
};
-static int buffer_length(pySamplebuffer *self)
+static Py_ssize_t buffer_length(PyObject *s)
{
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
return self->buf?self->buf->Frames():0;
}
-static PyObject *buffer_item(pySamplebuffer *self, int i)
+static PyObject *buffer_item(PyObject *s,Py_ssize_t i)
{
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
PyObject *ret;
if(self->buf) {
if (i < 0 || i >= self->buf->Frames()) {
@@ -281,7 +271,7 @@ PyObject *arrayfrombuffer(PyObject *buf,int c,int n)
arr = (PyObject *)NA_NewAllFromBuffer(c == 1?1:2,shape,numtype,buf,0,0,NA_ByteOrder(),1,1);
#else
void *data;
- int len;
+ Py_ssize_t len;
int err = PyObject_AsWriteBuffer(buf,&data,&len);
if(!err) {
FLEXT_ASSERT(len <= n*c*sizeof(t_sample));
@@ -301,8 +291,9 @@ PyObject *arrayfrombuffer(PyObject *buf,int c,int n)
return NULL;
}
-static PyObject *buffer_slice(pySamplebuffer *self,int ilow = 0,int ihigh = 1<<(sizeof(int)*8-2))
+static PyObject *buffer_slice(PyObject *s,Py_ssize_t ilow = 0,Py_ssize_t ihigh = 1<<(sizeof(int)*8-2))
{
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
PyObject *ret;
#ifdef PY_ARRAYS
if(arrsupport()) {
@@ -336,8 +327,9 @@ static PyObject *buffer_slice(pySamplebuffer *self,int ilow = 0,int ihigh = 1<<(
return ret;
}
-static int buffer_ass_item(pySamplebuffer *self,int i,PyObject *v)
+static int buffer_ass_item(PyObject *s,Py_ssize_t i,PyObject *v)
{
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
int ret;
if(self->buf) {
if (i < 0 || i >= self->buf->Frames()) {
@@ -368,8 +360,9 @@ static int buffer_ass_item(pySamplebuffer *self,int i,PyObject *v)
return ret;
}
-static int buffer_ass_slice(pySamplebuffer *self,int ilow,int ihigh,PyObject *value)
+static int buffer_ass_slice(PyObject *s,Py_ssize_t ilow,Py_ssize_t ihigh,PyObject *value)
{
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
int ret;
#ifdef PY_ARRAYS
if(arrsupport()) {
@@ -426,9 +419,10 @@ static int buffer_ass_slice(pySamplebuffer *self,int ilow,int ihigh,PyObject *va
return ret;
}
-static PyObject *buffer_concat(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_concat(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PySequence_Concat(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -439,9 +433,10 @@ static PyObject *buffer_concat(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_repeat(pySamplebuffer *self,int rep)
+static PyObject *buffer_repeat(PyObject *s,Py_ssize_t rep)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PySequence_Repeat(nobj,rep);
if(ret == nobj) self->dirty = true;
@@ -454,19 +449,19 @@ static PyObject *buffer_repeat(pySamplebuffer *self,int rep)
static PySequenceMethods buffer_as_seq = {
- (inquiry)buffer_length, /* inquiry sq_length; __len__ */
- (binaryfunc)buffer_concat, /* __add__ */
- (intargfunc)buffer_repeat, /* __mul__ */
- (intargfunc)buffer_item, /* intargfunc sq_item; __getitem__ */
- (intintargfunc)buffer_slice, /* intintargfunc sq_slice; __getslice__ */
- (intobjargproc)buffer_ass_item, /* intobjargproc sq_ass_item; __setitem__ */
- (intintobjargproc)buffer_ass_slice, /* intintobjargproc sq_ass_slice; __setslice__ */
+ buffer_length, /* inquiry sq_length; __len__ */
+ buffer_concat, /* __add__ */
+ buffer_repeat, /* __mul__ */
+ buffer_item, /* intargfunc sq_item; __getitem__ */
+ buffer_slice, /* intintargfunc sq_slice; __getslice__ */
+ buffer_ass_item, /* intobjargproc sq_ass_item; __setitem__ */
+ buffer_ass_slice, /* intintobjargproc sq_ass_slice; __setslice__ */
};
-static PyObject *buffer_iter(PyObject *obj)
+static PyObject *buffer_iter(PyObject *s)
{
- pySamplebuffer *self = (pySamplebuffer *)obj;
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *it = PyObject_GetIter(nobj);
Py_DECREF(nobj);
@@ -477,9 +472,10 @@ static PyObject *buffer_iter(PyObject *obj)
}
-static PyObject *buffer_add(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_add(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Add(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -490,9 +486,10 @@ static PyObject *buffer_add(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_subtract(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_subtract(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Subtract(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -503,9 +500,10 @@ static PyObject *buffer_subtract(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_multiply(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_multiply(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Multiply(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -516,9 +514,10 @@ static PyObject *buffer_multiply(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_divide(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_divide(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Divide(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -529,9 +528,10 @@ static PyObject *buffer_divide(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_remainder(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_remainder(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Remainder(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -542,9 +542,10 @@ static PyObject *buffer_remainder(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_divmod(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_divmod(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Divmod(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -555,9 +556,10 @@ static PyObject *buffer_divmod(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_power(pySamplebuffer *self,PyObject *op1,PyObject *op2)
+static PyObject *buffer_power(PyObject *s,PyObject *op1,PyObject *op2)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Power(nobj,op1,op2);
if(ret == nobj) self->dirty = true;
@@ -568,9 +570,10 @@ static PyObject *buffer_power(pySamplebuffer *self,PyObject *op1,PyObject *op2)
return NULL;
}
-static PyObject *buffer_negative(pySamplebuffer *self)
+static PyObject *buffer_negative(PyObject *s)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Negative(nobj);
if(ret == nobj) self->dirty = true;
@@ -581,9 +584,10 @@ static PyObject *buffer_negative(pySamplebuffer *self)
return NULL;
}
-static PyObject *buffer_pos(pySamplebuffer *self)
+static PyObject *buffer_pos(PyObject *s)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Positive(nobj);
Py_DECREF(nobj);
@@ -593,9 +597,10 @@ static PyObject *buffer_pos(pySamplebuffer *self)
return NULL;
}
-static PyObject *buffer_absolute(pySamplebuffer *self)
+static PyObject *buffer_absolute(PyObject *s)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_Absolute(nobj);
if(ret == nobj) self->dirty = true;
@@ -606,7 +611,7 @@ static PyObject *buffer_absolute(pySamplebuffer *self)
return NULL;
}
-static int buffer_coerce(pySamplebuffer **pm, PyObject **pw)
+static int buffer_coerce(PyObject **pm, PyObject **pw)
{
if(pySamplebuffer_Check(*pw)) {
Py_INCREF(*pm);
@@ -617,9 +622,10 @@ static int buffer_coerce(pySamplebuffer **pm, PyObject **pw)
return 1;
}
-static PyObject *buffer_inplace_add(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_inplace_add(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlaceAdd(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -630,9 +636,10 @@ static PyObject *buffer_inplace_add(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_inplace_subtract(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_inplace_subtract(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlaceSubtract(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -643,9 +650,10 @@ static PyObject *buffer_inplace_subtract(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_inplace_multiply(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_inplace_multiply(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlaceMultiply(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -656,9 +664,10 @@ static PyObject *buffer_inplace_multiply(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_inplace_divide(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_inplace_divide(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlaceDivide(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -669,9 +678,10 @@ static PyObject *buffer_inplace_divide(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_inplace_remainder(pySamplebuffer *self,PyObject *op)
+static PyObject *buffer_inplace_remainder(PyObject *s,PyObject *op)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlaceRemainder(nobj,op);
if(ret == nobj) self->dirty = true;
@@ -682,9 +692,10 @@ static PyObject *buffer_inplace_remainder(pySamplebuffer *self,PyObject *op)
return NULL;
}
-static PyObject *buffer_inplace_power(pySamplebuffer *self,PyObject *op1,PyObject *op2)
+static PyObject *buffer_inplace_power(PyObject *s,PyObject *op1,PyObject *op2)
{
- PyObject *nobj = buffer_slice(self);
+ pySamplebuffer *self = reinterpret_cast<pySamplebuffer *>(s);
+ PyObject *nobj = buffer_slice(s);
if(nobj) {
PyObject *ret = PyNumber_InPlacePower(nobj,op1,op2);
if(ret == nobj) self->dirty = true;
diff --git a/externals/grill/py/source/pyprefix.h b/externals/grill/py/source/pyprefix.h
index 50deefb9..0614b3e0 100644
--- a/externals/grill/py/source/pyprefix.h
+++ b/externals/grill/py/source/pyprefix.h
@@ -6,7 +6,7 @@ For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
$LastChangedRevision: 26 $
-$LastChangedDate: 2008-01-03 17:20:03 +0100 (Thu, 03 Jan 2008) $
+$LastChangedDate: 2008-01-04 12:58:11 +0100 (Fri, 04 Jan 2008) $
$LastChangedBy: thomas $
*/
@@ -41,10 +41,14 @@ $LastChangedBy: thomas $
#include <flcontainers.h>
#include <string>
-#ifdef PY_USE_INOFFICIAL
+#if FLEXT_SYS == FLEXT_SYS_PD && defined(PY_USE_INOFFICIAL)
extern "C" {
#include <s_stuff.h>
}
#endif
+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
+#endif
+
#endif
diff --git a/externals/grill/py/source/pysymbol.cpp b/externals/grill/py/source/pysymbol.cpp
index 2e0a7264..b812e134 100644
--- a/externals/grill/py/source/pysymbol.cpp
+++ b/externals/grill/py/source/pysymbol.cpp
@@ -6,7 +6,7 @@ For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
$LastChangedRevision: 26 $
-$LastChangedDate: 2008-01-03 17:20:03 +0100 (Thu, 03 Jan 2008) $
+$LastChangedDate: 2008-01-03 18:15:53 +0100 (Thu, 03 Jan 2008) $
$LastChangedBy: thomas $
*/
@@ -91,13 +91,15 @@ static long symbol_hash(PyObject *self)
}
-static int symbol_length(pySymbol *self)
+static Py_ssize_t symbol_length(PyObject *s)
{
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
return strlen(flext::GetString(self->sym));
}
-static PyObject *symbol_item(pySymbol *self, int i)
+static PyObject *symbol_item(PyObject *s,Py_ssize_t i)
{
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
const char *str = flext::GetString(self->sym);
int len = strlen(str);
if(i < 0) i += len;
@@ -110,8 +112,9 @@ static PyObject *symbol_item(pySymbol *self, int i)
}
}
-static PyObject *symbol_slice(pySymbol *self,int ilow = 0,int ihigh = 1<<(sizeof(int)*8-2))
+static PyObject *symbol_slice(PyObject *s,Py_ssize_t ilow = 0,Py_ssize_t ihigh = 1<<(sizeof(int)*8-2))
{
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
const char *str = flext::GetString(self->sym);
int len = strlen(str);
if(ilow < 0) {
@@ -124,9 +127,10 @@ static PyObject *symbol_slice(pySymbol *self,int ilow = 0,int ihigh = 1<<(sizeof
return PyString_FromStringAndSize(str+ilow,ilow <= ihigh?ihigh-ilow+1:0);
}
-static PyObject *symbol_concat(pySymbol *self,PyObject *op)
+static PyObject *symbol_concat(PyObject *s,PyObject *op)
{
- PyObject *nobj = symbol_slice(self); // take all
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
+ PyObject *nobj = symbol_slice(s); // take all
if(nobj) {
PyObject *ret = PySequence_Concat(nobj,op);
Py_DECREF(nobj);
@@ -136,9 +140,10 @@ static PyObject *symbol_concat(pySymbol *self,PyObject *op)
return NULL;
}
-static PyObject *symbol_repeat(pySymbol *self,int rep)
+static PyObject *symbol_repeat(PyObject *s,Py_ssize_t rep)
{
- PyObject *nobj = symbol_slice(self); // take all
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
+ PyObject *nobj = symbol_slice(s); // take all
if(nobj) {
PyObject *ret = PySequence_Repeat(nobj,rep);
Py_DECREF(nobj);
@@ -149,19 +154,19 @@ static PyObject *symbol_repeat(pySymbol *self,int rep)
}
static PySequenceMethods symbol_as_seq = {
- (inquiry)symbol_length, /* inquiry sq_length; __len__ */
- (binaryfunc)symbol_concat, /* __add__ */
- (intargfunc)symbol_repeat, /* __mul__ */
- (intargfunc)symbol_item, /* intargfunc sq_item; __getitem__ */
- (intintargfunc)symbol_slice, /* intintargfunc sq_slice; __getslice__ */
+ symbol_length, /* inquiry sq_length; __len__ */
+ symbol_concat, /* __add__ */
+ symbol_repeat, /* __mul__ */
+ symbol_item, /* intargfunc sq_item; __getitem__ */
+ symbol_slice, /* intintargfunc sq_slice; __getslice__ */
NULL, /* intobjargproc sq_ass_item; __setitem__ */
NULL, /* intintobjargproc sq_ass_slice; __setslice__ */
};
-static PyObject *symbol_iter(PyObject *obj)
+static PyObject *symbol_iter(PyObject *s)
{
- pySymbol *self = (pySymbol *)obj;
- PyObject *nobj = symbol_slice(self);
+ pySymbol *self = reinterpret_cast<pySymbol *>(s);
+ PyObject *nobj = symbol_slice(s);
if(nobj) {
PyObject *it = PyObject_GetIter(nobj);
Py_DECREF(nobj);