annotate scripts/help/doc.m @ 14868:5d3a684236b0

maint: Use Octave coding conventions for cuddling parentheses in scripts directory * lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m, colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m, int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m, __isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m, rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m, inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m, gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m, ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m, compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m, getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m, __xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m, fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m, copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m, installed_packages.m, is_architecture_dependent.m, load_package_dirs.m, print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m, allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m, comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m, fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, print.m, __add_datasource__.m, __add_default_menu__.m, __axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m, __errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m, __ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m, __go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m, __stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m, surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m, mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m, arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m, hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m, __sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m, treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m, magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m, quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m, strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m, test.m, now.m: Use Octave coding conventions for cuddling parentheses in scripts directory.
author Rik <octave@nomad.inbox5.com>
date Tue, 17 Jul 2012 07:08:39 -0700
parents e3d03b48ecb5
children 049e8bbff782
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1 ## Copyright (C) 2005-2012 S�ren Hauberg
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11547
diff changeset
2 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
3 ## This file is part of Octave.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
4 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
13 ## General Public License for more details.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
14 ##
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6615
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
18
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
11547
e1851653d59c Eliminate @deffn macros.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
20 ## @deftypefn {Command} {} doc @var{function_name}
6615
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
21 ## Display documentation for the function @var{function_name}
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
22 ## directly from an on-line version of
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
23 ## the printed manual, using the GNU Info browser. If invoked without
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
24 ## any arguments, the manual is shown from the beginning.
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
25 ##
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
26 ## For example, the command @kbd{doc rand} starts the GNU Info browser
9133
c0cef1436788 Update help text for sections 2.2 and 2.3 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents: 8746
diff changeset
27 ## at the @code{rand} node in the on-line version of the manual.
6615
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
28 ##
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
29 ## Once the GNU Info browser is running, help for using it is available
687ae48b2253 [project @ 2007-05-13 06:24:57 by jwe]
jwe
parents: 6344
diff changeset
30 ## using the command @kbd{C-h}.
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
31 ## @seealso{help}
11547
e1851653d59c Eliminate @deffn macros.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
32 ## @end deftypefn
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
33
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
34 ## Author: Soren Hauberg <soren@hauberg.org>
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
35 ## Adapted-by: jwe
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
36
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
37 function retval = doc (fname)
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
38
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
39 if (nargin == 0 || nargin == 1)
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
40
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
41 ftype = 0;
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
42
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
43 if (nargin == 1)
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
44 ## Get the directory where the function lives.
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
45 ## FIXME -- maybe we should have a better way of doing this.
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
46
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
47 if (ischar (fname))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
48 ftype = exist (fname);
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
49 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
50 error ("doc: expecting argument to be a character string");
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
51 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
52 else
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
53 fname = "";
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
54 endif
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
55
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
56 if (ftype == 2 || ftype == 3)
6339
20c48710b2c7 [project @ 2007-02-22 18:22:24 by dbateman]
dbateman
parents: 6017
diff changeset
57 ffile = which (fname);
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
58 else
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
59 ffile = "";
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
60 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
61
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
62 if (isempty (ffile))
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
63 info_dir = octave_config_info ("infodir");
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
64 else
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
65 info_dir = fileparts (ffile);
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
66 endif
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
67
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11547
diff changeset
68 ## Determine if a file called doc.info exist in the same
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
69 ## directory as the function.
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
70
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
71 info_file_name = fullfile (info_dir, "doc.info");
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
72
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
73 [stat_info, err] = stat (info_file_name);
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
74
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
75 if (err < 0)
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
76 info_file_name = info_file ();
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
77 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
78
6017
b124a912d28b [project @ 2006-10-02 14:58:18 by jwe]
jwe
parents: 6016
diff changeset
79 ## FIXME -- don't change the order of the arguments below because
b124a912d28b [project @ 2006-10-02 14:58:18 by jwe]
jwe
parents: 6016
diff changeset
80 ## the info-emacs-info script currently expects --directory DIR as
b124a912d28b [project @ 2006-10-02 14:58:18 by jwe]
jwe
parents: 6016
diff changeset
81 ## the third and fourth arguments. Someone should fix that.
b124a912d28b [project @ 2006-10-02 14:58:18 by jwe]
jwe
parents: 6016
diff changeset
82
b124a912d28b [project @ 2006-10-02 14:58:18 by jwe]
jwe
parents: 6016
diff changeset
83 cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
84 info_program (), info_file_name, info_dir);
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
85
6344
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
86 have_fname = ! isempty (fname);
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
87
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
88 if (have_fname)
14636
e3d03b48ecb5 doc.m: quote info args
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14363
diff changeset
89 status = system (sprintf ("%s --index-search \"%s\"", cmd, fname));
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
90 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
91
6344
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
92 if (! (have_fname && status == 0))
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
93 status = system (cmd);
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
94 if (status == 127)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
95 warning ("unable to find info program `%s'", info_program ());
6344
860682863572 [project @ 2007-02-22 20:24:11 by jwe]
jwe
parents: 6339
diff changeset
96 endif
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
97 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
98
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
99 if (nargout > 0)
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
100 retval = status;
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
101 endif
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
102
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
103 else
5830
0bb816a28335 [project @ 2006-05-26 19:04:08 by jwe]
jwe
parents: 5794
diff changeset
104 print_usage ();
5672
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
105 endif
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
106
62734ddaf17b [project @ 2006-03-15 21:27:34 by jwe]
jwe
parents:
diff changeset
107 endfunction
8558
438520011621 Check for successful build of the documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7017
diff changeset
108
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
109
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
110 %!test
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
111 %! ifile = info_file ();
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
112 %! if (exist (ifile) != 2 && exist (sprintf ("%s.gz", ifile)) != 2)
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
113 %! error ("Info file %s or %s.gz does not exist!", ifile, ifile);
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
114 %! endif
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
115