# HG changeset patch # User Rik # Date 1413867299 25200 # Node ID e5a1e79519080f7020d5d367df1ee3431d531e79 # Parent f32fb4d3fb9e97c71776ff0c75b61059156f6c2c Deprecate octave_tmp_file_name. * NEWS: Announce deprecation. * file-io.cc: Remove DEFALIAS to tmpnam function. * scripts/deprecated/octave_tmp_file_name.m: New m-file to replace DEFALIAS. Issues warning about deprecation and calls tmpnam internally. * scripts/deprecated/module.mk: Add octave_tmp_file_name.m to build system. diff -r f32fb4d3fb9e -r e5a1e7951908 NEWS --- a/NEWS Mon Oct 20 21:21:27 2014 -0700 +++ b/NEWS Mon Oct 20 21:54:59 2014 -0700 @@ -125,19 +125,20 @@ be removed from Octave 4.6 (or whatever version is the second major release after 4.2): - Function | Replacement - -------------------|------------------ - bicubic | interp2 - delaunay3 | delaunay - dump_prefs | individual preference get/set routines - find_dir_in_path | dir_in_loadpath - finite | isfinite - fmod | rem - fnmatch | glob or regexp - luinc | ilu or ichol - nfields | numfields - syl | sylvester - usage | print_usage + Function | Replacement + ---------------------|------------------ + bicubic | interp2 + delaunay3 | delaunay + dump_prefs | individual preference get/set routines + find_dir_in_path | dir_in_loadpath + finite | isfinite + fmod | rem + fnmatch | glob or regexp + luinc | ilu or ichol + nfields | numfields + octave_tmp_file_name | tempname + syl | sylvester + usage | print_usage The following functions were deprecated in Octave 3.8 and have been removed from Octave 4.2. diff -r f32fb4d3fb9e -r e5a1e7951908 libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Mon Oct 20 21:21:27 2014 -0700 +++ b/libinterp/corefcn/file-io.cc Mon Oct 20 21:54:59 2014 -0700 @@ -1932,9 +1932,6 @@ DEFUNX ("tmpnam", Ftmpnam, args, , "-*- texinfo -*-\n\ -@c List other forms of function in documentation index\n\ -@findex octave_tmp_file_name\n\ -\n\ @deftypefn {Built-in Function} {@var{fname} =} tmpnam ()\n\ @deftypefnx {Built-in Function} {@var{fname} =} tmpnam (@var{dir})\n\ @deftypefnx {Built-in Function} {@var{fname} =} tmpnam (@var{dir}, @var{prefix})\n\ @@ -1980,8 +1977,6 @@ return retval; } -DEFALIAS (octave_tmp_file_name, tmpnam); - DEFUN (tmpfile, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} tmpfile ()\n\ diff -r f32fb4d3fb9e -r e5a1e7951908 scripts/deprecated/module.mk --- a/scripts/deprecated/module.mk Mon Oct 20 21:21:27 2014 -0700 +++ b/scripts/deprecated/module.mk Mon Oct 20 21:54:59 2014 -0700 @@ -10,6 +10,7 @@ deprecated/fnmatch.m \ deprecated/isstr.m \ deprecated/luinc.m \ + deprecated/octave_tmp_file_name.m \ deprecated/nfields.m \ deprecated/strmatch.m \ deprecated/syl.m \ diff -r f32fb4d3fb9e -r e5a1e7951908 scripts/deprecated/octave_tmp_file_name.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/octave_tmp_file_name.m Mon Oct 20 21:54:59 2014 -0700 @@ -0,0 +1,54 @@ +## Copyright (C) 2014 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 {Built-in Function} {@var{fname} =} octave_tmp_file_name () +## @deftypefnx {Built-in Function} {@var{fname} =} octave_tmp_file_name (@var{dir}) +## @deftypefnx {Built-in Function} {@var{fname} =} octave_tmp_file_name (@var{dir}, @var{prefix}) +## +## @code{octave_tmp_file_name} is deprecated and will be removed in Octave +## version 4.6. Use @code{tempname} for equivalent functionality. +## +## Return a unique temporary file name as a string. +## +## If @var{prefix} is omitted, a value of @qcode{"oct-"} is used. +## If @var{dir} is also omitted, the default directory for temporary files +## (@code{P_tmpdir} is used. If @var{dir} is provided, it must exist, +## otherwise the default directory for temporary files is used. +## @seealso{tempname, tmpnam, mkstemp, tempdir, P_tmpdir, tmpfile} +## @end deftypefn + +## Deprecated in version 4.2 + + +function filename = octave_tmp_file_name (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "octave_tmp_file_name is obsolete and will be removed from a future version of Octave, please use tempname instead"); + endif + + filename = tmpnam (varargin{:}); + +endfunction + + +%!assert (1) +