diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-01-19 04:58:36 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-01-19 04:58:36 +0000 |
commit | 6138980e885884ef96b726f695fb038e2b939935 (patch) | |
tree | 764c56a9a16e4175699ba9fd5cb45a9a3282fe46 /externals/grill/py/source | |
parent | 86ecf983a799e73b54a13616e5fda6b268c20e5e (diff) |
- a bit more functions for the symbol type
- exporting symbol functions
corrected argument passing to class methods
updated for OSX
adjust pd and py files for correct argument passing
svn path=/trunk/; revision=2523
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r-- | externals/grill/py/source/pyargs.cpp | 6 | ||||
-rw-r--r-- | externals/grill/py/source/pyprefix.h | 4 | ||||
-rw-r--r-- | externals/grill/py/source/pysymbol.cpp | 1 | ||||
-rw-r--r-- | externals/grill/py/source/pysymbol.h | 53 |
4 files changed, 51 insertions, 13 deletions
diff --git a/externals/grill/py/source/pyargs.cpp b/externals/grill/py/source/pyargs.cpp index 1b549160..aee12a17 100644 --- a/externals/grill/py/source/pyargs.cpp +++ b/externals/grill/py/source/pyargs.cpp @@ -51,8 +51,10 @@ PyObject *py::MakePyArgs(const t_symbol *s,int argc,const t_atom *argv,int inlet int ix; PyObject *tmp; - if(!withself || argc < (any?1:2)) tmp = pArgs,ix = pix; - else tmp = PyTuple_New(argc+(any?1:0)),ix = 0; +// if(!withself || argc < (any?1:2)) + tmp = pArgs,ix = pix; +// else +// tmp = PyTuple_New(argc+(any?1:0)),ix = 0; if(any) PyTuple_SET_ITEM(tmp, ix++, pySymbol_FromSymbol(s)); diff --git a/externals/grill/py/source/pyprefix.h b/externals/grill/py/source/pyprefix.h index fcce64a1..3f149b61 100644 --- a/externals/grill/py/source/pyprefix.h +++ b/externals/grill/py/source/pyprefix.h @@ -8,8 +8,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. */
-#ifndef __PREFIX_H
-#define __PREFIX_H
+#ifndef __PYPREFIX_H
+#define __PYPREFIX_H
#define FLEXT_ATTRIBUTES 1
#include <flext.h>
diff --git a/externals/grill/py/source/pysymbol.cpp b/externals/grill/py/source/pysymbol.cpp index 176f9895..189d6a6f 100644 --- a/externals/grill/py/source/pysymbol.cpp +++ b/externals/grill/py/source/pysymbol.cpp @@ -8,6 +8,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. */
+#include "pyprefix.h"
#include "pysymbol.h"
inline pySymbol *symbol_newsym(const t_symbol *sym)
diff --git a/externals/grill/py/source/pysymbol.h b/externals/grill/py/source/pysymbol.h index bf06437d..c6e057d4 100644 --- a/externals/grill/py/source/pysymbol.h +++ b/externals/grill/py/source/pysymbol.h @@ -8,7 +8,31 @@ WARRANTIES, see the file, "license.txt," in this distribution. */
-#include "pyprefix.h"
+#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
@@ -16,21 +40,31 @@ typedef struct { const t_symbol *sym;
} pySymbol;
-extern PyTypeObject pySymbol_Type;
+PY_EXPORT extern PyTypeObject pySymbol_Type;
-extern pySymbol *pySymbol__;
-extern pySymbol *pySymbol_bang;
-extern pySymbol *pySymbol_list;
-extern pySymbol *pySymbol_symbol;
-extern pySymbol *pySymbol_float;
-extern pySymbol *pySymbol_int;
+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) -PyObject *pySymbol_FromSymbol(const t_symbol *sym); +PY_EXPORT PyObject *pySymbol_FromSymbol(const t_symbol *sym); + +inline PyObject *pySymbol_FromString(const char *str) +{ + return pySymbol_FromSymbol(flext::MakeSymbol(str)); +} + +inline PyObject *pySymbol_FromString(PyObject *str) +{ + return pySymbol_FromSymbol(flext::MakeSymbol(PyString_AsString(str))); +} inline const t_symbol *pySymbol_AS_SYMBOL(PyObject *op)
{
@@ -55,3 +89,4 @@ inline const t_symbol *pyObject_AsSymbol(PyObject *op) return pySymbol_AsSymbol(op);
}
+#endif
|