changeset 18070:ff05d5b70411

Deprecate find_dir_in_path in favor of dir_in_path. * NEWS: Announce deprecation of find_dir_in_path and new function dir_in_path. * scripts/deprecated/find_dir_in_path.m: Add script to call dir_in_path and give deprecation warning. * scripts/deprecated/module.mk: Add deprecated find_dir_in_path.m to build system. * utils.cc (Fdir_in_path): Renamed find_dir_in_path to dir_in_path. * help.m, what.m, rundemos.m, runtests.m: Chane instances of find_dir_in_path to dir_in_path. * utils.cc, variables.cc: Change seealso links to point to dir_in_path. * func.txi: Document dir_in_path function.
author Rik <rik@octave.org>
date Tue, 03 Dec 2013 15:59:56 -0800
parents 76006571e45a
children d48ef9e24324
files NEWS doc/interpreter/func.txi libinterp/corefcn/utils.cc libinterp/corefcn/variables.cc scripts/deprecated/find_dir_in_path.m scripts/deprecated/module.mk scripts/help/help.m scripts/miscellaneous/what.m scripts/testfun/rundemos.m scripts/testfun/runtests.m
diffstat 10 files changed, 57 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Dec 03 16:06:46 2013 -0800
+++ b/NEWS	Tue Dec 03 15:59:56 2013 -0800
@@ -3,7 +3,7 @@
 
  ** Other new functions added in 4.2:
 
-      *none*
+      dir_in_path
 
  ** Deprecated functions.
 
@@ -24,7 +24,7 @@
     be removed from Octave 4.6 (or whatever version is the second major
     release after 4.2):
 
-      *none*
+      find_dir_in_path
 
 
     The following keywords were deprecated in Octave 3.8 and have been
--- a/doc/interpreter/func.txi	Tue Dec 03 16:06:46 2013 -0800
+++ b/doc/interpreter/func.txi	Tue Dec 03 15:59:56 2013 -0800
@@ -802,7 +802,7 @@
 
 @DOCSTRING(command_line_path)
 
-@DOCSTRING(find_dir_in_path)
+@DOCSTRING(dir_in_path)
 
 @node Subfunctions
 @subsection Subfunctions
