changeset 7151:aeeb646f6538

[project @ 2007-11-09 19:34:17 by jwe]
author jwe
date Fri, 09 Nov 2007 19:35:52 +0000
parents 68a1b616b7df
children 8903b5151c8b
files scripts/ChangeLog scripts/audio/wavread.m scripts/control/base/__bodquist__.m scripts/control/base/dare.m scripts/control/base/dlqr.m scripts/control/hinf/h2norm.m scripts/control/system/c2d.m scripts/control/system/is_detectable.m scripts/control/system/is_signal_list.m scripts/control/system/is_stabilizable.m scripts/control/system/tfout.m scripts/general/isdefinite.m scripts/linear-algebra/krylov.m scripts/miscellaneous/compare_versions.m scripts/optimization/glpk.m scripts/path/savepath.m scripts/plot/findobj.m scripts/plot/shading.m scripts/polynomial/mpoles.m scripts/polynomial/polyint.m scripts/signal/freqz.m scripts/signal/hurst.m scripts/sparse/spfun.m scripts/sparse/spones.m scripts/sparse/spstats.m scripts/testfun/assert.m scripts/testfun/fail.m scripts/testfun/test.m src/ChangeLog src/DLD-FUNCTIONS/__gnuplot_raw__.l
diffstat 30 files changed, 60 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,17 @@
 2007-11-09  John W. Eaton  <jwe@octave.org>
 
+	* audio/wavread.m, control/base/__bodquist__.m,
+	control/base/dare.m, control/base/dlqr.m, control/hinf/h2norm.m,
+	control/system/c2d.m, control/system/is_detectable.m,
+	control/system/is_signal_list.m, control/system/is_stabilizable.m,
+	control/system/tfout.m, general/isdefinite.m,
+	linear-algebra/krylov.m, miscellaneous/compare_versions.m,
+	optimization/glpk.m, path/savepath.m, plot/findobj.m,
+	plot/shading.m, polynomial/mpoles.m, polynomial/polyint.m,
+	signal/freqz.m, signal/hurst.m, sparse/spfun.m, sparse/spones.m,
+	sparse/spstats.m, testfun/assert.m, testfun/fail.m,
+	testfun/test.m: Use specific end keywords.
+
 	* plot/surfc.m, plot/meshc.m: Don't change view if hold is on.
 
 2007-11-09  Kai Habel  <kai.habel@gmx.de>
--- a/scripts/audio/wavread.m
+++ b/scripts/audio/wavread.m
@@ -115,7 +115,7 @@
       fclose (fid);
       error ("wavread: file contains no data chunk");
     endif
-  end
+  endwhile
 
   ## data chunk size
   ck_size = fread (fid, 1, "uint32", 0, BYTEORDER);
@@ -190,7 +190,8 @@
     yi = reshape (yi, 3, rows(yi)/3)';
     yi(yi(:,3) >= 128, 3) -= 256;
     yi = yi * [1; 256; 65536];
-  end
+  endif
+
   if (format_tag == FORMAT_PCM)
     ## normalize samples
     switch (bits_per_sample)
--- a/scripts/control/base/__bodquist__.m
+++ b/scripts/control/base/__bodquist__.m
@@ -81,7 +81,7 @@
     endif
     if (is_signal_list (outputs) || ischar (outputs))
       outputs = sysidx (sys, "out", outputs);
-    end
+    endif
     sys = sysprune (sys, outputs, inputs);
     [nn, nz, mm, pp] = sysdimensions (sys);
   endif
--- a/scripts/control/base/dare.m
+++ b/scripts/control/base/dare.m
@@ -97,10 +97,10 @@
     ##Checking positive definiteness
     if (isdefinite (r) <= 0)
       error ("dare: r not positive definite");
-    end
+    endif
     if (isdefinite (q) < 0)
       error ("dare: q not positive semidefinite");
-    end
+    endif
 
     ## Check r dimensions.
     [n, m] = size (b);
--- a/scripts/control/base/dlqr.m
+++ b/scripts/control/base/dlqr.m
@@ -139,7 +139,7 @@
     warning ("dlqr: (a,q) not detectable");
   elseif (dflag == -1)
     error ("dlqr: (a,q) has non minimal modes near unit circle");
-  end
+  endif
 
   ## Compute the Riccati solution
   p = dare (ao, b, qo, r);
--- a/scripts/control/hinf/h2norm.m
+++ b/scripts/control/hinf/h2norm.m
@@ -53,7 +53,7 @@
     print_usage ();
   elseif (! isstruct (sys))
     error ("Sys must be in system data structure");
-  end
+  endif
   dflg = is_digital (sys);
 
   if (! is_stable (sys))
--- a/scripts/control/system/c2d.m
+++ b/scripts/control/system/c2d.m
@@ -172,7 +172,7 @@
     ## replace Acd
     if (nz)
       aa(crng,drng) = matexp(crng,n+m+(1:nz));
-    end
+    endif
 
     stnames = sysgetsignals (sys, "st");   ## continuous states renamed below
     innames = sysgetsignals (sys, "in");
