[PD-cvs] externals/grill/py/source pybase.cpp, 1.10, 1.11 pybase.h, 1.8, 1.9 pybuffer.h, 1.1, 1.2 pyext.cpp, 1.42, 1.43 pysymbol.h, 1.3, 1.4

Thomas Grill xovo at users.sourceforge.net
Mon Sep 26 16:00:01 CEST 2005


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

Modified Files:
	pybase.cpp pybase.h pybuffer.h pyext.cpp pysymbol.h 
Log Message:
__str__ method for pyext, to enable print self calls
enable symbol binding for all callables (not only functions and methods)
enable optimization of Python code in reease build
_isthreaded is now a data member instead of a method
compiler flag to exclude DSP objects
some cleanups
pyext: fix for missing __init__ attribute
some optimizations and py reload fix
some ASSERTs for explicitly created pyext classes (should be runtime checks i guess)
more safety for calls where association python-pd has already been removed
fixed typos
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.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** pybase.h	11 Aug 2005 15:00:58 -0000	1.8
--- pybase.h	26 Sep 2005 13:59:59 -0000	1.9
***************
*** 82,86 ****
  
      void OpenEditor();
!     void Respond(bool b);
  
      void Report() { while(PyErr_Occurred()) PyErr_Print(); }
--- 82,94 ----
  
      void OpenEditor();
! 
!     void Respond(bool b)
!     { 
!         if(respond) { 
!             t_atom a; 
!             SetBool(a,b); 
!             DumpOut(sym_response,1,&a); 
!         } 
!     }
  
      void Report() { while(PyErr_Occurred()) PyErr_Print(); }
***************
*** 159,163 ****
      static void thrworker(thr_params *data); 
  
!     bool qucall(PyObject *fun,PyObject *args);
  
      static void quworker(thr_params *);
--- 167,178 ----
      static void thrworker(thr_params *data); 
  
!     bool qucall(PyObject *fun,PyObject *args)
!     {
!         FifoEl *el = qufifo.New();
!         el->Set(this,fun,args);
!         qufifo.Put(el);
!         qucond.Signal();
!         return true;
!     }
  
      static void quworker(thr_params *);
***************
*** 170,173 ****
--- 185,189 ----
  
      static const t_symbol *sym_fint; // float or int symbol, depending on native number message type
+     static const t_symbol *sym_response;
  
      static const t_symbol *getone(t_atom &at,PyObject *arg);

Index: pybase.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pybase.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pybase.cpp	21 Sep 2005 10:52:33 -0000	1.10
--- pybase.cpp	26 Sep 2005 13:59:59 -0000	1.11
***************
*** 76,79 ****
--- 76,80 ----
  
  const t_symbol *pybase::sym_fint = NULL;
+ const t_symbol *pybase::sym_response = NULL;
  
  // -----------------------------------------------------------------------------------------------------------
***************
*** 84,89 ****
  
  void pybase::lib_setup()
