Mercurial > hg > octave-thorsten
diff src/pt-arg-list.cc @ 8136:2b2ca62f8ab6
dispatch to user-defined end function for classes if one is defined
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 23 Sep 2008 13:49:14 -0400 |
parents | 71f068b22fcc |
children | 177117c7e375 |
line wrap: on
line diff
--- a/src/pt-arg-list.cc +++ b/src/pt-arg-list.cc @@ -36,6 +36,7 @@ #include "oct-obj.h" #include "ov.h" #include "ov-usr-fcn.h" +#include "parse.h" #include "pt-arg-list.h" #include "pt-exp.h" #include "pt-pr-code.h" @@ -103,6 +104,22 @@ if (indexed_object) { + if (indexed_object->is_object ()) + { + octave_value_list args; + + args(2) = num_indices; + args(1) = index_position; + args(0) = *indexed_object; + + std::string class_name = indexed_object->class_name (); + + octave_value meth = symbol_table::find_method ("end", class_name); + + if (meth.is_defined ()) + return feval (meth.function_value (), args, 1); + } + dim_vector dv = indexed_object->dims (); int ndims = dv.length ();