[Numpy-svn] r3703 - trunk/numpy/doc/swig

numpy-svn@scip... numpy-svn@scip...
Wed Apr 11 11:50:43 CDT 2007


Author: wfspotz@sandia.gov
Date: 2007-04-11 11:50:38 -0500 (Wed, 11 Apr 2007)
New Revision: 3703

Modified:
   trunk/numpy/doc/swig/numpy.i
Log:
Provided more sophisticated typecheck typemap for IN_ARRAYs

Modified: trunk/numpy/doc/swig/numpy.i
===================================================================
--- trunk/numpy/doc/swig/numpy.i	2007-04-11 07:32:05 UTC (rev 3702)
+++ trunk/numpy/doc/swig/numpy.i	2007-04-11 16:50:38 UTC (rev 3703)
@@ -445,7 +445,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY1[ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY1[ANY])
@@ -467,7 +467,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
@@ -490,7 +490,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
@@ -513,7 +513,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY2[ANY][ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY2[ANY][ANY])
@@ -535,7 +535,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
@@ -559,7 +559,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
@@ -583,7 +583,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
@@ -606,7 +606,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
@@ -632,7 +632,7 @@
 %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
 {
-  $1 = ($input != NULL);
+  $1 = is_array($input) || PySequence_Check($input);
 }
 %typemap(in)
   (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)



More information about the Numpy-svn mailing list