Skip to content
This repository
Browse code

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.
  • Loading branch information...
commit 28214cf236251897038dcedfb50a62a2a2007358 1 parent 95e2e15
Charles Harris authored February 01, 2012
12  doc/source/reference/c-api.array.rst
Source Rendered
@@ -336,7 +336,7 @@ From scratch
336 336
     and data type given by *dtype*. If *fortran* is non-zero, then a
337 337
     Fortran-order array is created, otherwise a C-order array is
338 338
     created. Fill the memory with zeros (or the 0 object if *dtype*
339  
-    corresponds to :ctype:`PyArray_OBJECT` ).
  339
+    corresponds to :ctype:`NPY_OBJECT` ).
340 340
 
341 341
 .. cfunction:: PyObject* PyArray_ZEROS(int nd, npy_intp* dims, int type_num, int fortran)
342 342
 
@@ -349,7 +349,7 @@ From scratch
349 349
     and data type given by *dtype*. If *fortran* is non-zero, then a
350 350
     Fortran-order array is created, otherwise a C-order array is
351 351
     created. The array is uninitialized unless the data type
352  
-    corresponds to :ctype:`PyArray_OBJECT` in which case the array is
  352
+    corresponds to :ctype:`NPY_OBJECT` in which case the array is
353 353
     filled with :cdata:`Py_None`.
354 354
 
355 355
 .. cfunction:: PyObject* PyArray_EMPTY(int nd, npy_intp* dims, int typenum, int fortran)
@@ -1272,7 +1272,7 @@ New data types
1272 1272
     *totype*. Any old casting function is over-written. A ``0`` is
1273 1273
     returned on success or a ``-1`` on failure.
1274 1274
 
1275  
-.. cfunction:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, PyArray_SCALARKIND scalar)
  1275
+.. cfunction:: int PyArray_RegisterCanCast(PyArray_Descr* descr, int totype, NPY_SCALARKIND scalar)
1276 1276
 
1277 1277
     Register the data-type number, *totype*, as castable from
1278 1278
     data-type object, *descr*, of the given *scalar* kind. Use
@@ -1281,7 +1281,7 @@ New data types
1281 1281
     *totype*.
1282 1282
 
1283 1283
 
1284  
-Special functions for PyArray_OBJECT
  1284
+Special functions for NPY_OBJECT
1285 1285
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1286 1286
 
1287 1287
 .. cfunction:: int PyArray_INCREF(PyArrayObject* op)
@@ -1318,7 +1318,7 @@ Special functions for PyArray_OBJECT
1318 1318
 
1319 1319
     Fill a newly created array with a single value obj at all
1320 1320
     locations in the structure with object data-types. No checking is
1321  
-    performed but *arr* must be of data-type :ctype:`PyArray_OBJECT` and be
  1321
+    performed but *arr* must be of data-type :ctype:`NPY_OBJECT` and be
1322 1322
     single-segment and uninitialized (no previous objects in
1323 1323
     position). Use :cfunc:`PyArray_DECREF` (*arr*) if you need to
1324 1324
     decrement all the items in the object array prior to calling this
@@ -1952,7 +1952,7 @@ Calculation
1952 1952
     Equivalent to :meth:`ndarray.mean` (*self*, *axis*, *rtype*). Returns the
1953 1953
     mean of the elements along the given *axis*, using the enumerated
1954 1954
     type *rtype* as the data type to sum in. Default sum behavior is
1955  
-    obtained using :cdata:`PyArray_NOTYPE` for *rtype*.
  1955
+    obtained using :cdata:`NPY_NOTYPE` for *rtype*.
1956 1956
 
1957 1957
 .. cfunction:: PyObject* PyArray_Trace(PyArrayObject* self, int offset, int axis1, int axis2, int rtype, PyArrayObject* out)
1958 1958
 
20  doc/source/reference/c-api.types-and-structures.rst
Source Rendered
@@ -388,7 +388,7 @@ PyArrayDescr_Type
388 388
     .. code-block:: c
389 389
 
