1 #ifndef _NPY_ARRAYMAPPING_H_
2 #define _NPY_ARRAYMAPPING_H_
3 
4 extern NPY_NO_EXPORT PyMappingMethods array_as_mapping;
5 
6 
7 /*
8  * Struct into which indices are parsed.
9  * I.e. integer ones should only be parsed once, slices and arrays
10  * need to be validated later and for the ellipsis we need to find how
11  * many slices it represents.
12  */
13 typedef struct {
14     /*
15      * Object of index: slice, array, or NULL. Owns a reference.
16      */
17     PyObject *object;
18     /*
19      * Value of an integer index, number of slices an Ellipsis is worth,
20      * -1 if input was an integer array and the original size of the
21      * boolean array if it is a converted boolean array.
22      */
23     npy_intp value;
24     /* kind of index, see constants in mapping.c */
25     int type;
26 } npy_index_info;
27 
28 
29 NPY_NO_EXPORT Py_ssize_t
30 array_length(PyArrayObject *self);
31 
32 NPY_NO_EXPORT PyObject *
33 array_item_asarray(PyArrayObject *self, npy_intp i);
34 
35 NPY_NO_EXPORT PyObject *
36 array_item_asscalar(PyArrayObject *self, npy_intp i);
37 
38 NPY_NO_EXPORT PyObject *
39 array_item(PyArrayObject *self, Py_ssize_t i);
40 
41 NPY_NO_EXPORT PyObject *
42 array_subscript_asarray(PyArrayObject *self, PyObject *op);
43 
44 NPY_NO_EXPORT PyObject *
45 array_subscript(PyArrayObject *self, PyObject *op);
46 
47 NPY_NO_EXPORT int
48 array_assign_item(PyArrayObject *self, Py_ssize_t i, PyObject *v);
49 
50 /*
51  * Prototypes for Mapping calls --- not part of the C-API
52  * because only useful as part of a getitem call.
53  */
54 NPY_NO_EXPORT void
55 PyArray_MapIterReset(PyArrayMapIterObject *mit);
56 
57 NPY_NO_EXPORT void
58 PyArray_MapIterNext(PyArrayMapIterObject *mit);
59 
60 NPY_NO_EXPORT int
61 PyArray_MapIterCheckIndices(PyArrayMapIterObject *mit);
62 
63 NPY_NO_EXPORT void
64 PyArray_MapIterSwapAxes(PyArrayMapIterObject *mit, PyArrayObject **ret, int getmap);
65 
66 NPY_NO_EXPORT PyObject*
67 PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type,
68                    int ndim, int fancy_ndim,
69                    PyArrayObject *arr, PyArrayObject *subspace,
70                    npy_uint32 subspace_iter_flags, npy_uint32 subspace_flags,
71                    npy_uint32 extra_op_flags, PyArrayObject *extra_op,
72                    PyArray_Descr *extra_op_dtype);
73 #endif
74