diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2010-05-09 16:19:08 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-05-09 16:19:08 +0000 |
commit | 81a86c775143d7335613fdb960d6267fc3d602f8 (patch) | |
tree | 77dc5e33e1b3006ea662a9d9c85311c380e36b57 | |
parent | 7d5a4558baf58464ba9c09a6ee94cf14f536efa3 (diff) | |
download | numpy-81a86c775143d7335613fdb960d6267fc3d602f8.tar.gz |
STY: Some cleanups of ndarraytypes.h.
-rw-r--r-- | numpy/core/include/numpy/ndarraytypes.h | 501 |
1 files changed, 315 insertions, 186 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index d39bd47d7..cd9ec9993 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -4,6 +4,10 @@ /* This is auto-generated by the installer */ #include "numpyconfig.h" +#include "npy_common.h" +#include "npy_endian.h" +#include "utils.h" + #ifdef NPY_ENABLE_SEPARATE_COMPILATION #define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN #else @@ -17,16 +21,16 @@ #define NPY_ALLOW_THREADS 0 #endif -#include "npy_endian.h" -#include "utils.h" -/* There are several places in the code where an array of dimensions is - * allocated statically. This is the size of that static allocation. +/* + * There are several places in the code where an array of dimensions + * is allocated statically. This is the size of that static + * allocation. * - * The array creation itself could have arbitrary dimensions but - * all the places where static allocation is used would need to - * be changed to dynamic (including inside of several structures) + * The array creation itself could have arbitrary dimensions but all + * the places where static allocation is used would need to be changed + * to dynamic (including inside of several structures) */ #define NPY_MAXDIMS 32 @@ -36,24 +40,24 @@ #define NPY_FAIL 0 #define NPY_SUCCEED 1 -/* Binary compatibility version number. This number is increased - whenever the C-API is changed such that binary compatibility is - broken, i.e. whenever a recompile of extension modules is - needed. */ +/* + * Binary compatibility version number. This number is increased + * whenever the C-API is changed such that binary compatibility is + * broken, i.e. whenever a recompile of extension modules is needed. + */ #define NPY_VERSION NPY_ABI_VERSION -/* Minor API version. This number is increased whenever a change is - made to the C-API -- whether it breaks binary compatibility or not. - Some changes, such as adding a function pointer to the end of the - function table, can be made without breaking binary compatibility. - In this case, only the NPY_FEATURE_VERSION (*not* NPY_VERSION) - would be increased. Whenever binary compatibility is broken, both - NPY_VERSION and NPY_FEATURE_VERSION should be increased. +/* + * Minor API version. This number is increased whenever a change is + * made to the C-API -- whether it breaks binary compatibility or not. + * Some changes, such as adding a function pointer to the end of the + * function table, can be made without breaking binary compatibility. + * In this case, only the NPY_FEATURE_VERSION (*not* NPY_VERSION) + * would be increased. Whenever binary compatibility is broken, both + * NPY_VERSION and NPY_FEATURE_VERSION should be increased. */ #define NPY_FEATURE_VERSION NPY_API_VERSION -#include "npy_common.h" - enum NPY_TYPES { NPY_BOOL=0, NPY_BYTE, NPY_UBYTE, NPY_SHORT, NPY_USHORT, @@ -86,13 +90,16 @@ enum NPY_TYPES { NPY_BOOL=0, /* How many floating point types are there */ #define NPY_NUM_FLOATTYPE 3 -/* We need to match npy_intp to a signed integer of the same size as - a pointer variable. npy_uintp to the equivalent unsigned integer -*/ +/* + * We need to match npy_intp to a signed integer of the same size as a + * pointer variable. npy_uintp to the equivalent unsigned integer + */ -/* These characters correspond to the array type and the - struct module */ +/* + * These characters correspond to the array type and the struct + * module + */ /* except 'p' -- signed integer for pointer type */ @@ -122,9 +129,12 @@ enum NPY_TYPECHAR { NPY_BOOLLTR = '?', NPY_TIMEDELTALTR = 'm', NPY_CHARLTR = 'c', - /* No Descriptor, just a define -- this let's - Python users specify an array of integers - large enough to hold a pointer on the platform*/ + /* + * No Descriptor, just a define -- this let's + * Python users specify an array of integers + * large enough to hold a pointer on the + * platform + */ NPY_INTPLTR = 'p', NPY_UINTPLTR = 'P', @@ -210,8 +220,10 @@ typedef enum { #define NPY_STR_as "as" -/* This is to typedef npy_intp to the appropriate pointer size for this - * platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. */ +/* + * This is to typedef npy_intp to the appropriate pointer size for + * this platform. Py_intptr_t, Py_uintptr_t are defined in pyport.h. + */ typedef Py_intptr_t npy_intp; typedef Py_uintptr_t npy_uintp; #define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T @@ -265,8 +277,10 @@ typedef Py_uintptr_t npy_uintp; #define NPY_INTP_FMT "Ld" #endif -/* We can only use C99 formats for npy_int_p if it is the same as intp_t, hence - * the condition on HAVE_UNITPTR_T */ +/* + * We can only use C99 formats for npy_int_p if it is the same as + * intp_t, hence the condition on HAVE_UNITPTR_T + */ #if (NPY_USE_C99_FORMATS) == 1 \ && (defined HAVE_UINTPTR_T) \ && (defined HAVE_INTTYPES_H) @@ -281,9 +295,10 @@ typedef Py_uintptr_t npy_uintp; #define NPY_STRINGIFY(x) #x #define NPY_TOSTRING(x) NPY_STRINGIFY(x) - /* Macros to define how array, and dimension/strides data is - allocated. - */ + /* + * Macros to define how array, and dimension/strides data is + * allocated. + */ /* Data buffer */ #define PyDataMem_NEW(size) ((char *)malloc(size)) @@ -314,7 +329,7 @@ typedef Py_uintptr_t npy_uintp; /* forward declaration */ struct _PyArray_Descr; - /* These must deal with unaligned and swapped data if necessary */ +/* These must deal with unaligned and swapped data if necessary */ typedef PyObject * (PyArray_GetItemFunc) (void *, void *); typedef int (PyArray_SetItemFunc)(PyObject *, void *, void *); @@ -325,9 +340,11 @@ typedef void (PyArray_CopySwapFunc)(void *, void *, int, void *); typedef npy_bool (PyArray_NonzeroFunc)(void *, void *); - /* These assume aligned and notswapped data -- a buffer will be - used before or contiguous data will be obtained - */ +/* + * These assume aligned and notswapped data -- a buffer will be used + * before or contiguous data will be obtained + */ + typedef int (PyArray_CompareFunc)(const void *, const void *, void *); typedef int (PyArray_ArgFunc)(void*, npy_intp, npy_intp*, void *); @@ -337,8 +354,10 @@ typedef void (PyArray_DotFunc)(void *, npy_intp, void *, npy_intp, void *, typedef void (PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *); -/* XXX the ignore argument should be removed next time the API version - is bumped. It used to be the separator. */ +/* + * XXX the ignore argument should be removed next time the API version + * is bumped. It used to be the separator. + */ typedef int (PyArray_ScanFunc)(FILE *fp, void *dptr, char *ignore, struct _PyArray_Descr *); typedef int (PyArray_FromStrFunc)(char *s, void *dptr, char **endptr, @@ -370,65 +389,90 @@ typedef struct { typedef struct { /* The next four functions *cannot* be NULL */ - /* Functions to get and set items with standard - Python types -- not array scalars */ + /* + * Functions to get and set items with standard Python types + * -- not array scalars + */ PyArray_GetItemFunc *getitem; PyArray_SetItemFunc *setitem; - /* Copy and/or swap data. Memory areas may not overlap */ - /* Use memmove first if they might */ + /* + * Copy and/or swap data. Memory areas may not overlap + * Use memmove first if they might + */ PyArray_CopySwapNFunc *copyswapn; PyArray_CopySwapFunc *copyswap; - /* Function to compare items */ - /* Can be NULL + /* + * Function to compare items + * Can be NULL */ PyArray_CompareFunc *compare; - /* Function to select largest - Can be NULL - */ + /* + * Function to select largest + * Can be NULL + */ PyArray_ArgFunc *argmax; - /* Function to compute dot product */ - /* Can be NULL */ + /* + * Function to compute dot product + * Can be NULL + */ PyArray_DotFunc *dotfunc; - /* Function to scan an ASCII file and - place a single value plus possible separator - Can be NULL - */ + /* + * Function to scan an ASCII file and + * place a single value plus possible separator + * Can be NULL + */ PyArray_ScanFunc *scanfunc; - /* Function to read a single value from a string */ - /* and adjust the pointer; Can be NULL */ + /* + * Function to read a single value from a string + * and adjust the pointer; Can be NULL + */ PyArray_FromStrFunc *fromstr; - /* Function to determine if data is zero or not */ - /* If NULL a default version is */ - /* used at Registration time. */ + /* + * Function to determine if data is zero or not + * If NULL a default version is + * used at Registration time. + */ PyArray_NonzeroFunc *nonzero; - /* Used for arange. Can be NULL.*/ + /* + * Used for arange. + * Can be NULL. + */ PyArray_FillFunc *fill; - /* Function to fill arrays with scalar values - Can be NULL*/ + /* + * Function to fill arrays with scalar values + * Can be NULL + */ PyArray_FillWithScalarFunc *fillwithscalar; - /* Sorting functions; Can be NULL*/ + /* + * Sorting functions + * Can be NULL + */ PyArray_SortFunc *sort[NPY_NSORTS]; PyArray_ArgSortFunc *argsort[NPY_NSORTS]; - /* Dictionary of additional casting functions - PyArray_VectorUnaryFuncs - which can be populated to support casting - to other registered types. Can be NULL*/ + /* + * Dictionary of additional casting functions + * PyArray_VectorUnaryFuncs + * which can be populated to support casting + * to other registered types. Can be NULL + */ PyObject *castdict; - /* Functions useful for generalizing - the casting rules. Can be NULL; - */ + /* + * Functions useful for generalizing + * the casting rules. + * Can be NULL; + */ PyArray_ScalarKindFunc *scalarkind; int **cancastscalarkindto; int *cancastto; @@ -437,14 +481,19 @@ typedef struct { PyArray_FastPutmaskFunc *fastputmask; PyArray_FastTakeFunc *fasttake; - /* A little room to grow --- should use generic function interface for most additions */ + /* + * A little room to grow --- should use generic function + * interface for most additions + */ void *pad1; void *pad2; void *pad3; void *pad4; - /* Functions to cast to all other standard types*/ - /* Can have some NULL entries */ + /* + * Functions to cast to all other standard types + * Can have some NULL entries + */ PyArray_VectorUnaryFunc *cast[NPY_NTYPES]; } PyArray_ArrFuncs; @@ -467,8 +516,10 @@ typedef struct { #define NPY_USE_SETITEM 0x40 /* define NPY_IS_COMPLEX */ -/* These are inherited for global data-type if any data-types in the field - have them */ +/* + *These are inherited for global data-type if any data-types in the + * field have them + */ #define NPY_FROM_FIELDS (NPY_NEEDS_INIT | NPY_LIST_PICKLE | \ NPY_ITEM_REFCOUNT | NPY_NEEDS_PYAPI) @@ -484,33 +535,43 @@ typedef struct { typedef struct _PyArray_Descr { PyObject_HEAD - PyTypeObject *typeobj; /* the type object representing an - instance of this type -- should not - be two type_numbers with the same type - object. */ + PyTypeObject *typeobj; /* + * the type object representing an + * instance of this type -- should not + * be two type_numbers with the same type + * object. + */ char kind; /* kind for this type */ char type; /* unique-character representing this type */ - char byteorder; /* '>' (big), '<' (little), '|' - (not-applicable), or '=' (native). */ - char unused; + char byteorder; /* + * '>' (big), '<' (little), '|' + * (not-applicable), or '=' (native). + */ + char unused; int flags; /* flag describing data type */ int type_num; /* number representing this type */ int elsize; /* element size for this type */ int alignment; /* alignment needed for this type */ struct _arr_descr \ - *subarray; /* Non-NULL if this type is - is an array (C-contiguous) - of some other type - */ - PyObject *fields; /* The fields dictionary for this type */ - /* For statically defined descr this - is always Py_None */ - - PyObject *names; /* An ordered tuple of field names or NULL - if no fields are defined */ - - PyArray_ArrFuncs *f; /* a table of functions specific for each - basic data descriptor */ + *subarray; /* + * Non-NULL if this type is + * is an array (C-contiguous) + * of some other type + */ + PyObject *fields; /* The fields dictionary for this type + * For statically defined descr this + * is always Py_None + */ + + PyObject *names; /* + * An ordered tuple of field names or NULL + * if no fields are defined + */ + + PyArray_ArrFuncs *f; /* + * a table of functions specific for each + * basic data descriptor + */ PyObject *metadata; /* Metadata about this dtype */ } PyArray_Descr; @@ -521,28 +582,37 @@ typedef struct _arr_descr { } PyArray_ArrayDescr; /* - The main array object structure. It is recommended to use the macros - defined below (PyArray_DATA and friends) access fields here, instead - of the members themselves. + * The main array object structure. It is recommended to use the macros + * defined below (PyArray_DATA and friends) access fields here, instead + * of the members themselves. */ typedef struct PyArrayObject { PyObject_HEAD char *data; /* pointer to raw data buffer */ int nd; /* number of dimensions, also called ndim */ - npy_intp *dimensions; /* size in each dimension */ - npy_intp *strides; /* bytes to jump to get to the - next element in each dimension */ - PyObject *base; /* This object should be decref'd - upon deletion of array */ - /* For views it points to the original array */ - /* For creation from buffer object it points - to an object that shold be decref'd on - deletion */ - /* For UPDATEIFCOPY flag this is an array - to-be-updated upon deletion of this one */ + npy_intp *dimensions; /* size in each dimension */ + npy_intp *strides; /* + * bytes to jump to get to the + * next element in each dimension + */ + PyObject *base; /* + * This object should be decref'd upon + * deletion of array + * + * For views it points to the original + * array + * + * For creation from buffer object it + * points to an object that shold be + * decref'd on deletion + * + * For UPDATEIFCOPY flag this is an + * array to-be-updated upon deletion + * of this one + */ PyArray_Descr *descr; /* Pointer to type structure */ - int flags; /* Flags describing array -- see below*/ + int flags; /* Flags describing array -- see below */ PyObject *weakreflist; /* For weakreferences */ } PyArrayObject; @@ -571,7 +641,10 @@ typedef struct { typedef struct { NPY_DATETIMEUNIT base; int num; - int den; /* Converted to 1 on input for now -- an input-only mechanism */ + int den; /* + * Converted to 1 on input for now -- an + * input-only mechanism + */ int events; } PyArray_DatetimeMetaData; @@ -600,57 +673,75 @@ typedef struct { typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); -/* Means c-style contiguous (last index varies the fastest). The - data elements right after each other. */ +/* + * Means c-style contiguous (last index varies the fastest). The data + * elements right after each other. + */ #define NPY_CONTIGUOUS 0x0001 -/* set if array is a contiguous Fortran array: the first index - varies the fastest in memory (strides array is reverse of - C-contiguous array)*/ + +/* + * set if array is a contiguous Fortran array: the first index varies + * the fastest in memory (strides array is reverse of C-contiguous + * array) + */ #define NPY_FORTRAN 0x0002 #define NPY_C_CONTIGUOUS NPY_CONTIGUOUS #define NPY_F_CONTIGUOUS NPY_FORTRAN /* - Note: all 0-d arrays are CONTIGUOUS and FORTRAN contiguous. If a - 1-d array is CONTIGUOUS it is also FORTRAN contiguous -*/ + * Note: all 0-d arrays are CONTIGUOUS and FORTRAN contiguous. If a + * 1-d array is CONTIGUOUS it is also FORTRAN contiguous + */ -/* If set, the array owns the data: it will be free'd when the array - is deleted. */ +/* + * If set, the array owns the data: it will be free'd when the array + * is deleted. + */ #define NPY_OWNDATA 0x0004 -/* An array never has the next four set; they're only used as parameter - flags to the the various FromAny functions */ +/* + * An array never has the next four set; they're only used as parameter + * flags to the the various FromAny functions + */ /* Cause a cast to occur regardless of whether or not it is safe. */ #define NPY_FORCECAST 0x0010 -/* Always copy the array. Returned arrays are always CONTIGUOUS, ALIGNED, - and WRITEABLE. */ +/* + * Always copy the array. Returned arrays are always CONTIGUOUS, + * ALIGNED, and WRITEABLE. + */ #define NPY_ENSURECOPY 0x0020 /* Make sure the returned array is a base-class ndarray */ #define NPY_ENSUREARRAY 0x0040 -/* Make sure that the strides are in units of the element size - Needed for some operations with record-arrays. -*/ +/* + * Make sure that the strides are in units of the element size Needed + * for some operations with record-arrays. + */ #define NPY_ELEMENTSTRIDES 0x0080 -/* Array data is aligned on the appropiate memory address for the - type stored according to how the compiler would align things - (e.g., an array of integers (4 bytes each) starts on - a memory address that's a multiple of 4) */ +/* + * Array data is aligned on the appropiate memory address for the type + * stored according to how the compiler would align things (e.g., an + * array of integers (4 bytes each) starts on a memory address that's + * a multiple of 4) + */ #define NPY_ALIGNED 0x0100 + /* Array data has the native endianness */ #define NPY_NOTSWAPPED 0x0200 + /* Array data is writeable */ #define NPY_WRITEABLE 0x0400 -/* If this flag is set, then base contains a pointer to an array of - the same size that should be updated with the current contents of - this array when this array is deallocated -*/ + +/* + * If this flag is set, then base contains a pointer to an array of + * the same size that should be updated with the current contents of + * this array when this array is deallocated + */ #define NPY_UPDATEIFCOPY 0x1000 /* This flag is for the array interface */ @@ -674,9 +765,10 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); #define NPY_UPDATE_ALL (NPY_CONTIGUOUS | NPY_FORTRAN | NPY_ALIGNED) -/* Size of internal buffers used for alignment */ -/* Make BUFSIZE a multiple of sizeof(cdouble) -- ususally 16 */ -/* So that ufunc buffers are aligned */ +/* + * Size of internal buffers used for alignment Make BUFSIZE a multiple + * of sizeof(cdouble) -- ususally 16 so that ufunc buffers are aligned + */ #define NPY_MIN_BUFSIZE ((int)sizeof(cdouble)) #define NPY_MAX_BUFSIZE (((int)sizeof(cdouble))*1000000) #define NPY_BUFSIZE 10000 @@ -696,7 +788,8 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); #define PyArray_CNE(p,q) (((p).real!=(q).real) || ((p).imag != (q).imag)) /* - * C API: consists of Macros and functions. The MACROS are defined here. + * C API: consists of Macros and functions. The MACROS are defined + * here. */ @@ -746,8 +839,10 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); /* FWD declaration */ typedef struct PyArrayIterObject_tag PyArrayIterObject; -/* type of the function which translates a set of coordinates to a pointer to - * the data */ +/* + * 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 { @@ -898,9 +993,9 @@ struct PyArrayIterObject_tag { /* - Any object passed to PyArray_Broadcast must be binary compatible with - this structure. -*/ + * Any object passed to PyArray_Broadcast must be binary compatible + * with this structure. + */ typedef struct { PyObject_HEAD @@ -958,8 +1053,10 @@ typedef struct { typedef struct { PyObject_HEAD - /* Multi-iterator portion --- needs to be present in this order to - work with PyArray_Broadcast */ + /* + * Multi-iterator portion --- needs to be present in this + * order to work with PyArray_Broadcast + */ int numiter; /* number of index-array iterators */ @@ -976,13 +1073,15 @@ typedef struct { /* flat iterator for subspace (when numiter < nd) */ PyArrayIterObject *subspace; - /* if subspace iteration, then this is the array of - axes in the underlying array represented by the - index objects */ + /* + * if subspace iteration, then this is the array of axes in + * the underlying array represented by the index objects + */ int iteraxes[NPY_MAXDIMS]; - /* if subspace iteration, the these are the coordinates - to the start of the subspace. - */ + /* + * if subspace iteration, the these are the coordinates to the + * start of the subspace. + */ npy_intp bscoord[NPY_MAXDIMS]; PyObject *indexobj; /* creating obj */ @@ -1029,11 +1128,15 @@ typedef struct { /* Dimensions is the dimension of the array */ npy_intp dimensions[NPY_MAXDIMS]; - /* Neighborhood points coordinates are computed relatively to the point pointed - * by _internal_iter */ + /* + * Neighborhood points coordinates are computed relatively to the + * point pointed by _internal_iter + */ PyArrayIterObject* _internal_iter; - /* To keep a reference to the representation of the constant value for - * constant padding */ + /* + * To keep a reference to the representation of the constant value + * for constant padding + */ char* constant; int mode; @@ -1053,19 +1156,22 @@ static NPY_INLINE int PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); #endif -/* Include inline implementations - functions defined there are not considered - * public API */ +/* + * Include inline implementations - functions defined there are not + * considered public API + */ #define _NPY_INCLUDE_NEIGHBORHOOD_IMP #include "_neighborhood_iterator_imp.h" #undef _NPY_INCLUDE_NEIGHBORHOOD_IMP -/* The default array type - */ +/* The default array type */ #define NPY_DEFAULT_TYPE NPY_DOUBLE #define PyArray_DEFAULT NPY_DEFAULT_TYPE -/* All sorts of useful ways to look into a PyArrayObject. - These are the recommended over casting to PyArrayObject and accessing - the members directly. + +/* + * All sorts of useful ways to look into a PyArrayObject. These are + * the recommended over casting to PyArrayObject and accessing the + * members directly. */ #define PyArray_NDIM(obj) (((PyArrayObject *)(obj))->nd) @@ -1184,10 +1290,10 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); #define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj)) #define PyArray_HASFIELDS(obj) PyDataType_HASFIELDS(PyArray_DESCR(obj)) - /* FIXME: This should check for a flag on the data-type - that states whether or not it is variable length. - Because the ISFLEXIBLE check is hard-coded to the - built-in data-types. + /* + * FIXME: This should check for a flag on the data-type that + * states whether or not it is variable length. Because the + * ISFLEXIBLE check is hard-coded to the built-in data-types. */ #define PyArray_ISVARIABLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj)) @@ -1228,26 +1334,49 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); #define PyDataType_ISBYTESWAPPED(d) (!PyDataType_ISNOTSWAPPED(d)) -/* This is the form of the struct that's returned pointed by the - PyCObject attribute of an array __array_struct__. See - http://numpy.scipy.org/array_interface.shtml for the full - documentation. */ +/* + * This is the form of the struct that's returned pointed by the + * PyCObject attribute of an array __array_struct__. See + * http://numpy.scipy.org/array_interface.shtml for the full + * documentation. + */ typedef struct { - int two; /* contains the integer 2 as a sanity check */ + int two; /* + * contains the integer 2 as a sanity + * check + */ + int nd; /* number of dimensions */ - char typekind; /* kind in array --- character code of typestr */ + + char typekind; /* + * kind in array --- character code of + * typestr + */ + int itemsize; /* size of each element */ - int flags; /* how should be data interpreted. Valid - flags are CONTIGUOUS (1), FORTRAN (2), - ALIGNED (0x100), NOTSWAPPED (0x200), and - WRITEABLE (0x400). - ARR_HAS_DESCR (0x800) states that arrdescr - field is present in structure */ - npy_intp *shape; /* A length-nd array of shape information */ - npy_intp *strides; /* A length-nd array of stride information */ + + int flags; /* + * how should be data interpreted. Valid + * flags are CONTIGUOUS (1), FORTRAN (2), + * ALIGNED (0x100), NOTSWAPPED (0x200), and + * WRITEABLE (0x400). ARR_HAS_DESCR (0x800) + * states that arrdescr field is present in + * structure + */ + + npy_intp *shape; /* + * A length-nd array of shape + * information + */ + + npy_intp *strides; /* A length-nd array of stride information */ + void *data; /* A pointer to the first element of the array */ - PyObject *descr; /* A list of fields or NULL (ignored if flags - does not have ARR_HAS_DESCR flag set) */ + + PyObject *descr; /* + * A list of fields or NULL (ignored if flags + * does not have ARR_HAS_DESCR flag set) + */ } PyArrayInterface; #endif /* NPY_ARRAYTYPES_H */ |