Permalink
Browse files

changes to compile for MSVC9.0 (Visual Studio 2008)

  • Loading branch information...
1 parent 47eb6c1 commit 78dfcc455d89a002036642a2a9231d945101e7c5 @bergtholdt bergtholdt committed with matthew-brett Jul 15, 2011
View
4 libcstat/fff/fff_base.h
@@ -35,11 +35,7 @@ extern "C" {
#ifdef NO_APPEND_FORTRAN
# define FFF_FNAME(x) x
#else
-#ifdef _MSC_VER /* _WIN32 */
-# define FFF_FNAME(x) x
-#else
# define FFF_FNAME(x) x##_
-#endif
#endif
View
38 libcstat/wrapper/fffpy.c
@@ -129,11 +129,12 @@ fff_vector* fff_vector_fromPyArray(const PyArrayObject* x)
*/
PyArrayObject* fff_vector_toPyArray(fff_vector* y)
{
- if (y == NULL)
- return NULL;
PyArrayObject* x;
- size_t size = y->size;
+ size_t size;
npy_intp dims[1];
+ if (y == NULL)
+ return NULL;
+ size = y->size;
dims[0] = (npy_intp) size;
@@ -181,6 +182,8 @@ PyArrayObject* fff_vector_const_toPyArray(const fff_vector* y)
fff_matrix* fff_matrix_fromPyArray(const PyArrayObject* x)
{
fff_matrix* y;
+ npy_intp dim[2];
+ PyArrayObject* xd;
/* Check that the input object is a two-dimensional array */
if (PyArray_NDIM(x) != 2) {
@@ -206,8 +209,10 @@ fff_matrix* fff_matrix_fromPyArray(const PyArrayObject* x)
else {
size_t dim0 = PyArray_DIM(x,0), dim1 = PyArray_DIM(x,1);
y = fff_matrix_new((size_t)dim0, (size_t)dim1);
- npy_intp dim[2] = {dim0, dim1};
- PyArrayObject* xd = (PyArrayObject*) PyArray_SimpleNewFromData(2, dim, NPY_DOUBLE, (void*)y->data);
+ dim[0] = dim0;
+ dim[1] = dim1;
+
+ xd = (PyArrayObject*) PyArray_SimpleNewFromData(2, dim, NPY_DOUBLE, (void*)y->data);
PyArray_CastTo(xd, (PyArrayObject*)x);
Py_XDECREF(xd);
}
@@ -223,13 +228,16 @@ fff_matrix* fff_matrix_fromPyArray(const PyArrayObject* x)
*/
PyArrayObject* fff_matrix_toPyArray(fff_matrix* y)
{
- if (y == NULL)
- return NULL;
PyArrayObject* x;
- size_t size1 = y->size1;
- size_t size2 = y->size2;
- size_t tda = y->tda;
+ size_t size1;
+ size_t size2;
+ size_t tda;
npy_intp dims[2];
+ if (y == NULL)
+ return NULL;
+ size1 = y->size1;
+ size2 = y->size2;
+ tda = y->tda;
dims[0] = (npy_intp) size1;
dims[1] = (npy_intp) size2;
@@ -428,12 +436,16 @@ fff_array* fff_array_fromPyArray(const PyArrayObject* x)
PyArrayObject* fff_array_toPyArray(fff_array* y)
{
- if (y == NULL)
- return NULL;
PyArrayObject* x;
- npy_intp dims[4] = {y->dimX, y->dimY, y->dimZ, y->dimT};
+ npy_intp dims[4];
int datatype;
fff_array* yy;
+ if (y == NULL)
+ return NULL;
+ dims[0] = y->dimX;
+ dims[1] = y->dimY;
+ dims[2] = y->dimZ;
+ dims[3] = y->dimT;
/* Match data type */
datatype = fff_datatype_toNumPy(y->datatype);
View
3 nipy/algorithms/registration/cubic_spline.c
@@ -9,6 +9,9 @@
#define FLOOR(a)((a)>0.0 ? (int)(a):(((int)(a)-a)!= 0.0 ? (int)(a)-1 : (int)(a)))
#define ROUND(a)(FLOOR(a+0.5))
+#ifdef _MSC_VER
+#define inline __inline
+#endif
#define CUBIC_SPLINE_MIRROR(x, n, p) \
((x)<0.0 ? (-(x)) : ((x)>(n) ? ((p)-(x)) : (x)))
View
3 nipy/algorithms/registration/joint_histogram.c
@@ -11,6 +11,9 @@
#define UROUND(a) ((int)(a+0.5))
#define ROUND(a)(FLOOR(a+0.5))
+#ifdef _MSC_VER
+#define inline __inline
+#endif
static inline void _pv_interpolation(unsigned int i,
double* H, unsigned int clampJ,
View
4 nipy/algorithms/segmentation/mrf.c
@@ -3,6 +3,10 @@
#include <math.h>
#include <stdlib.h>
+#ifdef _MSC_VER
+#define inline __inline
+#endif
+
/* Numpy import */
void mrf_import_array(void) {

0 comments on commit 78dfcc4

Please sign in to comment.