changeset 6400:566343604d95

[project @ 2007-03-08 22:58:22 by jwe]
author jwe
date Thu, 08 Mar 2007 22:58:23 +0000
parents e4d3e9bddff3
children f8cbc0871ed6
files src/ChangeLog src/mex.cc src/mxarray.h
diffstat 3 files changed, 33 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Mar 08 21:12:59 2007 +0000
+++ b/src/ChangeLog	Thu Mar 08 22:58:23 2007 +0000
@@ -1,3 +1,18 @@
+2007-03-08  John W. Eaton  <jwe@octave.org>
+
+	* mex.cc (mxArray_octave_value::set_dimensions,
+	mxArray_octave_value::set_m, mxArray_octave_value::set_n, 
+	mxArray_octave_value::set_class_name,
+	mxArray_octave_value::set_ir, mxArray_octave_value::set_jc,
+	mxArray_octave_value::remove_field,
+	mxArray_octave_value::set_field_by_number):
+	Don't panic; request mutation instead.
+	(class mxArray_octave_value): 
+
+	* mxarray.h (mxArray::set_m, mxArray::set_n,
+	mxArray::set_dimensions): Wrap method call call with
+	DO_VOID_MUTABLE_METHOD.
+
 2007-03-08  David Bateman  <dbateman@free.fr>
 
 	* data.cc (do_cat): Ignore leading empty matrices.
--- a/src/mex.cc	Thu Mar 08 21:12:59 2007 +0000
+++ b/src/mex.cc	Thu Mar 08 22:58:23 2007 +0000
@@ -360,13 +360,13 @@
     return ndims;
   }
 
-  void set_m (int /*m*/) { panic_impossible (); }
-
-  void set_n (int /*n*/) { panic_impossible (); }
+  void set_m (int /*m*/) { request_mutation (); }
+
+  void set_n (int /*n*/) { request_mutation (); }
 
   void set_dimensions (int */*dims_arg*/, int /*ndims_arg*/)
   {
-    panic_impossible ();
+    request_mutation ();
   }
 
   int get_number_of_elements (void) const { return val.numel (); }
@@ -432,7 +432,7 @@
   }
 
   // Not allowed.
-  void set_class_name (const char */*name_arg*/) { panic_impossible (); }
+  void set_class_name (const char */*name_arg*/) { request_mutation (); }
 
   mxArray *get_cell (int /*idx*/) const
   {
@@ -441,7 +441,7 @@
   }
 
   // Not allowed.
-  void set_cell (int /*idx*/, mxArray */*val*/) { panic_impossible (); }
+  void set_cell (int /*idx*/, mxArray */*val*/) { request_mutation (); }
 
   double get_scalar (void) const { return val.scalar_value (true); }
 
@@ -471,10 +471,10 @@
   }
 
   // Not allowed.
-  void set_data (void */*pr*/) { panic_impossible (); }
+  void set_data (void */*pr*/) { request_mutation (); }
 
   // Not allowed.
-  void set_imag_data (void */*pi*/) { panic_impossible (); }
+  void set_imag_data (void */*pi*/) { request_mutation (); }
 
   int *get_ir (void) const
   {
@@ -499,23 +499,23 @@
   int get_nzmax (void) const { return val.nzmax (); }
 
   // Not allowed.
-  void set_ir (int */*ir*/) { panic_impossible (); }
+  void set_ir (int */*ir*/) { request_mutation (); }
 
   // Not allowed.
-  void set_jc (int */*jc*/) { panic_impossible (); }
+  void set_jc (int */*jc*/) { request_mutation (); }
 
   // Not allowed.
-  void set_nzmax (int /*nzmax*/) { panic_impossible (); }
+  void set_nzmax (int /*nzmax*/) { request_mutation (); }
 
   // Not allowed.
   int add_field (const char */*key*/)
   {
-    panic_impossible ();
-    return -1;
+    request_mutation ();
+    return 0;
   }
 
   // Not allowed.
-  void remove_field (int /*key_num*/) { panic_impossible (); }
+  void remove_field (int /*key_num*/) { request_mutation (); }
 
   mxArray *get_field_by_number (int /*index*/, int /*key_num*/) const
   {
@@ -526,7 +526,7 @@
   // Not allowed.
   void set_field_by_number (int /*index*/, int /*key_num*/, mxArray */*val*/)
   {
-    panic_impossible ();
+    request_mutation ();
   }
 
   int get_number_of_fields (void) const { return val.nfields (); }
--- a/src/mxarray.h	Thu Mar 08 21:12:59 2007 +0000
+++ b/src/mxarray.h	Thu Mar 08 22:58:23 2007 +0000
@@ -212,11 +212,11 @@
 
   virtual int get_number_of_dimensions (void) const { return rep->get_number_of_dimensions (); }
 
-  virtual void set_m (int m) { rep->set_m (m); }
+  virtual void set_m (int m) { DO_VOID_MUTABLE_METHOD (set_m (m)); }
 
-  virtual void set_n (int n) { rep->set_n (n); }
+  virtual void set_n (int n) { DO_VOID_MUTABLE_METHOD (set_n (n)); }
 
-  virtual void set_dimensions (int *dims_arg, int ndims_arg) { rep->set_dimensions (dims_arg, ndims_arg); }
+  virtual void set_dimensions (int *dims_arg, int ndims_arg) { DO_VOID_MUTABLE_METHOD (set_dimensions (dims_arg, ndims_arg)); }
 
   virtual int get_number_of_elements (void) const { return rep->get_number_of_elements (); }