From ad9d49bf213f525d122656fc7dc55287b9ae00f0 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 15 Jul 2005 16:13:43 +0000 Subject: None returned by script will bang the output fixes for atomic pyext._outlet messages svn path=/trunk/; revision=3346 --- externals/grill/py/py.xcode/project.pbxproj | 86 ++++++++++++++++++++++++++++- externals/grill/py/source/clmeth.cpp | 27 ++++++--- externals/grill/py/source/py.cpp | 6 +- externals/grill/py/source/pyargs.cpp | 9 ++- 4 files changed, 113 insertions(+), 15 deletions(-) diff --git a/externals/grill/py/py.xcode/project.pbxproj b/externals/grill/py/py.xcode/project.pbxproj index 3bc57f99..d6d17c21 100644 --- a/externals/grill/py/py.xcode/project.pbxproj +++ b/externals/grill/py/py.xcode/project.pbxproj @@ -45,6 +45,11 @@ }; 08FB77ADFE841716C02AAC07 = { children = ( + E90043820887A302008AEAFC, + E90043830887A302008AEAFC, + E90043840887A302008AEAFC, + E90043850887A302008AEAFC, + E90043860887A302008AEAFC, E90E51DB08091989001341AC, E90E51DC08091989001341AC, E90E51DD08091989001341AC, @@ -130,6 +135,81 @@ //E92 //E93 //E94 + E90043820887A302008AEAFC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = pyatom.cpp; + path = source/pyatom.cpp; + refType = 4; + sourceTree = ""; + }; + E90043830887A302008AEAFC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = pyatom.h; + path = source/pyatom.h; + refType = 4; + sourceTree = ""; + }; + E90043840887A302008AEAFC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = pybase.cpp; + path = source/pybase.cpp; + refType = 4; + sourceTree = ""; + }; + E90043850887A302008AEAFC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = pybase.h; + path = source/pybase.h; + refType = 4; + sourceTree = ""; + }; + E90043860887A302008AEAFC = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = pymeth.cpp; + path = source/pymeth.cpp; + refType = 4; + sourceTree = ""; + }; + E90043870887A302008AEAFC = { + fileRef = E90043820887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E90043880887A302008AEAFC = { + fileRef = E90043830887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E90043890887A302008AEAFC = { + fileRef = E90043840887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E900438A0887A302008AEAFC = { + fileRef = E90043850887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E900438B0887A302008AEAFC = { + fileRef = E90043860887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; E90E51DB08091989001341AC = { fileEncoding = 30; isa = PBXFileReference; @@ -314,6 +394,8 @@ E90E52EB08092581001341AC, E90E52EC08092581001341AC, E90E52ED08092581001341AC, + E90043880887A302008AEAFC, + E900438A0887A302008AEAFC, ); isa = PBXHeadersBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -332,6 +414,9 @@ E90E52F60809258A001341AC, E90E52F70809258A001341AC, E90E52F80809258A001341AC, + E90043870887A302008AEAFC, + E90043890887A302008AEAFC, + E900438B0887A302008AEAFC, ); isa = PBXSourcesBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -367,7 +452,6 @@ HEADER_SEARCH_PATHS = "/usr/local/include/flext $(PDApp)/src"; INSTALL_PATH = "$(PDApp)/extra"; LIBRARY_STYLE = BUNDLE; - OPTIMIZATION_CFLAGS = ""; OTHER_CFLAGS = ""; OTHER_LDFLAGS = "-bundle_loader $(PDApp)/bin/pd"; OTHER_REZFLAGS = ""; diff --git a/externals/grill/py/source/clmeth.cpp b/externals/grill/py/source/clmeth.cpp index 37ba257e..3d740bcb 100644 --- a/externals/grill/py/source/clmeth.cpp +++ b/externals/grill/py/source/clmeth.cpp @@ -167,15 +167,26 @@ PyObject *pyext::pyext_outlet(PyObject *,PyObject *args) pyext *ext = GetThis(self); PyObject *val; - - bool tp = - sz == 3 && - PySequence_Check( - val = PyTuple_GET_ITEM(args,2) // borrow reference - ); + bool tp; +#if 0 + if(sz == 3) { + val = PyTuple_GET_ITEM(args,2); // borrow reference + Py_INCREF(val); + tp = PySequence_Check(val); + } + else + tp = false; if(!tp) - val = PySequence_GetSlice(args,2,sz); // new ref + val = PySequence_GetSlice(args,2,sz); // new ref +#else + if(sz == 3) { + val = PyTuple_GET_ITEM(args,2); // borrow reference + Py_INCREF(val); + } + else + val = PySequence_GetSlice(args,2,sz); // new ref +#endif int o = PyInt_AsLong(outl); if(o >= 1 && o <= ext->Outlets()) { @@ -190,7 +201,7 @@ PyObject *pyext::pyext_outlet(PyObject *,PyObject *args) else PyErr_SetString(PyExc_ValueError,"pyext - _outlet: index out of range"); - if(!tp) Py_DECREF(val); + Py_DECREF(val); } else PyErr_SetString(PyExc_SyntaxError,"pyext - Syntax: _outlet(self,outlet,args...)"); diff --git a/externals/grill/py/source/py.cpp b/externals/grill/py/source/py.cpp index 7cb7fa97..da9459fe 100644 --- a/externals/grill/py/source/py.cpp +++ b/externals/grill/py/source/py.cpp @@ -125,7 +125,7 @@ pyobj::pyobj(int argc,const t_atom *argv) int inlets; if(argc && CanbeInt(*argv)) { inlets = GetAInt(*argv); - if(inlets < 1) inlets = 1; + if(inlets < 0) inlets = 1; argv++,argc--; } else @@ -352,7 +352,7 @@ bool pyobj::callpy(PyObject *fun,PyObject *args) return false; } else { - if(ret != Py_None && !OutObject(this,0,ret) && PyErr_Occurred()) + if(!OutObject(this,0,ret) && PyErr_Occurred()) PyErr_Print(); Py_DECREF(ret); return true; @@ -384,7 +384,7 @@ bool pyobj::CbMethodResort(int n,const t_symbol *s,int argc,const t_atom *argv) PyObject *pargs; - if(objects) { + if(objects || CntIn() == 1) { int inlets = CntIn()-1; pargs = PyTuple_New(inlets); for(int i = 0; i < inlets; ++i) { diff --git a/externals/grill/py/source/pyargs.cpp b/externals/grill/py/source/pyargs.cpp index 5c903f17..2957801d 100644 --- a/externals/grill/py/source/pyargs.cpp +++ b/externals/grill/py/source/pyargs.cpp @@ -130,12 +130,15 @@ const t_symbol *pybase::GetPyArgs(AtomList &lst,PyObject *pValue,int offs) { if(pValue == NULL) return false; + // output bang on None returned + if(pValue == Py_None) return sym_bang; + // analyze return value or tuple int rargc = 0; retval tp = nothing; - if(PyString_Check(pValue)) { + if(PyString_Check(pValue) || pySymbol_Check(pValue)) { rargc = 1; tp = atom; } @@ -143,8 +146,8 @@ const t_symbol *pybase::GetPyArgs(AtomList &lst,PyObject *pValue,int offs) rargc = PySequence_Size(pValue); tp = sequ; } - else if(pValue != Py_None) { - rargc = 1; + else { + rargc = 1; tp = atom; } // else -- cgit v1.2.1