Mercurial > hg > octave-shane
changeset 7252:d35fa45980c6
[project @ 2007-12-04 19:02:46 by jwe]
author | jwe |
---|---|
date | Tue, 04 Dec 2007 19:02:46 +0000 |
parents | ace1030cbe36 |
children | c5a024013d2d |
files | src/ChangeLog src/error.cc |
diffstat | 2 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2007-12-04 John W. Eaton <jwe@octave.org> + * error.cc (Ferror): Handle error id. + * load-save.cc (Fsave, Fload): Doc fixes. From Marco Caliari <caliari@sci.univr.it>.
--- a/src/error.cc +++ b/src/error.cc @@ -963,6 +963,7 @@ DEFUN (error, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} error (@var{template}, @dots{})\n\ +@deftypefnx {Built-in Function} {} error (@var{id}, @var{template}, @dots{})\n\ Format the optional arguments under the control of the template string\n\ @var{template} using the same rules as the @code{printf} family of\n\ functions (@pxref{Formatted Output}) and print the resulting message\n\ @@ -1016,18 +1017,43 @@ @end example\n\ @end deftypefn") { - // FIXME -- need to extract and pass message id to - // handle_message. + octave_value retval; + + int nargin = args.length (); + + octave_value_list nargs = args; + + std::string id; + + if (nargin > 1) + { + std::string arg1 = args(0).string_value (); - octave_value_list retval; - handle_message (error_with_id, "", "unspecified error", args); + if (! error_state) + { + if (arg1.find ('%') == NPOS) + { + id = arg1; + + nargs.resize (nargin-1); + + for (int i = 1; i < nargin; i++) + nargs(i-1) = args(i); + } + } + else + return retval; + } + + handle_message (error_with_id, id.c_str (), "unspecified error", nargs); + return retval; } DEFCMD (warning, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} warning (@var{template}, @dots{})\n\ -@deftypefnx {Built-in Function} {} warning (@var{id}, @var{template})\n\ +@deftypefnx {Built-in Function} {} warning (@var{id}, @var{template}, @dots{})\n\ Format the optional arguments under the control of the template string\n\ @var{template} using the same rules as the @code{printf} family of\n\ functions (@pxref{Formatted Output}) and print the resulting message\n\ @@ -1343,8 +1369,6 @@ return retval; } - // handle_message. - std::string prev_msg = Vlast_warning_message; std::string curr_msg = handle_message (warning_with_id, id.c_str (),