# HG changeset patch # User Rik # Date 1301949433 25200 # Node ID 89604fa96d2f45c09a3b494417d4a52649a95299 # Parent 232a90612254905198e351912c31139297022246 Deprecate perror, strerror functions. diff -r 232a90612254 -r 89604fa96d2f ChangeLog --- a/ChangeLog Sun Apr 03 20:33:14 2011 -0700 +++ b/ChangeLog Mon Apr 04 13:37:13 2011 -0700 @@ -1,3 +1,7 @@ +2011-04-04 Rik + + * NEWS: Add perror, strerror to list of functions deprecated in 3.4 + 2011-03-31 Rik * NEWS: Add cquad to list of functions deprecated in 3.4 diff -r 232a90612254 -r 89604fa96d2f NEWS --- a/NEWS Sun Apr 03 20:33:14 2011 -0700 +++ b/NEWS Mon Apr 04 13:37:13 2011 -0700 @@ -461,9 +461,9 @@ be removed from Octave 3.8 (or whatever version is the second major release after 3.4): - autocor cellidx fstat is_global saveimage - autocov cquad gammai krylovb values - betai dispatch glpkmex replot + autocor cellidx fstat is_global replot values + autocov cquad gammai krylovb saveimage + betai dispatch glpkmex perror strerror Summary of important user-visible changes for version 3.2: --------------------------------------------------------- diff -r 232a90612254 -r 89604fa96d2f doc/ChangeLog --- a/doc/ChangeLog Sun Apr 03 20:33:14 2011 -0700 +++ b/doc/ChangeLog Mon Apr 04 13:37:13 2011 -0700 @@ -1,3 +1,8 @@ +2011-04-04 Rik + + * interpreter/grammar.txi: Remove reference to deprecated function + perror(). + 2011-04-03 Rik * interpreter/grammar.txi, interpreter/octave.texi: Add new section diff -r 232a90612254 -r 89604fa96d2f doc/interpreter/nonlin.txi --- a/doc/interpreter/nonlin.txi Sun Apr 03 20:33:14 2011 -0700 +++ b/doc/interpreter/nonlin.txi Mon Apr 04 13:37:13 2011 -0700 @@ -113,16 +113,6 @@ @noindent A value of @code{info = 1} indicates that the solution has converged. -The function @code{perror} may be used to print English messages -corresponding to the numeric error codes. For example: - -@example -@group -perror ("fsolve", 1) - @print{} solution converged to requested tolerance -@end group -@end example - When no Jacobian is supplied (as in the example above) it is approximated numerically. This requires more function evaluations, and hence is less efficient. In the example above we could compute the Jacobian diff -r 232a90612254 -r 89604fa96d2f scripts/ChangeLog --- a/scripts/ChangeLog Sun Apr 03 20:33:14 2011 -0700 +++ b/scripts/ChangeLog Mon Apr 04 13:37:13 2011 -0700 @@ -1,3 +1,8 @@ +2011-04-04 Rik + + * deprecated/module.mk, general/module.mk: Deprecate perror, strerror + functions. + 2011-04-02 Rik * statistics/base/prctile.m, statistics/base/quantile.m: Improve diff -r 232a90612254 -r 89604fa96d2f scripts/deprecated/module.mk --- a/scripts/deprecated/module.mk Sun Apr 03 20:33:14 2011 -0700 +++ b/scripts/deprecated/module.mk Mon Apr 04 13:37:13 2011 -0700 @@ -16,11 +16,13 @@ deprecated/is_global.m \ deprecated/isstr.m \ deprecated/krylovb.m \ + deprecated/perror.m \ deprecated/replot.m \ deprecated/saveimage.m \ deprecated/setstr.m \ deprecated/sphcat.m \ deprecated/spvcat.m \ + deprecated/strerror.m \ deprecated/values.m \ deprecated/weibcdf.m \ deprecated/weibinv.m \ diff -r 232a90612254 -r 89604fa96d2f scripts/deprecated/perror.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/perror.m Mon Apr 04 13:37:13 2011 -0700 @@ -0,0 +1,45 @@ +## Copyright (C) 1993-2011 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} perror (@var{funcname}, @var{num}) +## Print the error message for function @var{funcname} corresponding to the +## error number @var{num}. This function is intended to be used to print +## useful error messages for those functions that return numeric error +## codes. +## @seealso{strerror} +## @end deftypefn + +## Author: jwe + +function perror (funcname, num) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "perror is obsolete and will be removed from a future version of Octave."); + endif + + if (nargin != 2) + print_usage (); + else + printf (strerror (funcname, num)); + endif + +endfunction diff -r 232a90612254 -r 89604fa96d2f scripts/deprecated/strerror.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/strerror.m Mon Apr 04 13:37:13 2011 -0700 @@ -0,0 +1,72 @@ +## Copyright (C) 1995-2011 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} strerror (@var{name}, @var{num}) +## Return the text of an error message for function @var{name} +## corresponding to the error number @var{num}. This function is intended +## to be used to print useful error messages for those functions that +## return numeric error codes. +## @end deftypefn + +## Author: jwe + +function msg = strerror (name, num) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "strerror is obsolete and will be removed from a future version of Octave."); + endif + + if (nargin != 2) + print_usage (); + endif + + if (! ischar (name)) + error ("strerror: first argument must be a string"); + endif + + if (! isscalar (num)) + error ("strerror: second argument must be a scalar"); + endif + + if (strcmp (name, "fsolve")) + + if (num == -2) + msg = "input error\n"; + elseif (num == -1) + msg = "error encountered in user-supplied function\n"; + elseif (num == 1) + msg = "solution converged to requested tolerance\n"; + elseif (num == 3) + msg = "iteration is not making good progress\n"; + elseif (num == 4) + msg = "iteration limit exceeded\n"; + else + error ("strerror: unrecognized error code for fsolve"); + endif + + else + + error ("strerror: unrecognized function NAME"); + + endif + +endfunction diff -r 232a90612254 -r 89604fa96d2f scripts/general/module.mk --- a/scripts/general/module.mk Sun Apr 03 20:33:14 2011 -0700 +++ b/scripts/general/module.mk Mon Apr 04 13:37:13 2011 -0700 @@ -57,7 +57,6 @@ general/nargoutchk.m \ general/nextpow2.m \ general/num2str.m \ - general/perror.m \ general/pol2cart.m \ general/polyarea.m \ general/postpad.m \ @@ -75,7 +74,6 @@ general/shiftdim.m \ general/sortrows.m \ general/sph2cart.m \ - general/strerror.m \ general/structfun.m \ general/subsindex.m \ general/triplequad.m \ diff -r 232a90612254 -r 89604fa96d2f scripts/general/perror.m --- a/scripts/general/perror.m Sun Apr 03 20:33:14 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -## Copyright (C) 1993-2011 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} perror (@var{funcname}, @var{num}) -## Print the error message for function @var{funcname} corresponding to the -## error number @var{num}. This function is intended to be used to print -## useful error messages for those functions that return numeric error -## codes. -## @seealso{strerror} -## @end deftypefn - -## Author: jwe - -function perror (funcname, num) - - if (nargin != 2) - print_usage (); - else - printf (strerror (funcname, num)); - endif - -endfunction diff -r 232a90612254 -r 89604fa96d2f scripts/general/strerror.m --- a/scripts/general/strerror.m Sun Apr 03 20:33:14 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -## Copyright (C) 1995-2011 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} strerror (@var{name}, @var{num}) -## Return the text of an error message for function @var{name} -## corresponding to the error number @var{num}. This function is intended -## to be used to print useful error messages for those functions that -## return numeric error codes. -## @end deftypefn - -## Author: jwe - -function msg = strerror (name, num) - - if (nargin != 2) - print_usage (); - endif - - if (! ischar (name)) - error ("strerror: first argument must be a string"); - endif - - if (! isscalar (num)) - error ("strerror: second argument must be a scalar"); - endif - - if (strcmp (name, "fsolve")) - - if (num == -2) - msg = "input error\n"; - elseif (num == -1) - msg = "error encountered in user-supplied function\n"; - elseif (num == 1) - msg = "solution converged to requested tolerance\n"; - elseif (num == 3) - msg = "iteration is not making good progress\n"; - elseif (num == 4) - msg = "iteration limit exceeded\n"; - else - error ("strerror: unrecognized error code for fsolve"); - endif - - else - - error ("strerror: unrecognized function NAME"); - - endif - -endfunction