390 390
        typedef struct {
391  
-           PyArray_VectorUnaryFunc *cast[PyArray_NTYPES];
  391
+           PyArray_VectorUnaryFunc *cast[NPY_NTYPES];
392 392
            PyArray_GetItemFunc *getitem;
393 393
            PyArray_SetItemFunc *setitem;
394 394
            PyArray_CopySwapNFunc *copyswapn;
@@ -401,8 +401,8 @@ PyArrayDescr_Type
401 401
            PyArray_NonzeroFunc *nonzero;
402 402
            PyArray_FillFunc *fill;
403 403
            PyArray_FillWithScalarFunc *fillwithscalar;
404  
-           PyArray_SortFunc *sort[PyArray_NSORTS];
405  
-           PyArray_ArgSortFunc *argsort[PyArray_NSORTS];
  404
+           PyArray_SortFunc *sort[NPY_NSORTS];
  405
+           PyArray_ArgSortFunc *argsort[NPY_NSORTS];
406 406
            PyObject *castdict;
407 407
            PyArray_ScalarKindFunc *scalarkind;
408 408
            int **cancastscalarkindto;
@@ -544,8 +544,8 @@ PyArrayDescr_Type
544 544
 
545 545
         An array of function pointers to a particular sorting
546 546
         algorithms. A particular sorting algorithm is obtained using a
547  
-        key (so far :cdata:`PyArray_QUICKSORT`, :data`PyArray_HEAPSORT`, and
548  
-        :cdata:`PyArray_MERGESORT` are defined). These sorts are done
  547
+        key (so far :cdata:`NPY_QUICKSORT`, :data`NPY_HEAPSORT`, and
  548
+        :cdata:`NPY_MERGESORT` are defined). These sorts are done
549 549
         in-place assuming contiguous and aligned data.
550 550
 
551 551
     .. cmember:: int argsort(void* start, npy_intp* result, npy_intp length,
@@ -563,27 +563,27 @@ PyArrayDescr_Type
563 563
         functions for user- defined data-types. Each function is
564 564
         wrapped in a :ctype:`PyCObject *` and keyed by the data-type number.
565 565
 
566  
-    .. cmember:: PyArray_SCALARKIND scalarkind(PyArrayObject* arr)
  566
+    .. cmember:: NPY_SCALARKIND scalarkind(PyArrayObject* arr)
567 567
 
568 568
         A function to determine how scalars of this type should be
569 569
         interpreted. The argument is ``NULL`` or a 0-dimensional array
570 570
         containing the data (if that is needed to determine the kind
571 571
         of scalar). The return value must be of type
572  
-        :ctype:`PyArray_SCALARKIND`.
  572
+        :ctype:`NPY_SCALARKIND`.
573 573
 
574 574
     .. cmember:: int **cancastscalarkindto
575 575
 
576  
-        Either ``NULL`` or an array of :ctype:`PyArray_NSCALARKINDS`
  576
+        Either ``NULL`` or an array of :ctype:`NPY_NSCALARKINDS`
577 577
         pointers. These pointers should each be either ``NULL`` or a
578 578
         pointer to an array of integers (terminated by
579  
-        :cdata:`PyArray_NOTYPE`) indicating data-types that a scalar of
  579
+        :cdata:`NPY_NOTYPE`) indicating data-types that a scalar of
580 580
         this data-type of the specified kind can be cast to safely
581 581
         (this usually means without losing precision).
582 582
 
583 583
     .. cmember:: int *cancastto
584 584
 
585 585
         Either ``NULL`` or an array of integers (terminated by
586  
-        :cdata:`PyArray_NOTYPE` ) indicated data-types that this data-type
  586
+        :cdata:`NPY_NOTYPE` ) indicated data-types that this data-type
587 587
         can be cast to safely (this usually means without losing
588 588
         precision).
589 589
 
6  doc/source/user/c-info.beyond-basics.rst
Source Rendered
@@ -189,7 +189,7 @@ feature follows.
189 189
         PyArray_MultiIter_NEXT(mobj);
190 190
     }
191 191
 
192  
-The function :cfunc:`PyArray_RemoveLargest` ( ``multi`` ) can be used to
  192
+The function :cfunc:`PyArray_RemoveSmallest` ( ``multi`` ) can be used to
193 193
 take a multi-iterator object and adjust all the iterators so that
194 194
 iteration does not take place over the largest dimension (it makes
195 195
 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,
330 330
 scalarkind) should be used to specify that the data-type object
331 331
 from_descr can be cast to the data-type with type number
332 332
 totype_number. If you are not trying to alter scalar coercion rules,
333  
-then use :cdata:`PyArray_NOSCALAR` for the scalarkind argument.
  333
+then use :cdata:`NPY_NOSCALAR` for the scalarkind argument.
334 334
 
335 335
 If you want to allow your new data-type to also be able to share in
336 336
 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
340 340
 can be cast to separately for each scalar kind that may be returned
341 341
 from your user-defined data-type. If you don't register scalar
