changeset 5902:6af4cea82cc7

[project @ 2006-07-25 19:56:00 by jwe]
author jwe
date Tue, 25 Jul 2006 19:56:00 +0000
parents 5610a3fdeca6
children 11bb9bf343a0
files src/ChangeLog src/mex.cc
diffstat 2 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Jul 22 08:40:40 2006 +0000
+++ b/src/ChangeLog	Tue Jul 25 19:56:00 2006 +0000
@@ -1,3 +1,10 @@
+2006-07-25  John W. Eaton  <jwe@octave.org>
+
+	* mex.cc (mxArray_struct::as_octave_value, call_mex,
+	mexCallMATLAB, mxArray_cell::as_octave_value):
+	Convert NULL mxArray* pointers to empty matrix values.
+	(mxArray_octave_value:get_ir): Fix typo.
+
 2006-07-22  John W. Eaton  <jwe@octave.org>
 
 	* mxarray.h: New file.
--- a/src/mex.cc	Sat Jul 22 08:40:40 2006 +0000
+++ b/src/mex.cc	Tue Jul 25 19:56:00 2006 +0000
@@ -453,7 +453,7 @@
   int *get_ir (void) const
   {
 #if SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_INT
-    return val.mex_get_jc ();
+    return val.mex_get_ir ();
 #else
     request_mutation ();
     return 0;
@@ -1445,7 +1445,10 @@
 
 	int k = 0;
 	for (int j = i; j < ntot; j += nfields)
-	  p[k++] = data[j]->as_octave_value ();
+	  {
+	    mxArray *t = data[j];
+	    p[k++] = t ? t->as_octave_value () : octave_value (Matrix ());
+	  }
 
 	m.assign (keys[i], c);
       }
@@ -1655,7 +1658,10 @@
     octave_value *p = c.fortran_vec ();
 
     for (int i = 0; i < nel; i++)
-      p[i] = data[i]->as_octave_value ();
+      {
+	mxArray *t = data[i];
+	p[i] = t ? t->as_octave_value () : octave_value (Matrix ());
+      }
 
     return c;
   }
@@ -2723,9 +2729,8 @@
 	{
 	  if (argout[i])
 	    {
-	      retval(i) = argout[i]->as_octave_value ();
-
-	      //	      mxDestroyArray (argout[i]);
+	      mxArray *t = argout[i];
+	      retval(i) = t ? t->as_octave_value () : octave_value (Matrix ());
 	    }
 	}
     }
@@ -2771,7 +2776,10 @@
   args.resize (nargin);
 
   for (int i = 0; i < nargin; i++)
-    args(i) = argin[i]->as_octave_value ();
+    {
+      mxArray *t = argin[i];
+      args(i) = t ? t->as_octave_value () : octave_value (Matrix ());
+    }
 
   octave_value_list retval = feval (fname, args, nargout);