aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-12-05 05:36:32 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-12-05 05:36:32 +0000
commit60ee6bb60b11bbfbccf56f335c9c6213e6daa79d (patch)
tree99b0c72c60aeba5d1a0489aae9edd16f371d965c /externals/grill/py/source
parentbbd9d289d152f6ef085dec680f0b1611c29f0e32 (diff)
""
svn path=/trunk/; revision=278
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r--externals/grill/py/source/clmeth.cpp10
-rw-r--r--externals/grill/py/source/main.cpp6
-rw-r--r--externals/grill/py/source/main.h7
-rw-r--r--externals/grill/py/source/modmeth.cpp20
-rw-r--r--externals/grill/py/source/py.cpp2
-rw-r--r--externals/grill/py/source/pyext.cpp12
-rw-r--r--externals/grill/py/source/pyext.h2
7 files changed, 32 insertions, 27 deletions
diff --git a/externals/grill/py/source/clmeth.cpp b/externals/grill/py/source/clmeth.cpp
index 0a30d1f7..283f52e9 100644
--- a/externals/grill/py/source/clmeth.cpp
+++ b/externals/grill/py/source/clmeth.cpp
@@ -230,7 +230,6 @@ PyObject *pyext::pyext_tocanvas(PyObject *,PyObject *args)
if(self && PyInstance_Check(self)) {
pyext *ext = GetThis(self);
-#ifdef PD
I sz = PySequence_Size(args);
PyObject *val;
BL tp = sz == 2 && PySequence_Check(PyTuple_GetItem(args,1));
@@ -245,13 +244,13 @@ PyObject *pyext::pyext_tocanvas(PyObject *,PyObject *args)
t_glist *gl = ext->thisCanvas(); //canvas_getcurrent();
t_class **cl = (t_pd *)gl;
if(cl) {
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
pd_forwardmess(cl,lst->Count(),lst->Atoms());
#else
- #pragma message ("Send is not implemented")
+#pragma message ("Send is not implemented")
#endif
}
-#ifdef _DEBUG
+#ifdef FLEXT_DEBUG
else
post("pyext - no parent canvas?!");
#endif
@@ -262,9 +261,6 @@ PyObject *pyext::pyext_tocanvas(PyObject *,PyObject *args)
if(lst) delete lst;
if(!tp) Py_DECREF(val);
-#else
-#pragma message ("Not implemented for MaxMSP")
-#endif
}
}
diff --git a/externals/grill/py/source/main.cpp b/externals/grill/py/source/main.cpp
index 2522ff51..a0e77cef 100644
--- a/externals/grill/py/source/main.cpp
+++ b/externals/grill/py/source/main.cpp
@@ -181,7 +181,7 @@ V py::ReloadModule()
V py::GetModulePath(const C *mod,C *dir,I len)
{
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
// uarghh... pd doesn't show it's path for extra modules
C *name;
@@ -191,7 +191,9 @@ V py::GetModulePath(const C *mod,C *dir,I len)
// if dir is current working directory... name points to dir
if(dir == name) strcpy(dir,".");
-#elif defined(MAXMSP)
+#elif FLEXT_SYS == FLEXT_SYS_MAX
+ // how do i get the path in Max/MSP?
+#else
*dir = 0;
#endif
}
diff --git a/externals/grill/py/source/main.h b/externals/grill/py/source/main.h
index b4096819..eaa9f7b6 100644
--- a/externals/grill/py/source/main.h
+++ b/externals/grill/py/source/main.h
@@ -13,12 +13,13 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
#include <Python.h>
-#ifndef NT
+
+#if FLEXT_OS == FLEXT_LINUX || FLEXT_OS == FLEXT_IRIX
#include <unistd.h>
#endif
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
-#error You need at least flext version 0.4.0
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
#endif
#define PY__VERSION "0.1.1"
diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp
index b7d2cab0..50d4ac81 100644
--- a/externals/grill/py/source/modmeth.cpp
+++ b/externals/grill/py/source/modmeth.cpp
@@ -101,20 +101,26 @@ PyObject *py::py_blocksize(PyObject *self,PyObject *args)
PyObject *py::py_inchannels(PyObject *self,PyObject *args)
{
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
I ch = sys_get_inchannels();
-#else // MAXMSP
+#elif FLEXT_SYS == FLEXT_SYS_MAX
I ch = sys_getch(); // not functioning
+#else
+#pragma message("Not implemented!")
+ ch = 0;
#endif
return PyLong_FromLong(ch);
}
PyObject *py::py_outchannels(PyObject *self,PyObject *args)
{
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
I ch = sys_get_outchannels();
-#else // MAXMSP
+#elif FLEXT_SYS == FLEXT_SYS_MAX
I ch = sys_getch(); // not functioning
+#else
+#pragma message("Not implemented!")
+ ch = 0;
#endif
return PyLong_FromLong(ch);
}
@@ -139,13 +145,13 @@ PyObject *py::py_send(PyObject *,PyObject *args)
// t_class **cl = (t_class **)GetBound(recv);
t_class **cl = (t_class **)recv->s_thing;
if(cl) {
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
pd_forwardmess(cl,lst->Count(),lst->Atoms());
#else
- #pragma message ("Send is not implemented")
+#pragma message ("Send is not implemented")
#endif
}
-#ifdef _DEBUG
+#ifdef FLEXT_DEBUG
else
post("py/pyext - Receiver doesn't exist");
#endif
diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp
index eff88daf..f6127716 100644
--- a/externals/grill/py/source/py.cpp
+++ b/externals/grill/py/source/py.cpp
@@ -218,7 +218,7 @@ V pyobj::m_help()
{
post("");
post("py %s - python script object, (C)2002 Thomas Grill",PY__VERSION);
-#ifdef _DEBUG
+#ifdef FLEXT_DEBUG
post("compiled on " __DATE__ " " __TIME__);
#endif
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index 4df12c37..8bff5913 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -85,7 +85,7 @@ pyext::pyext(I argc,const t_atom *argv):
// init script module
if(argc >= 1) {
C dir[1024];
-#ifdef PD
+#if FLEXT_SYS == FLEXT_SYS_PD
// add dir of current patch to path
strcpy(dir,GetString(canvas_getdir(thisCanvas())));
AddToPath(dir);
@@ -93,7 +93,7 @@ pyext::pyext(I argc,const t_atom *argv):
strcpy(dir,GetString(canvas_getcurrentdir()));
AddToPath(dir);
#else
- #pragma message("Adding current dir to path is not implemented")
+#pragma message("Adding current dir to path is not implemented")
#endif
GetModulePath(GetString(argv[0]),dir,sizeof(dir));
@@ -298,7 +298,7 @@ V pyext::m_doc_()
-BL pyext::m_method_(I n,const t_symbol *s,I argc,t_atom *argv)
+BL pyext::m_method_(I n,const t_symbol *s,I argc,const t_atom *argv)
{
if(pyobj && n >= 1) {
return callwork(n,s,argc,argv);
@@ -314,7 +314,7 @@ V pyext::m_help()
{
post("");
post("pyext %s - python script object, (C)2002 Thomas Grill",PY__VERSION);
-#ifdef _DEBUG
+#ifdef FLEXT_DEBUG
post("compiled on " __DATE__ " " __TIME__);
#endif
@@ -351,7 +351,7 @@ PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,const t_ato
else {
ret = PyEval_CallObject(pmeth, pargs);
if (ret == NULL) // function not found resp. arguments not matching
-#if 1 //def _DEBUG
+#if 1 //def FLEXT_DEBUG
PyErr_Print();
#else
PyErr_Clear();
@@ -371,7 +371,7 @@ PyObject *pyext::call(const C *meth,I inlet,const t_symbol *s,I argc,const t_ato
V pyext::work_wrapper(V *data)
{
++thrcount;
-#ifdef _DEBUG
+#ifdef FLEXT_DEBUG
if(!data)
post("%s - no data!",thisName());
else
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index f0baf310..d804d825 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -39,7 +39,7 @@ public:
I Outlets() const { return outlets; }
protected:
- BL m_method_(I n,const t_symbol *s,I argc,t_atom *argv);
+ virtual BL m_method_(I n,const t_symbol *s,I argc,const t_atom *argv);
BL work(I n,const t_symbol *s,I argc,const t_atom *argv);