Mercurial > hg > octave-terminal
changeset 9205:ba7f45642ffe
error.cc (Ferror): handle error struct argument
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 15 May 2009 12:09:11 -0400 |
parents | 1f47a9404d93 |
children | 5f36c6c9be13 |
files | src/ChangeLog src/error.cc |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2009-05-15 John W. Eaton <jwe@octave.org> + * error.cc (Ferror): Handle error struct argument. + * ls-mat5.cc (save_mat5_binary_element): Avoid multiple calls to contents method. From David Bateman <dbateman@free.fr>. (save_mat5_element_length): Use const Cell to avoid making copies
--- a/src/error.cc +++ b/src/error.cc @@ -1004,6 +1004,35 @@ else return retval; } + else if (nargin == 1 && args(0).is_map ()) + { + octave_value_list tmp; + + Octave_map m = args(0).map_value (); + + if (m.numel () == 1) + { + if (m.contains ("message")) + { + Cell c = m.contents ("message"); + + if (! c.is_empty () && c(0).is_string ()) + nargs(0) = c(0).string_value (); + } + + if (m.contains ("identifier")) + { + Cell c = m.contents ("identifier"); + + if (! c.is_empty () && c(0).is_string ()) + id = c(0).string_value (); + } + + // FIXME -- also need to handle "stack" field in error + // structure, but that will require some more significant + // surgery on handle_message, error_with_id, etc. + } + } handle_message (error_with_id, id.c_str (), "unspecified error", nargs);