Mercurial > hg > octave-image
changeset 843:98c59bb02d0d
Deprecate iptchecknargin and iptcheckstrs.
* iptchecknargin.m: deprecate iptchecknargin in favour of narginchk, or
print_usage after checking nargin.
* iptcheckstrs.m: deprecate iptcheckstrs in favour of validatestrings.
* NEWS: update list of deprecated functions.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Fri, 06 Dec 2013 17:00:10 +0000 |
parents | 006ab95a7e07 |
children | b52546b11470 |
files | NEWS inst/iptchecknargin.m inst/iptcheckstrs.m |
diffstat | 3 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -59,6 +59,8 @@ bwborder impad imrotate_Fourier + iptchecknargin + iptcheckstrs uintlut ** The functions im2col and col2im has been completely rewritten for massive
--- a/inst/iptchecknargin.m +++ b/inst/iptchecknargin.m @@ -17,6 +17,19 @@ ## @deftypefn {Function File} {} iptchecknargin (@var{low}, @var{high}, @var{in}, @var{func_name}) ## Checks for correct number of arguments. ## +## This function has been deprecated. For an exact replacement, use +## @code{narginchk (@var{low}, @var{high})} instead. Alternatively, +## @code{print_usage} is able to provide an even better error message +## provided that there is documentation for the function: +## +## @example +## @group +## if (nargin < min_inputs || nargin > max_inputs) +## print_usage (); +## endif +## @end group +## @end example +## ## This function returns an error unless @var{in} is between the values of ## @var{low} and @var{high}. It does nothing otherwise. They all must be non ## negative scalar integers. @var{high} can also be Inf. @@ -28,6 +41,13 @@ function iptchecknargin (low, high, in, func_name) + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "iptchecknargin is obsolete and will be removed from a future version of the image package, please use narginchk instead"); + endif + if (nargin != 4) print_usage; elseif (!isnumeric (low) || !isscalar (low) || !isreal (low) || low < 0 || !isfinite (low) || rem (low, 1) != 0)
--- a/inst/iptcheckstrs.m +++ b/inst/iptcheckstrs.m @@ -17,6 +17,8 @@ ## @deftypefn {Function File} {@var{valid} =} iptcheckstrs (@var{in}, @var{valid_str}, @var{func_name}, @var{var_name}, @var{pos}) ## Check if argument is a valid string. ## +## This function has been deprecated. Use @code{validatestring} instead. +## ## If @var{in} is not a string, present in the cell array of strings ## @var{valid_str} gives a properly formatted error message. Otherwise, ## @var{valid} is the matched string. The performed matching is case-insensitive. @@ -30,6 +32,13 @@ function out = iptcheckstrs (in, valid_str, func_name, var_name, pos) + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "iptcheckstrs is obsolete and will be removed from a future version of the image package, please use validatestring instead"); + endif + if (nargin != 5) print_usage; elseif (!ischar (in))