Mercurial > hg > octave-shane
changeset 11588:d5bd2766c640
style fixes for warning and error messages in script files
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,21 @@ +2011-01-20 John W. Eaton <jwe@octave.org> + + * deprecated/cellidx.m, deprecated/dmult.m, + deprecated/intwarning.m, deprecated/str2mat.m, general/curl.m, + general/divergence.m, general/gradient.m, geometry/griddata.m, + help/gen_doc_cache.m, io/dlmwrite.m, miscellaneous/getappdata.m, + miscellaneous/isappdata.m, miscellaneous/rmappdata.m, + miscellaneous/setappdata.m, miscellaneous/unpack.m, + optimization/lsqnonneg.m, optimization/pqpnonneg.m, + pkg/get_forge_pkg.m, pkg/pkg.m, plot/__fltk_print__.m, + plot/__gnuplot_get_var__.m, plot/__gnuplot_open_stream__.m, + plot/__gnuplot_print__.m, plot/daspect.m, + plot/gnuplot_drawnow.m, plot/pbaspect.m, + plot/private/__errplot__.m, plot/private/__fltk_file_filter__.m, + plot/private/__ghostscript__.m, plot/uigetfile.m, + plot/uiputfile.m, polynomial/polyaffine.m, sparse/pcg.m: + Style fixes for error and warning messages. + 2011-01-20 John W. Eaton <jwe@octave.org> * @ftp/dir.m, @ftp/mget.m, @ftp/mput.m, ChangeLog,
--- a/scripts/deprecated/cellidx.m +++ b/scripts/deprecated/cellidx.m @@ -41,7 +41,7 @@ if (! warned) warned = true; warning ("Octave:deprecated-function", - "cellidx is obsolete and will be removed from a future version of Octave; use ismember instead."); + "cellidx is obsolete and will be removed from a future version of Octave; use ismember instead"); endif if (nargin != 2)
--- a/scripts/deprecated/dmult.m +++ b/scripts/deprecated/dmult.m @@ -33,7 +33,7 @@ if (! warned) warned = true; warning ("Octave:deprecated-function", - "dmult is obsolete and will be removed from a future version of Octave; please use the straightforward (and now efficient) syntax ""diag(A)*B""."); + "dmult is obsolete and will be removed from a future version of Octave; please use the straightforward (and now efficient) syntax \"diag(A)*B\""); endif if (nargin != 2)
--- a/scripts/deprecated/intwarning.m +++ b/scripts/deprecated/intwarning.m @@ -70,7 +70,7 @@ if (! warned) warned = true; warning ("Octave:deprecated-function", - "intwarning is obsolete and will be removed from a future version of Octave. Integer math no longer produces warnings. Supply your own checks if you need those."); + "intwarning is obsolete and will be removed from a future version of Octave; integer math no longer produces warnings -- supply your own checks if you need those"); endif return;
--- a/scripts/deprecated/str2mat.m +++ b/scripts/deprecated/str2mat.m @@ -37,7 +37,7 @@ if (! warned) warned = true; warning ("Octave:deprecated-function", - "str2mat is obsolete and will be removed from a future version of Octave; please use char instead."); + "str2mat is obsolete and will be removed from a future version of Octave; please use char instead"); endif retval = char (varargin{:});
--- a/scripts/general/curl.m +++ b/scripts/general/curl.m @@ -76,9 +76,9 @@ if ((nargin == 4) || (nargin == 2)) if (!size_equal (varargin{fidx}, varargin{fidx + 1})) - error ("curl: size of X and Y must match."); + error ("curl: size of X and Y must match"); elseif (ndims (varargin{fidx}) != 2) - error ("curl: expected two-dimensional matrices X and Y."); + error ("curl: expected two-dimensional matrices X and Y"); elseif ((length (dx) != columns (varargin{fidx})) || (length (dy) != rows (varargin{fidx}))) error ("curl: size of dx and dy must match the respective dimension of X and Y"); @@ -96,18 +96,18 @@ varargout{1} = rot_z; varargout{2} = av; else - error ("curl: number of output arguments must be 1 or 2.") + error ("curl: number of output arguments must be 1 or 2") endif elseif ((nargin == 6) || (nargin == 3)) if (!size_equal (varargin{fidx}, varargin{fidx + 1}, varargin{fidx + 2})) error ("curl: size of X, Y, and Z must match") elseif (ndims (varargin{fidx}) != 3) - error ("curl: expected two-dimensional matrices X, Y, and Z."); + error ("curl: expected two-dimensional matrices X, Y, and Z"); elseif ((length (dx) != size (varargin{fidx}, 2)) || (length (dy) != size (varargin{fidx}, 1)) || (length (dz) != size (varargin{fidx}, 3))) - error ("curl: size of dx, dy, and dz must match the respective dimesion of X, Y, and Z."); + error ("curl: size of dx, dy, and dz must match the respective dimesion of X, Y, and Z"); endif [~, dFx_dy, dFx_dz] = gradient (varargin{fidx}, dx, dy, dz);
--- a/scripts/general/divergence.m +++ b/scripts/general/divergence.m @@ -74,9 +74,9 @@ if ((nargin == 4) || (nargin == 2)) if (!size_equal (varargin{fidx},varargin{fidx + 1})) - error ("divergence: size of X and Y must match."); + error ("divergence: size of X and Y must match"); elseif (ndims (varargin{fidx}) != 2) - error ("divergence: expected two-dimensional matrices X and Y."); + error ("divergence: expected two-dimensional matrices X and Y"); elseif ((length (dx) != columns (varargin{fidx})) || (length (dy) != rows (varargin{fidx}))) error ("divergence: size of dx and dy must match the respective dimension of X and Y"); endif @@ -88,11 +88,11 @@ if (!size_equal (varargin{fidx},varargin{fidx + 1},varargin{fidx + 2})) error ("divergence: size of X, Y, and Z must match") elseif (ndims (varargin{fidx}) != 3) - error ("divergence: expected two-dimensional matrices X, Y, and Z."); + error ("divergence: expected two-dimensional matrices X, Y, and Z"); elseif ((length (dx) != size (varargin{fidx}, 2)) || (length (dy) != size (varargin{fidx}, 1)) || (length (dz) != size (varargin{fidx}, 3))) - error ("divergence: size of dx, dy, and dz must match the respective dimesion of X, Y, and Z."); + error ("divergence: size of dx, dy, and dz must match the respective dimesion of X, Y, and Z"); endif ## x-direction
--- a/scripts/general/gradient.m +++ b/scripts/general/gradient.m @@ -121,7 +121,7 @@ else ## have spacing value for each dimension if (length(varargin) != nd) - error ("gradient: dimensions and number of spacing values do not match."); + error ("gradient: dimensions and number of spacing values do not match"); endif for i = 1:nd if (isscalar (varargin{i}))
--- a/scripts/geometry/griddata.m +++ b/scripts/geometry/griddata.m @@ -55,9 +55,9 @@ [x, y] = meshgrid (x, y); elseif (! all (size (x) == size (y) & size (x) == size (z))) if (isvector (z)) - error ("griddata: X, Y, and Z, be vectors of same length."); + error ("griddata: X, Y, and Z, be vectors of same length"); else - error ("griddata: lengths of X, Y must match the columns and rows of Z."); + error ("griddata: lengths of X, Y must match the columns and rows of Z"); endif endif
--- a/scripts/help/gen_doc_cache.m +++ b/scripts/help/gen_doc_cache.m @@ -74,7 +74,7 @@ ## Did we get the help text? if (status != 0 || isempty (text)) - warning ("gen_doc_cache: unusable help text in '%s'. Ignoring function.", f); + warning ("gen_doc_cache: unusable help text found in file '%s'", f); return; endif
--- a/scripts/io/dlmwrite.m +++ b/scripts/io/dlmwrite.m @@ -140,7 +140,7 @@ elseif (strcmpi (varargin{i}, "off")) opentype = "wt"; else - error ("dlmwrite: append must be \"on\" or \"off\"."); + error ("dlmwrite: append must be \"on\" or \"off\""); endif else if (i == 1)
--- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -26,7 +26,7 @@ function val = getappdata (h, name) if (! (all (ishandle (h)) && ischar (name))) - error ("getappdata: invalid input.") + error ("getappdata: invalid input") endif appdata(numel(h)) = struct();
--- a/scripts/miscellaneous/isappdata.m +++ b/scripts/miscellaneous/isappdata.m @@ -27,7 +27,7 @@ function res = isappdata (h, name) if (! (all (ishandle (h)) && ischar (name))) - error ("isappdata: invalid input.") + error ("isappdata: invalid input") endif for nh = 1:numel(h)
--- a/scripts/miscellaneous/rmappdata.m +++ b/scripts/miscellaneous/rmappdata.m @@ -26,7 +26,7 @@ function rmappdata (h, varargin) if (! (all (ishandle (h)) && iscellstr (varargin))) - error ("rmappdata: invalid input.") + error ("rmappdata: invalid input") endif for nh = 1:numel(h)
--- a/scripts/miscellaneous/setappdata.m +++ b/scripts/miscellaneous/setappdata.m @@ -27,7 +27,7 @@ function setappdata (h, varargin) if (! (all (ishandle (h)) && mod (numel (varargin), 2) == 0)) - error ("setappdata: invalid input.") + error ("setappdata: invalid input") endif for nh = 1:numel(h) @@ -44,7 +44,7 @@ elseif (ischar (varargin{narg})) appdata.(varargin{narg}) = varargin{narg+1}; else - error ("setappdata: invalid input.") + error ("setappdata: invalid input") endif endfor set (h(nh), "__appdata__", appdata);
--- a/scripts/miscellaneous/unpack.m +++ b/scripts/miscellaneous/unpack.m @@ -79,7 +79,7 @@ cfile = canonicalize_file_name (file); if (isempty (cfile)) - error ("unpack: file \"%s\" not found.", file); + error ("unpack: file \"%s\" not found", file); else file = cfile; endif
--- a/scripts/optimization/lsqnonneg.m +++ b/scripts/optimization/lsqnonneg.m @@ -160,7 +160,7 @@ idx = find (w == max (w)); if (numel (idx) > 1) warning ("lsqnonneg:nonunique", - "A non-unique solution may be returned due to equal gradients."); + "a non-unique solution may be returned due to equal gradients"); idx = idx(1); endif ## move the index from Z to P. Keep P sorted.
--- a/scripts/optimization/pqpnonneg.m +++ b/scripts/optimization/pqpnonneg.m @@ -159,7 +159,7 @@ idx = find (w == max (w)); if (numel (idx) > 1) warning ("pqpnonneg:nonunique", - "A non-unique solution may be returned due to equal gradients."); + "a non-unique solution may be returned due to equal gradients"); idx = idx(1); endif ## move the index from Z to P. Keep P sorted.
--- a/scripts/pkg/get_forge_pkg.m +++ b/scripts/pkg/get_forge_pkg.m @@ -46,7 +46,7 @@ pat = "<tdclass=""package_table"">PackageVersion:</td><td>([0-9.]*)</td>"; t = regexp (html, pat, "tokens"); if (isempty (t) || isempty(t{1})) - error ("get_forge_pkg: could not read version number from package's page."); + error ("get_forge_pkg: could not read version number from package's page"); else ver = t{1}{1}; if (nargout > 1) @@ -55,7 +55,7 @@ url = sprintf (urlbase, name, ver); ## Verify that the string exists on the page. if (isempty (strfind (html, url))) - warning ("get_forge_pkg: download URL not verified."); + warning ("get_forge_pkg: download URL not verified"); endif endif endif
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -1886,7 +1886,7 @@ ## Write INDEX. fid = fopen (index_file, "w"); if (fid == -1) - error ("couldn't open %s for writing.", index_file); + error ("couldn't open %s for writing", index_file); endif fprintf (fid, "%s >> %s\n", desc.name, desc.title); fprintf (fid, "%s\n", categories{1});
--- a/scripts/plot/__fltk_print__.m +++ b/scripts/plot/__fltk_print__.m @@ -139,7 +139,7 @@ endif otherwise error (sprintf ("print:no%soutput", opts.devopt), - "print.m: %s output is not available for GL2PS output.", + "print.m: %s output is not available for GL2PS output", upper (opts.devopt)) endswitch @@ -151,7 +151,7 @@ endif pid = popen (pipeline{n}, "w"); if (pid < 0) - error ("print:popenfailed", "print.m: failed to open pipe."); + error ("print:popenfailed", "print.m: failed to open pipe"); endif unwind_protect drawnow (gl2ps_device{n} , sprintf ("%d" , pid));
--- a/scripts/plot/__gnuplot_get_var__.m +++ b/scripts/plot/__gnuplot_get_var__.m @@ -90,7 +90,7 @@ [gpin, err] = fopen (gpin_name, "r"); endif if (err != 0) - error ("__gnuplot_get_var__: Can not open fifo."); + error ("__gnuplot_get_var__: can not open fifo"); endif gp_cmd = sprintf ("\nif (exists(\"%s\")) print %s; else print NaN\n", gp_var_name(1:n), gp_var_name);
--- a/scripts/plot/__gnuplot_open_stream__.m +++ b/scripts/plot/__gnuplot_open_stream__.m @@ -29,14 +29,14 @@ if (npipes > 1) [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:}); if (pid < 0) - error ("__gnuplot_open_stream__: failed to open connection to gnuplot."); + error ("__gnuplot_open_stream__: failed to open connection to gnuplot"); else plot_stream(3) = pid; endif else plot_stream = popen (sprintf ("%s ", prog, args{:}), "w"); if (plot_stream < 0) - error ("__gnuplot_open_stream__: failed to open connection to gnuplot."); + error ("__gnuplot_open_stream__: failed to open connection to gnuplot"); endif endif if (nargin > 1)
--- a/scripts/plot/__gnuplot_print__.m +++ b/scripts/plot/__gnuplot_print__.m @@ -93,7 +93,7 @@ local_drawnow (sprintf ("lua tikz %s", gp_opts), opts.name, opts); else error (sprintf ("print:no%soutput", opts.devopt), - "print.m: '%s' output is not available for Gnuplot-%s.", + "print.m: '%s' output is not available for gnuplot-%s", upper (opts.devopt), __gnuplot_version__ ()) endif case "svg" @@ -105,7 +105,7 @@ local_drawnow (sprintf ("%s %s", opts.devopt, gp_opts), opts.name, opts); else error (sprintf ("print:no%soutput", opts.devopt), - "print.m: '%s' output is not available for Gnuplot-%s.", + "print.m: '%s' output is not available for gnuplot-%s", upper (opts.devopt), __gnuplot_version__ ()) endif case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"} @@ -155,7 +155,7 @@ "---------- output begin ----------", output, "----------- output end -----------"); - error ("gnuplot:failedpipe", "print: Failed to print.") + error ("gnuplot:failedpipe", "print: failed to print") endif endfor
--- a/scripts/plot/daspect.m +++ b/scripts/plot/daspect.m @@ -56,7 +56,7 @@ varargout{1} = get (hax, "dataaspectratiomode"); return else - error ("daspect: only one output is allowed.") + error ("daspect: only one output is allowed") endif case "manual" set (hax, "dataaspectratiomode", "manual"); @@ -68,10 +68,10 @@ elseif (isreal (varargin{1}) && numel (varargin{1}) == 3) set (hax, "dataaspectratio", varargin{1}) else - error ("daspect: invalid input.") + error ("daspect: invalid input") endif elseif (numel (varargin) > 1) - error ("daspect: too many inputs.") + error ("daspect: too many inputs") endif elseif (nargout == 0) print_usage (); @@ -80,7 +80,7 @@ if (nargout == 1) varargout{1} = get (hax, "dataaspectratio"); elseif (nargout > 1) - error ("daspect: only one output is allowed.") + error ("daspect: only one output is allowed") endif endfunction
--- a/scripts/plot/gnuplot_drawnow.m +++ b/scripts/plot/gnuplot_drawnow.m @@ -51,7 +51,7 @@ __go_draw_figure__ (h, fid, enhanced, mono); endif else - error ("gnuplot_drawnow: the gnuplot terminal, \"%s\", is not available.", + error ("gnuplot_drawnow: the gnuplot terminal, \"%s\", is not available", gnuplot_trim_term (term)) endif unwind_protect_cleanup
--- a/scripts/plot/pbaspect.m +++ b/scripts/plot/pbaspect.m @@ -56,7 +56,7 @@ varargout{1} = get (hax, "plotboxaspectratiomode"); return else - error ("pbaspect: only one output is allowed.") + error ("pbaspect: only one output is allowed") endif case "manual" set (hax, "plotboxaspectratiomode", "manual"); @@ -68,10 +68,10 @@ elseif (isreal (varargin{1}) && numel (varargin{1}) == 3) set (hax, "plotboxaspectratio", varargin{1}) else - error ("pbaspect: invalid input.") + error ("pbaspect: invalid input") endif elseif (numel (varargin) > 1) - error ("pbaspect: too many inputs.") + error ("pbaspect: too many inputs") endif elseif (nargout == 0) print_usage (); @@ -80,7 +80,7 @@ if (nargout == 1) varargout{1} = get (hax, "plotboxaspectratio"); elseif (nargout > 1) - error ("pbaspect: only one output is allowed.") + error ("pbaspect: only one output is allowed") endif endfunction
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -146,7 +146,7 @@ error ("errorbar: error plot with 6 columns only valid for boxxy and xyerr"); endif otherwise - error ("errorbar: error plot requires 2, 3, 4 or 6 arguments."); + error ("errorbar: error plot requires 2, 3, 4 or 6 arguments"); endswitch addproperty ("xdata", hg, "data", xdata(:)) @@ -257,7 +257,7 @@ ydata = [y1; y2]; return else - error ("errorbar: valid error bar types are xerr, yerr, boxxy, and xyerr.") + error ("errorbar: valid error bar types are xerr, yerr, boxxy, and xyerr") endif xdata = xdata.'(:); ydata = ydata.'(:);
--- a/scripts/plot/private/__fltk_file_filter__.m +++ b/scripts/plot/private/__fltk_file_filter__.m @@ -29,7 +29,7 @@ if (iscell (file_filter)) [r, c] = size (file_filter); if ((c == 0) || (c > 2)) - error ("expecting 1 or to 2 columns for file filter cell."); + error ("expecting 1 or to 2 columns for file filter cell"); endif fltk_str = ""; for idx = 1 : r
--- a/scripts/plot/private/__ghostscript__.m +++ b/scripts/plot/private/__ghostscript__.m @@ -114,13 +114,13 @@ unwind_protect fid = fopen (offsetfile, "w"); if (fid == -1) - error ("print:fopenfailed", "__ghostscript__.m: fopen() failed."); + error ("print:fopenfailed", "__ghostscript__.m: fopen() failed"); endif fprintf (fid, "%s\n", offset_ps{:}) unwind_protect_cleanup status = fclose (fid); if (status == -1) - error ("print:fclosefailed", "__ghostscript__.m: fclose() failed."); + error ("print:fclosefailed", "__ghostscript__.m: fclose() failed"); endif end_unwind_protect if (opts.debug)
--- a/scripts/plot/uigetfile.m +++ b/scripts/plot/uigetfile.m @@ -153,7 +153,7 @@ if (any (cellfun(@(x)strcmp (x, "fltk"), available_graphics_toolkits ()))) [retfile, retpath, retindex] = __fltk_uigetfile__ (outargs{:}); else - error ("uigetfile: fltk graphics toolkit required."); + error ("uigetfile: fltk graphics toolkit required"); endif endfunction
--- a/scripts/plot/uiputfile.m +++ b/scripts/plot/uiputfile.m @@ -85,7 +85,7 @@ endif else - error ("uiputfile: number of input arguments must be less than four."); + error ("uiputfile: number of input arguments must be less than four"); endif if (any (cellfun(@(x)strcmp (x, "fltk"), available_graphics_toolkits ())))
--- a/scripts/polynomial/polyaffine.m +++ b/scripts/polynomial/polyaffine.m @@ -38,11 +38,11 @@ endif if (! isvector (f)) - error ("polyaffine: F must be a vector."); + error ("polyaffine: F must be a vector"); endif if (! isvector (mu) || length (mu) != 2) - error ("polyaffine: MU must be a two-element vector."); + error ("polyaffine: MU must be a two-element vector"); endif lf = length (f);
--- a/scripts/sparse/pcg.m +++ b/scripts/sparse/pcg.m @@ -333,7 +333,7 @@ ## fprintf (stderr, "pcg condest: %g\n", eigest(2)/eigest(1)); else eigest = [NaN, NaN]; - warning ("pcg: eigenvalue estimate failed: iteration converged too fast."); + warning ("pcg: eigenvalue estimate failed: iteration converged too fast"); endif else eigest = [NaN, NaN];