Mercurial > hg > octave-lojdl
changeset 7896:92c26470fe56
Frats fix for nargin==0
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 25 Jun 2008 12:46:32 +0200 |
parents | f1a1f6dd7fac |
children | 322a066543ac |
files | src/ChangeLog src/pr-output.cc |
diffstat | 2 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -70,6 +70,10 @@ * error.cc (verror): Restore newline in msg_string. Stripping "error: " prefix when buffering error messages is no longer neeed. +2008-06-25 David Bateman <dbateman@free.fr> + + * pr-output.cc (Frats): Print usage if nargin == 0. + 2008-06-10 John W. Eaton <jwe@octave.org> * mexproto.h (mxCreateLogicalScalar): Declar arg as mxLogical, not int.
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -2766,18 +2766,20 @@ int nargin = args.length (); - unwind_protect::begin_frame ("Frats"); - - unwind_protect_int (rat_string_len); - - rat_string_len = 9; - - if (nargin == 2) - rat_string_len = args(1).nint_value (); - - if (! error_state) + if (nargin < 1 || nargin > 2 || nargout > 1) + print_usage (); + else { - if (nargin < 3 && nargout < 2) + unwind_protect::begin_frame ("Frats"); + + unwind_protect_int (rat_string_len); + + rat_string_len = 9; + + if (nargin == 2) + rat_string_len = args(1).nint_value (); + + if (! error_state) { octave_value arg = args(0); @@ -2817,12 +2819,10 @@ else error ("rats: expecting numeric input"); } - else - print_usage (); + + unwind_protect::run_frame ("Frats"); } - unwind_protect::run_frame ("Frats"); - return retval; }