aboutsummaryrefslogtreecommitdiff
path: root/externals/grill
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill')
-rw-r--r--externals/grill/py/py.vcproj10
-rw-r--r--externals/grill/py/readme.txt1
-rw-r--r--externals/grill/py/source/clmeth.cpp4
-rw-r--r--externals/grill/py/source/modmeth.cpp32
-rw-r--r--externals/grill/py/source/pybase.cpp5
-rw-r--r--externals/grill/py/source/pybase.h1
-rw-r--r--externals/grill/py/source/pyext.h4
-rw-r--r--externals/grill/py/source/pysymbol.cpp4
8 files changed, 48 insertions, 13 deletions
diff --git a/externals/grill/py/py.vcproj b/externals/grill/py/py.vcproj
index 50d989c8..25b2ec33 100644
--- a/externals/grill/py/py.vcproj
+++ b/externals/grill/py/py.vcproj
@@ -85,7 +85,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="C:\data\prog\packs\pthreads\include;c:\programme\audio\pd\src;..\flext\source;c:\programme\prog\Python24\include"
+ AdditionalIncludeDirectories="C:\data\prog\packs\pthreads\include;&quot;c:\data\pd\pd-cvs\src&quot;;..\flext\source;c:\programme\prog\Python24\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PY_EXPORTS;FLEXT_SYS=2;FLEXT_THREADS;PY_NUMARRAY"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -105,7 +105,7 @@
OutputFile="$(outdir)/py.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="&quot;C:\data\prog\packs\Python-2.4\PCbuild&quot;;C:\data\prog\packs\pthreads\lib;c:/programme/audio/pd/bin"
+ AdditionalLibraryDirectories="&quot;C:\data\prog\packs\Python-2.4\PCbuild&quot;;C:\data\prog\packs\pthreads\lib;&quot;c:\data\pd\pd-cvs\bin&quot;"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(outdir)/py.pdb"
SubSystem="2"
@@ -1049,6 +1049,12 @@
RelativePath=".\source\pybase.h">
</File>
<File
+ RelativePath=".\source\pybundle.cpp">
+ </File>
+ <File
+ RelativePath=".\source\pybundle.h">
+ </File>
+ <File
RelativePath="source\register.cpp">
<FileConfiguration
Name="PD Debug|Win32">
diff --git a/externals/grill/py/readme.txt b/externals/grill/py/readme.txt
index 5ca1876e..31f4d2a3 100644
--- a/externals/grill/py/readme.txt
+++ b/externals/grill/py/readme.txt
@@ -114,6 +114,7 @@ Version history:
- ADD: __str__ method for pyext, to enable print self calls
- ADD: enable symbol binding for all callables (not only functions and methods)
- ADD: Buffer.resize(frames,keep=1,zero=1) method
+- ADD: py.Bundle class to support flext message bundles
0.2.0:
- ADD: handling of Python threads
diff --git a/externals/grill/py/source/clmeth.cpp b/externals/grill/py/source/clmeth.cpp
index c8d38f81..be003291 100644
--- a/externals/grill/py/source/clmeth.cpp
+++ b/externals/grill/py/source/clmeth.cpp
@@ -210,10 +210,10 @@ PyObject *pyext::pyext_outlet(PyObject *,PyObject *args)
Py_INCREF(val);
}
else
- val = PySequence_GetSlice(args,2,sz); // new ref
+ val = PyTuple_GetSlice(args,2,sz); // new ref
#endif
- int o = PyInt_AsLong(outl);
+ int o = PyInt_AS_LONG(outl);
if(o >= 1 && o <= ext->Outlets()) {
// offset outlet by signal outlets
o += ext->sigoutlets;
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp
index 44299b0c..a611690f 100644
--- a/externals/grill/py/source/modmeth.cpp
+++ b/externals/grill/py/source/modmeth.cpp
@@ -118,6 +118,7 @@ PyObject *pybase::py_send(PyObject *,PyObject *args)
) {
PyObject *val;
+#if 0
bool tp =
sz == 2 &&
PySequence_Check(
@@ -126,28 +127,47 @@ PyObject *pybase::py_send(PyObject *,PyObject *args)
if(!tp)
val = PySequence_GetSlice(args,1,sz); // new ref
+#else
+ if(sz == 2) {
+ val = PyTuple_GET_ITEM(args,1); // borrow reference
+ Py_INCREF(val);
+ }
+ else
+ val = PySequence_GetSlice(args,1,sz); // new ref
+#endif
AtomListStatic<16> lst;
const t_symbol *sym = GetPyArgs(lst,val);
+ Py_DECREF(val);
+
if(sym) {
bool ok = Forward(recv,sym,lst.Count(),lst.Atoms());
#ifdef FLEXT_DEBUG
if(!ok)
post("py/pyext - Receiver doesn't exist");
#endif
+ Py_INCREF(Py_None);
+ return Py_None;
}
- else if(PyErr_Occurred())
+/*
+ else if(PyErr_Occurred())
PyErr_Print();
else
post("py/pyext - No data to send");
-
- if(!tp) Py_DECREF(val);
+*/
+ else {
+ FLEXT_ASSERT(PyErr_Occurred());
+ return NULL;
+ }
}
+/*
else
post("py/pyext - Send name is invalid");
-
- Py_INCREF(Py_None);
- return Py_None;
+*/
+ else {
+ PyErr_SetString(PyExc_ValueError,"py/pyext - Send name is invalid");
+ return NULL;
+ }
}
#ifdef FLEXT_THREADS
diff --git a/externals/grill/py/source/pybase.cpp b/externals/grill/py/source/pybase.cpp
index bdc76099..f20328d8 100644
--- a/externals/grill/py/source/pybase.cpp
+++ b/externals/grill/py/source/pybase.cpp
@@ -94,6 +94,7 @@ const t_symbol *pybase::sym_response = NULL;
void initsymbol();
void initsamplebuffer();
+void initbundle();
void pybase::lib_setup()
{
@@ -186,6 +187,10 @@ void pybase::lib_setup()
initsamplebuffer();
PyModule_AddObject(module_obj,"Buffer",(PyObject *)&pySamplebuffer_Type);
+ // add message bundle type
+ initbundle();
+ PyModule_AddObject(module_obj,"Bundle",(PyObject *)&pyBundle_Type);
+
// -------------------------------------------------------------
FLEXT_SETUP(pyobj);
diff --git a/externals/grill/py/source/pybase.h b/externals/grill/py/source/pybase.h
index 59a1d062..3645a7af 100644
--- a/externals/grill/py/source/pybase.h
+++ b/externals/grill/py/source/pybase.h
@@ -14,6 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "main.h"
#include "pysymbol.h"
#include "pybuffer.h"
+#include "pybundle.h"
class pybase
: public flext
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index 672fe5f1..4696c72c 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -44,6 +44,8 @@ public:
int Inlets() const { return inlets; }
int Outlets() const { return outlets; }
+ static pyext *GetThis(PyObject *self);
+
protected:
virtual bool Init();
@@ -87,8 +89,6 @@ protected:
virtual PyObject *GetSig(int ix,bool in);
- static pyext *GetThis(PyObject *self);
-
private:
static void Setup(t_classid);
diff --git a/externals/grill/py/source/pysymbol.cpp b/externals/grill/py/source/pysymbol.cpp
index be7d3139..502606af 100644
--- a/externals/grill/py/source/pysymbol.cpp
+++ b/externals/grill/py/source/pysymbol.cpp
@@ -36,8 +36,10 @@ static int symbol_init(PyObject *self, PyObject *args, PyObject *kwds)
((pySymbol *)self)->sym = pySymbol_AS_SYMBOL(arg);
else if(PyString_Check(arg))
((pySymbol *)self)->sym = flext::MakeSymbol(PyString_AS_STRING(arg));
- else
+ else {
+ PyErr_SetString(PyExc_TypeError,"string or symbol argument expected");
ret = -1;
+ }
Py_DECREF(arg);
return ret;