Update of /cvsroot/pure-data/externals/grill/py/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31148/source
Modified Files: modmeth.cpp pybase.h pybuffer.cpp Log Message: added message bundle functionality (pyext.Bundle class) enable compiled-only scripts (without .py) small optimizations and fixes small changes for numpy support enable module packages (module/__init__.py[co]), now also for Max compiler flag to exclude DSP objects some ASSERTs for explicitly created pyext classes (should be runtime checks i guess) added pyext._list and pyext._tuple to convert input lists to Python sequence objects let _inlets and _outlets default to 0
Index: pybase.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/py/source/pybase.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pybase.h 23 Mar 2006 01:42:05 -0000 1.11 --- pybase.h 3 Aug 2006 16:33:37 -0000 1.12 *************** *** 120,128 **** #endif
! #ifdef PY_NUMARRAY ! static void setupNumarray(); ! static PyObject *py_import(PyObject *,PyObject *args); ! static PyObject *py_export(PyObject *,PyObject *args); ! #endif
// ----thread stuff ------------ --- 120,125 ---- #endif
! static PyObject *py_list(PyObject *,PyObject *args); ! static PyObject *py_tuple(PyObject *,PyObject *args);
// ----thread stuff ------------
Index: modmeth.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/py/source/modmeth.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** modmeth.cpp 12 Dec 2005 00:18:42 -0000 1.22 --- modmeth.cpp 3 Aug 2006 16:33:37 -0000 1.23 *************** *** 3,7 **** py/pyext - python external object for PD and Max/MSP
! Copyright (c)2002-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. --- 3,7 ---- py/pyext - python external object for PD and Max/MSP
! Copyright (c)2002-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. *************** *** 28,36 **** { "_setvalue", pybase::py_setvalue, METH_VARARGS,"Set value of a 'value' object" }, #endif ! {NULL, NULL, 0, NULL} // sentinel };
const char *pybase::py_doc = ! "py/pyext - python external object for PD and Max/MSP, (C)2002-2005 Thomas Grill\n" "\n" "This is the pyext module. Available function:\n" --- 28,40 ---- { "_setvalue", pybase::py_setvalue, METH_VARARGS,"Set value of a 'value' object" }, #endif ! ! { "_list", pybase::py_list, METH_VARARGS,"Make a list from arguments" }, ! { "_tuple", pybase::py_tuple, METH_VARARGS,"Make a tuple from arguments" }, ! ! {NULL, NULL, 0, NULL} // sentinel };
const char *pybase::py_doc = ! "py/pyext - python external object for PD and Max/MSP, (C)2002-2006 Thomas Grill\n" "\n" "This is the pyext module. Available function:\n" *************** *** 43,46 **** --- 47,53 ---- "_getvalue(name): Get value of a 'value' object\n" "_setvalue(name,float): Set value of a 'value' object\n" + + "_list(args...): Make a list from args\n" + "_tuple(args...): Make a tuple from args\n" ;
*************** *** 241,242 **** --- 248,272 ---- } #endif + + PyObject *pybase::py_list(PyObject *,PyObject *args) + { + // should always be a tuple + FLEXT_ASSERT(PyTuple_Check(args)); + + const int sz = PyTuple_GET_SIZE(args); + PyObject *ret = PyList_New(sz); + for(int i = 0; i < sz; ++i) { + PyObject *el = PyTuple_GET_ITEM(args,i); + Py_INCREF(el); + PyList_SET_ITEM(ret,i,el); + } + return ret; + } + + PyObject *pybase::py_tuple(PyObject *,PyObject *args) + { + // should always be a tuple + FLEXT_ASSERT(PyTuple_Check(args)); + Py_INCREF(args); + return args; + }
Index: pybuffer.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/py/source/pybuffer.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pybuffer.cpp 19 Nov 2005 23:14:18 -0000 1.9 --- pybuffer.cpp 3 Aug 2006 16:33:37 -0000 1.10 *************** *** 14,18 ****
! #if defined(PY_NUMERIC) #define PY_ARRAYS 1 #elif defined(PY_NUMARRAY) --- 14,18 ----
! #if defined(PY_NUMERIC) || defined(PY_NUMPY) #define PY_ARRAYS 1 #elif defined(PY_NUMARRAY)