--- a/scripts/control/system/is_detectable.m
+++ b/scripts/control/system/is_detectable.m
@@ -60,7 +60,7 @@
 
   if (! exist ("tol"))
     tol = 200*eps;
-  end    
+  endif
 
   retval = is_stabilizable (a', c', tol, dflg);
 
--- a/scripts/control/system/is_signal_list.m
+++ b/scripts/control/system/is_signal_list.m
@@ -31,7 +31,7 @@
   flg = iscell (mylist);
   if (flg)
     flg = (rows (mylist) == 1 || columns (mylist) == 1);
-  end
+  endif
   if (flg)
     for ii = 1:length (mylist)
       if (! (ischar (mylist{ii}) && rows (mylist{ii}) == 1))
--- a/scripts/control/system/is_stabilizable.m
+++ b/scripts/control/system/is_stabilizable.m
@@ -66,7 +66,7 @@
       disc = dflg;
     else
       disc = 0;
-    end
+    endif
   endif
 
   if (! exist ("tol"))
--- a/scripts/control/system/tfout.m
+++ b/scripts/control/system/tfout.m
@@ -54,6 +54,6 @@
     disp (denomstring)
   else
     error ("tfout: empty transfer function")
-  end
+  endif
 
 endfunction
--- a/scripts/general/isdefinite.m
+++ b/scripts/general/isdefinite.m
@@ -45,7 +45,7 @@
 	retval = 0;
       else
 	retval = -1;
-      end
+      endif
     else
       error ("isdefinite: matrix x must be symmetric");
     endif
