summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-02-01 16:24:45 -0700
committerCharles Harris <charlesr.harris@gmail.com>2012-02-04 16:11:39 -0700
commit28214cf236251897038dcedfb50a62a2a2007358 (patch)
tree5a6df5beb0037a05ad4476a21341a9284e2980f6 /doc
parent95e2e1574bf14ce463489752427274c0d138a6ec (diff)
downloadnumpy-28214cf236251897038dcedfb50a62a2a2007358.tar.gz
DOC: Replace references to macros in old_defines with new.
Also remove swig support for numpy < 1 from numpy.i since it expects the old macros.
Diffstat (limited to 'doc')
-rw-r--r--doc/source/reference/c-api.array.rst12
-rw-r--r--doc/source/reference/c-api.types-and-structures.rst20
-rw-r--r--doc/source/user/c-info.beyond-basics.rst6
-rw-r--r--doc/source/user/c-info.how-to-extend.rst4
-rw-r--r--doc/swig/numpy.i57
-rw-r--r--doc/swig/pyfragments.swg55
6 files changed, 21 insertions, 133 deletions
diff --git a/doc/source/reference/c-api.array.rst b/doc/source/reference/c-api.array.rst
index 46a215a12..89981a977 100644
--- a/doc/source/reference/c-api.array.rst
+++ b/doc/source/reference/c-api.array.rst
@@ -336,7 +336,7 @@ From scratch
and data type given by *dtype*. If *fortran* is non-zero, then a
Fortran-order array is created, otherwise a C-order array is
created. Fill the memory with zeros (or the 0 object if *dtype*
- corresponds to :ctype:`PyArray_OBJECT` ).
+ corresponds to :ctype:`NPY_OBJECT` ).
.. cfunction:: PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran)
@@ -349,7 +349,7 @@ From scratch
and data type given by *dtype*. If *fortran* is non-zero, then a
Fortran-order array is created, otherwise a C-order array is
created. The array is uninitialized unless the data type
- corresponds to :ctype:`PyArray_OBJECT` in which case the array is
+ corresponds to :ctype:`NPY_OBJECT` in which case the array is
filled with :cdata:`Py_None`.
.. cfunction:: PyObject* PyArray_EMPTY(int nd, npy_intp* dims, int typenum, int fortran)
@@ -1272,7 +1272,7 @@ New data types
*totype*. Any old casting function is over-written. A ``0`` is
returned on success or a ``-1`` on failure.
-.. cfunction:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, PyArray_SCALARKIND scalar)
+.. cfunction:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, NPY_SCALARKIND scalar)
Register the data-type number, *totype*, as castable from
data-type object, *descr*, of the given *scalar* kind. Use
@@ -1281,7 +1281,7 @@ New data types
*totype*.
-Special functions for PyArray_OBJECT
+Special functions for NPY_OBJECT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. cfunction:: int PyArray_INCREF(PyArrayObject* op)
@@ -1318,7 +1318,7 @@ Special functions for PyArray_OBJECT
Fill a newly created array with a single value obj at all
locations in the structure with object data-types. No checking is
- performed but *arr* must be of data-type :ctype:`PyArray_OBJECT` and be
+ performed but *arr* must be of data-type :ctype:`NPY_OBJECT` and be
single-segment and uninitialized (no previous objects in
position). Use :cfunc:`PyArray_DECREF` (*arr*) if you need to
decrement all the items in the object array prior to calling this
@@ -1952,7 +1952,7 @@ Calculation
Equivalent to :meth:`ndarray.mean` (*self*, *axis*, *rtype*). Returns the
mean of the elements along the given *axis*, using the enumerated
type *rtype* as the data type to sum in. Default sum behavior is
- obtained using :cdata:`PyArray_NOTYPE` for *rtype*.
+ obtained using :cdata:`NPY_NOTYPE` for *rtype*.
.. cfunction:: PyObject* PyArray_Trace(PyArrayObject* self, int offset, int axis1, int axis2, int rtype, PyArrayObject* out)
diff --git a/doc/source/reference/c-api.types-and-structures.rst b/doc/source/reference/c-api.types-and-structures.rst
index 8c813faf5..07c7e07be 100644
--- a/doc/source/reference/c-api.types-and-structures.rst
+++ b/doc/source/reference/c-api.types-and-structures.rst
@@ -388,7 +388,7 @@ PyArrayDescr_Type
.. code-block:: c
typedef struct {
- PyArray_VectorUnaryFunc *cast[PyArray_NTYPES];
+ PyArray_VectorUnaryFunc *cast[NPY_NTYPES];
PyArray_GetItemFunc *getitem;
PyArray_SetItemFunc *setitem;
PyArray_CopySwapNFunc *copyswapn;
@@ -401,8 +401,8 @@ PyArrayDescr_Type
PyArray_NonzeroFunc *nonzero;
PyArray_FillFunc *fill;
PyArray_FillWithScalarFunc *fillwithscalar;
- PyArray_SortFunc *sort[PyArray_NSORTS];
- PyArray_ArgSortFunc *argsort[PyArray_NSORTS];
+ PyArray_SortFunc *sort[NPY_NSORTS];
+ PyArray_ArgSortFunc *argsort[NPY_NSORTS];
PyObject *castdict;
PyArray_ScalarKindFunc *scalarkind;
int **cancastscalarkindto;
@@ -544,8 +544,8 @@ PyArrayDescr_Type
An array of function pointers to a particular sorting
algorithms. A particular sorting algorithm is obtained using a
- key (so far :cdata:`PyArray_QUICKSORT`, :data`PyArray_HEAPSORT`, and
- :cdata:`PyArray_MERGESORT` are defined). These sorts are done
+ key (so far :cdata:`NPY_QUICKSORT`, :data`NPY_HEAPSORT`, and
+ :cdata:`NPY_MERGESORT` are defined). These sorts are done
in-place assuming contiguous and aligned data.
.. cmember:: int argsort(void* start, npy_intp* result, npy_intp length,
@@ -563,27 +563,27 @@ PyArrayDescr_Type
functions for user- defined data-types. Each function is
wrapped in a :ctype:`PyCObject *` and keyed by the data-type number.
- .. cmember:: PyArray_SCALARKIND scalarkind(PyArrayObject* arr)
+ .. cmember:: NPY_SCALARKIND scalarkind(PyArrayObject* arr)
A function to determine how scalars of this type should be
interpreted. The argument is ``NULL`` or a 0-dimensional array
containing the data (if that is needed to determine the kind
of scalar). The return value must be of type
- :ctype:`PyArray_SCALARKIND`.
+ :ctype:`NPY_SCALARKIND`.
.. cmember:: int **cancastscalarkindto
- Either ``NULL`` or an array of :ctype:`PyArray_NSCALARKINDS`
+ Either ``NULL`` or an array of :ctype:`NPY_NSCALARKINDS`
pointers. These pointers should each be either ``NULL`` or a
pointer to an array of integers (terminated by
- :cdata:`PyArray_NOTYPE`) indicating data-types that a scalar of
+ :cdata:`NPY_NOTYPE`) indicating data-types that a scalar of
this data-type of the specified kind can be cast to safely
(this usually means without losing precision).
.. cmember:: int *cancastto
Either ``NULL`` or an array of integers (terminated by
- :cdata:`PyArray_NOTYPE` ) indicated data-types that this data-type
+ :cdata:`NPY_NOTYPE` ) indicated data-types that this data-type
can be cast to safely (this usually means without losing
precision).
diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst
index 9ed2ab386..3437985b6 100644
--- a/doc/source/user/c-info.beyond-basics.rst
+++ b/doc/source/user/c-info.beyond-basics.rst
@@ -189,7 +189,7 @@ feature follows.
PyArray_MultiIter_NEXT(mobj);
}
-The function :cfunc:`PyArray_RemoveLargest` ( ``multi`` ) can be used to
+The function :cfunc:`PyArray_RemoveSmallest` ( ``multi`` ) can be used to
take a multi-iterator object and adjust all the iterators so that
iteration does not take place over the largest dimension (it makes
that dimension of size 1). The code being looped over that makes use
@@ -330,7 +330,7 @@ function :cfunc:`PyArray_RegisterCanCast` (from_descr, totype_number,
scalarkind) should be used to specify that the data-type object
from_descr can be cast to the data-type with type number
totype_number. If you are not trying to alter scalar coercion rules,
-then use :cdata:`PyArray_NOSCALAR` for the scalarkind argument.
+then use :cdata:`NPY_NOSCALAR` for the scalarkind argument.
If you want to allow your new data-type to also be able to share in
the scalar coercion rules, then you need to specify the scalarkind
@@ -340,7 +340,7 @@ available to that function). Then, you can register data-types that
can be cast to separately for each scalar kind that may be returned
from your user-defined data-type. If you don't register scalar
coercion handling, then all of your user-defined data-types will be
-seen as :cdata:`PyArray_NOSCALAR`.
+seen as :cdata:`NPY_NOSCALAR`.
Registering a ufunc loop
diff --git a/doc/source/user/c-info.how-to-extend.rst b/doc/source/user/c-info.how-to-extend.rst
index 2d10c36a3..5901ce3e3 100644
--- a/doc/source/user/c-info.how-to-extend.rst
+++ b/doc/source/user/c-info.how-to-extend.rst
@@ -522,10 +522,10 @@ simpler forms exist that are easier to use.
This function allocates new memory and places it in an ndarray
with *nd* dimensions whose shape is determined by the array of
at least *nd* items pointed to by *dims*. The memory for the
- array is uninitialized (unless typenum is :cdata:`PyArray_OBJECT` in
+ array is uninitialized (unless typenum is :cdata:`NPY_OBJECT` in
which case each element in the array is set to NULL). The
*typenum* argument allows specification of any of the builtin
- data-types such as :cdata:`PyArray_FLOAT` or :cdata:`PyArray_LONG`. The
+ data-types such as :cdata:`NPY_FLOAT` or :cdata:`NPY_LONG`. The
memory for the array can be set to zero if desired using
:cfunc:`PyArray_FILLWBYTE` (return_object, 0).
diff --git a/doc/swig/numpy.i b/doc/swig/numpy.i
index e3ff236aa..ea3f76405 100644
--- a/doc/swig/numpy.i
+++ b/doc/swig/numpy.i
@@ -11,63 +11,6 @@
/**********************************************************************/
-%fragment("NumPy_Backward_Compatibility", "header")
-{
-/* Support older NumPy data type names
-*/
-%#if NDARRAY_VERSION < 0x01000000
-%#define NPY_BOOL PyArray_BOOL
-%#define NPY_BYTE PyArray_BYTE
-%#define NPY_UBYTE PyArray_UBYTE
-%#define NPY_SHORT PyArray_SHORT
-%#define NPY_USHORT PyArray_USHORT
-%#define NPY_INT PyArray_INT
-%#define NPY_UINT PyArray_UINT
-%#define NPY_LONG PyArray_LONG
-%#define NPY_ULONG PyArray_ULONG
-%#define NPY_LONGLONG PyArray_LONGLONG
-%#define NPY_ULONGLONG PyArray_ULONGLONG
-%#define NPY_FLOAT PyArray_FLOAT
-%#define NPY_DOUBLE PyArray_DOUBLE
-%#define NPY_LONGDOUBLE PyArray_LONGDOUBLE
-%#define NPY_CFLOAT PyArray_CFLOAT
-%#define NPY_CDOUBLE PyArray_CDOUBLE
-%#define NPY_CLONGDOUBLE PyArray_CLONGDOUBLE
-%#define NPY_OBJECT PyArray_OBJECT
-%#define NPY_STRING PyArray_STRING
-%#define NPY_UNICODE PyArray_UNICODE
-%#define NPY_VOID PyArray_VOID
-%#define NPY_NTYPES PyArray_NTYPES
-%#define NPY_NOTYPE PyArray_NOTYPE
-%#define NPY_CHAR PyArray_CHAR
-%#define NPY_USERDEF PyArray_USERDEF
-%#define npy_intp intp
-
-%#define NPY_MAX_BYTE MAX_BYTE
-%#define NPY_MIN_BYTE MIN_BYTE
-%#define NPY_MAX_UBYTE MAX_UBYTE
-%#define NPY_MAX_SHORT MAX_SHORT
-%#define NPY_MIN_SHORT MIN_SHORT
-%#define NPY_MAX_USHORT MAX_USHORT
-%#define NPY_MAX_INT MAX_INT
-%#define NPY_MIN_INT MIN_INT
-%#define NPY_MAX_UINT MAX_UINT
-%#define NPY_MAX_LONG MAX_LONG
-%#define NPY_MIN_LONG MIN_LONG
-%#define NPY_MAX_ULONG MAX_ULONG
-%#define NPY_MAX_LONGLONG MAX_LONGLONG
-%#define NPY_MIN_LONGLONG MIN_LONGLONG
-%#define NPY_MAX_ULONGLONG MAX_ULONGLONG
-%#define NPY_MAX_INTP MAX_INTP
-%#define NPY_MIN_INTP MIN_INTP
-
-%#define NPY_FARRAY FARRAY
-%#define NPY_F_CONTIGUOUS F_CONTIGUOUS
-%#endif
-}
-
-/**********************************************************************/
-
/* The following code originally appeared in
* enthought/kiva/agg/src/numeric.i written by Eric Jones. It was
* translated from C++ to C by John Hunter. Bill Spotz has modified
diff --git a/doc/swig/pyfragments.swg b/doc/swig/pyfragments.swg
index 0deaa61e1..8f077ee62 100644
--- a/doc/swig/pyfragments.swg
+++ b/doc/swig/pyfragments.swg
@@ -8,61 +8,6 @@
* numpy.
*/
-%fragment("NumPy_Backward_Compatibility", "header")
-{
-/* Support older NumPy data type names
- */
-%#if NDARRAY_VERSION < 0x01000000
-%#define NPY_BOOL PyArray_BOOL
-%#define NPY_BYTE PyArray_BYTE
-%#define NPY_UBYTE PyArray_UBYTE
-%#define NPY_SHORT PyArray_SHORT
-%#define NPY_USHORT PyArray_USHORT
-%#define NPY_INT PyArray_INT
-%#define NPY_UINT PyArray_UINT
-%#define NPY_LONG PyArray_LONG
-%#define NPY_ULONG PyArray_ULONG
-%#define NPY_LONGLONG PyArray_LONGLONG
-%#define NPY_ULONGLONG PyArray_ULONGLONG
-%#define NPY_FLOAT PyArray_FLOAT
-%#define NPY_DOUBLE PyArray_DOUBLE
-%#define NPY_LONGDOUBLE PyArray_LONGDOUBLE
-%#define NPY_CFLOAT PyArray_CFLOAT
-%#define NPY_CDOUBLE PyArray_CDOUBLE
-%#define NPY_CLONGDOUBLE PyArray_CLONGDOUBLE
-%#define NPY_OBJECT PyArray_OBJECT
-%#define NPY_STRING PyArray_STRING
-%#define NPY_UNICODE PyArray_UNICODE
-%#define NPY_VOID PyArray_VOID
-%#define NPY_NTYPES PyArray_NTYPES
-%#define NPY_NOTYPE PyArray_NOTYPE
-%#define NPY_CHAR PyArray_CHAR
-%#define NPY_USERDEF PyArray_USERDEF
-%#define npy_intp intp
-
-%#define NPY_MAX_BYTE MAX_BYTE
-%#define NPY_MIN_BYTE MIN_BYTE
-%#define NPY_MAX_UBYTE MAX_UBYTE
-%#define NPY_MAX_SHORT MAX_SHORT
-%#define NPY_MIN_SHORT MIN_SHORT
-%#define NPY_MAX_USHORT MAX_USHORT
-%#define NPY_MAX_INT MAX_INT
-%#define NPY_MIN_INT MIN_INT
-%#define NPY_MAX_UINT MAX_UINT
-%#define NPY_MAX_LONG MAX_LONG
-%#define NPY_MIN_LONG MIN_LONG
-%#define NPY_MAX_ULONG MAX_ULONG
-%#define NPY_MAX_LONGLONG MAX_LONGLONG
-%#define NPY_MIN_LONGLONG MIN_LONGLONG
-%#define NPY_MAX_ULONGLONG MAX_ULONGLONG
-%#define NPY_MAX_INTP MAX_INTP
-%#define NPY_MIN_INTP MIN_INTP
-
-%#define NPY_FARRAY FARRAY
-%#define NPY_F_CONTIGUOUS F_CONTIGUOUS
-%#endif
-}
-
/**********************************************************************/
/* Override the SWIG_AsVal_frag(long) fragment so that it also checks