[Numpy-svn] r6389 - branches/coremath/numpy/core/include/numpy
numpy-svn at scipy.org
numpy-svn at scipy.org
Wed Feb 18 12:27:39 EST 2009
Author: cdavid
Date: 2009-02-18 11:27:26 -0600 (Wed, 18 Feb 2009)
New Revision: 6389
Added:
branches/coremath/numpy/core/include/numpy/npy_common.h
Modified:
branches/coremath/numpy/core/include/numpy/ndarrayobject.h
Log:
Put npy type base types declaration into separate header, to be usable by C libraries without pulling the whole ndarray stuff.
Modified: branches/coremath/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- branches/coremath/numpy/core/include/numpy/ndarrayobject.h 2009-02-18 17:26:30 UTC (rev 6388)
+++ branches/coremath/numpy/core/include/numpy/ndarrayobject.h 2009-02-18 17:27:26 UTC (rev 6389)
@@ -56,73 +56,8 @@
*/
#define NPY_FEATURE_VERSION 0x00000001
-/* Some platforms don't define bool, long long, or long double.
- Handle that here.
-*/
+#include "npy_common.h"
-#define NPY_BYTE_FMT "hhd"
-#define NPY_UBYTE_FMT "hhu"
-#define NPY_SHORT_FMT "hd"
-#define NPY_USHORT_FMT "hu"
-#define NPY_INT_FMT "d"
-#define NPY_UINT_FMT "u"
-#define NPY_LONG_FMT "ld"
-#define NPY_ULONG_FMT "lu"
-#define NPY_FLOAT_FMT "g"
-#define NPY_DOUBLE_FMT "g"
-
-#ifdef PY_LONG_LONG
-typedef PY_LONG_LONG npy_longlong;
-typedef unsigned PY_LONG_LONG npy_ulonglong;
-# ifdef _MSC_VER
-# define NPY_LONGLONG_FMT "I64d"
-# define NPY_ULONGLONG_FMT "I64u"
-# define NPY_LONGLONG_SUFFIX(x) (x##i64)
-# define NPY_ULONGLONG_SUFFIX(x) (x##Ui64)
-# else
- /* #define LONGLONG_FMT "lld" Another possible variant
- #define ULONGLONG_FMT "llu"
-
- #define LONGLONG_FMT "qd" -- BSD perhaps?
- #define ULONGLONG_FMT "qu"
- */
-# define NPY_LONGLONG_FMT "Ld"
-# define NPY_ULONGLONG_FMT "Lu"
-# define NPY_LONGLONG_SUFFIX(x) (x##LL)
-# define NPY_ULONGLONG_SUFFIX(x) (x##ULL)
-# endif
-#else
-typedef long npy_longlong;
-typedef unsigned long npy_ulonglong;
-# define NPY_LONGLONG_SUFFIX(x) (x##L)
-# define NPY_ULONGLONG_SUFFIX(x) (x##UL)
-#endif
-
-
-typedef unsigned char npy_bool;
-#define NPY_FALSE 0
-#define NPY_TRUE 1
-
-
-#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE
- typedef double npy_longdouble;
- #define NPY_LONGDOUBLE_FMT "g"
-#else
- typedef long double npy_longdouble;
- #define NPY_LONGDOUBLE_FMT "Lg"
-#endif
-
-#ifndef Py_USING_UNICODE
-#error Must use Python with unicode enabled.
-#endif
-
-
-typedef signed char npy_byte;
-typedef unsigned char npy_ubyte;
-typedef unsigned short npy_ushort;
-typedef unsigned int npy_uint;
-typedef unsigned long npy_ulong;
-
/* These are for completeness */
typedef float npy_float;
typedef double npy_double;
Added: branches/coremath/numpy/core/include/numpy/npy_common.h
===================================================================
--- branches/coremath/numpy/core/include/numpy/npy_common.h 2009-02-18 17:26:30 UTC (rev 6388)
+++ branches/coremath/numpy/core/include/numpy/npy_common.h 2009-02-18 17:27:26 UTC (rev 6389)
@@ -0,0 +1,74 @@
+#ifndef _NPY_COMMON_H_
+#define _NPY_COMMON_H_
+
+/* This is auto-generated */
+#include "numpyconfig.h"
+
+/* Some platforms don't define bool, long long, or long double.
+ Handle that here.
+*/
+
+#define NPY_BYTE_FMT "hhd"
+#define NPY_UBYTE_FMT "hhu"
+#define NPY_SHORT_FMT "hd"
+#define NPY_USHORT_FMT "hu"
+#define NPY_INT_FMT "d"
+#define NPY_UINT_FMT "u"
+#define NPY_LONG_FMT "ld"
+#define NPY_ULONG_FMT "lu"
+#define NPY_FLOAT_FMT "g"
+#define NPY_DOUBLE_FMT "g"
+
+#ifdef PY_LONG_LONG
+typedef PY_LONG_LONG npy_longlong;
+typedef unsigned PY_LONG_LONG npy_ulonglong;
+# ifdef _MSC_VER
+# define NPY_LONGLONG_FMT "I64d"
+# define NPY_ULONGLONG_FMT "I64u"
+# define NPY_LONGLONG_SUFFIX(x) (x##i64)
+# define NPY_ULONGLONG_SUFFIX(x) (x##Ui64)
+# else
+ /* #define LONGLONG_FMT "lld" Another possible variant
+ #define ULONGLONG_FMT "llu"
+
+ #define LONGLONG_FMT "qd" -- BSD perhaps?
+ #define ULONGLONG_FMT "qu"
+ */
+# define NPY_LONGLONG_FMT "Ld"
+# define NPY_ULONGLONG_FMT "Lu"
+# define NPY_LONGLONG_SUFFIX(x) (x##LL)
+# define NPY_ULONGLONG_SUFFIX(x) (x##ULL)
+# endif
+#else
+typedef long npy_longlong;
+typedef unsigned long npy_ulonglong;
+# define NPY_LONGLONG_SUFFIX(x) (x##L)
+# define NPY_ULONGLONG_SUFFIX(x) (x##UL)
+#endif
+
+
+typedef unsigned char npy_bool;
+#define NPY_FALSE 0
+#define NPY_TRUE 1
+
+
+#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE
+ typedef double npy_longdouble;
+ #define NPY_LONGDOUBLE_FMT "g"
+#else
+ typedef long double npy_longdouble;
+ #define NPY_LONGDOUBLE_FMT "Lg"
+#endif
+
+#ifndef Py_USING_UNICODE
+#error Must use Python with unicode enabled.
+#endif
+
+
+typedef signed char npy_byte;
+typedef unsigned char npy_ubyte;
+typedef unsigned short npy_ushort;
+typedef unsigned int npy_uint;
+typedef unsigned long npy_ulong;
+
+#endif
More information about the Numpy-svn
mailing list