Mercurial > octave
changeset 26301:99318daeaddd stable
Properly deprecate output_max_field_width from cset 4d945f2e5914.
* libinterp/corefcn/pr-flt-fmt.cc (Foutput_max_field_width): Transform
deprecated function to m-file output_max_field_width.m
* scripts/deprecated/output_max_field_width.m: Create equivalent function.
* scripts/deprecated/module.mk: Add new m-file to build system.
* doc/interpreter/numbers.txi: Strip deprecated function from manual.
* NEWS: Advertise deprecated function.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Mon, 24 Dec 2018 18:09:58 +0100 |
parents | ef7f95f89407 |
children | c5fb4699e9cb |
files | NEWS doc/interpreter/numbers.txi libinterp/corefcn/pr-flt-fmt.cc scripts/deprecated/module.mk scripts/deprecated/output_max_field_width.m |
diffstat | 5 files changed, 55 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Dec 25 12:41:52 2018 +0100 +++ b/NEWS Mon Dec 24 18:09:58 2018 +0100 @@ -235,9 +235,9 @@ be removed from Octave 7 (or whatever version is the second major release after 5.0): - Function | Replacement - ---------------------|------------------ - | + Function | Replacement + -----------------------|------------------ + output_max_field_width | output_precision ** The following functions were deprecated in Octave 4.2 and have been removed from Octave 5.0.
--- a/doc/interpreter/numbers.txi Tue Dec 25 12:41:52 2018 +0100 +++ b/doc/interpreter/numbers.txi Mon Dec 24 18:09:58 2018 +0100 @@ -290,14 +290,11 @@ section to indicate which columns are being displayed. You can use the following variables to control the format of the output. -@DOCSTRING(output_max_field_width) - @DOCSTRING(output_precision) It is possible to achieve a wide range of output styles by using -different values of @code{output_precision} and -@code{output_max_field_width}. Reasonable combinations can be set using -the @code{format} function. @xref{Basic Input and Output}. +different values of @code{output_precision}. Reasonable combinations can be +set using the @code{format} function. @xref{Basic Input and Output}. @DOCSTRING(split_long_rows)
--- a/libinterp/corefcn/pr-flt-fmt.cc Tue Dec 25 12:41:52 2018 +0100 +++ b/libinterp/corefcn/pr-flt-fmt.cc Mon Dec 24 18:09:58 2018 +0100 @@ -45,16 +45,6 @@ Voutput_precision = prec; } -DEFUN (output_max_field_width, , , - doc: /* -*- texinfo -*- -@deftypefn {} {} output_max_field_width -This function is obsolete and will be removed from a future version -of Octave. -@end deftypefn */) -{ - return octave_value (20); -} - DEFUN (output_precision, args, nargout, doc: /* -*- texinfo -*- @deftypefn {} {@var{val} =} output_precision ()
--- a/scripts/deprecated/module.mk Tue Dec 25 12:41:52 2018 +0100 +++ b/scripts/deprecated/module.mk Mon Dec 24 18:09:58 2018 +0100 @@ -5,6 +5,7 @@ %reldir%/comma.m \ %reldir%/desktop.m \ %reldir%/java2mat.m \ + %reldir%/output_max_field_width.m \ %reldir%/paren.m \ %reldir%/semicolon.m \ %reldir%/tmpnam.m \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/output_max_field_width.m Mon Dec 24 18:09:58 2018 +0100 @@ -0,0 +1,49 @@ +## Copyright (C) 2018 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 +## <https://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {} {@var{val} =} output_max_field_width () +## @deftypefnx {} {@var{old_val} =} output_max_field_width (@var{new_val}) +## @deftypefnx {} {} output_max_field_width (@var{new_val}, "local") +## +## @code{output_max_field_width} is deprecated and will be removed in Octave +## version 7. Use @code{output_precision} instead. +## +## Query or set the internal variable that specifies the maximum width +## of a numeric output field. +## +## When called from inside a function with the @qcode{"local"} option, the +## variable is changed locally for the function and any subroutines it calls. +## The original variable value is restored when exiting the function. +## @seealso{format, fixed_point_format, output_precision} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 7. + +function retval = output_max_field_width (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "output_max_field_width is obsolete and will be removed from a future version of Octave, please use output_precision instead"); + endif + + retval = 20; + +endfunction