# HG changeset patch # User jwe # Date 1091473460 0 # Node ID 9a3a32f5a27de22c29e7619d36ad1c3f60085dd1 # Parent b11223097ad43aae78313bfee40673747a5a4b99 [project @ 2004-08-02 19:04:20 by jwe] diff -r b11223097ad4 -r 9a3a32f5a27d src/ChangeLog --- a/src/ChangeLog Mon Aug 02 16:33:11 2004 +0000 +++ b/src/ChangeLog Mon Aug 02 19:04:20 2004 +0000 @@ -1,5 +1,7 @@ 2004-08-02 John W. Eaton + * ov-fcn-handle.cc (octave_value::subsref): New function. + * ov-cx-mat.cc (try_narrowing_conversion): Also allow complex to real conversion for N-d arrays. diff -r b11223097ad4 -r 9a3a32f5a27d src/ov-fcn-handle.cc --- 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& 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) { diff -r b11223097ad4 -r 9a3a32f5a27d src/ov-fcn-handle.h --- a/src/ov-fcn-handle.h Mon Aug 02 16:33:11 2004 +0000 +++ b/src/ov-fcn-handle.h Mon Aug 02 19:04:20 2004 +0000 @@ -148,6 +148,17 @@ octave_value *clone (void) const { return new octave_fcn_handle (*this); } octave_value *empty_clone (void) const { return new octave_fcn_handle (); } + octave_value subsref (const std::string&, + const std::list&) + { + panic_impossible (); + return octave_value (); + } + + octave_value_list subsref (const std::string& type, + const std::list& idx, + int nargout); + bool is_matrix_type (void) const { return false; } bool is_numeric_type (void) const { return false; }