Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
API: Rename the iterator function pointer types to be more consistent…
… with NumPy convention

'NpyIter_IterNext_Fn' -> 'NpyIter_IterNextFunc *'
'NpyIter_GetCoords_Fn' -> 'NpyIter_GetCoordsFunc *'
  • Loading branch information
mwiebe committed Mar 11, 2011
1 parent 72ef8a6 commit 0c0c49c
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
16 changes: 8 additions & 8 deletions doc/source/reference/c-api.iterator.rst
Expand Up @@ -87,7 +87,7 @@ number of non-zero elements in an array.
PyArray_NonzeroFunc* nonzero = PyArray_DESCR(self)->f->nonzero;
NpyIter* iter;
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char** dataptr;
npy_intp* strideptr,* innersizeptr;
Expand Down Expand Up @@ -171,7 +171,7 @@ NPY_KEEPORDER is desired.
PyObject *CopyArray(PyObject *arr, NPY_ORDER order)
{
NpyIter *iter;
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
PyObject *op[2], *ret;
npy_uint32 flags;
npy_uint32 op_flags[2];
Expand Down Expand Up @@ -758,7 +758,7 @@ Construction and Destruction
.. code-block:: c
NpyIter *iter1, *iter1;
NpyIter_IterNext_Fn iternext1, iternext2;
NpyIter_IterNextFunc *iternext1, *iternext2;
char **dataptrs1;
/*
Expand Down Expand Up @@ -930,7 +930,7 @@ Construction and Destruction
Functions For Iteration
-----------------------

.. cfunction:: NpyIter_IterNext_Fn NpyIter_GetIterNext(NpyIter* iter, char** errmsg)
.. cfunction:: NpyIter_IterNextFunc* NpyIter_GetIterNext(NpyIter* iter, char** errmsg)

Returns a function pointer for iteration. A specialized version
of the function pointer may be calculated by this function
Expand All @@ -948,7 +948,7 @@ Functions For Iteration

.. code-block:: c
NpyIter_IterNext_Fn iternext = NpyIter_GetIterNext(iter, NULL);
NpyIter_IterNextFunc *iternext = NpyIter_GetIterNext(iter, NULL);
char** dataptr = NpyIter_GetDataPtrArray(iter);
do {
Expand All @@ -960,7 +960,7 @@ Functions For Iteration

.. code-block:: c
NpyIter_IterNext_Fn iternext = NpyIter_GetIterNext(iter, NULL);
NpyIter_IterNextFunc *iternext = NpyIter_GetIterNext(iter, NULL);
char** dataptr = NpyIter_GetDataPtrArray(iter);
npy_intp* stride = NpyIter_GetInnerStrideArray(iter);
npy_intp* size_ptr = NpyIter_GetInnerLoopSizePtr(iter), size;
Expand Down Expand Up @@ -994,7 +994,7 @@ Functions For Iteration
/* The constructor should have buffersize passed as this value */
#define FIXED_BUFFER_SIZE 1024
NpyIter_IterNext_Fn iternext = NpyIter_GetIterNext(iter, NULL);
NpyIter_IterNextFunc *iternext = NpyIter_GetIterNext(iter, NULL);
char **dataptr = NpyIter_GetDataPtrArray(iter);
npy_intp *stride = NpyIter_GetInnerStrideArray(iter);
npy_intp *size_ptr = NpyIter_GetInnerLoopSizePtr(iter), size;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ Functions For Iteration
}
} while (iternext());
.. cfunction:: NpyIter_GetCoords_Fn NpyIter_GetGetCoords(NpyIter* iter, char** errmsg)
.. cfunction:: NpyIter_GetCoordsFunc *NpyIter_GetGetCoords(NpyIter* iter, char** errmsg)

Returns a function pointer for getting the coordinates
of the iterator. Returns NULL if the iterator does not
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/include/numpy/ndarraytypes.h
Expand Up @@ -867,8 +867,8 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
typedef struct NpyIter_InternalOnly NpyIter;

