[PD-cvs] externals/grill/py/source clmeth.cpp, 1.26, 1.27 modmeth.cpp, 1.21, 1.22 pybase.cpp, 1.12, 1.13 pybase.h, 1.9, 1.10 pyext.h, 1.29, 1.30 pysymbol.cpp, 1.3, 1.4

Thomas Grill xovo at users.sourceforge.net
Mon Dec 12 01:18:44 CET 2005


Update of /cvsroot/pure-data/externals/grill/py/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22721/source

Modified Files:
	clmeth.cpp modmeth.cpp pybase.cpp pybase.h pyext.h 
	pysymbol.cpp 
Log Message:
__str__ method for pyext, to enable print self calls
added message bundle functionality (pyext.Bundle class)
enable symbol binding for all callables (not only functions and methods)
small optimizations and fixes
enable optimization of Python code in reease build
_isthreaded is now a data member instead of a method
more safety for calls where association python-pd has already been removed
fixes for pthreads V2


Index: clmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/clmeth.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** clmeth.cpp	21 Sep 2005 10:52:33 -0000	1.26
--- clmeth.cpp	12 Dec 2005 00:18:42 -0000	1.27
***************
*** 211,218 ****
          }
          else
!             val = PySequence_GetSlice(args,2,sz);  // new ref
  #endif
  
! 		int o = PyInt_AsLong(outl);
  		if(o >= 1 && o <= ext->Outlets()) {
              // offset outlet by signal outlets
--- 211,218 ----
          }
          else
!             val = PyTuple_GetSlice(args,2,sz);  // new ref
  #endif
  
! 		int o = PyInt_AS_LONG(outl);
  		if(o >= 1 && o <= ext->Outlets()) {
              // offset outlet by signal outlets

Index: pyext.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyext.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** pyext.h	21 Sep 2005 10:52:33 -0000	1.29
--- pyext.h	12 Dec 2005 00:18:42 -0000	1.30
***************
*** 45,48 ****
--- 45,50 ----
  	int Outlets() const { return outlets; }
  
+ 	static pyext *GetThis(PyObject *self);
+ 
  protected:
  
***************
*** 88,93 ****
      virtual PyObject *GetSig(int ix,bool in);
  
- 	static pyext *GetThis(PyObject *self);
- 
  private:
  	static void Setup(t_classid);
--- 90,93 ----

Index: modmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/modmeth.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** modmeth.cpp	9 Jul 2005 13:03:34 -0000	1.21
--- modmeth.cpp	12 Dec 2005 00:18:42 -0000	1.22
***************
*** 119,122 ****
--- 119,123 ----
  		PyObject *val;
  
+ #if 0
  		bool tp = 
              sz == 2 && 
***************
*** 127,133 ****
--- 128,144 ----
  		if(!tp)
  			val = PySequence_GetSlice(args,1,sz);  // new ref
+ #else
+         if(sz == 2) {
+             val = PyTuple_GET_ITEM(args,1); // borrow reference
+             Py_INCREF(val);
+         }
+         else
+             val = PySequence_GetSlice(args,1,sz);  // new ref
+ #endif
  
          AtomListStatic<16> lst;
          const t_symbol *sym = GetPyArgs(lst,val);
+ 		Py_DECREF(val);
+ 
  		if(sym) {
      		bool ok = Forward(recv,sym,lst.Count(),lst.Atoms());
***************
*** 136,152 ****
  				post("py/pyext - Receiver doesn't exist");
  #endif
  		}
! 		else if(PyErr_Occurred())
              PyErr_Print();
          else
  			post("py/pyext - No data to send");
! 
! 		if(!tp) Py_DECREF(val);
  	}
  	else
  		post("py/pyext - Send name is invalid");
! 
!     Py_INCREF(Py_None);
!     return Py_None;
  }
  
--- 147,172 ----
  				post("py/pyext - Receiver doesn't exist");
  #endif
+             Py_INCREF(Py_None);
+             return Py_None;
  		}
! /*
!         else if(PyErr_Occurred())
              PyErr_Print();
          else
  			post("py/pyext - No data to send");
! */
!         else {
!             FLEXT_ASSERT(PyErr_Occurred());
!             return NULL;
!         }
  	}
+ /*
  	else
  		post("py/pyext - Send name is invalid");
! */
!     else {
!         PyErr_SetString(PyExc_ValueError,"py/pyext - Send name is invalid");
!         return NULL;
!     }
  }
  

Index: pysymbol.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pysymbol.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pysymbol.cpp	9 Jul 2005 13:03:34 -0000	1.3
--- pysymbol.cpp	12 Dec 2005 00:18:42 -0000	1.4
***************
*** 37,42 ****
      else if(PyString_Check(arg))
          ((pySymbol *)self)->sym = flext::MakeSymbol(PyString_AS_STRING(arg));
!     else
          ret = -1;
      Py_DECREF(arg);
  
--- 37,44 ----
      else if(PyString_Check(arg))
          ((pySymbol *)self)->sym = flext::MakeSymbol(PyString_AS_STRING(arg));
!     else {
!         PyErr_SetString(PyExc_TypeError,"string or symbol argument expected");
          ret = -1;
+     }
      Py_DECREF(arg);
  

Index: pybase.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pybase.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pybase.h	26 Sep 2005 13:59:59 -0000	1.9
--- pybase.h	12 Dec 2005 00:18:42 -0000	1.10
***************
*** 15,18 ****
--- 15,19 ----
  #include "pysymbol.h"
  #include "pybuffer.h"
+ #include "pybundle.h"
  
  class pybase

Index: pybase.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pybase.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** pybase.cpp	6 Dec 2005 21:54:32 -0000	1.12
--- pybase.cpp	12 Dec 2005 00:18:42 -0000	1.13
***************
*** 95,98 ****
--- 95,99 ----
  void initsymbol();
  void initsamplebuffer();
+ void initbundle();
  
  void pybase::lib_setup()
***************
*** 187,190 ****
--- 188,195 ----
      PyModule_AddObject(module_obj,"Buffer",(PyObject *)&pySamplebuffer_Type);
  
+     // add message bundle type
+     initbundle();
+     PyModule_AddObject(module_obj,"Bundle",(PyObject *)&pyBundle_Type);
+ 
  	// -------------------------------------------------------------
  





More information about the Pd-cvs mailing list