Mercurial > hg > octave-thorsten
changeset 4924:9a3a32f5a27d
[project @ 2004-08-02 19:04:20 by jwe]
author | jwe |
---|---|
date | Mon, 02 Aug 2004 19:04:20 +0000 |
parents | b11223097ad4 |
children | 90f51232d751 |
files | src/ChangeLog src/ov-fcn-handle.cc src/ov-fcn-handle.h |
diffstat | 3 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2004-08-02 John W. Eaton <jwe@octave.org> + * 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.
--- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -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) {
--- a/src/ov-fcn-handle.h +++ b/src/ov-fcn-handle.h @@ -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<octave_value_list>&) + { + panic_impossible (); + return octave_value (); + } + + octave_value_list subsref (const std::string& type, + const std::list<octave_value_list>& idx, + int nargout); + bool is_matrix_type (void) const { return false; } bool is_numeric_type (void) const { return false; }