/* Iterator function pointers that may be specialized */
typedef int (*NpyIter_IterNext_Fn )(NpyIter *iter);
typedef void (*NpyIter_GetCoords_Fn )(NpyIter *iter,
typedef int (NpyIter_IterNextFunc)(NpyIter *iter);
typedef void (NpyIter_GetCoordsFunc)(NpyIter *iter,
npy_intp *outcoords);

/*** Global flags that may be passed to the iterator constructors ***/
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/convert.c
Expand Up @@ -366,7 +366,7 @@ PyArray_FillWithZero(PyArrayObject *a)
PyArray_Descr *dtype = PyArray_DESCR(a);
NpyIter *iter;

NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp stride, *countptr;
int needs_api;
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/ctors.c
Expand Up @@ -2430,7 +2430,7 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src,
void *transferdata = NULL;
NpyIter *dst_iter, *src_iter;

NpyIter_IterNext_Fn dst_iternext, src_iternext;
NpyIter_IterNextFunc *dst_iternext, *src_iternext;
char **dst_dataptr, **src_dataptr;
npy_intp dst_stride, src_stride;
npy_intp *dst_countptr, *src_countptr;
Expand Down Expand Up @@ -2693,7 +2693,7 @@ PyArray_CopyInto(PyArrayObject *dst, PyArrayObject *src)
npy_uint32 op_flags[2];
NpyIter *iter;

NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *countptr;
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/einsum.c.src
Expand Up @@ -3061,7 +3061,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop,
ret = NULL;
}
else if (NpyIter_GetIterSize(iter) != 0) {
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *countptr;
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/item_selection.c
Expand Up @@ -1698,7 +1698,7 @@ PyArray_CountNonzero(PyArrayObject *self)
npy_intp nonzero_count = 0;

NpyIter *iter;
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strideptr, *innersizeptr;

Expand Down Expand Up @@ -1783,8 +1783,8 @@ PyArray_Nonzero(PyArrayObject *self)
npy_intp *coords;

NpyIter *iter;
NpyIter_IterNext_Fn iternext;
NpyIter_GetCoords_Fn getcoords;
NpyIter_IterNextFunc *iternext;
NpyIter_GetCoordsFunc *getcoords;
char **dataptr;
npy_intp *innersizeptr;

Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/new_iterator.c.src
Expand Up @@ -1910,7 +1910,7 @@ npyiter_iternext_sizeone(NpyIter *iter)
* This is so that the function can be called from code not holding
* the GIL.
*/
NPY_NO_EXPORT NpyIter_IterNext_Fn
NPY_NO_EXPORT NpyIter_IterNextFunc *
NpyIter_GetIterNext(NpyIter *iter, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
Expand Down Expand Up @@ -2088,7 +2088,7 @@ npyiter_getcoord_itflags@tag_itflags@(NpyIter *iter, npy_intp *outcoord)
* This is so that the function can be called from code not holding
* the GIL.
*/
NPY_NO_EXPORT NpyIter_GetCoords_Fn
NPY_NO_EXPORT NpyIter_GetCoordsFunc *
NpyIter_GetGetCoords(NpyIter *iter, char **errmsg)
{
npy_uint32 itflags = NIT_ITFLAGS(iter);
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/new_iterator_pywrap.c
Expand Up @@ -29,8 +29,8 @@ struct NewNpyArrayIterObject_tag {
/* Child to update for nested iteration */
NewNpyArrayIterObject *nested_child;
/* Cached values from the iterator */
NpyIter_IterNext_Fn iternext;
NpyIter_GetCoords_Fn getcoords;
NpyIter_IterNextFunc *iternext;
NpyIter_GetCoordsFunc *getcoords;
char **dataptrs;
PyArray_Descr **dtypes;
PyArrayObject **operands;
Expand Down
12 changes: 6 additions & 6 deletions numpy/core/src/umath/ufunc_object.c
Expand Up @@ -1769,7 +1769,7 @@ iterator_loop(PyUFuncObject *self,
char *baseptrs[NPY_MAXARGS];
int needs_api;

NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *count_ptr;
Expand Down Expand Up @@ -2396,7 +2396,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self,

/* Do the ufunc loop */
if (NpyIter_GetIterSize(iter) != 0) {
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *count_ptr;

Expand Down Expand Up @@ -3061,7 +3061,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
char *dataptr_copy[3];
npy_intp stride_copy[3];

NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *stride;
npy_intp *count_ptr;
Expand All @@ -3081,7 +3081,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Execute the loop with two nested iterators */
if (iter_inner) {
/* Only UFUNC_REDUCE uses iter_inner */
NpyIter_IterNext_Fn iternext_inner;
NpyIter_IterNextFunc *iternext_inner;
char **dataptr_inner;
npy_intp *stride_inner;
npy_intp count, *count_ptr_inner;
Expand Down Expand Up @@ -3214,7 +3214,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr,
/* Execute the loop with just the inner iterator */
if (iter_inner) {
/* Only UFUNC_REDUCE uses iter_inner */
NpyIter_IterNext_Fn iternext_inner;
NpyIter_IterNextFunc *iternext_inner;
char **dataptr_inner;
npy_intp *stride_inner;
npy_intp count, *count_ptr_inner;
Expand Down Expand Up @@ -3606,7 +3606,7 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
char *dataptr_copy[3];
npy_intp stride_copy[3];

NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp count_m1;
npy_intp stride0, stride1;
Expand Down
6 changes: 3 additions & 3 deletions numpy/lib/src/_compiled_base.c
Expand Up @@ -765,7 +765,7 @@ arr_ravel_coords(PyObject *self, PyObject *args, PyObject *kwds)
}

if (NpyIter_GetIterSize(iter) != 0) {
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr;
Expand Down Expand Up @@ -962,7 +962,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)

if (order == NPY_CORDER) {
if (NpyIter_GetIterSize(iter) != 0) {
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr, count;
Expand All @@ -989,7 +989,7 @@ arr_unravel_index(PyObject *self, PyObject *args, PyObject *kwds)
}
else if (order == NPY_FORTRANORDER) {
if (NpyIter_GetIterSize(iter) != 0) {
NpyIter_IterNext_Fn iternext;
NpyIter_IterNextFunc *iternext;
char **dataptr;
npy_intp *strides;
npy_intp *countptr, count;
Expand Down

0 comments on commit 0c0c49c

Please sign in to comment.