diff src/ov-fcn-handle.cc @ 4924:9a3a32f5a27d

[project @ 2004-08-02 19:04:20 by jwe]
author jwe
date Mon, 02 Aug 2004 19:04:20 +0000
parents f6d6335c08f6
children 90f51232d751
line wrap: on
line diff
--- a/src/ov-fcn-handle.cc	Mon Aug 02 16:33:11 2004 +0000
+++ b/src/ov-fcn-handle.cc	Mon Aug 02 19:04:20 2004 +0000
@@ -79,6 +79,45 @@
 				     "function handle",
 				     "function handle");
 
+octave_value_list
+octave_fcn_handle::subsref (const std::string& type,
+			    const std::list<octave_value_list>& idx,
+			    int nargout)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+	octave_function *f = function_value ();
+	retval = f->subsref (type, idx, nargout);
+      }
+      break;
+
+
+    case '{':
+    case '.':
+      {
+	std::string nm = type_name ();
+	error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // XXX FIXME XXX -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_builtin::subsref.
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (type, idx);
+
+  return retval;
+}
+
 octave_function *
 octave_fcn_handle::function_value (bool)
 {