changeset 8652:b93f17317ca3

fixes to __all_opts__
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 03 Feb 2009 08:32:28 +0100
parents ea8e65ca234f
children 2479ebf1c33f
files scripts/ChangeLog scripts/optimization/__all_opts__.m
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Feb 03 08:16:39 2009 +0100
+++ b/scripts/ChangeLog	Tue Feb 03 08:32:28 2009 +0100
@@ -1,3 +1,8 @@
+2009-02-03  Jaroslav Hajek  <highegg@gmail.com>
+
+	* optimization/__all_opts__.m: Yield empty list in recursive calls.
+	mlock to avoid unloading.
+
 2009-01-30  John W. Eaton  <jwe@octave.org>
 
 	* optimization/PKG_ADD: Delete.
--- a/scripts/optimization/__all_opts__.m	Tue Feb 03 08:16:39 2009 +0100
+++ b/scripts/optimization/__all_opts__.m	Tue Feb 03 08:32:28 2009 +0100
@@ -26,14 +26,20 @@
   
   persistent saved_names = {};
 
+  ## do not clear this function
+  mlock ();
+
   ## guard against recursive calls.
   persistent recursive = false;
 
-  if (nargin == 0)
+  if (recursive)
+    names = {};
+  elseif (nargin == 0)
     names = saved_names;
   else
     ## query all options from all known functions. These will call optimset,
     ## which will in turn call us, but we won't answer.
+    recursive = true;
     names = saved_names;
     for i = 1:nargin
       try
@@ -52,6 +58,7 @@
       error ("__all_opts__: duplicate options with inconsistent case.");
     endif
     saved_names = names;
+    recursive = false;
   endif
 
 endfunction