changeset 10849:f1a45913662a

propagate isargout info through function handles
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 03 Aug 2010 19:01:54 +0200
parents d782d7b524a6
children 6c57bd7d0808
files src/ChangeLog src/ov-fcn-handle.cc src/ov-fcn-handle.h
diffstat 3 files changed, 37 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-03  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-fcn-handle.cc 
+	(octave_value::subsref (..., const std::list<octave_lvalue> *)
+	octave_value::do_multi_index_op (..., const std::list<octave_lvalue> *)): 
+	New methods. Move code here.
+	* ov-fcn-handle.h: Declare them.
+
 2010-08-03  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-usr-fcn.cc (Fis_ignored_output): Rename to Fisargout. Change the
--- a/src/ov-fcn-handle.cc
+++ b/src/ov-fcn-handle.cc
@@ -85,6 +85,14 @@
                             const std::list<octave_value_list>& idx,
                             int nargout)
 {
+  return octave_fcn_handle::subsref (type, idx, nargout, 0);
+}
+
+octave_value_list
+octave_fcn_handle::subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            int nargout, const std::list<octave_lvalue>* lvalue_list)
+{
   octave_value_list retval;
 
   switch (type[0])
@@ -93,7 +101,8 @@
       {
         int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
 
-        retval = do_multi_index_op (tmp_nargout, idx.front ());
+        retval = do_multi_index_op (tmp_nargout, idx.front (),
+                                    idx.size () == 1 ? lvalue_list : 0);
       }
       break;
 
@@ -123,6 +132,14 @@
 octave_fcn_handle::do_multi_index_op (int nargout, 
                                       const octave_value_list& args)
 {
+  return do_multi_index_op (nargout, args, 0);
+}
+
+octave_value_list
+octave_fcn_handle::do_multi_index_op (int nargout, 
+                                      const octave_value_list& args,
+                                      const std::list<octave_lvalue>* lvalue_list)
+{
   octave_value_list retval;
 
   out_of_date_check (fcn, std::string (), false);
@@ -153,9 +170,9 @@
         }
 
       if (ov_fcn.is_defined ())
-        retval = ov_fcn.do_multi_index_op (nargout, args);
+        retval = ov_fcn.do_multi_index_op (nargout, args, lvalue_list);
       else if (fcn.is_defined ())
-        retval = fcn.do_multi_index_op (nargout, args);
+        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
       else
         error ("%s: no method for class %s", nm.c_str (), dispatch_type.c_str ());
     }
@@ -163,7 +180,7 @@
     {
       // Non-overloaded function (anonymous, subfunction, private function).
       if (fcn.is_defined ())
-        retval = fcn.do_multi_index_op (nargout, args);
+        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
       else
         error ("%s: no longer valid function handle", nm.c_str ());
     }
--- a/src/ov-fcn-handle.h
+++ b/src/ov-fcn-handle.h
@@ -83,9 +83,17 @@
                              const std::list<octave_value_list>& idx,
                              int nargout);
 
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout, const std::list<octave_lvalue>* lvalue_list);
+
   octave_value_list
   do_multi_index_op (int nargout, const octave_value_list& args);
 
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args, 
+                     const std::list<octave_lvalue>* lvalue_list);
+
   bool is_defined (void) const { return true; }
 
   bool is_function_handle (void) const { return true; }