diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-09-26 13:59:59 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-09-26 13:59:59 +0000 |
commit | 4eb1464e5439332693a92ab76776b06d9b0c8700 (patch) | |
tree | 8b64a78801a2d3ac3857ffdc2a35407114565790 /externals/grill/py/source/pybuffer.h | |
parent | 0f849641afd27b4e7c9326fbcd402105fd62ced0 (diff) |
__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
svn path=/trunk/; revision=3637
Diffstat (limited to 'externals/grill/py/source/pybuffer.h')
-rw-r--r-- | externals/grill/py/source/pybuffer.h | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/externals/grill/py/source/pybuffer.h b/externals/grill/py/source/pybuffer.h index 1d59dd95..3889e563 100644 --- a/externals/grill/py/source/pybuffer.h +++ b/externals/grill/py/source/pybuffer.h @@ -1,52 +1,52 @@ -/*
-
-py/pyext - python script 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.
-
-*/
-
-#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;
-
+/* + +py/pyext - python script 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. + +*/ + +#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) +#define pySamplebuffer_CheckExact(op) ((op)->ob_type == &pySamplebuffer_Type) PY_EXPORT PyObject *pySamplebuffer_FromSymbol(const t_symbol *sym); @@ -61,19 +61,19 @@ inline PyObject *pySamplebuffer_FromString(PyObject *str) return pySamplebuffer_FromString(PyString_AsString(str)); } -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
+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 |