--- a/libinterp/corefcn/utils.cc	Tue Dec 03 16:06:46 2013 -0800
+++ b/libinterp/corefcn/utils.cc	Tue Dec 03 15:59:56 2013 -0800
@@ -303,7 +303,7 @@
 If the second optional argument @qcode{\"all\"} is supplied, return\n\
 a cell array containing the list of all files that have the same\n\
 name in the path.  If no files are found, return an empty cell array.\n\
-@seealso{file_in_path, find_dir_in_path, path}\n\
+@seealso{file_in_path, dir_in_path, path}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -380,7 +380,7 @@
 If the third optional argument @qcode{\"all\"} is supplied, return\n\
 a cell array containing the list of all files that have the same\n\
 name in the path.  If no files are found, return an empty cell array.\n\
-@seealso{file_in_loadpath, find_dir_in_path, path}\n\
+@seealso{file_in_loadpath, dir_in_path, path}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -892,10 +892,10 @@
 %!error make_absolute_filename ("foo", "bar")
 */
 
-DEFUN (find_dir_in_path, args, ,
+DEFUN (dir_in_path, args, ,
        "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} find_dir_in_path (@var{dir})\n\
-@deftypefnx {Built-in Function} {} find_dir_in_path (@var{dir}, \"all\")\n\
+@deftypefn  {Built-in Function} {} dir_in_path (@var{dir})\n\
+@deftypefnx {Built-in Function} {} dir_in_path (@var{dir}, \"all\")\n\
 Return the full name of the path element matching @var{dir}.  The\n\
 match is performed at the end of each path element.  For example, if\n\
 @var{dir} is @qcode{\"foo/bar\"}, it matches the path element\n\
@@ -926,7 +926,7 @@
             retval = Cell (load_path::find_matching_dirs (dir));
         }
       else
-        error ("find_dir_in_path: DIR must be a directory name");
+        error ("dir_in_path: DIR must be a directory name");
     }
   else
     print_usage ();
@@ -937,8 +937,8 @@
 /*
 ## FIXME: We need system-dependent tests here.
 
-%!error find_dir_in_path ()
-%!error find_dir_in_path ("foo", "bar", 1)
+%!error dir_in_path ()
+%!error dir_in_path ("foo", "bar", 1)
 */
 
 DEFUNX ("errno", Ferrno, args, ,
--- a/libinterp/corefcn/variables.cc	Tue Dec 03 16:06:46 2013 -0800
+++ b/libinterp/corefcn/variables.cc	Tue Dec 03 15:59:56 2013 -0800
@@ -548,7 +548,7 @@
 Check only for directories.\n\
 @end table\n\
 \n\
-@seealso{file_in_loadpath, file_in_path, find_dir_in_path, stat}\n\
+@seealso{file_in_loadpath, file_in_path, dir_in_path, stat}\n\
 @end deftypefn")
 {
   octave_value retval = false;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/find_dir_in_path.m	Tue Dec 03 15:59:56 2013 -0800
@@ -0,0 +1,40 @@
+## Copyright (C) 2013 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
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Built-in Function} {} find_dir_in_path (@var{dir})
+## @deftypefnx {Built-in Function} {} find_dir_in_path (@var{dir}, "all")
+## This function has been deprecated.  Use @code{dir_in_path} instead.
+## @seealso{dir_in_path}
+## @end deftypefn
+
+## Deprecated in version 4.2
+
+function retval = find_dir_in_path (varargin)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "find_dir_in_path is obsolete and will be removed from a future version of Octave, please use dir_in_path instead");
+  endif
+
+  retval = dir_in_path (varargin{:});
+
+endfunction
+
--- a/scripts/deprecated/module.mk	Tue Dec 03 16:06:46 2013 -0800
+++ b/scripts/deprecated/module.mk	Tue Dec 03 15:59:56 2013 -0800
@@ -1,6 +1,7 @@
 FCN_FILE_DIRS += deprecated
 
 deprecated_FCN_FILES = \
+  deprecated/find_dir_in_path.m \
   deprecated/isstr.m
 
 FCN_FILES += $(deprecated_FCN_FILES)
--- a/scripts/help/help.m	Tue Dec 03 16:06:46 2013 -0800
+++ b/scripts/help/help.m	Tue Dec 03 15:59:56 2013 -0800
@@ -163,7 +163,7 @@
 
   found = false;
 
-  dlist = find_dir_in_path (name, "all");
+  dlist = dir_in_path (name, "all");
 
   for i = 1:numel (dlist)
     fname = make_absolute_filename (fullfile (dlist{i}, "Contents.m"));
--- a/scripts/miscellaneous/what.m	Tue Dec 03 16:06:46 2013 -0800
+++ b/scripts/miscellaneous/what.m	Tue Dec 03 15:59:56 2013 -0800
@@ -37,7 +37,7 @@
       if (d(end) == '/' || d(end) == '\')
         d(end) = [];
       endif
-      dtmp = find_dir_in_path (d);
+      dtmp = dir_in_path (d);
       if (isempty (dtmp))
         error ("what: could not find the directory %s", d);
       endif
--- a/scripts/testfun/rundemos.m	Tue Dec 03 16:06:46 2013 -0800
+++ b/scripts/testfun/rundemos.m	Tue Dec 03 15:59:56 2013 -0800
@@ -42,7 +42,7 @@
       if (directory(end) == '/' || directory(end) == '\')
         directory(end) = [];
       endif
-      fullname = find_dir_in_path (directory);
+      fullname = dir_in_path (directory);
       if (isempty (fullname))
         error ("rundemos: DIRECTORY argument must be a valid pathname");
       endif
--- a/scripts/testfun/runtests.m	Tue Dec 03 16:06:46 2013 -0800
+++ b/scripts/testfun/runtests.m	Tue Dec 03 15:59:56 2013 -0800
@@ -42,7 +42,7 @@
       if (directory(end) == '/' || directory(end) == '\')
         directory(end) = [];
       endif
-      fullname = find_dir_in_path (directory);
+      fullname = dir_in_path (directory);
       if (isempty (fullname))
         error ("runtests: DIRECTORY argument must be a valid pathname");
       endif