diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2007-03-07 13:40:14 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2007-03-07 13:40:14 +0000 |
commit | 03c7468fcc51888c8271b904e4d6400ed5c1cbb1 (patch) | |
tree | 411627e2da0f574bba30fb6d6a5b772bff07e448 /externals/grill/py/source/pysymbol.h | |
parent | 2f2aaa03a0ace959c6ff911d8b11b45f143c7d6e (diff) |
multiply inlets for py (hot and cold inlets)
small optimizations and fixes
use PyGILState_\*() functionality (enabled with PY_USE_GIL)
updates for DSP processing
__str__ method for pyext, to enable print self calls
added message bundle functionality (pyext.Bundle class)
enable compiled-only scripts (without .py)
enable optimization of Python code in reease build
let _inlets and _outlets default to 0
fix for numpy
some ASSERTs for explicitly created pyext classes (should be runtime checks i guess)
open editor for script under OS X
fixing numpy initialization quirks
enable symbol binding for all callables (not only functions and methods)
_isthreaded is now a data member instead of a method
fix for gcc4
added pyext._list and pyext._tuple to convert input lists to Python sequence objects
enable module packages (module/__init__.py[co]), now also for Max
python-like dotted module.function syntax
cleaned up float vs. int pyext tags
compiler flag to exclude DSP objects
some optimizations and py reload fix
more safety for calls where association python-pd has already been removed
always run Python interpreter in the background
svn path=/trunk/; revision=7474
Diffstat (limited to 'externals/grill/py/source/pysymbol.h')
-rw-r--r-- | externals/grill/py/source/pysymbol.h | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/externals/grill/py/source/pysymbol.h b/externals/grill/py/source/pysymbol.h index 42f6765c..3de4cb00 100644 --- a/externals/grill/py/source/pysymbol.h +++ b/externals/grill/py/source/pysymbol.h @@ -1,55 +1,55 @@ -/*
-
-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 __PYSYMBOL_H
-#define __PYSYMBOL_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;
-} pySymbol;
-
-PY_EXPORT extern PyTypeObject pySymbol_Type;
-
-PY_EXPORT extern pySymbol *pySymbol__;
-PY_EXPORT extern pySymbol *pySymbol_bang;
-PY_EXPORT extern pySymbol *pySymbol_list;
-PY_EXPORT extern pySymbol *pySymbol_symbol;
-PY_EXPORT extern pySymbol *pySymbol_float;
-PY_EXPORT extern pySymbol *pySymbol_int;
-
-
+/* + +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 __PYSYMBOL_H +#define __PYSYMBOL_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; +} pySymbol; + +PY_EXPORT extern PyTypeObject pySymbol_Type; + +PY_EXPORT extern pySymbol *pySymbol__; +PY_EXPORT extern pySymbol *pySymbol_bang; +PY_EXPORT extern pySymbol *pySymbol_list; +PY_EXPORT extern pySymbol *pySymbol_symbol; +PY_EXPORT extern pySymbol *pySymbol_float; +PY_EXPORT extern pySymbol *pySymbol_int; + + #define pySymbol_Check(op) PyObject_TypeCheck(op, &pySymbol_Type) #define pySymbol_CheckExact(op) ((op)->ob_type == &pySymbol_Type) @@ -66,27 +66,27 @@ inline PyObject *pySymbol_FromString(PyObject *str) return pySymbol_FromString(PyString_AsString(str)); } -inline const t_symbol *pySymbol_AS_SYMBOL(PyObject *op)
-{
- return ((pySymbol *)op)->sym;
-}
-
-inline const t_symbol *pySymbol_AsSymbol(PyObject *op)
-{
- return pySymbol_Check(op)?pySymbol_AS_SYMBOL(op):NULL;
-}
-
-inline const char *pySymbol_AS_STRING(PyObject *op)
-{
- return flext::GetString(pySymbol_AS_SYMBOL(op));
-}
-
-inline const t_symbol *pyObject_AsSymbol(PyObject *op)
-{
- if(PyString_Check(op))
- return flext::MakeSymbol(PyString_AS_STRING(op));
- else
- return pySymbol_AsSymbol(op);
-}
-
-#endif
+inline const t_symbol *pySymbol_AS_SYMBOL(PyObject *op) +{ + return ((pySymbol *)op)->sym; +} + +inline const t_symbol *pySymbol_AsSymbol(PyObject *op) +{ + return pySymbol_Check(op)?pySymbol_AS_SYMBOL(op):NULL; +} + +inline const char *pySymbol_AS_STRING(PyObject *op) +{ + return flext::GetString(pySymbol_AS_SYMBOL(op)); +} + +inline const t_symbol *pyObject_AsSymbol(PyObject *op) +{ + if(PyString_Check(op)) + return flext::MakeSymbol(PyString_AS_STRING(op)); + else + return pySymbol_AsSymbol(op); +} + +#endif |