changeset 19252:edf5d63c82e1

Deprecate strmatch function. * scripts/deprecated/strmatch.m: Moved from scripts/strings. Add deprecation warning to code and to docstring. * strings.txi: Remove from manual * scripts/deprecated/module.mk: Add to build system in deprecated directory. * scripts/strings/module.mk: Remove from build system in strings directory.
author Rik <rik@octave.org>
date Fri, 29 Aug 2014 20:41:58 -0700
parents 83b88e20e9c1
children 1c4994e66962
files doc/interpreter/strings.txi scripts/deprecated/module.mk scripts/deprecated/strmatch.m scripts/strings/module.mk scripts/strings/strmatch.m
diffstat 4 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/strings.txi
+++ b/doc/interpreter/strings.txi
@@ -442,8 +442,6 @@
 
 @DOCSTRING(strjoin)
 
-@DOCSTRING(strmatch)
-
 @DOCSTRING(strtok)
 
 @DOCSTRING(strsplit)
--- a/scripts/deprecated/module.mk
+++ b/scripts/deprecated/module.mk
@@ -4,7 +4,8 @@
   deprecated/bicubic.m \
   deprecated/find_dir_in_path.m \
   deprecated/isstr.m \
-  deprecated/nfields.m
+  deprecated/nfields.m \
+  deprecated/strmatch.m
 
 FCN_FILES += $(deprecated_FCN_FILES)
 
rename from scripts/strings/strmatch.m
rename to scripts/deprecated/strmatch.m
--- a/scripts/strings/strmatch.m
+++ b/scripts/deprecated/strmatch.m
@@ -21,6 +21,11 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {} strmatch (@var{s}, @var{A})
 ## @deftypefnx {Function File} {} strmatch (@var{s}, @var{A}, "exact")
+##
+## @code{strmatch} is deprecated and will be removed in Octave version 4.6.
+## Use @code{strncmp} (normal case), or @code{strcmp} (@qcode{"exact"} case),
+## or @code{regexp} in all new code.
+##
 ## Return indices of entries of @var{A} which begin with the string @var{s}.
 ## The second argument @var{A} must be a string, character matrix, or a cell
 ## array of strings.  If the third argument @qcode{"exact"} is not given, then
@@ -42,17 +47,23 @@
 ## @end group
 ## @end example
 ##
-## @strong{Caution:} @code{strmatch} is scheduled for deprecation.  Use
-## @code{strncmp} (normal case), or @code{strcmp} (@qcode{"exact"} case), or
-## @code{regexp} in all new code.
 ## @seealso{strfind, findstr, strcmp, strncmp, strcmpi, strncmpi, find}
 ## @end deftypefn
 
 ## Author: Paul Kienzle, Alois Schloegl
 ## Adapted-by: jwe
 
+## Deprecated in version 4.2
+
 function idx = strmatch (s, A, exact)
 
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "strmatch is obsolete and will be removed from a future version of Octave, please use strncmp, strcmp, or regexp instead");
+  endif
+
   if (nargin < 2 || nargin > 3)
     print_usage ();
   endif
--- a/scripts/strings/module.mk
+++ b/scripts/strings/module.mk
@@ -23,7 +23,6 @@
   strings/strchr.m \
   strings/strjoin.m \
   strings/strjust.m \
-  strings/strmatch.m \
   strings/strsplit.m \
   strings/strtok.m \
   strings/strtrim.m \