Mercurial > hg > octave-lojdl
changeset 8183:277218396978
Handle arrays of handles in the Fishandle function
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 06 Oct 2008 13:31:56 -0400 |
parents | 1b2256d6e01d |
children | bb3bdcdaa063 |
files | src/ChangeLog src/graphics.cc |
diffstat | 2 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-10-06 David Bateman <dbateman@free.fr> + + * graphics.cc (static bool is_handle (const octave_value&)): Delete. + (static octave_value is_handle (const octave_value&)): New function. + 2008-10-03 Jaroslav Hajek <highegg@gmail.com> * Cell.cc (Cell::delete_elements): Don't pass second arg to
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -1424,10 +1424,34 @@ return h.ok (); } -static bool +static octave_value is_handle (const octave_value& val) { - return val.is_real_scalar () && is_handle (val.double_value ()); + octave_value retval = false; + + if (val.is_real_scalar () && is_handle (val.double_value ())) + retval = true; + else if (val.is_real_matrix ()) + { + if (val.is_string ()) + retval = boolNDArray (val.dims (), false); + else + { + const NDArray handles = val.array_value (); + + if (! error_state) + { + boolNDArray result (handles.dims ()); + + for (octave_idx_type i = 0; i < handles.numel (); i++) + result.xelem (i) = is_handle (handles (i)); + + retval = result; + } + } + } + + return retval; } static bool