! {
! 	post("");
  	post("------------------------------------------------");
  	post("py/pyext %s - python script objects",PY__VERSION);
--- 85,90 ----
  
  void pybase::lib_setup()
! {   
!     post("");
  	post("------------------------------------------------");
  	post("py/pyext %s - python script objects",PY__VERSION);
***************
*** 99,102 ****
--- 100,113 ----
  	// -------------------------------------------------------------
  
+     sym_response = flext::MakeSymbol("response");
+ 
+ #if FLEXT_SYS == FLEXT_SYS_PD
+     sym_fint = sym_float;
+ #else
+     sym_fint = sym_int;
+ #endif
+ 
+ 	// -------------------------------------------------------------
+ 
  	Py_Initialize();
  
***************
*** 164,173 ****
      PyModule_AddObject(module_obj,"Buffer",(PyObject *)&pySamplebuffer_Type);
  
- #if FLEXT_SYS == FLEXT_SYS_PD
-     sym_fint = sym_float;
- #else
-     sym_fint = sym_int;
- #endif
- 
  	// -------------------------------------------------------------
  
--- 175,178 ----
***************
*** 549,563 ****
  }
  
- static const t_symbol *sym_response = flext::MakeSymbol("response");
- 
- void pybase::Respond(bool b) 
- { 
-     if(respond) { 
-         t_atom a; 
-         SetBool(a,b); 
-         DumpOut(sym_response,1,&a); 
-     } 
- }
- 
  void pybase::Reload()
  {
--- 554,557 ----
***************
*** 726,738 ****
  }
  
- bool pybase::qucall(PyObject *fun,PyObject *args)
- {
-     FifoEl *el = qufifo.New();
-     el->Set(this,fun,args);
-     qufifo.Put(el);
-     qucond.Signal();
-     return true;
- }
- 
  void pybase::quworker(thr_params *)
  {
--- 720,723 ----

Index: pyext.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyext.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** pyext.cpp	20 Sep 2005 20:50:40 -0000	1.42
--- pyext.cpp	26 Sep 2005 13:59:59 -0000	1.43
***************
*** 260,263 ****
--- 260,265 ----
              Py_DECREF(init);
  	    }
+             // __init__ has not been found - don't care
+             PyErr_Clear();
          
  	    Py_DECREF(pargs);

Index: pysymbol.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pysymbol.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pysymbol.h	9 Mar 2005 04:58:11 -0000	1.3
--- pysymbol.h	26 Sep 2005 13:59:59 -0000	1.4
***************
*** 52,56 ****
  
  #define pySymbol_Check(op) PyObject_TypeCheck(op, &pySymbol_Type)
! #define pySymbol_CheckExact(op) ((op)->ob_type == &PySymbol_Type)
  
  
--- 52,56 ----
  
  #define pySymbol_Check(op) PyObject_TypeCheck(op, &pySymbol_Type)
! #define pySymbol_CheckExact(op) ((op)->ob_type == &pySymbol_Type)
  
  

Index: pybuffer.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pybuffer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pybuffer.h	9 Mar 2005 04:58:11 -0000	1.1
--- pybuffer.h	26 Sep 2005 13:59:59 -0000	1.2
***************
*** 1,51 ****
! /* 
! 
! py/pyext - python script object for PD and Max/MSP
! 
! Copyright (c)2002-2005 Thomas Grill (gr at grrrr.org)
! For information on usage and redistribution, and for a DISCLAIMER OF ALL
! WARRANTIES, see the file, "license.txt," in this distribution.  
! 
! */
! 
! #ifndef __PYBUFFER_H
! #define __PYBUFFER_H
! 
! #include <flext.h>
! 
! #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500)
! #error You need at least flext version 0.5.0
! #endif
! 
! #if FLEXT_OS == FLEXT_OS_MAC
! #include <Python/Python.h>
! #else
! #include <Python.h>
! #endif
! 
! 
! #ifdef _MSC_VER
!     #ifdef PY_EXPORTS
!         #define PY_EXPORT __declspec(dllexport)
!     #else
!         #define PY_EXPORT __declspec(dllimport)
!     #endif
! #else
!     #define PY_EXPORT
! #endif
! 
! typedef struct {
!     PyObject_HEAD
!     /* Type-specific fields go here. */
!     const t_symbol *sym;
!     flext::buffer *buf;
!     flext::buffer::lock_t lock;
!     bool dirty;
! } pySamplebuffer;
! 
! PY_EXPORT extern PyTypeObject pySamplebuffer_Type;
! 
  #define pySamplebuffer_Check(op) PyObject_TypeCheck(op, &pySamplebuffer_Type)
! #define pySamplebuffer_CheckExact(op) ((op)->ob_type == &PySamplebuffer_Type)
  
  
--- 1,51 ----
! /* 
! 
! py/pyext - python script object for PD and Max/MSP
! 
! Copyright (c)2002-2005 Thomas Grill (gr at grrrr.org)
! For information on usage and redistribution, and for a DISCLAIMER OF ALL
! WARRANTIES, see the file, "license.txt," in this distribution.  
! 
! */
! 
! #ifndef __PYBUFFER_H
! #define __PYBUFFER_H
! 
! #include <flext.h>
! 
! #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500)
! #error You need at least flext version 0.5.0
! #endif
! 
! #if FLEXT_OS == FLEXT_OS_MAC
! #include <Python/Python.h>
! #else
! #include <Python.h>
! #endif
! 
! 
! #ifdef _MSC_VER
!     #ifdef PY_EXPORTS
!         #define PY_EXPORT __declspec(dllexport)
!     #else
!         #define PY_EXPORT __declspec(dllimport)
!     #endif
! #else
!     #define PY_EXPORT
! #endif
! 
! typedef struct {
!     PyObject_HEAD
!     /* Type-specific fields go here. */
!     const t_symbol *sym;
!     flext::buffer *buf;
!     flext::buffer::lock_t lock;
!     bool dirty;
! } pySamplebuffer;
! 
! PY_EXPORT extern PyTypeObject pySamplebuffer_Type;
! 
  #define pySamplebuffer_Check(op) PyObject_TypeCheck(op, &pySamplebuffer_Type)
! #define pySamplebuffer_CheckExact(op) ((op)->ob_type == &pySamplebuffer_Type)
  
  
***************
*** 62,79 ****
  }
  
! inline const t_symbol *pySamplebuffer_AS_SYMBOL(PyObject *op) 
! {
!     return ((pySamplebuffer *)op)->sym;
! }
! 
! inline const t_symbol *pySamplebuffer_AsSymbol(PyObject *op) 
! {
!     return pySamplebuffer_Check(op)?pySamplebuffer_AS_SYMBOL(op):NULL;
! }
! 
! inline const char *pySamplebuffer_AS_STRING(PyObject *op) 
! {
!     return flext::GetString(pySamplebuffer_AS_SYMBOL(op));
! }
! 
! #endif
--- 62,79 ----
  }
  
! inline const t_symbol *pySamplebuffer_AS_SYMBOL(PyObject *op) 
! {
!     return ((pySamplebuffer *)op)->sym;
! }
! 
! inline const t_symbol *pySamplebuffer_AsSymbol(PyObject *op) 
! {
!     return pySamplebuffer_Check(op)?pySamplebuffer_AS_SYMBOL(op):NULL;
! }
! 
! inline const char *pySamplebuffer_AS_STRING(PyObject *op) 
! {
!     return flext::GetString(pySamplebuffer_AS_SYMBOL(op));
! }
! 
! #endif





More information about the Pd-cvs mailing list