# HG changeset patch # User John W. Eaton # Date 1287622157 14400 # Node ID a44f979a35ce4a5bf6c8eee4f19f744a398455e3 # Parent d3eaaa7c6762e397941175bb6257fe6e20233e54 style fixes for some .m files diff -r d3eaaa7c6762 -r a44f979a35ce scripts/ChangeLog --- a/scripts/ChangeLog Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/ChangeLog Wed Oct 20 20:49:17 2010 -0400 @@ -1,3 +1,12 @@ +2010-10-20 John W. Eaton + + * io/strread.m, optimization/sqp.m, plot/daspect.m, + plot/pbaspect.m, plot/gnuplot_drawnow.m, plot/isocolors.m, + plot/isonormals.m, plot/legend.m, plot/print.m, + plot/private/__interp_cube__.m, plot/__fltk_print__.m, + plot/__gnuplot_print__.m, plot/__print_parse_opts__.m, + statistics/base/quantile.m: Style fixes. + 2010-10-19 John W. Eaton * strings/module.mk (strings_FCN_FILES): Include diff -r d3eaaa7c6762 -r a44f979a35ce scripts/io/strread.m --- a/scripts/io/strread.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/io/strread.m Wed Oct 20 20:49:17 2010 -0400 @@ -192,7 +192,7 @@ data = words (m:nspecif:end); ## Map to format - switch specif (m, :) + switch (specif(m,:)) case "%s" data (end+1:num_lines) = {""}; varargout {k} = data'; diff -r d3eaaa7c6762 -r a44f979a35ce scripts/optimization/sqp.m --- a/scripts/optimization/sqp.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/optimization/sqp.m Wed Oct 20 20:49:17 2010 -0400 @@ -234,13 +234,13 @@ obj_grd = @fd_obj_grd; have_hess = 0; if (iscell (objf)) - switch length (objf) - case {1} + switch (numel (objf)) + case 1 obj_fun = objf{1}; - case {2} + case 2 obj_fun = objf{1}; obj_grd = objf{2}; - case {3} + case 3 obj_fun = objf{1}; obj_grd = objf{2}; obj_hess = objf{3}; @@ -258,10 +258,10 @@ if (nargin > 2) ce_grd = @fd_ce_jac; if (iscell (cef)) - switch length (cef) - case {1} + switch (numel (cef)) + case 1 ce_fun = cef{1}; - case {2} + case 2 ce_fun = cef{1}; ce_grd = cef{2}; otherwise diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/__fltk_print__.m --- a/scripts/plot/__fltk_print__.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/__fltk_print__.m Wed Oct 20 20:49:17 2010 -0400 @@ -37,7 +37,7 @@ gl2ps_device = {}; pipeline = {}; - switch lower (opts.devopt) + switch (lower (opts.devopt)) case {"eps", "eps2", "epsc", "epsc2"} ## format GL2PS_EPS gl2ps_device = {"eps"}; @@ -70,11 +70,11 @@ pipeline = {sprintf("cat > %s.%s", name, suffix)}; pipeline{2} = sprintf ("cat > %s.tex", name); endif - case {"tikz"} + case "tikz" ## format GL2PS_PGF gl2ps_device = {"pgf"}; pipeline = {sprintf("cat > %s", opts.name)}; - case {"svg"} + case "svg" ## format GL2PS_SVG gl2ps_device = {"svg"}; pipeline = {sprintf("cat > %s", opts.name)}; @@ -99,7 +99,7 @@ gl2ps_device = {"eps"}; pipeline = {cmd}; endif - case {"aifm"} + case "aifm" cmd = opts.pstoedit_cmd (opts, "ps2ai"); gl2ps_device = {"eps"}; pipeline = {sprintf("%s > %s", cmd, opts.name)}; diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/__gnuplot_print__.m --- a/scripts/plot/__gnuplot_print__.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/__gnuplot_print__.m Wed Oct 20 20:49:17 2010 -0400 @@ -48,7 +48,7 @@ pipeline = ""; - switch lower (opts.devopt) + switch (lower (opts.devopt)) case {"eps", "eps2", "epsc", "epsc2"} if (any (strcmp (opts.devopt, {"eps", "epsc"}))) gp_opts = sprintf ("%s level1", gp_opts); @@ -88,7 +88,7 @@ endif local_drawnow (sprintf ("%s %s", term, gp_opts), strcat (name, ".", suffix), opts) - case {"tikz"} + case "tikz" if (__gnuplot_has_terminal__ ("tikz")) local_drawnow (sprintf ("lua tikz %s", gp_opts), opts.name, opts); else @@ -96,7 +96,7 @@ "print.m: '%s' output is not available for Gnuplot-%s.", upper (opts.devopt), __gnuplot_version__ ()) endif - case {"svg"} + case "svg" local_drawnow (sprintf ("svg dynamic %s", gp_opts), opts.name, opts); case {"aifm", "corel", "eepic", "emf", "fig"} local_drawnow (sprintf ("%s %s", opts.devopt, gp_opts), opts.name, opts); @@ -194,8 +194,8 @@ opts.(varargin{n}) = varargin{n+1}; endfor f = ""; - switch opts.devopt - case {"cgm"} + switch (opts.devopt) + case "cgm" if (! isempty (opts.font) && ! isempty (opts.fontsize)) f = sprintf ("font ""%s,%d""", opts.font, opts.fontsize); elseif (! isempty (opts.font)) @@ -215,7 +215,7 @@ elseif (! isempty (opts.fontsize)) f = sprintf ("%d", 2 * opts.fontsize); endif - case {"svg"} + case "svg" if (! isempty (opts.font) && ! isempty (opts.fontsize)) fontsize = round (opts.fontsize * 0.75); f = sprintf ("fname ""%s"" fsize %d", opts.font, fontsize); @@ -225,7 +225,7 @@ fontsize = round (opts.fontsize * 0.75); f = sprintf ("%s fsize %d", f, fontsize); endif - case {"pdf"} + case "pdf" if (! isempty (opts.font) && ! isempty (opts.fontsize)) f = sprintf ("font ""%s,%d""", opts.font, opts.fontsize); elseif (! isempty (opts.font)) @@ -245,7 +245,7 @@ elseif (! isempty (opts.fontsize)) f = sprintf ("%d", opts.fontsize); endif - case {"pslatex"} + case "pslatex" if (! isempty (opts.fontsize)) f = sprintf ("%d", opts.fontsize); endif @@ -257,7 +257,7 @@ elseif (! isempty (opts.fontsize)) f = sprintf ("font ""%d""", opts.fontsize); endif - case {"emf"} + case "emf" if (! isempty (opts.font) && ! isempty (opts.fontsize)) f = sprintf ("""%s"" %d", opts.font, opts.fontsize); elseif (! isempty (opts.font)) @@ -265,7 +265,7 @@ elseif (! isempty (opts.fontsize)) f = sprintf ("%d", opts.fontsize); endif - case {"canvas"} + case "canvas" if (! isempty (opts.fontsize)) f = sprintf ("fsize %d", opts.fontsize); endif @@ -277,7 +277,7 @@ elseif (! isempty (opts.fontsize)) f = sprintf ("%d", opts.fontsize); endif - case {"fig"} + case "fig" if (! isempty (opts.font) && ! isempty (opts.fontsize)) f = sprintf ("font %s fontsize %d", opts.font, opts.fontsize); elseif (! isempty (opts.font)) @@ -291,7 +291,7 @@ function [h, fontsize] = get_figure_text_objs (opts) h = findall (opts.figure, "-property", "fontsize"); fontsize = get (h, "fontsize"); - switch numel (fontsize) + switch (numel (fontsize)) case 0 fontsize = {}; case 1 diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/__print_parse_opts__.m --- a/scripts/plot/__print_parse_opts__.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/__print_parse_opts__.m Wed Oct 20 20:49:17 2010 -0400 @@ -542,7 +542,7 @@ papersize = papertype; papersize(papersize=="-") = ""; papersize = strrep (papersize, "us", ""); - switch papersize + switch (papersize) case "a" papersize = "letter"; case {"b", "tabloid"} @@ -558,12 +558,12 @@ endfunction function value = convert2points (value, units) - switch units - case {"inches"} + switch (units) + case "inches" value = value * 72; - case {"centimeters"} + case "centimeters" value = value * 72 / 25.4; - case {"normalized"} + case "normalized" error ("print:customnormalized", "print.m: papersize=='' and paperunits='normalized' may not be combined.") endswitch diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/daspect.m --- a/scripts/plot/daspect.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/daspect.m Wed Oct 20 20:49:17 2010 -0400 @@ -50,21 +50,21 @@ if (numel (varargin) == 1) if (ischar (varargin{1}) && any (strcmpi (varargin{1}, {"mode", "manual", "auto"}))) - switch varargin{1} - case {"mode"} + switch (varargin{1}) + case "mode" if (nargout < 2) varargout{1} = get (hax, "dataaspectratiomode"); return else error ("daspect: only one output is allowed.") endif - case {"manual"} + case "manual" set (hax, "dataaspectratiomode", "manual"); - case {"auto"} + case "auto" set (hax, "dataaspectratiomode", "auto"); endswitch elseif (isreal (varargin{1}) - && any (numel (varargin{1}) == [2 3])) + && any (numel (varargin{1}) == [2, 3])) set (hax, "dataaspectratio", varargin{1}) else error ("daspect: invalid input.") diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/gnuplot_drawnow.m --- a/scripts/plot/gnuplot_drawnow.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/gnuplot_drawnow.m Wed Oct 20 20:49:17 2010 -0400 @@ -206,7 +206,7 @@ if (__gnuplot_has_feature__ ("wxt_figure_size")) terminals_with_size{end+1} = "wxt"; endif - switch term + switch (term) case terminals_with_size size_str = sprintf ("size %g,%g", gnuplot_size); case "tikz" diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/isocolors.m --- a/scripts/plot/isocolors.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/isocolors.m Wed Oct 20 20:49:17 2010 -0400 @@ -100,7 +100,7 @@ function varargout = isocolors(varargin) calc_rgb = false; - switch nargin + switch (nargin) case 2 c = varargin{1}; vp = varargin{2}; @@ -141,17 +141,17 @@ pa = vp; v = get (pa, "Vertices"); else - error("isocolors: last argument is not a vertex list or patch handle"); + error ("isocolors: last argument is not a vertex list or patch handle"); endif - if ( calc_rgb ) + if (calc_rgb) new_col = zeros (size (v, 1), 3); - new_col(:, 1) = __interp_cube__ (x, y, z, R, v, "values" ); - new_col(:, 2) = __interp_cube__ (x, y, z, G, v, "values" ); - new_col(:, 3) = __interp_cube__ (x, y, z, B, v, "values" ); + new_col(:,1) = __interp_cube__ (x, y, z, R, v, "values" ); + new_col(:,2) = __interp_cube__ (x, y, z, G, v, "values" ); + new_col(:,3) = __interp_cube__ (x, y, z, B, v, "values" ); else new_col = __interp_cube__ (x, y, z, c, v, "values" ); endif - switch nargout + switch (nargout) case 0 if (!isempty (pa)) set (pa, "FaceVertexCData", new_col); diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/isonormals.m --- a/scripts/plot/isonormals.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/isonormals.m Wed Oct 20 20:49:17 2010 -0400 @@ -105,7 +105,7 @@ error ("isonormals: Unknown option '%s'", varargin{nargin}); endif endif - switch na + switch (na) case 2 c = varargin{1}; vp = varargin{2}; @@ -135,7 +135,7 @@ else normals = __interp_cube__ (x, y, z, c, v, "normals"); endif - switch nargout + switch (nargout) case 0 if (!isempty (pa)) set (pa, "VertexNormals", normals); diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/legend.m --- a/scripts/plot/legend.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/legend.m Wed Oct 20 20:49:17 2010 -0400 @@ -512,7 +512,7 @@ else lpos = [0, 0, num1 * xstep, num2 * ystep]; endif - switch(position) + switch (position) case "north" if (outside) lpos = [ca_pos(1) + (ca_pos(3) - lpos(3)) / 2, ... @@ -621,7 +621,7 @@ yk = 0; for k = 1 : numel (hplots) hobjects = [hobjects, texthandle (k)]; - switch get (hplots(k), "type") + switch (get (hplots(k), "type")) case "line" color = get (hplots(k), "color"); style = get (hplots(k), "linestyle"); diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/pbaspect.m --- a/scripts/plot/pbaspect.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/pbaspect.m Wed Oct 20 20:49:17 2010 -0400 @@ -50,21 +50,21 @@ if (numel (varargin) == 1) if (ischar (varargin{1}) && any (strcmpi (varargin{1}, {"mode", "manual", "auto"}))) - switch varargin{1} - case {"mode"} + switch (varargin{1}) + case "mode" if (nargout < 2) varargout{1} = get (hax, "plotboxaspectratiomode"); return else error ("pbaspect: only one output is allowed.") endif - case {"manual"} + case "manual" set (hax, "plotboxaspectratiomode", "manual"); - case {"auto"} + case "auto" set (hax, "plotboxaspectratiomode", "auto"); endswitch elseif (isreal (varargin{1}) - && any (numel (varargin{1}) == [2 3])) + && any (numel (varargin{1}) == [2, 3])) set (hax, "plotboxaspectratio", varargin{1}) else error ("pbaspect: invalid input.") diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/print.m --- a/scripts/plot/print.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/print.m Wed Oct 20 20:49:17 2010 -0400 @@ -363,7 +363,7 @@ endif ## call the backend print script - switch get (opts.figure, "__backend__") + switch (get (opts.figure, "__backend__")) case "gnuplot" opts = __gnuplot_print__ (opts); otherwise diff -r d3eaaa7c6762 -r a44f979a35ce scripts/plot/private/__interp_cube__.m --- a/scripts/plot/private/__interp_cube__.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/plot/private/__interp_cube__.m Wed Oct 20 20:49:17 2010 -0400 @@ -50,7 +50,7 @@ return endif - switch req + switch (req) case "values" [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v); case "normals" diff -r d3eaaa7c6762 -r a44f979a35ce scripts/statistics/base/quantile.m --- a/scripts/statistics/base/quantile.m Tue Oct 19 04:31:30 2010 -0400 +++ b/scripts/statistics/base/quantile.m Wed Oct 20 20:49:17 2010 -0400 @@ -1,4 +1,4 @@ -## Copyright (C) 2008, 2009 Ben Abbott and Jaroslav Hajek +n## Copyright (C) 2008, 2009 Ben Abbott and Jaroslav Hajek ## ## This file is part of Octave. ## @@ -52,21 +52,24 @@ ## interpolation function respecting each methods' representative cdf. ## ## @enumerate 4 -## @item Method 4: p(k) = k / n. That is, linear interpolation of the empirical cdf. +## @item Method 4: p(k) = k / n. That is, linear interpolation of the +## empirical cdf. ## -## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear function where -## the knots are the values midway through the steps of the empirical cdf. +## @item Method 5: p(k) = (k - 0.5) / n. That is a piecewise linear +## function where the knots are the values midway through the steps of +## the empirical cdf. ## ## @item Method 6: p(k) = k / (n + 1). ## ## @item Method 7: p(k) = (k - 1) / (n - 1). ## -## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile estimates -## are approximately median-unbiased regardless of the distribution of @var{x}. +## @item Method 8: p(k) = (k - 1/3) / (n + 1/3). The resulting quantile +## estimates are approximately median-unbiased regardless of the +## distribution of @var{x}. ## -## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile estimates -## are approximately unbiased for the expected order statistics if @var{x} is -## normally distributed. +## @item Method 9: p(k) = (k - 3/8) / (n + 1/4). The resulting quantile +## estimates are approximately unbiased for the expected order +## statistics if @var{x} is normally distributed. ## @end enumerate ## ## Hyndman and Fan (1996) recommend method 8. Maxima, S, and R @@ -323,9 +326,9 @@ ## The column-distribution indices. pcd = kron (ones (n, 1), mx*(0:nx-1)); mm = kron (ones (n, 1), m); - switch method + switch (method) case {1, 2, 3} - switch method + switch (method) case 1 p = max (ceil (kron (p, m)), 1); inv(k,:) = x(p + pcd); @@ -345,7 +348,7 @@ endswitch otherwise - switch method + switch (method) case 4 p = kron (p, m);