342 342
 coercion handling, then all of your user-defined data-types will be
343  
-seen as :cdata:`PyArray_NOSCALAR`.
  343
+seen as :cdata:`NPY_NOSCALAR`.
344 344
 
345 345
 
346 346
 Registering a ufunc loop
4  doc/source/user/c-info.how-to-extend.rst
Source Rendered
@@ -522,10 +522,10 @@ simpler forms exist that are easier to use.
522 522
     This function allocates new memory and places it in an ndarray
523 523
     with *nd* dimensions whose shape is determined by the array of
524 524
     at least *nd* items pointed to by *dims*. The memory for the
525  
-    array is uninitialized (unless typenum is :cdata:`PyArray_OBJECT` in
  525
+    array is uninitialized (unless typenum is :cdata:`NPY_OBJECT` in
526 526
     which case each element in the array is set to NULL). The
527 527
     *typenum* argument allows specification of any of the builtin
528  
-    data-types such as :cdata:`PyArray_FLOAT` or :cdata:`PyArray_LONG`. The
  528
+    data-types such as :cdata:`NPY_FLOAT` or :cdata:`NPY_LONG`. The
529 529
     memory for the array can be set to zero if desired using
530 530
     :cfunc:`PyArray_FILLWBYTE` (return_object, 0).
531 531
 
57  doc/swig/numpy.i
@@ -11,63 +11,6 @@
11 11
 
12 12
 /**********************************************************************/
13 13
 
14  
-%fragment("NumPy_Backward_Compatibility", "header")
15  
-{
16  
-/* Support older NumPy data type names
17  
-*/
18  
-%#if NDARRAY_VERSION < 0x01000000
19  
-%#define NPY_BOOL          PyArray_BOOL
20  
-%#define NPY_BYTE          PyArray_BYTE
21  
-%#define NPY_UBYTE         PyArray_UBYTE
22  
-%#define NPY_SHORT         PyArray_SHORT
23  
-%#define NPY_USHORT        PyArray_USHORT
24  
-%#define NPY_INT           PyArray_INT
25  
-%#define NPY_UINT          PyArray_UINT
26  
-%#define NPY_LONG          PyArray_LONG
27  
-%#define NPY_ULONG         PyArray_ULONG
28  
-%#define NPY_LONGLONG      PyArray_LONGLONG
29  
-%#define NPY_ULONGLONG     PyArray_ULONGLONG
30  
-%#define NPY_FLOAT         PyArray_FLOAT
31  
-%#define NPY_DOUBLE        PyArray_DOUBLE
32  
-%#define NPY_LONGDOUBLE    PyArray_LONGDOUBLE
33  
-%#define NPY_CFLOAT        PyArray_CFLOAT
34  
-%#define NPY_CDOUBLE       PyArray_CDOUBLE
35  
-%#define NPY_CLONGDOUBLE   PyArray_CLONGDOUBLE
36  
-%#define NPY_OBJECT        PyArray_OBJECT
37  
-%#define NPY_STRING        PyArray_STRING
38  
-%#define NPY_UNICODE       PyArray_UNICODE
39  
-%#define NPY_VOID          PyArray_VOID
40  
-%#define NPY_NTYPES        PyArray_NTYPES
41  
-%#define NPY_NOTYPE        PyArray_NOTYPE
42  
-%#define NPY_CHAR          PyArray_CHAR
43  
-%#define NPY_USERDEF       PyArray_USERDEF
44  
-%#define npy_intp          intp
45  
-
46  
-%#define NPY_MAX_BYTE      MAX_BYTE
47  
-%#define NPY_MIN_BYTE      MIN_BYTE
48  
-%#define NPY_MAX_UBYTE     MAX_UBYTE
49  
-%#define NPY_MAX_SHORT     MAX_SHORT
50  
-%#define NPY_MIN_SHORT     MIN_SHORT
51  
-%#define NPY_MAX_USHORT    MAX_USHORT
52  
-%#define NPY_MAX_INT       MAX_INT
53  
-%#define NPY_MIN_INT       MIN_INT
54  
-%#define NPY_MAX_UINT      MAX_UINT
55  
-%#define NPY_MAX_LONG      MAX_LONG
56  
-%#define NPY_MIN_LONG      MIN_LONG
57  
-%#define NPY_MAX_ULONG     MAX_ULONG
58  
-%#define NPY_MAX_LONGLONG  MAX_LONGLONG
59  
-%#define NPY_MIN_LONGLONG  MIN_LONGLONG
60  
-%#define NPY_MAX_ULONGLONG MAX_ULONGLONG
61  
-%#define NPY_MAX_INTP      MAX_INTP
62  
-%#define NPY_MIN_INTP      MIN_INTP
63  
-
64  
-%#define NPY_FARRAY        FARRAY
65  
-%#define NPY_F_CONTIGUOUS  F_CONTIGUOUS
66  
-%#endif
67  
-}
68  
-
69  
-/**********************************************************************/
70  
-
71 14
 /* The following code originally appeared in
72 15
  * enthought/kiva/agg/src/numeric.i written by Eric Jones.  It was
73 16
  * translated from C++ to C by John Hunter.  Bill Spotz has modified
55  doc/swig/pyfragments.swg
@@ -8,61 +8,6 @@
8 8
  * numpy.
9 9
  */
10 10
 
11  
-%fragment("NumPy_Backward_Compatibility", "header")
12  
-{
13  
-/* Support older NumPy data type names
14  
- */
15  
-%#if NDARRAY_VERSION < 0x01000000
16  
-%#define NPY_BOOL          PyArray_BOOL
17  
-%#define NPY_BYTE          PyArray_BYTE
18  
-%#define NPY_UBYTE         PyArray_UBYTE
19  
-%#define NPY_SHORT         PyArray_SHORT
20  
-%#define NPY_USHORT        PyArray_USHORT
21  
-%#define NPY_INT           PyArray_INT
22  
-%#define NPY_UINT          PyArray_UINT
23  
-%#define NPY_LONG          PyArray_LONG
24  
-%#define NPY_ULONG         PyArray_ULONG
25  
-%#define NPY_LONGLONG      PyArray_LONGLONG
26  
-%#define NPY_ULONGLONG     PyArray_ULONGLONG
27  
-%#define NPY_FLOAT         PyArray_FLOAT
28  
-%#define NPY_DOUBLE        PyArray_DOUBLE
29  
-%#define NPY_LONGDOUBLE    PyArray_LONGDOUBLE
30  
-%#define NPY_CFLOAT        PyArray_CFLOAT
31  
-%#define NPY_CDOUBLE       PyArray_CDOUBLE
32  
-%#define NPY_CLONGDOUBLE   PyArray_CLONGDOUBLE
33  
-%#define NPY_OBJECT        PyArray_OBJECT
34  
-%#define NPY_STRING        PyArray_STRING
35  
-%#define NPY_UNICODE       PyArray_UNICODE
36  
-%#define NPY_VOID          PyArray_VOID
37  
-%#define NPY_NTYPES        PyArray_NTYPES
38  
-%#define NPY_NOTYPE        PyArray_NOTYPE
39  
-%#define NPY_CHAR          PyArray_CHAR
40  
-%#define NPY_USERDEF       PyArray_USERDEF
41  
-%#define npy_intp          intp
42  
-
43  
-%#define NPY_MAX_BYTE      MAX_BYTE
44  
-%#define NPY_MIN_BYTE      MIN_BYTE
45  
-%#define NPY_MAX_UBYTE     MAX_UBYTE
46  
-%#define NPY_MAX_SHORT     MAX_SHORT
47  
-%#define NPY_MIN_SHORT     MIN_SHORT
48  
-%#define NPY_MAX_USHORT    MAX_USHORT
49  
-%#define NPY_MAX_INT       MAX_INT
50  
-%#define NPY_MIN_INT       MIN_INT
51  
-%#define NPY_MAX_UINT      MAX_UINT
52  
-%#define NPY_MAX_LONG      MAX_LONG
53  
-%#define NPY_MIN_LONG      MIN_LONG
54  
-%#define NPY_MAX_ULONG     MAX_ULONG
55  
-%#define NPY_MAX_LONGLONG  MAX_LONGLONG
56  
-%#define NPY_MIN_LONGLONG  MIN_LONGLONG
57  
-%#define NPY_MAX_ULONGLONG MAX_ULONGLONG
58  
-%#define NPY_MAX_INTP      MAX_INTP
59  
-%#define NPY_MIN_INTP      MIN_INTP
60  
-
61  
-%#define NPY_FARRAY        FARRAY
62  
-%#define NPY_F_CONTIGUOUS  F_CONTIGUOUS
63  
-%#endif
64  
-}
65  
-
66 11
 /**********************************************************************/
67 12
 
68 13
 /* Override the SWIG_AsVal_frag(long) fragment so that it also checks

0 notes on commit 28214cf

Please sign in to comment.
Something went wrong with that request. Please try again.