ref: 228e8d80880f3258ed2ae5637afe3338eba76708
dir: /interfaces/python/aubiowraphell.h/
#include "aubio-types.h" #define AUBIO_DECLARE(NAME, PARAMS...) \ typedef struct { \ PyObject_HEAD \ aubio_ ## NAME ## _t * o; \ PARAMS; \ } Py_## NAME; #define AUBIO_NEW(NAME) \ static PyObject * \ Py_ ## NAME ## _new (PyTypeObject * type, PyObject * args, PyObject * kwds) \ { \ Py_ ## NAME * self; \ self = (Py_ ## NAME *) type->tp_alloc (type, 0); \ return (PyObject *)self; \ } #define AUBIO_INIT(NAME, PARAMS... ) \ static int \ Py_ ## NAME ## _init (Py_ ## NAME * self, PyObject * args, PyObject * kwds) \ { \ self->o = new_aubio_## NAME ( PARAMS ); \ if (self->o == NULL) { \ return -1; \ } \ \ return 0; \ } #define AUBIO_DEL(NAME) \ static void \ Py_ ## NAME ## _del ( Py_ ## NAME * self) \ { \ del_aubio_ ## NAME (self->o); \ self->ob_type->tp_free ((PyObject *) self); \ } #define AUBIO_MEMBERS_START(NAME) \ static PyMemberDef Py_ ## NAME ## _members[] = { #define AUBIO_MEMBERS_STOP(NAME) \ {NULL} \ }; #define AUBIO_METHODS(NAME) \ static PyMethodDef Py_ ## NAME ## _methods[] = { \ {NULL} \ }; #define AUBIO_TYPEOBJECT(NAME, PYNAME) \ PyTypeObject Py_ ## NAME ## Type = { \ PyObject_HEAD_INIT (NULL) \ 0, \ PYNAME, \ sizeof (Py_ ## NAME), \ 0, \ (destructor) Py_ ## NAME ## _del, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ (ternaryfunc)Py_ ## NAME ## _do, \ 0, \ 0, \ 0, \ 0, \ Py_TPFLAGS_DEFAULT, \ Py_ ## NAME ## _doc, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ Py_ ## NAME ## _methods, \ Py_ ## NAME ## _members, \ 0, \ 0, \ 0, \ 0, \ 0, \ 0, \ (initproc) Py_ ## NAME ## _init, \ 0, \ Py_ ## NAME ## _new, \ }; // some more helpers #define AUBIO_NEW_VEC(name, type, lengthval) \ name = (type *) PyObject_New (type, & type ## Type); \ name->length = lengthval;