Permalink
Browse files

Merge branch 'replace-noprefix'

* replace-noprefix: (30 commits)
  BUG: Fix typo npydouble.
  UPD: Remove now redundant typedef.
  UPD: Fix a few more spots missing prefixes.
  BUG: Fix scons build script so it works with umathmodule.c.
  STY: Cleanup some prefixing that crept into comments.
  UPD: Various fixes, Remove #define NPY_NO_PREFIX from files in core.
  ENH: Add some needed macros to include files.
  UPD: Use prefixed types in scalartypes.c.src.
  UPD: Make multiarray *.c files use prefixed macros.
  UPD: Use prefixed types in arraytypes.c.src.
  ENH: Add a few needed macros to npy_common.h.
  UPD: Include ndarrayobject.h instead of arrayobject.h in boolean_ops.c.src.
  UPD: Use prefixed types in lowlevel_strided_loops.c.src template headers.
  UPD: Use explicit prefixed types in einsum.c.src template headers.
  UPD: Use prefixed versions of double and int in multiarray_tests.c.src.
  UPD: Remove includes of noprefix.h in ufunc_object.c and _compiled_base.c.
  BUG: Fix unprefixed reference to cdouble in ndarrayobject.h.
  UPD: Use prefixed macros in numpy/core/src/scalarmathmodule.c.src.
  UPD: Use prefixed macros in numpy/core/src/umath/funcs.inc.src.
  MOV: Rename umathmodule.c.src umathmodule.c since it has no templates.
  ...
  • Loading branch information...
charris committed Feb 10, 2012
2 parents 096b436 + 87214fb commit ca258fc430fbcba6a3824dd3834f8e14259a62c8
Showing with 3,585 additions and 3,041 deletions.
  1. +0 −2 numpy/core/SConscript
  2. +1 −1 numpy/core/blasdot/_dotblas.c
  3. +1 −2 numpy/core/bscript
  4. +3 −2 numpy/core/include/numpy/arrayobject.h
  5. +3 −3 numpy/core/include/numpy/ndarraytypes.h
  6. +9 −2 numpy/core/include/numpy/noprefix.h
  7. +12 −2 numpy/core/include/numpy/npy_common.h
  8. +9 −9 numpy/core/include/numpy/npy_interrupt.h
  9. +2 −3 numpy/core/setup.py
  10. +20 −21 numpy/core/src/multiarray/arrayobject.c
  11. +654 −449 numpy/core/src/multiarray/arraytypes.c.src
  12. +1 −2 numpy/core/src/multiarray/buffer.c
  13. +5 −6 numpy/core/src/multiarray/calculation.c
  14. +18 −19 numpy/core/src/multiarray/common.c
  15. +73 −74 numpy/core/src/multiarray/conversion_utils.c
  16. +4 −4 numpy/core/src/multiarray/conversion_utils.h
  17. +2 −3 numpy/core/src/multiarray/convert.c
  18. +3 −4 numpy/core/src/multiarray/convert_datatype.c
  19. +11 −11 numpy/core/src/multiarray/ctors.c
  20. +10 −10 numpy/core/src/multiarray/ctors.h
  21. +46 −47 numpy/core/src/multiarray/descriptor.c
  22. +1 −1 numpy/core/src/multiarray/dtype_transfer.c
  23. +128 −124 numpy/core/src/multiarray/einsum.c.src
  24. +4 −5 numpy/core/src/multiarray/flagsobject.c
  25. +20 −21 numpy/core/src/multiarray/getset.c
  26. +1 −1 numpy/core/src/multiarray/hashdescr.c
  27. +86 −87 numpy/core/src/multiarray/item_selection.c
  28. +19 −20 numpy/core/src/multiarray/iterators.c
  29. +3 −3 numpy/core/src/multiarray/iterators.h
  30. +41 −21 numpy/core/src/multiarray/lowlevel_strided_loops.c.src
  31. +15 −16 numpy/core/src/multiarray/mapping.c
  32. +4 −4 numpy/core/src/multiarray/mapping.h
  33. +18 −18 numpy/core/src/multiarray/methods.c
  34. +14 −8 numpy/core/src/multiarray/multiarray_tests.c.src
  35. +19 −20 numpy/core/src/multiarray/multiarraymodule.c
  36. +1 −1 numpy/core/src/multiarray/nditer_impl.h
  37. +1 −1 numpy/core/src/multiarray/nditer_pywrap.c
  38. +1 −2 numpy/core/src/multiarray/number.c
  39. +0 −1 numpy/core/src/multiarray/numpymemoryview.c
  40. +0 −1 numpy/core/src/multiarray/numpyos.c
  41. +3 −4 numpy/core/src/multiarray/refcount.c
  42. +8 −9 numpy/core/src/multiarray/scalarapi.c
  43. +197 −137 numpy/core/src/multiarray/scalartypes.c.src
  44. +1 −1 numpy/core/src/multiarray/scalartypes.h
  45. +2 −3 numpy/core/src/multiarray/sequence.c
  46. +8 −9 numpy/core/src/multiarray/shape.c
  47. +19 −20 numpy/core/src/multiarray/ucsnarrow.c
  48. +3 −4 numpy/core/src/multiarray/usertypes.c
  49. +1 −1 numpy/core/src/npymath/ieee754.c.src
  50. +3 −3 numpy/core/src/npymath/npy_math.c.src
  51. +2 −2 numpy/core/src/npymath/npy_math_complex.c.src
  52. +511 −269 numpy/core/src/scalarmathmodule.c.src
  53. +72 −70 numpy/core/src/umath/funcs.inc.src
  54. +335 −319 numpy/core/src/umath/loops.c.src
  55. +1,004 −1,004 numpy/core/src/umath/loops.h
  56. +85 −90 numpy/core/src/umath/loops.h.src
  57. +15 −15 numpy/core/src/umath/ufunc_object.c
  58. +26 −26 numpy/core/src/umath/umath_tests.c.src
  59. +10 −7 numpy/core/src/umath/{umathmodule.c.src → umathmodule.c}
  60. +6 −6 numpy/f2py/doc/multiarray/array_from_pyobj.c
  61. +2 −2 numpy/lib/src/_compiled_base.c
  62. +9 −9 numpy/linalg/lapack_litemodule.c
