1 #ifndef _NPY_1_7_DEPRECATED_API_H
2 #define _NPY_1_7_DEPRECATED_API_H
3 
4 #ifndef NPY_DEPRECATED_INCLUDES
5 #error "Should never include npy_*_*_deprecated_api directly."
6 #endif
7 
8 /* Emit a warning if the user did not specifically request the old API */
9 #ifndef NPY_NO_DEPRECATED_API
10 #if defined(_WIN32)
11 #define _WARN___STR2__(x) #x
12 #define _WARN___STR1__(x) _WARN___STR2__(x)
13 #define _WARN___LOC__ __FILE__ "(" _WARN___STR1__(__LINE__) ") : Warning Msg: "
14 #pragma message(_WARN___LOC__"Using deprecated NumPy API, disable it with " \
15                          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
16 #else
17 #warning "Using deprecated NumPy API, disable it with " \
18          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
19 #endif
20 #endif
21 
22 /*
23  * This header exists to collect all dangerous/deprecated NumPy API
24  * as of NumPy 1.7.
25  *
26  * This is an attempt to remove bad API, the proliferation of macros,
27  * and namespace pollution currently produced by the NumPy headers.
28  */
29 
30 /* These array flags are deprecated as of NumPy 1.7 */
31 #define NPY_CONTIGUOUS NPY_ARRAY_C_CONTIGUOUS
32 #define NPY_FORTRAN NPY_ARRAY_F_CONTIGUOUS
33 
34 /*
35  * The consistent NPY_ARRAY_* names which don't pollute the NPY_*
36  * namespace were added in NumPy 1.7.
37  *
38  * These versions of the carray flags are deprecated, but
39  * probably should only be removed after two releases instead of one.
40  */
41 #define NPY_C_CONTIGUOUS   NPY_ARRAY_C_CONTIGUOUS
42 #define NPY_F_CONTIGUOUS   NPY_ARRAY_F_CONTIGUOUS
43 #define NPY_OWNDATA        NPY_ARRAY_OWNDATA
44 #define NPY_FORCECAST      NPY_ARRAY_FORCECAST
45 #define NPY_ENSURECOPY     NPY_ARRAY_ENSURECOPY
46 #define NPY_ENSUREARRAY    NPY_ARRAY_ENSUREARRAY
47 #define NPY_ELEMENTSTRIDES NPY_ARRAY_ELEMENTSTRIDES
48 #define NPY_ALIGNED        NPY_ARRAY_ALIGNED
49 #define NPY_NOTSWAPPED     NPY_ARRAY_NOTSWAPPED
50 #define NPY_WRITEABLE      NPY_ARRAY_WRITEABLE
51 #define NPY_UPDATEIFCOPY   NPY_ARRAY_UPDATEIFCOPY
52 #define NPY_BEHAVED        NPY_ARRAY_BEHAVED
53 #define NPY_BEHAVED_NS     NPY_ARRAY_BEHAVED_NS
54 #define NPY_CARRAY         NPY_ARRAY_CARRAY
55 #define NPY_CARRAY_RO      NPY_ARRAY_CARRAY_RO
56 #define NPY_FARRAY         NPY_ARRAY_FARRAY
57 #define NPY_FARRAY_RO      NPY_ARRAY_FARRAY_RO
58 #define NPY_DEFAULT        NPY_ARRAY_DEFAULT
59 #define NPY_IN_ARRAY       NPY_ARRAY_IN_ARRAY
60 #define NPY_OUT_ARRAY      NPY_ARRAY_OUT_ARRAY
61 #define NPY_INOUT_ARRAY    NPY_ARRAY_INOUT_ARRAY
62 #define NPY_IN_FARRAY      NPY_ARRAY_IN_FARRAY
63 #define NPY_OUT_FARRAY     NPY_ARRAY_OUT_FARRAY
64 #define NPY_INOUT_FARRAY   NPY_ARRAY_INOUT_FARRAY
65 #define NPY_UPDATE_ALL     NPY_ARRAY_UPDATE_ALL
66 
67 /* This way of accessing the default type is deprecated as of NumPy 1.7 */
68 #define PyArray_DEFAULT NPY_DEFAULT_TYPE
69 
70 /* These DATETIME bits aren't used internally */
71 #define PyDataType_GetDatetimeMetaData(descr)                                 \
72     ((descr->metadata == NULL) ? NULL :                                       \
73         ((PyArray_DatetimeMetaData *)(PyCapsule_GetPointer(                   \
74                 PyDict_GetItemString(                                         \
75                     descr->metadata, NPY_METADATA_DTSTR), NULL))))
76 
77 /*
78  * Deprecated as of NumPy 1.7, this kind of shortcut doesn't
79  * belong in the public API.
80  */
81 #define NPY_AO PyArrayObject
82 
83 /*
84  * Deprecated as of NumPy 1.7, an all-lowercase macro doesn't
85  * belong in the public API.
86  */
87 #define fortran fortran_
88 
89 /*
90  * Deprecated as of NumPy 1.7, as it is a namespace-polluting
91  * macro.
92  */
93 #define FORTRAN_IF PyArray_FORTRAN_IF
94 
95 /* Deprecated as of NumPy 1.7, datetime64 uses c_metadata instead */
96 #define NPY_METADATA_DTSTR "__timeunit__"
97 
98 /*
99  * Deprecated as of NumPy 1.7.
100  * The reasoning:
101  *  - These are for datetime, but there's no datetime "namespace".
102  *  - They just turn NPY_STR_<x> into "<x>", which is just
103  *    making something simple be indirected.
104  */
105 #define NPY_STR_Y "Y"
106 #define NPY_STR_M "M"
107 #define NPY_STR_W "W"
108 #define NPY_STR_D "D"
109 #define NPY_STR_h "h"
110 #define NPY_STR_m "m"
111 #define NPY_STR_s "s"
112 #define NPY_STR_ms "ms"
113 #define NPY_STR_us "us"
114 #define NPY_STR_ns "ns"
115 #define NPY_STR_ps "ps"
116 #define NPY_STR_fs "fs"
117 #define NPY_STR_as "as"
118 
119 /*
120  * The macros in old_defines.h are Deprecated as of NumPy 1.7 and will be
121  * removed in the next major release.
122  */
123 #include "old_defines.h"
124 
125 #endif
126