Update of /cvsroot/pure-data/externals/grill/py/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21556/source
Modified Files:
main.cpp main.h modmeth.cpp py.cpp pyargs.cpp
Log Message:
""
Index: pyargs.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyargs.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** pyargs.cpp 31 Aug 2004 04:07:35 -0000 1.7
--- pyargs.cpp 20 Sep 2004 04:06:08 -0000 1.8
***************
*** 108,112 ****
tp = sequ;
}
! else {
rargc = 1;
tp = atom;
--- 108,114 ----
tp = sequ;
}
! else if(pValue == Py_None)
! Py_DECREF(pValue);
! else {
rargc = 1;
tp = atom;
Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/main.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** main.cpp 31 Aug 2004 04:07:35 -0000 1.15
--- main.cpp 20 Sep 2004 04:06:08 -0000 1.16
***************
*** 22,26 ****
post("");
post("py/pyext %s - python script objects, (C)2002-2004 Thomas Grill",PY__VERSION);
! post("");
// -------------------------------------------------------------
--- 22,29 ----
post("");
post("py/pyext %s - python script objects, (C)2002-2004 Thomas Grill",PY__VERSION);
! #ifdef FLEXT_DEBUG
! post("DEBUG version compiled on %s %s",__DATE__,__TIME__);
! #endif
! post("");
// -------------------------------------------------------------
***************
*** 28,34 ****
Py_Initialize();
! #if 0 //def FLEXT_DEBUG
Py_DebugFlag = 1;
! Py_VerboseFlag = 1;
#endif
--- 31,37 ----
Py_Initialize();
! #ifdef FLEXT_DEBUG
Py_DebugFlag = 1;
! // Py_VerboseFlag = 1;
#endif
Index: modmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/modmeth.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** modmeth.cpp 31 Aug 2004 04:07:35 -0000 1.10
--- modmeth.cpp 20 Sep 2004 04:06:08 -0000 1.11
***************
*** 20,27 ****
#endif
! { "_samplerate", py::py_samplerate, 0,"Get system sample rate" },
! { "_blocksize", py::py_blocksize, 0,"Get system block size" },
! { "_inchannels", py::py_inchannels, 0,"Get number of audio in channels" },
! { "_outchannels", py::py_outchannels, 0,"Get number of audio out channels" },
{NULL, NULL, 0, NULL} // sentinel
--- 20,32 ----
#endif
! { "_samplerate", py::py_samplerate, METH_NOARGS,"Get system sample rate" },
! { "_blocksize", py::py_blocksize, METH_NOARGS,"Get system block size" },
! { "_inchannels", py::py_inchannels, METH_NOARGS,"Get number of audio in channels" },
! { "_outchannels", py::py_outchannels, METH_NOARGS,"Get number of audio out channels" },
!
! #if FLEXT_SYS == FLEXT_SYS_PD
! { "_getvalue", py::py_getvalue, METH_VARARGS,"Get value of a 'value' object" },
! { "_setvalue", py::py_setvalue, METH_VARARGS,"Set value of a 'value' object" },
! #endif
{NULL, NULL, 0, NULL} // sentinel
***************
*** 40,43 ****
--- 45,50 ----
"_inchannels(): Get number of audio in channels\n"
"_outchannels(): Get number of audio out channels\n"
+ "_getvalue(name): Get value of a 'value' object\n"
+ "_setvalue(name,float): Set value of a 'value' object\n"
;
***************
*** 187,190 ****
--- 194,243 ----
#endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ PyObject *py::py_getvalue(PyObject *self,PyObject *args)
+ {
+ FLEXT_ASSERT(PyTuple_Check(args));
+
+ PyObject *ret;
+ PyObject *name = PyTuple_GetItem(args,0); // borrowed reference
+
+ if(name && PyString_Check(name)) {
+ const t_symbol *sym = MakeSymbol(PyString_AsString(name));
+
+ float f;
+ if(value_getfloat(const_cast<t_symbol *>(sym),&f)) {
+ post("py/pyext - Could not get value '%s'",GetString(sym));
+ Py_INCREF(ret = Py_None);
+ }
+ else
+ ret = PyFloat_FromDouble(f);
+ }
+ else {
+ post("py/pyext - Syntax: _getvalue [name]");
+ Py_INCREF(ret = Py_None);
+ }
+ return ret;
+ }
+
+ PyObject *py::py_setvalue(PyObject *self,PyObject *args)
+ {
+ FLEXT_ASSERT(PyTuple_Check(args));
+
+ PyObject *name = PyTuple_GetItem(args,0); // borrowed reference
+ PyObject *val = PyTuple_GetItem(args,1); // borrowed reference
+ if(name && val && PyString_Check(name) && PyNumber_Check(val)) {
+ const t_symbol *sym = MakeSymbol(PyString_AsString(name));
+ float f = (float)PyFloat_AsDouble(val);
+
+ if(value_setfloat(const_cast<t_symbol *>(sym),f))
+ post("py/pyext - Could not set value '%s'",GetString(sym));
+ }
+ else
+ post("py/pyext - Syntax: _setvalue [name] [value]");
+
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ #endif
Index: main.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/main.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** main.h 21 Aug 2004 04:13:48 -0000 1.21
--- main.h 20 Sep 2004 04:06:08 -0000 1.22
***************
*** 116,119 ****
--- 116,123 ----
static PyObject *py_inchannels(PyObject *,PyObject *args);
static PyObject *py_outchannels(PyObject *,PyObject *args);
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ static PyObject *py_getvalue(PyObject *,PyObject *args);
+ static PyObject *py_setvalue(PyObject *,PyObject *args);
+ #endif
// ----thread stuff ------------
Index: py.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/py.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** py.cpp 21 Aug 2004 04:13:48 -0000 1.13
--- py.cpp 20 Sep 2004 04:06:08 -0000 1.14
***************
*** 322,326 ****
// call to outlet _outside_ the Mutex lock!
// otherwise (if not detached) deadlock will occur
! ToOutList(0,*rargs);
delete rargs;
}
--- 322,326 ----
// call to outlet _outside_ the Mutex lock!
// otherwise (if not detached) deadlock will occur
! if(rargs->Count()) ToOutList(0,*rargs);
delete rargs;
}