View
@@ -386,8 +386,6 @@ boolean_ops_src = env.GenerateFromTemplate(
lowlevel_strided_loops_src = env.GenerateFromTemplate(
pjoin('src', 'multiarray', 'lowlevel_strided_loops.c.src'))
einsum_src = env.GenerateFromTemplate(pjoin('src', 'multiarray', 'einsum.c.src'))
-umathmodule_src = env.GenerateFromTemplate(pjoin('src', 'umath',
- 'umathmodule.c.src'))
umath_tests_src = env.GenerateFromTemplate(pjoin('src', 'umath',
'umath_tests.c.src'))
multiarray_tests_src = env.GenerateFromTemplate(pjoin('src', 'multiarray',
@@ -3,7 +3,7 @@ static char module_doc[] =
#include "Python.h"
#include "npy_config.h"
-#include "numpy/ndarrayobject.h"
+#include "numpy/arrayobject.h"
#ifndef CBLAS_HEADER
#define CBLAS_HEADER "cblas.h"
#endif
View
@@ -475,7 +475,6 @@ def pbuild(context):
name="ufunc_api")
ufunc_templates = ["src/umath/loops.c.src",
- "src/umath/umathmodule.c.src",
"src/umath/funcs.inc.src"]
bld(target="ufunc_templates", source=ufunc_templates)
@@ -485,7 +484,7 @@ def pbuild(context):
includes = ["src/umath", "src/private"]
if ENABLE_SEPARATE_COMPILATION:
- sources = [pjoin("src", "umath", "umathmodule.c.src"),
+ sources = [pjoin("src", "umath", "umathmodule.c"),
pjoin("src", "umath", "ufunc_object.c"),
pjoin("src", "umath", "loops.c.src")]
else:
@@ -11,11 +11,12 @@
#ifndef Py_ARRAYOBJECT_H
#define Py_ARRAYOBJECT_H
+
#include "ndarrayobject.h"
+#include "npy_interrupt.h"
+
#ifdef NPY_NO_PREFIX
#include "noprefix.h"
#endif
-#include "npy_interrupt.h"
-
#endif
@@ -919,10 +919,10 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
/*
* Size of internal buffers used for alignment Make BUFSIZE a multiple
- * of sizeof(cdouble) -- usually 16 so that ufunc buffers are aligned
+ * of sizeof(npy_cdouble) -- usually 16 so that ufunc buffers are aligned
*/
-#define NPY_MIN_BUFSIZE ((int)sizeof(cdouble))
-#define NPY_MAX_BUFSIZE (((int)sizeof(cdouble))*1000000)
+#define NPY_MIN_BUFSIZE ((int)sizeof(npy_cdouble))
+#define NPY_MAX_BUFSIZE (((int)sizeof(npy_cdouble))*1000000)
#define NPY_BUFSIZE 8192
/* buffer stress test size: */
/*#define NPY_BUFSIZE 17*/
@@ -1,12 +1,19 @@
#ifndef NPY_NOPREFIX_H
#define NPY_NOPREFIX_H
-/* You can directly include noprefix.h as a backward
-compatibility measure*/
+/*
+ * You can directly include noprefix.h as a backward
+ * compatibility measure
+ */
#ifndef NPY_NO_PREFIX
#include "ndarrayobject.h"
+#include "npy_interrupt.h"
#endif
+#define SIGSETJMP NPY_SIGSETJMP
+#define SIGLONGJMP NPY_SIGLONGJMP
+#define SIGJMP_BUF NPY_SIGJMP_BUF
+
#define MAX_DIMS NPY_MAXDIMS
#define longlong npy_longlong
@@ -29,8 +29,13 @@ enum {
*/
typedef Py_intptr_t npy_intp;
typedef Py_uintptr_t npy_uintp;
+#define NPY_SIZEOF_CHAR 1
+#define NPY_SIZEOF_BYTE 1
#define NPY_SIZEOF_INTP NPY_SIZEOF_PY_INTPTR_T
#define NPY_SIZEOF_UINTP NPY_SIZEOF_PY_INTPTR_T
+#define NPY_SIZEOF_CFLOAT NPY_SIZEOF_COMPLEX_FLOAT
+#define NPY_SIZEOF_CDOUBLE NPY_SIZEOF_COMPLEX_DOUBLE
+#define NPY_SIZEOF_CLONGDOUBLE NPY_SIZEOF_COMPLEX_LONGDOUBLE
#ifdef constchar
#undef constchar
@@ -77,7 +82,7 @@ typedef Py_uintptr_t npy_uintp;
#define PyIntpArrType_Type PyLongArrType_Type
#define PyUIntpArrType_Type PyULongArrType_Type
#define NPY_MAX_INTP NPY_MAX_LONG
- #define NPY_MIN_INTP MIN_LONG
+ #define NPY_MIN_INTP NPY_MIN_LONG
#define NPY_MAX_UINTP NPY_MAX_ULONG
#define NPY_INTP_FMT "ld"
#elif defined(PY_LONG_LONG) && (NPY_SIZEOF_PY_INTPTR_T == NPY_SIZEOF_LONGLONG)
@@ -297,16 +302,21 @@ typedef struct { npy_longdouble real, imag; } npy_clongdouble;
#define NPY_SIZEOF_DATETIME 8
#define NPY_SIZEOF_TIMEDELTA 8
-#define NPY_BITSOF_BOOL (sizeof(npy_bool)*CHAR_BIT)
+#define NPY_BITSOF_BOOL (sizeof(npy_bool) * CHAR_BIT)
#define NPY_BITSOF_CHAR CHAR_BIT
+#define NPY_BITSOF_BYTE (NPY_SIZEOF_BYTE * CHAR_BIT)
#define NPY_BITSOF_SHORT (NPY_SIZEOF_SHORT * CHAR_BIT)
#define NPY_BITSOF_INT (NPY_SIZEOF_INT * CHAR_BIT)
#define NPY_BITSOF_LONG (NPY_SIZEOF_LONG * CHAR_BIT)
#define NPY_BITSOF_LONGLONG (NPY_SIZEOF_LONGLONG * CHAR_BIT)
+#define NPY_BITSOF_INTP (NPY_SIZEOF_INTP * CHAR_BIT)
#define NPY_BITSOF_HALF (NPY_SIZEOF_HALF * CHAR_BIT)
#define NPY_BITSOF_FLOAT (NPY_SIZEOF_FLOAT * CHAR_BIT)
#define NPY_BITSOF_DOUBLE (NPY_SIZEOF_DOUBLE * CHAR_BIT)
#define NPY_BITSOF_LONGDOUBLE (NPY_SIZEOF_LONGDOUBLE * CHAR_BIT)
+#define NPY_BITSOF_CFLOAT (NPY_SIZEOF_CFLOAT * CHAR_BIT)
+#define NPY_BITSOF_CDOUBLE (NPY_SIZEOF_CDOUBLE * CHAR_BIT)
+#define NPY_BITSOF_CLONGDOUBLE (NPY_SIZEOF_CLONGDOUBLE * CHAR_BIT)
#define NPY_BITSOF_DATETIME (NPY_SIZEOF_DATETIME * CHAR_BIT)
#define NPY_BITSOF_TIMEDELTA (NPY_SIZEOF_TIMEDELTA * CHAR_BIT)
@@ -85,22 +85,22 @@ Interrupt handling does not work well with threads.
#ifndef sigsetjmp
-#define SIGSETJMP(arg1, arg2) setjmp(arg1)
-#define SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
-#define SIGJMP_BUF jmp_buf
+#define NPY_SIGSETJMP(arg1, arg2) setjmp(arg1)
+#define NPY_SIGLONGJMP(arg1, arg2) longjmp(arg1, arg2)
+#define NPY_SIGJMP_BUF jmp_buf
#else
-#define SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
-#define SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
-#define SIGJMP_BUF sigjmp_buf
+#define NPY_SIGSETJMP(arg1, arg2) sigsetjmp(arg1, arg2)
+#define NPY_SIGLONGJMP(arg1, arg2) siglongjmp(arg1, arg2)
+#define NPY_SIGJMP_BUF sigjmp_buf
#endif
# define NPY_SIGINT_ON { \
PyOS_sighandler_t _npy_sig_save; \
_npy_sig_save = PyOS_setsig(SIGINT, _PyArray_SigintHandler); \
- if (SIGSETJMP(*((SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
+ if (NPY_SIGSETJMP(*((NPY_SIGJMP_BUF *)_PyArray_GetSigintBuf()), \
1) == 0) { \
# define NPY_SIGINT_OFF } \
@@ -109,8 +109,8 @@ Interrupt handling does not work well with threads.
#else /* NPY_NO_SIGNAL */
-# define NPY_SIGINT_ON
-# define NPY_SIGINT_OFF
+#define NPY_SIGINT_ON
+#define NPY_SIGINT_OFF
#endif /* HAVE_SIGSETJMP */
View
@@ -829,8 +829,7 @@ def generate_umath_templated_sources(ext, build_dir):
subpath = join('src', 'umath')
# NOTE: For manual template conversion of loops.h.src, read the note
# in that file.
- sources = [join(local_dir, subpath, 'loops.c.src'),
- join(local_dir, subpath, 'umathmodule.c.src')]
+ sources = [join(local_dir, subpath, 'loops.c.src')]
# numpy.distutils generate .c from .c.src in weird directories, we have
# to add them there as they depend on the build_dir
@@ -854,7 +853,7 @@ def generate_umath_c(ext, build_dir):
return []
umath_src = [
- join('src', 'umath', 'umathmodule.c.src'),
+ join('src', 'umath', 'umathmodule.c'),
join('src', 'umath', 'funcs.inc.src'),
join('src', 'umath', 'loops.c.src'),
join('src', 'umath', 'ufunc_object.c'),
@@ -27,7 +27,6 @@ maintainer email: oliphant.travis@ieee.org
/*#include <stdio.h>*/
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
@@ -426,7 +425,7 @@ dump_data(char **string, int *n, int *max_n, char *data, int nd,
#define CHECK_MEMORY do { if (*n >= *max_n-16) { \
*max_n *= 2; \
- *string = (char *)_pya_realloc(*string, *max_n); \
+ *string = (char *)PyArray_realloc(*string, *max_n); \
}} while (0)
if (nd == 0) {
@@ -513,17 +512,17 @@ PyArray_DebugPrint(PyArrayObject *obj)
printf(" flags :");
if (fobj->flags & NPY_ARRAY_C_CONTIGUOUS)
- printf(" C_CONTIGUOUS");
+ printf(" NPY_C_CONTIGUOUS");
if (fobj->flags & NPY_ARRAY_F_CONTIGUOUS)
- printf(" F_CONTIGUOUS");
+ printf(" NPY_F_CONTIGUOUS");
if (fobj->flags & NPY_ARRAY_OWNDATA)
- printf(" OWNDATA");
+ printf(" NPY_OWNDATA");
if (fobj->flags & NPY_ARRAY_ALIGNED)
- printf(" ALIGNED");
+ printf(" NPY_ALIGNED");
if (fobj->flags & NPY_ARRAY_WRITEABLE)
- printf(" WRITEABLE");
+ printf(" NPY_WRITEABLE");
if (fobj->flags & NPY_ARRAY_UPDATEIFCOPY)
- printf(" UPDATEIFCOPY");
+ printf(" NPY_UPDATEIFCOPY");
if (fobj->flags & NPY_ARRAY_MASKNA)
printf(" MASKNA");
if (fobj->flags & NPY_ARRAY_OWNMASKNA)
@@ -561,7 +560,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
max_n = PyArray_NBYTES(self)*4*sizeof(char) + 7;
- if ((string = (char *)_pya_malloc(max_n)) == NULL) {
+ if ((string = (char *)PyArray_malloc(max_n)) == NULL) {
return PyErr_NoMemory();
}
@@ -575,7 +574,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
if (dump_data(&string, &n, &max_n, PyArray_DATA(self),
PyArray_NDIM(self), PyArray_DIMS(self),
PyArray_STRIDES(self), self) < 0) {
- _pya_free(string);
+ PyArray_free(string);
return NULL;
}
@@ -595,7 +594,7 @@ array_repr_builtin(PyArrayObject *self, int repr)
ret = PyUString_FromStringAndSize(string, n);
}
- _pya_free(string);
+ PyArray_free(string);
return ret;
}
@@ -730,7 +729,7 @@ _myunincmp(npy_ucs4 *s1, npy_ucs4 *s2, int len1, int len2)
s2t = malloc(size);
memcpy(s2t, s2, size);
}
- val = PyArray_CompareUCS4(s1t, s2t, MIN(len1,len2));
+ val = PyArray_CompareUCS4(s1t, s2t, PyArray_MIN(len1,len2));
if ((val != 0) || (len1 == len2)) {
goto finish;
}
@@ -778,7 +777,7 @@ _mystrncmp(char *s1, char *s2, int len1, int len2)
int val;
int diff;
- val = memcmp(s1, s2, MIN(len1, len2));
+ val = memcmp(s1, s2, PyArray_MIN(len1, len2));
if ((val != 0) || (len1 == len2)) {
return val;
}
@@ -927,7 +926,7 @@ _compare_strings(PyArrayObject *result, PyArrayMultiIterObject *multi,
int cmp_op, void *func, int rstrip)
{
PyArrayIterObject *iself, *iother;
- Bool *dptr;
+ npy_bool *dptr;
npy_intp size;
int val;
int N1, N2;
@@ -936,7 +935,7 @@ _compare_strings(PyArrayObject *result, PyArrayMultiIterObject *multi,
char* (*stripfunc)(char *, char *, int);
compfunc = func;
- dptr = (Bool *)PyArray_DATA(result);
+ dptr = (npy_bool *)PyArray_DATA(result);
iself = multi->iters[0];
iother = multi->iters[1];
size = multi->size;
@@ -1163,7 +1162,7 @@ _void_compare(PyArrayObject *self, PyArrayObject *other, int cmp_op)
newdims.ptr = dimensions;
newdims.len = result_ndim+1;
memcpy(dimensions, PyArray_DIMS((PyArrayObject *)temp),
- sizeof(intp)*result_ndim);
+ sizeof(npy_intp)*result_ndim);
dimensions[result_ndim] = -1;
temp2 = PyArray_Newshape((PyArrayObject *)temp,
&newdims, NPY_ANYORDER);
@@ -1415,7 +1414,7 @@ PyArray_ElementStrides(PyObject *obj)
*/
/*NUMPY_API*/
-NPY_NO_EXPORT Bool
+NPY_NO_EXPORT npy_bool
PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp offset,
npy_intp *dims, npy_intp *newstrides)
{
@@ -1432,10 +1431,10 @@ PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp offset,
for (i = 0; i < nd; i++) {
byte_begin = newstrides[i]*(dims[i] - 1);
if ((byte_begin < begin) || (byte_begin > end)) {
- return FALSE;
+ return NPY_FALSE;
}
}
- return TRUE;
+ return NPY_TRUE;
}
@@ -1449,7 +1448,7 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
PyArray_Dims dims = {NULL, 0};
PyArray_Dims strides = {NULL, 0};
PyArray_Chunk buffer;
- longlong offset = 0;
+ npy_longlong offset = 0;
NPY_ORDER order = NPY_CORDER;
int is_f_order = 0;
PyArrayObject *ret;
@@ -1608,7 +1607,7 @@ array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems))
{
PyObject *obj;
/* nitems will always be 0 */
- obj = (PyObject *)_pya_malloc(NPY_SIZEOF_PYARRAYOBJECT);
+ obj = (PyObject *)PyArray_malloc(NPY_SIZEOF_PYARRAYOBJECT);
PyObject_Init(obj, type);
return obj;
}
Oops, something went wrong.

0 comments on commit ca258fc

Please sign in to comment.