From 53c16e06983f9b03464f41b8c0ed3206382c5538 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 9 Jan 2005 04:59:30 +0000 Subject: support for Python threads, at last small fixes merged in 20041229-newdetach branch. renamed locking functions svn path=/trunk/; revision=2483 --- externals/grill/py/source/pyargs.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'externals/grill/py/source/pyargs.cpp') diff --git a/externals/grill/py/source/pyargs.cpp b/externals/grill/py/source/pyargs.cpp index 3c2d3c35..90686a90 100644 --- a/externals/grill/py/source/pyargs.cpp +++ b/externals/grill/py/source/pyargs.cpp @@ -2,7 +2,7 @@ py/pyext - python external object for PD and MaxMSP -Copyright (c)2002-2004 Thomas Grill (gr@grrrr.org) +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. @@ -21,13 +21,13 @@ static PyObject *MakePyAtom(const t_atom &at) return (double)ival == fval?PyInt_FromLong(ival):PyFloat_FromDouble(fval); } // these following should never happen - else if(flext::IsFloat(at)) return PyFloat_FromDouble((D)flext::GetFloat(at)); + else if(flext::IsFloat(at)) return PyFloat_FromDouble((double)flext::GetFloat(at)); else if(flext::IsInt(at)) return PyInt_FromLong(flext::GetInt(at)); return NULL; } -PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,I inlet,BL withself) +PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,int inlet,bool withself) { PyObject *pArgs; @@ -40,10 +40,10 @@ PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,I inlet,B else */ { - BL any = IsAnything(s); + bool any = IsAnything(s); pArgs = PyTuple_New(argc+(any?1:0)+(inlet >= 0?1:0)); - I pix = 0; + int pix = 0; if(inlet >= 0) { PyObject *pValue = PyInt_FromLong(inlet); @@ -52,7 +52,7 @@ PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,I inlet,B PyTuple_SetItem(pArgs, pix++, pValue); } - I ix; + int ix; PyObject *tmp; if(!withself || argc < (any?1:2)) tmp = pArgs,ix = pix; else tmp = PyTuple_New(argc+(any?1:0)),ix = 0; @@ -64,7 +64,7 @@ PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,I inlet,B PyTuple_SetItem(tmp, ix++, pValue); } - for(I i = 0; i < argc; ++i) { + for(int i = 0; i < argc; ++i) { PyObject *pValue = MakePyAtom(argv[i]); if(!pValue) { post("py/pyext: cannot convert argument %i",any?i+1:i); @@ -95,8 +95,8 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self) // analyze return value or tuple - I rargc = 0; - BL ok = true; + int rargc = 0; + bool ok = true; retval tp = nothing; if(PyString_Check(pValue)) { @@ -116,7 +116,7 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self) ret = new AtomList(rargc); - for(I ix = 0; ix < rargc; ++ix) { + for(int ix = 0; ix < rargc; ++ix) { PyObject *arg; if(tp == sequ) arg = PySequence_GetItem(pValue,ix); // new reference @@ -125,7 +125,7 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self) if(PyInt_Check(arg)) SetInt((*ret)[ix],PyInt_AsLong(arg)); else if(PyLong_Check(arg)) SetInt((*ret)[ix],PyLong_AsLong(arg)); - else if(PyFloat_Check(arg)) SetFloat((*ret)[ix],(F)PyFloat_AsDouble(arg)); + else if(PyFloat_Check(arg)) SetFloat((*ret)[ix],(float)PyFloat_AsDouble(arg)); else if(PyString_Check(arg)) SetString((*ret)[ix],PyString_AsString(arg)); else if(ix == 0 && self && PyInstance_Check(arg)) { // assumed to be self ... that should be checked _somehow_ !!! @@ -135,7 +135,7 @@ flext::AtomList *py::GetPyArgs(PyObject *pValue,PyObject **self) else { PyObject *tp = PyObject_Type(arg); PyObject *stp = tp?PyObject_Str(tp):NULL; - C *tmp = ""; + char *tmp = ""; if(stp) tmp = PyString_AsString(stp); post("py/pyext: Could not convert argument %s",tmp); Py_XDECREF(stp); -- cgit v1.2.1