changeset 9925:da19f179967b octave-forge

optim: mention deprecated functions on NEWS and make warning appear only once per session
author carandraug
date Fri, 30 Mar 2012 11:56:24 +0000
parents 6a29d43054bb
children 2cdbb2aba987
files main/optim/NEWS main/optim/inst/fminunc_compat.m main/optim/inst/optimset_compat.m
diffstat 3 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main/optim/NEWS	Fri Mar 30 11:10:16 2012 +0000
+++ b/main/optim/NEWS	Fri Mar 30 11:56:24 2012 +0000
@@ -1,6 +1,9 @@
-Summary of important user-visible changes for optim 1.0.18:
+Summary of important user-visible changes for optim 1.1.0:
 -------------------------------------------------------------------
 
- ** The package makefile has been adapted for compatibility with Octave 3.6.0.
+ ** The following functions have been deprecated since they have been
+    implemented in Octave core:
 
- ** There is now a 'NEWS' file.
+      fminunc_compat  optimset_compat
+
+ ** The package Makefile has been adapted for compatibility with Octave 3.6.0.
--- a/main/optim/inst/fminunc_compat.m	Fri Mar 30 11:10:16 2012 +0000
+++ b/main/optim/inst/fminunc_compat.m	Fri Mar 30 11:56:24 2012 +0000
@@ -42,9 +42,15 @@
 ##                         the 'backend' option of minimize().
 ##
 ## This function is a front-end to minimize().
+
 function [x,fval,flag,out,df,d2f] = fminunc_compat (fun,x0,opt,varargin)
 
-  warning ("'fminunc_compat' has been deprecated in favor of 'fminunc', which is now part of core Octave. This function will possibly be removed from future versions of the 'optim' package.");
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "`fminunc_compat' has been deprecated, and will be removed in the future. Use `fminunc' from Octave core instead.");
+  endif
 
 if nargin < 3, opt = struct (); end
 if nargin > 3, 
--- a/main/optim/inst/optimset_compat.m	Fri Mar 30 11:10:16 2012 +0000
+++ b/main/optim/inst/optimset_compat.m	Fri Mar 30 11:56:24 2012 +0000
@@ -41,7 +41,12 @@
 ## Display      , ["off","iter","notify","final"] 
 ##                               : N/A
 
-  warning ("'optimset_compat' has been deprecated in favor of 'optimset', which is now part of core Octave. This function will possibly be removed from future versions of the 'optim' package.");
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "`optimset_compat' has been deprecated, and will be removed in the future. Use `optimset' from Octave core instead.");
+  endif
 
 args = varargin;