[Scipy-svn] r2891 - trunk/Lib/ndimage/src

scipy-svn@scip... scipy-svn@scip...
Thu Mar 29 08:05:55 CDT 2007


Author: stefan
Date: 2007-03-29 08:05:42 -0500 (Thu, 29 Mar 2007)
New Revision: 2891

Modified:
   trunk/Lib/ndimage/src/nd_image.h
Log:
Fix compiler warnings.


Modified: trunk/Lib/ndimage/src/nd_image.h
===================================================================
--- trunk/Lib/ndimage/src/nd_image.h	2007-03-29 12:36:36 UTC (rev 2890)
+++ trunk/Lib/ndimage/src/nd_image.h	2007-03-29 13:05:42 UTC (rev 2891)
@@ -33,14 +33,15 @@
 #define ND_IMAGE_H
 
 #include "Python.h"
-#include <numpy/noprefix.h>
 
-#define NI_MAXDIM NPY_MAXDIMS
+#ifndef ND_IMPORT_ARRAY
+#define NO_IMPORT_ARRAY
+#endif
 
-typedef npy_intp maybelong;
-#define MAXDIM NPY_MAXDIMS
+#include <numpy/noprefix.h>
+#undef NO_IMPORT_ARRAY
 
-#define HAS_UINT64 1
+/* Eventually get rid of everything below this line */
 
 typedef enum
 {
@@ -68,6 +69,39 @@
 #endif
 } NumarrayType;
 
+#define NI_MAXDIM NPY_MAXDIMS
+
+typedef npy_intp maybelong;
+#define MAXDIM NPY_MAXDIMS
+
+#define HAS_UINT64 1
+
+
+
+#ifdef ND_IMPORT_ARRAY
+
+/* Numarray Helper Functions */
+
+static PyArrayObject*
+NA_InputArray(PyObject *a, NumarrayType t, int requires)
+{
+    PyArray_Descr *descr;
+    if (t == tAny) descr = NULL;
+    else descr = PyArray_DescrFromType(t);
+    return (PyArrayObject *)                                            \
+        PyArray_CheckFromAny(a, descr, 0, 0, requires, NULL);
+}
+
+static unsigned long
+NA_elements(PyArrayObject  *a)
+{
+    int i;
+    unsigned long n = 1;
+    for(i = 0; i<a->nd; i++)
+        n *= a->dimensions[i];
+    return n;
+}
+
 /* satisfies ensures that 'a' meets a set of requirements and matches
 the specified type.
 */
@@ -91,16 +125,6 @@
     return type_ok;
 }
 
-static PyArrayObject*
-NA_InputArray(PyObject *a, NumarrayType t, int requires)
-{
-    PyArray_Descr *descr;
-    if (t == tAny) descr = NULL;
-    else descr = PyArray_DescrFromType(t);
-    return (PyArrayObject *)                                            \
-        PyArray_CheckFromAny(a, descr, 0, 0, requires, NULL);
-}
-
 static PyArrayObject *
 NA_OutputArray(PyObject *a, NumarrayType t, int requires)
 {
@@ -161,16 +185,6 @@
     return shadow;
 }
 
-static unsigned long
-NA_elements(PyArrayObject  *a)
-{
-    int i;
-    unsigned long n = 1;
-    for(i = 0; i<a->nd; i++)
-        n *= a->dimensions[i];
-    return n;
-}
-
 #define NUM_LITTLE_ENDIAN 0
 #define NUM_BIG_ENDIAN 1
 
@@ -275,11 +289,12 @@
                                        NA_ByteOrder(), 1, 1);
 }
 
-
-#define  NA_InputArray (*(PyArrayObject* (*) (PyObject*,NumarrayType,int) ) (void *) NA_InputArray)
 #define  NA_OutputArray (*(PyArrayObject* (*) (PyObject*,NumarrayType,int) ) (void *) NA_OutputArray)
 #define  NA_IoArray (*(PyArrayObject* (*) (PyObject*,NumarrayType,int) ) (void *) NA_IoArray)
+#define  NA_NewArray (*(PyArrayObject* (*) (void* buffer, NumarrayType type, int ndim, ...) ) (void *) NA_NewArray )
 #define  NA_elements (*(unsigned long (*) (PyArrayObject*) ) (void *) NA_elements)
-#define  NA_NewArray (*(PyArrayObject* (*) (void* buffer, NumarrayType type, int ndim, ...) ) (void *) NA_NewArray )
+#define  NA_InputArray (*(PyArrayObject* (*) (PyObject*,NumarrayType,int) ) (void *) NA_InputArray)
 
-#endif
+#endif /* ND_IMPORT_ARRAY */
+
+#endif /* ND_IMAGE_H */



More information about the Scipy-svn mailing list