diff options
author | David Cournapeau <cournape@gmail.com> | 2009-08-07 13:18:56 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-08-07 13:18:56 +0000 |
commit | b80758ff9830ee7bebbbbe23c60a8dd31c8dabfb (patch) | |
tree | 4462bf05e725ff8b56812530e8982f20d2f20320 /numpy | |
parent | 872966ffdfef1f7de9d7502d62e0f3418d2270e3 (diff) | |
download | numpy-b80758ff9830ee7bebbbbe23c60a8dd31c8dabfb.tar.gz |
Forward declare PyArrayIterObject
To fix the neighborhood iterator, we need to be able to add a member to
PyArrayIterObject which is a function pointer (which will do the
padding-specific translation coordinates -> data pointer: poor man's
polymorphism). As the function pointer takes an iter object as its first
argument, we need to make a proper declaration of PyArrayIterObject,
instead of using an anonymous struct as previously defined. I am not
sure whether this may break the ABI or not, though.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/include/numpy/ndarrayobject.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h index aa6c471f3..31e69fb6d 100644 --- a/numpy/core/include/numpy/ndarrayobject.h +++ b/numpy/core/include/numpy/ndarrayobject.h @@ -673,7 +673,18 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); #define NPY_DISABLE_C_API #endif -typedef struct { +/***************************** + * Basic iterator object + *****************************/ + +/* FWD declaration */ +typedef struct PyArrayIterObject_tag PyArrayIterObject; + +/* type of the function which translates a set of coordinates to a pointer to + * the data */ +typedef char* (*npy_iter_get_dataptr_t)(PyArrayIterObject* iter, npy_intp*); + +struct PyArrayIterObject_tag { PyObject_HEAD int nd_m1; /* number of dimensions - 1 */ npy_intp index, size; @@ -685,7 +696,8 @@ typedef struct { PyArrayObject *ao; char *dataptr; /* pointer to current item*/ npy_bool contiguous; -} PyArrayIterObject; + npy_iter_get_dataptr_t translate; +} ; /* Iterator API */ @@ -933,6 +945,7 @@ typedef struct { PyArrayObject *ao; char *dataptr; /* pointer to current item*/ npy_bool contiguous; + npy_iter_get_dataptr_t translate; /* * New members |