[Numpy-svn] r4493 - in trunk/numpy/doc/swig: . test

numpy-svn@scip... numpy-svn@scip...
Fri Nov 23 08:53:56 CST 2007


Author: stefan
Date: 2007-11-23 08:53:33 -0600 (Fri, 23 Nov 2007)
New Revision: 4493

Modified:
   trunk/numpy/doc/swig/numpy.i
   trunk/numpy/doc/swig/test/Makefile
   trunk/numpy/doc/swig/test/setup.py
Log:
Update SWIG typemaps to be C89 compliant (patch by Matthieu Brucher).
Fix filenames in setup.py.  Fix tests in Makefile.


Modified: trunk/numpy/doc/swig/numpy.i
===================================================================
--- trunk/numpy/doc/swig/numpy.i	2007-11-22 18:34:50 UTC (rev 4492)
+++ trunk/numpy/doc/swig/numpy.i	2007-11-23 14:53:33 UTC (rev 4493)
@@ -461,8 +461,8 @@
   (DATA_TYPE IN_ARRAY1[ANY])
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[1] = { $1_dim0 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[1] = { $1_dim0 };
   if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
 }
@@ -484,8 +484,8 @@
   (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[1] = { -1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[1] = { -1 };
   if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
   $1 = (DATA_TYPE*) array_data(array);
   $2 = (DIM_TYPE) array_size(array,0);
@@ -508,8 +508,8 @@
   (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[1] = {-1};
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[1] = {-1};
   if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
   $1 = (DIM_TYPE) array_size(array,0);
   $2 = (DATA_TYPE*) array_data(array);
@@ -532,8 +532,8 @@
   (DATA_TYPE IN_ARRAY2[ANY][ANY])
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[2] = { $1_dim0, $1_dim1 };
   if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
 }
@@ -555,8 +555,8 @@
   (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[2] = { -1, -1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[2] = { -1, -1 };
   if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
   $1 = (DATA_TYPE*) array_data(array);
   $2 = (DIM_TYPE) array_size(array,0);
@@ -580,8 +580,8 @@
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[2] = { -1, -1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[2] = { -1, -1 };
   if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
   $1 = (DIM_TYPE) array_size(array,0);
   $2 = (DIM_TYPE) array_size(array,1);
@@ -605,8 +605,8 @@
   (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
   if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
 }
@@ -629,8 +629,8 @@
   (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[3] = { -1, -1, -1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[3] = { -1, -1, -1 };
   if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
   $1 = (DATA_TYPE*) array_data(array);
   $2 = (DIM_TYPE) array_size(array,0);
@@ -656,8 +656,8 @@
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
   (PyArrayObject* array=NULL, int is_new_object=0)
 {
+  npy_intp size[3] = { -1, -1, -1 };
   array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
-  npy_intp size[3] = { -1, -1, -1 };
   if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
   $1 = (DIM_TYPE) array_size(array,0);
   $2 = (DIM_TYPE) array_size(array,1);
@@ -686,8 +686,8 @@
   (DATA_TYPE INPLACE_ARRAY1[ANY])
   (PyArrayObject* array=NULL)
 {
+  npy_intp size[1] = { $1_dim0 };
   array = obj_to_array_no_conversion($input, DATA_TYPECODE);
-  npy_intp size[1] = { $1_dim0 };
   if (!array || !require_dimensions(array,1) || !require_size(array, size, 1)
       || !require_contiguous(array) || !require_native(array)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
@@ -742,8 +742,8 @@
   (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
   (PyArrayObject* array=NULL)
 {
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
   array = obj_to_array_no_conversion($input, DATA_TYPECODE);
-  npy_intp size[2] = { $1_dim0, $1_dim1 };
   if (!array || !require_dimensions(array,2) || !require_size(array, size, 2)
       || !require_contiguous(array) || !require_native(array)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
@@ -798,8 +798,8 @@
   (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
   (PyArrayObject* array=NULL)
 {
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
   array = obj_to_array_no_conversion($input, DATA_TYPECODE);
-  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
   if (!array || !require_dimensions(array,3) || !require_size(array, size, 3)
       || !require_contiguous(array) || !require_native(array)) SWIG_fail;
   $1 = ($1_ltype) array_data(array);
@@ -873,6 +873,7 @@
   (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
   (PyObject * array = NULL)
 {
+  npy_intp dims[1];
   if (!PyInt_Check($input)) {
     char* typestring = pytype_string($input);
     PyErr_Format(PyExc_TypeError, 
@@ -881,7 +882,7 @@
     SWIG_fail;
   }
   $2 = (DIM_TYPE) PyInt_AsLong($input);
-  npy_intp dims[1] = { (npy_intp) $2 };
+  dims[0] = (npy_intp) $2;
   array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
   $1 = (DATA_TYPE*) array_data(array);
 }
@@ -897,6 +898,7 @@
   (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
   (PyObject * array = NULL)
 {
+  npy_intp dims[1];
   if (!PyInt_Check($input)) {
     char* typestring = pytype_string($input);
     PyErr_Format(PyExc_TypeError, 
@@ -905,7 +907,7 @@
     SWIG_fail;
   }
   $1 = (DIM_TYPE) PyInt_AsLong($input);
-  npy_intp dims[1] = { (npy_intp) $1 };
+  dims[0] = (npy_intp) $1;
   array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
   $2 = (DATA_TYPE*) array_data(array);
 }

Modified: trunk/numpy/doc/swig/test/Makefile
===================================================================
--- trunk/numpy/doc/swig/test/Makefile	2007-11-22 18:34:50 UTC (rev 4492)
+++ trunk/numpy/doc/swig/test/Makefile	2007-11-23 14:53:33 UTC (rev 4493)
@@ -11,9 +11,9 @@
 # Test target: run the tests
 .PHONY : test
 test: all
-	testVector.py
-	testMatrix.py
-	testTensor.py
+	python testVector.py
+	python testMatrix.py
+	python testTensor.py
 
 # Rule: %.i -> %_wrap.cxx
 %_wrap.cxx: %.i %.h ../numpy.i

Modified: trunk/numpy/doc/swig/test/setup.py
===================================================================
--- trunk/numpy/doc/swig/test/setup.py	2007-11-22 18:34:50 UTC (rev 4492)
+++ trunk/numpy/doc/swig/test/setup.py	2007-11-23 14:53:33 UTC (rev 4493)
@@ -16,21 +16,21 @@
 # _Vector extension module
 _Vector = Extension("_Vector",
                     ["Vector_wrap.cxx",
-                     "vector.cxx"],
+                     "Vector.cxx"],
                     include_dirs = [numpy_include],
                     )
 
 # _Matrix extension module
 _Matrix = Extension("_Matrix",
                     ["Matrix_wrap.cxx",
-                     "matrix.cxx"],
+                     "Matrix.cxx"],
                     include_dirs = [numpy_include],
                     )
 
 # _Tensor extension module
 _Tensor = Extension("_Tensor",
                     ["Tensor_wrap.cxx",
-                     "tensor.cxx"],
+                     "Tensor.cxx"],
                     include_dirs = [numpy_include],
                     )
 



More information about the Numpy-svn mailing list