aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r--externals/grill/py/source/bound.cpp2
-rw-r--r--externals/grill/py/source/main.cpp14
-rw-r--r--externals/grill/py/source/main.h6
-rw-r--r--externals/grill/py/source/modmeth.cpp2
-rw-r--r--externals/grill/py/source/py.cpp32
-rw-r--r--externals/grill/py/source/pyext.cpp12
-rw-r--r--externals/grill/py/source/pyext.h14
7 files changed, 44 insertions, 38 deletions
diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp
index 651bb52b..f402480b 100644
--- a/externals/grill/py/source/bound.cpp
+++ b/externals/grill/py/source/bound.cpp
@@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
t_class *pyext::px_class;
pyext::py_proxy *pyext::px_head,*pyext::px_tail;
-void pyext::py_proxy::px_method(py_proxy *obj,const t_symbol *s,int argc,t_atom *argv)
+void pyext::py_proxy::px_method(py_proxy *obj,const t_symbol *s,int argc,const t_atom *argv)
{
PY_LOCK
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 65e1d274..2522ff51 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -10,7 +10,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "main.h"
-
V py::lib_setup()
{
post("");
@@ -127,7 +126,7 @@ V py::m_doc()
-V py::SetArgs(I argc,t_atom *argv)
+V py::SetArgs(I argc,const t_atom *argv)
{
// script arguments
C **sargv = new C *[argc+1];
@@ -202,8 +201,15 @@ V py::AddToPath(const C *dir)
if(dir && *dir) {
PyObject *pobj = PySys_GetObject("path");
if(pobj && PyList_Check(pobj)) {
- PyObject *ps = PyString_FromString(dir);
- PyList_Append(pobj,ps);
+ int i,n = PyList_Size(pobj);
+ for(i = 0; i < n; ++i) {
+ PyObject *pt = PyList_GetItem(pobj,i);
+ if(PyString_Check(pt) && !strcmp(dir,PyString_AsString(pt))) break;
+ }
+ if(i == n) { // string is not yet existent in path
+ PyObject *ps = PyString_FromString(dir);
+ PyList_Append(pobj,ps);
+ }
}
PySys_SetObject("path",pobj);
}
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index 66b332cf..b4096819 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -21,7 +21,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#error You need at least flext version 0.4.0
#endif
-#define PY__VERSION "0.1.1pre3"
+#define PY__VERSION "0.1.1"
#define PYEXT_MODULE "pyext" // name for module
@@ -66,7 +66,7 @@ protected:
V GetModulePath(const C *mod,C *dir,I len);
V AddToPath(const C *dir);
- V SetArgs(I argc,t_atom *argv);
+ V SetArgs(I argc,const t_atom *argv);
V ImportModule(const C *name);
V ReloadModule();
@@ -98,7 +98,7 @@ protected:
// ----thread stuff ------------
V m_detach(BL det) { detach = det; }
- virtual V m_stop(int argc,t_atom *argv);
+ virtual V m_stop(int argc,const t_atom *argv);
BL detach,shouldexit;
I thrcount;
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp
index 51e103ed..b7d2cab0 100644
--- a/externals/grill/py/source/modmeth.cpp
+++ b/externals/grill/py/source/modmeth.cpp
@@ -66,7 +66,7 @@ V py::tick(py *th)
th->Unlock();
}
-V py::m_stop(int argc,t_atom *argv)
+V py::m_stop(int argc,const t_atom *argv)
{
if(thrcount) {
Lock();
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index 83c5d9b5..eff88daf 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -17,29 +17,29 @@ class pyobj:
FLEXT_HEADER(pyobj,py)
public:
- pyobj(I argc,t_atom *argv);
+ pyobj(I argc,const t_atom *argv);
~pyobj();
protected:
- BL m_method_(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL m_method_(I n,const t_symbol *s,I argc,const t_atom *argv);
- V work(const t_symbol *s,I argc,t_atom *argv);
+ V work(const t_symbol *s,I argc,const t_atom *argv);
V m_bang() { work(sym_bang,0,NULL); }
V m_reload();
- V m_reload_(I argc,t_atom *argv);
- V m_set(I argc,t_atom *argv);
+ V m_reload_(I argc,const t_atom *argv);
+ V m_set(I argc,const t_atom *argv);
V m_doc_();
virtual V m_help();
// methods for python arguments
- V callwork(const t_symbol *s,I argc,t_atom *argv);
+ V callwork(const t_symbol *s,I argc,const t_atom *argv);
- V m_py_list(I argc,t_atom *argv) { callwork(sym_list,argc,argv); }
- V m_py_float(I argc,t_atom *argv) { callwork(sym_float,argc,argv); }
- V m_py_int(I argc,t_atom *argv) { callwork(sym_int,argc,argv); }
- V m_py_any(const t_symbol *s,I argc,t_atom *argv) { callwork(s,argc,argv); }
+ V m_py_list(I argc,const t_atom *argv) { callwork(sym_list,argc,argv); }
+ V m_py_float(I argc,const t_atom *argv) { callwork(sym_float,argc,argv); }
+ V m_py_int(I argc,const t_atom *argv) { callwork(sym_int,argc,argv); }
+ V m_py_any(const t_symbol *s,I argc,const t_atom *argv) { callwork(s,argc,argv); }
const t_symbol *funname;
PyObject *function;
@@ -72,7 +72,7 @@ private:
FLEXT_LIB_V("py",pyobj)
-pyobj::pyobj(I argc,t_atom *argv):
+pyobj::pyobj(I argc,const t_atom *argv):
function(NULL),funname(NULL)
{
PY_LOCK
@@ -139,7 +139,7 @@ pyobj::~pyobj()
-BL pyobj::m_method_(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyobj::m_method_(I n,const t_symbol *s,I argc,const t_atom *argv)
{
if(n == 1)
post("%s - no method for type %s",thisName(),GetString(s));
@@ -160,7 +160,7 @@ V pyobj::m_reload()
PY_UNLOCK
}
-V pyobj::m_reload_(I argc,t_atom *argv)
+V pyobj::m_reload_(I argc,const t_atom *argv)
{
PY_LOCK
SetArgs(argc,argv);
@@ -169,7 +169,7 @@ V pyobj::m_reload_(I argc,t_atom *argv)
m_reload();
}
-V pyobj::m_set(I argc,t_atom *argv)
+V pyobj::m_set(I argc,const t_atom *argv)
{
PY_LOCK
@@ -279,7 +279,7 @@ V pyobj::Reload()
}
-V pyobj::work(const t_symbol *s,I argc,t_atom *argv)
+V pyobj::work(const t_symbol *s,I argc,const t_atom *argv)
{
AtomList *rargs = NULL;
@@ -311,7 +311,7 @@ V pyobj::work(const t_symbol *s,I argc,t_atom *argv)
}
}
-V pyobj::callwork(const t_symbol *s,I argc,t_atom *argv)
+V pyobj::callwork(const t_symbol *s,I argc,const t_atom *argv)
{
if(detach) {
if(shouldexit)
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 8e971873..4df12c37 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -36,7 +36,7 @@ I pyext::pyextref = 0;
PyObject *pyext::class_obj = NULL;
PyObject *pyext::class_dict = NULL;
-pyext::pyext(I argc,t_atom *argv):
+pyext::pyext(I argc,const t_atom *argv):
pyobj(NULL),pythr(NULL),
inlets(0),outlets(0),
methname(NULL)
@@ -274,7 +274,7 @@ V pyext::m_reload()
PY_UNLOCK
}
-V pyext::m_reload_(I argc,t_atom *argv)
+V pyext::m_reload_(I argc,const t_atom *argv)
{
args(argc,argv);
m_reload();
@@ -336,7 +336,7 @@ V pyext::m_help()
post("");
}
-PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *argv)
+PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,const t_atom *argv)
{
PyObject *ret = NULL;
@@ -351,7 +351,7 @@ PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *arg
else {
ret = PyEval_CallObject(pmeth, pargs);
if (ret == NULL) // function not found resp. arguments not matching
-#ifdef _DEBUG
+#if 1 //def _DEBUG
PyErr_Print();
#else
PyErr_Clear();
@@ -384,7 +384,7 @@ V pyext::work_wrapper(V *data)
--thrcount;
}
-BL pyext::callwork(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyext::callwork(I n,const t_symbol *s,I argc,const t_atom *argv)
{
if(detach) {
if(shouldexit) {
@@ -401,7 +401,7 @@ BL pyext::callwork(I n,const t_symbol *s,I argc,t_atom *argv)
return work(n,s,argc,argv);
}
-BL pyext::work(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyext::work(I n,const t_symbol *s,I argc,const t_atom *argv)
{
BL retv = false;
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index 2aba0e8e..f0baf310 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -19,7 +19,7 @@ class pyext:
FLEXT_HEADER_S(pyext,py,setup)
public:
- pyext(I argc,t_atom *argv);
+ pyext(I argc,const t_atom *argv);
~pyext();
static PyObject *pyext__doc__(PyObject *,PyObject *args);
@@ -41,10 +41,10 @@ public:
protected:
BL m_method_(I n,const t_symbol *s,I argc,t_atom *argv);
- BL work(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL work(I n,const t_symbol *s,I argc,const t_atom *argv);
V m_reload();
- V m_reload_(I argc,t_atom *argv);
+ V m_reload_(I argc,const t_atom *argv);
V m_doc_();
virtual V m_help();
@@ -87,7 +87,7 @@ private:
// bool cmp(PyObject *s,PyObject *f) const { return self == s && func == f; }
// void init(PyObject *s,char *f) { self = s,func = f,nxt = NULL; }
// bool cmp(PyObject *s,char *f) const { return self == s && func == f; }
- static void px_method(py_proxy *c,const t_symbol *s,int argc,t_atom *argv);
+ static void px_method(py_proxy *c,const t_symbol *s,int argc,const t_atom *argv);
};
static py_proxy *px_head,*px_tail;
@@ -96,16 +96,16 @@ private:
// ---------------------------
- PyObject *call(const C *meth,I inlet,const t_symbol *s,I argc,t_atom *argv);
+ PyObject *call(const C *meth,I inlet,const t_symbol *s,I argc,const t_atom *argv);
V work_wrapper(void *data);
- BL callwork(I n,const t_symbol *s,I argc,t_atom *argv);
+ BL callwork(I n,const t_symbol *s,I argc,const t_atom *argv);
class work_data:
public flext::AtomAnything
{
public:
- work_data(I _n,const t_symbol *_s,I _argc,t_atom *_argv): n(_n),AtomAnything(_s,_argc,_argv) {}
+ work_data(I _n,const t_symbol *_s,I _argc,const t_atom *_argv): n(_n),AtomAnything(_s,_argc,_argv) {}
I n;
};