--- a/scripts/linear-algebra/krylov.m
+++ b/scripts/linear-algebra/krylov.m
@@ -200,7 +200,7 @@
       av = alpha(i);
       V = V - av*hv*(hv'*V);
       H(i,nu-columns(V)+(1:columns(V))) = V(pivot_vec(i),:);
-    end
+    endfor
 
   endwhile
 
--- a/scripts/miscellaneous/compare_versions.m
+++ b/scripts/miscellaneous/compare_versions.m
@@ -141,7 +141,7 @@
     equal_op = true;
   else
     equal_op = false;
-  end
+  endif
   if any (ismember (operator, "~!"))
     not_op = true;
   else
--- a/scripts/optimization/glpk.m
+++ b/scripts/optimization/glpk.m
@@ -477,7 +477,7 @@
     endif
   else
     lb = zeros (nx, 1);
-  end
+  endif
 
   ## 5) Vector with the upper bound of each variable
 
@@ -490,7 +490,7 @@
     endif
   else
     ub = repmat (Inf, nx, 1);
-  end
+  endif
 
   ## 6) Sense of each constraint
 
@@ -507,7 +507,7 @@
     endif
   else
     ctype = repmat ("S", nc, 1);
-  end
+  endif
 
   ## 7) Vector with the type of variables
 
--- a/scripts/path/savepath.m
+++ b/scripts/path/savepath.m
@@ -102,7 +102,7 @@
   [fid, msg] = fopen (savefile, "wt");
   if (fid < 0)
     error ("savepath: unable to open file for writing, %s, %s", savefile, msg);
-  end
+  endif
   for i = 1:length (pre)
     fprintf (fid, "%s\n", pre{i})
   endfor
--- a/scripts/plot/findobj.m
+++ b/scripts/plot/findobj.m
@@ -75,7 +75,7 @@
     else
       handles = 0;
       n1 = 1;
-    end
+    endif
     if (n1 <= nargin)
       if (ischar (varargin{n1}))
 	if (strcmpi (varargin{n1}, 'flat'))
@@ -208,7 +208,7 @@
 	      match = regexp (p.(pname{np}), pvalue{np});
               if isempty (match)
                 match = 0;
-              end
+              endif
             elseif (numel (p.(pname{np})) == numel (pvalue{np}))
 	      if (ischar (pvalue{np}))
 		match = strcmpi (pvalue{np}, p.(pname{np}));
--- a/scripts/plot/shading.m
+++ b/scripts/plot/shading.m
@@ -31,7 +31,7 @@
   if (nargin == 1)
     mode = ax;
     ax = gca ();
-  end
+  endif
 
   if (nargin != 1 && nargin != 2)
     print_usage ();
--- a/scripts/polynomial/mpoles.m
+++ b/scripts/polynomial/mpoles.m
@@ -95,7 +95,7 @@
       p0 = mean (abs (p(find (abs (p) > 0))));
       if (isempty (p0))
         p0 = 1;
-      end
+      endif
     else
       p0 = abs (p(n));
     endif
--- a/scripts/polynomial/polyint.m
+++ b/scripts/polynomial/polyint.m
@@ -50,7 +50,7 @@
   if (lp == 0)
     p = [];
     return;
-  end
+  endif
 
   if (rows (p) > 1)
     ## Convert to column vector
--- a/scripts/signal/freqz.m
+++ b/scripts/signal/freqz.m
@@ -147,7 +147,7 @@
     f_r = f;
   else             # plot and don't return values
     freqz_plot (f, h);
-  end
+  endif
 
 endfunction
 
--- a/scripts/signal/hurst.m
+++ b/scripts/signal/hurst.m
@@ -37,7 +37,7 @@
     error ("hurst: x must not be a scalar")
   elseif (isvector (x))
     x = reshape (x, length (x), 1);
-  end
+  endif
 
   [xr, xc] = size (x);
 
--- a/scripts/sparse/spfun.m
+++ b/scripts/sparse/spfun.m
@@ -35,7 +35,7 @@
   else
     [i, j, v] = find (s);
     [m, n] = size (s);
-  end
+  endif
 
   if (isa (f, "function_handle") || isa (f, "inline function"))
     t = sparse (i, j, f(v), m, n);
--- a/scripts/sparse/spones.m
+++ b/scripts/sparse/spones.m
@@ -33,8 +33,10 @@
   else
     [i, j, v] = find (s);
     [m, n] = size (s);
-  end
+  endif
+
   s = sparse (i, j, 1, m, n);
+
 endfunction
 
 %!assert(issparse(spones([1,2;3,0])))
--- a/scripts/sparse/spstats.m
+++ b/scripts/sparse/spstats.m
@@ -48,12 +48,13 @@
   count = spsum (sparse (i, j, 1, n, m));
   if (nargout > 1) 
     mean = spsum (S) ./ count; 
-  end
+  endif
   if (nargout > 2) 
     ## FIXME Variance with count = 0 or 1?
     diff = S - sparse (i, j, mean(j), n, m); 
     var = spsum (diff .* diff) ./ (count - 1);
-  end
+  endif
+
 endfunction
 
 %!test
--- a/scripts/testfun/assert.m
+++ b/scripts/testfun/assert.m
@@ -67,7 +67,7 @@
   in = deblank (argn(1,:));
   for i = 2:rows (argn)
     in = strcat (in, ",", deblank (argn(i,:)));
-  end
+  endfor
   in = strcat ("(", in, ")");
 
   coda = "";
@@ -87,7 +87,7 @@
 	endfor
       catch
 	iserror = 1;
-      end
+      end_try_catch
     endif
 
   elseif (ischar (expected))
@@ -103,7 +103,7 @@
 	endfor
       catch
 	iserror = 1;
-      end
+      end_try_catch
     endif
 
   elseif (isstruct (expected))
@@ -130,7 +130,7 @@
 	endfor
       catch
 	iserror = 1;
-      end
+      end_try_catch
     endif
 
   elseif (ndims (cond) != ndims (expected)
--- a/scripts/testfun/fail.m
+++ b/scripts/testfun/fail.m
@@ -99,7 +99,7 @@
       err = lasterr;
       err([1:7, end]) = [];  # transform "error: ...\n", to "..."
       msg = sprintf ("expected warning <%s> but got error <%s>", pattern, err);
-    end
+    end_try_catch
       
   else
     ## perform the error test
@@ -115,7 +115,7 @@
 	return;
       endif
       msg = sprintf ("expected error <%s>\nbut got <%s>", pattern, err);
-    end
+    end_try_catch
   endif
 
   ## if we get here, then code didn't fail or error didn't match
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -574,7 +574,7 @@
 function s = bundle (varargin)
   for i = 1:nargin
     s.(deblank (argn(i,:))) = varargin{i};
-  end
+  endfor
 endfunction
 
 function body = __extract_test_code (nm)
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-09  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/__gnuplot_raw__.l: Don't add atexit ("closeplot")
+	to PKG_ADD file.
+
 2007-11-09  David Bateman  <dbateman@free.fr>
 
 	* graphics.cc, graphics.h.in (class patch): Add the field "keylabel".
@@ -20,7 +25,7 @@
 	Fgnuplot_command_using, Fgnuplot_command_with,
 	Fgnuplot_command_axes, Fgnuplot_command_title,
 	Fgnuplot_command_end, Fgnuplot_use_title_option,
-	F__clear_plot_window__, Fpurge_tmp_files,
+	F__clear_plot_window__, Fcloseplot, Fpurge_tmp_files,
 	F__gnuplot_raw__, F__gnuplot_send_inline_data__, F__gnuplot_set__,
 	F__gnuplot_show__, F__gnuplot_plot__, F__gnuplot_splot__,
 	F__gnuplot_replot__): Use WARN_OBSOLETE.
--- a/src/DLD-FUNCTIONS/__gnuplot_raw__.l
+++ b/src/DLD-FUNCTIONS/__gnuplot_raw__.l
@@ -31,8 +31,6 @@
 // PKG_ADD: mark_as_command ("__gnuplot_set__");
 // PKG_ADD: mark_as_command ("__gnuplot_show__");
 
-// PKG_ADD: atexit ("closeplot");
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -1730,9 +1728,7 @@
 @seealso{close}\n\
 @end deftypefn")
 {
-  // Don't use WARN_OBSOLETE here because closeplot is called
-  // unconditionally from atexit and always printing the warning when
-  // Octave exits could cause confusion.
+  WARN_OBSOLETE ("closeplot");
 
   gnuplot::close ();