annotate scripts/miscellaneous/edit.m @ 14363:f3d52523cde1

Use Octave coding conventions in all m-file %!test blocks * wavread.m, acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, celldisp.m, chop.m, circshift.m, colon.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m, divergence.m, flipdim.m, fliplr.m, flipud.m, genvarname.m, gradient.m, idivide.m, int2str.m, interp1.m, interp1q.m, interp2.m, interp3.m, interpft.m, interpn.m, isa.m, isdir.m, isequal.m, isequalwithequalnans.m, issquare.m, logspace.m, nargchk.m, narginchk.m, nargoutchk.m, nextpow2.m, nthargout.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m, profile.m, profshow.m, quadgk.m, quadv.m, randi.m, rat.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sph2cart.m, structfun.m, trapz.m, triplequad.m, convhull.m, dsearch.m, dsearchn.m, griddata3.m, griddatan.m, rectint.m, tsearchn.m, __makeinfo__.m, doc.m, get_first_help_sentence.m, help.m, type.m, unimplemented.m, which.m, imread.m, imwrite.m, dlmwrite.m, fileread.m, is_valid_file_id.m, strread.m, textread.m, textscan.m, commutation_matrix.m, cond.m, condest.m, cross.m, duplication_matrix.m, expm.m, housh.m, isdefinite.m, ishermitian.m, issymmetric.m, logm.m, normest.m, null.m, onenormest.m, orth.m, planerot.m, qzhess.m, rank.m, rref.m, trace.m, vech.m, ans.m, bincoeff.m, bug_report.m, bzip2.m, comma.m, compare_versions.m, computer.m, edit.m, fileparts.m, fullfile.m, getfield.m, gzip.m, info.m, inputname.m, isappdata.m, isdeployed.m, ismac.m, ispc.m, isunix.m, list_primes.m, ls.m, mexext.m, namelengthmax.m, news.m, orderfields.m, paren.m, recycle.m, rmappdata.m, semicolon.m, setappdata.m, setfield.m, substruct.m, symvar.m, ver.m, version.m, warning_ids.m, xor.m, fminbnd.m, fsolve.m, fzero.m, lsqnonneg.m, optimset.m, pqpnonneg.m, sqp.m, matlabroot.m, __gnuplot_drawnow__.m, __plt_get_axis_arg__.m, ancestor.m, cla.m, clf.m, close.m, colorbar.m, colstyle.m, comet3.m, contourc.m, figure.m, gca.m, gcbf.m, gcbo.m, gcf.m, ginput.m, graphics_toolkit.m, gtext.m, hggroup.m, hist.m, hold.m, isfigure.m, ishghandle.m, ishold.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, line.m, loglog.m, loglogerr.m, meshgrid.m, ndgrid.m, newplot.m, orient.m, patch.m, plot3.m, plotyy.m, __print_parse_opts__.m, quiver3.m, refreshdata.m, ribbon.m, semilogx.m, semilogxerr.m, semilogy.m, stem.m, stem3.m, subplot.m, title.m, uigetfile.m, view.m, whitebg.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, pchip.m, poly.m, polyaffine.m, polyder.m, polyfit.m, polygcd.m, polyint.m, polyout.m, polyval.m, polyvalm.m, ppder.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, intersect.m, ismember.m, powerset.m, setdiff.m, setxor.m, union.m, unique.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, fftconv.m, fftfilt.m, fftshift.m, freqz.m, hamming.m, hanning.m, ifftshift.m, sinc.m, sinetone.m, sinewave.m, unwrap.m, bicg.m, bicgstab.m, gmres.m, gplot.m, nonzeros.m, pcg.m, pcr.m, spaugment.m, spconvert.m, spdiags.m, speye.m, spfun.m, spones.m, sprand.m, sprandsym.m, spstats.m, spy.m, svds.m, treelayout.m, bessel.m, beta.m, betaln.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m, nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, rosser.m, vander.m, __finish__.m, center.m, cloglog.m, corr.m, cov.m, gls.m, histc.m, iqr.m, kendall.m, kurtosis.m, logit.m, mahalanobis.m, mean.m, meansq.m, median.m, mode.m, moment.m, ols.m, ppplot.m, prctile.m, probit.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m, skewness.m, spearman.m, statistics.m, std.m, table.m, var.m, zscore.m, betacdf.m, betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m, cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m, chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m, fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m, geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m, kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m, laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m, logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m, nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m, poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m, stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m, unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m, wblinv.m, wblpdf.m, wblrnd.m, kolmogorov_smirnov_test.m, kruskal_wallis_test.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, findstr.m, hex2dec.m, index.m, isletter.m, mat2str.m, rindex.m, str2num.m, strcat.m, strjust.m, strmatch.m, strsplit.m, strtok.m, strtrim.m, strtrunc.m, substr.m, validatestring.m, demo.m, example.m, fail.m, speed.m, addtodate.m, asctime.m, clock.m, ctime.m, date.m, datenum.m, datetick.m, datevec.m, eomday.m, etime.m, is_leap_year.m, now.m: Use Octave coding conventions in all m-file %!test blocks
author Rik <octave@nomad.inbox5.com>
date Mon, 13 Feb 2012 07:29:44 -0800
parents 72c96de7a403
children b76f0740940e
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: 12973
diff changeset
1 ## Copyright (C) 2001-2012 Paul Kienzle
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
2 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
4 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
9 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
14 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
18
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
9724
f22bbc5d56e9 Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents: 9153
diff changeset
20 ## @deftypefn {Command} {} edit @var{name}
f22bbc5d56e9 Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents: 9153
diff changeset
21 ## @deftypefnx {Command} {} edit @var{field} @var{value}
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7540
diff changeset
22 ## @deftypefnx {Command} {@var{value} =} edit get @var{field}
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
23 ## Edit the named function, or change editor settings.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
24 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
25 ## If @code{edit} is called with the name of a file or function as
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
26 ## its argument it will be opened in a text editor.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
27 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
28 ## @itemize @bullet
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
29 ## @item
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
30 ## If the function @var{name} is available in a file on your path and
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
31 ## that file is modifiable, then it will be edited in place. If it
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
32 ## is a system function, then it will first be copied to the directory
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
33 ## @env{HOME} (see further down) and then edited.
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
34 ## If no file is found, then the m-file
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
35 ## variant, ending with ".m", will be considered. If still no file
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
36 ## is found, then variants with a leading "@@" and then with both a
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
37 ## leading "@@" and trailing ".m" will be considered.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
38 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
39 ## @item
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
40 ## If @var{name} is the name of a function defined in the interpreter but
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
41 ## not in an m-file, then an m-file will be created in @env{HOME}
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
42 ## to contain that function along with its current definition.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
43 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
44 ## @item
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
45 ## If @code{name.cc} is specified, then it will search for @code{name.cc}
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
46 ## in the path and try to modify it, otherwise it will create a new
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
47 ## @file{.cc} file in @env{HOME}. If @var{name} happens to be an
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
48 ## m-file or interpreter defined function, then the text of that
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
49 ## function will be inserted into the .cc file as a comment.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
50 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
51 ## @item
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
52 ## If @var{name.ext} is on your path then it will be edited, otherwise
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
53 ## the editor will be started with @file{HOME/name.ext} as the
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
54 ## filename. If @file{name.ext} is not modifiable, it will be copied to
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10635
diff changeset
55 ## @env{HOME} before editing.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
56 ##
12973
b80b18f537ca doc: Correct various Texinfo warnings about incorrect use of macros.
Rik <octave@nomad.inbox5.com>
parents: 12632
diff changeset
57 ## @strong{Warning:} You may need to clear name before the new definition
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
58 ## is available. If you are editing a .cc file, you will need
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
59 ## to mkoctfile @file{name.cc} before the definition will be available.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
60 ## @end itemize
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
61 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
62 ## If @code{edit} is called with @var{field} and @var{value} variables,
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
63 ## the value of the control field @var{field} will be @var{value}.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
64 ## If an output argument is requested and the first argument is @code{get}
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
65 ## then @code{edit} will return the value of the control field @var{field}.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
66 ## If the control field does not exist, edit will return a structure
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
67 ## containing all fields and values. Thus, @code{edit get all} returns
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
68 ## a complete control structure.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
69 ## The following control fields are used:
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
70 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
71 ## @table @samp
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
72 ## @item editor
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
73 ## This is the editor to use to modify the functions. By default it uses
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
74 ## Octave's @env{EDITOR} built-in function, which comes from
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
75 ## @code{getenv("EDITOR")} and defaults to @code{emacs}. Use @code{%s}
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
76 ## In place of the function name. For example,
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
77 ## @table @samp
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
78 ## @item [EDITOR, " %s"]
12632
2dbac27e0e40 doc: miscellaneous touch-ups to documentation strings
Rik <octave@nomad.inbox5.com>
parents: 12207
diff changeset
79 ## Use the editor which Octave uses for @code{edit_history}.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
80 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
81 ## @item "xedit %s &"
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
82 ## pop up simple X11 editor in a separate window
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
83 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
84 ## @item "gnudoit -q \"(find-file \\\"%s\\\")\""
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
85 ## Send it to current Emacs; must have @code{(gnuserv-start)} in @file{.emacs}.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
86 ## @end table
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
87 ##
8795
bb38a86efa1b improve documentation for edit.m
Ivan Sutoris <ivan.sutoris@gmail.com>
parents: 8746
diff changeset
88 ## See also field 'mode', which controls how the editor is run by Octave.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
89 ##
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
90 ## On Cygwin, you will need to convert the Cygwin path to a Windows
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
91 ## path if you are using a native Windows editor. For example:
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
92 ## @c Set example in small font to prevent overfull line in TeX
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
93 ##
9153
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9038
diff changeset
94 ## @smallexample
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
95 ## @exdent '"C:/Program Files/Good Editor/Editor.exe" "$(cygpath -wa %s)"'
9153
5247e89688e1 Eliminate most overfull errors when running texi2pdf for generating pdf documentation
Rik <rdrider0-list@yahoo.com>
parents: 9038
diff changeset
96 ## @end smallexample
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
97 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
98 ## @item home
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
99 ## This is the location of user local m-files. Be be sure it is in your
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
100 ## path. The default is @file{~/octave}.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
101 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
102 ## @item author
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
103 ## This is the name to put after the "## Author:" field of new functions.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
104 ## By default it guesses from the @code{gecos} field of password database.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
105 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
106 ## @item email
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
107 ## This is the e-mail address to list after the name in the author field.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
108 ## By default it guesses @code{<$LOGNAME@@$HOSTNAME>}, and if @code{$HOSTNAME}
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
109 ## is not defined it uses @code{uname -n}. You probably want to override this.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
110 ## Be sure to use @code{<user@@host>} as your format.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
111 ##
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
112 ## @item license
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
113 ## @table @samp
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
114 ## @item gpl
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
115 ## GNU General Public License (default).
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
116 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
117 ## @item bsd
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
118 ## BSD-style license without advertising clause.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
119 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
120 ## @item pd
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
121 ## Public domain.
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
122 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
123 ## @item "text"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
124 ## Your own default copyright and license.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
125 ## @end table
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
126 ##
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
127 ## Unless you specify @samp{pd}, edit will prepend the copyright statement
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
128 ## with "Copyright (C) yyyy Function Author".
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
129 ##
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
130 ## @item mode
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
131 ## This value determines whether the editor should be started in async mode
8795
bb38a86efa1b improve documentation for edit.m
Ivan Sutoris <ivan.sutoris@gmail.com>
parents: 8746
diff changeset
132 ## (editor is started in the background and Octave continues) or sync mode
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
133 ## (Octave waits until the editor exits). Set it to "async" to start the editor
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
134 ## in async mode. The default is "sync" (see also "system").
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
135 ##
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
136 ## @item editinplace
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
137 ## Determines whether files should be edited in place, without regard to
9038
fca0dc2fb042 Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
138 ## whether they are modifiable or not. The default is @code{false}.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
139 ## @end table
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
140 ## @end deftypefn
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
141
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
142 ## Author: Paul Kienzle <pkienzle@users.sf.net>
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
143
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
144 ## Original version by Paul Kienzle distributed as free software in the
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
145 ## public domain.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
146
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
147 function ret = edit (file, state)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
148
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
149 ## Pick up globals or default them.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
150
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
151 persistent FUNCTION = struct ("EDITOR", cstrcat (EDITOR (), " %s"),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
152 "HOME", fullfile (default_home, "octave"),
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
153 "AUTHOR", default_user(1),
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
154 "EMAIL", [],
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
155 "LICENSE", "GPL",
12207
c37f167a816a edit.m: As most editors open their own window, change mode to "async".
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
156 "MODE", "async",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
157 "EDITINPLACE", false);
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7650
diff changeset
158 ## Make sure the state variables survive "clear functions".
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7650
diff changeset
159 mlock;
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
160
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
161 if (nargin == 2)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
162 switch (toupper (file))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
163 case "EDITOR"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
164 FUNCTION.EDITOR = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
165 case "HOME"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
166 if (! isempty (state) && state(1) == "~")
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
167 state = [ default_home, state(2:end) ];
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
168 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
169 FUNCTION.HOME = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
170 case "AUTHOR"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
171 FUNCTION.AUTHOR = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
172 case "EMAIL"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
173 FUNCTION.EMAIL = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
174 case "LICENSE"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
175 FUNCTION.LICENSE = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
176 case "MODE"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
177 if (strcmp (state, "sync") || strcmp (state, "async"))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
178 FUNCTION.MODE = state;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
179 else
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
180 error('edit: expected "edit MODE sync|async"');
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
181 endif
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
182 case "EDITINPLACE"
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
183 if (ischar (state))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
184 if (strcmpi (state, "true"))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
185 state = true;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
186 elseif (strcmpi (state, "false"))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
187 state = false;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
188 else
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
189 state = eval (state);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
190 endif
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
191 endif
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
192 FUNCTION.EDITINPLACE = state;
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
193 case "GET"
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
194 if (isfield (FUNCTION, toupper(state)))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
195 ret = FUNCTION.(toupper (state));
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
196 else
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
197 ret = FUNCTION;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
198 endif
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
199 otherwise
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
200 error ('edit: expected "edit EDITOR|HOME|AUTHOR|EMAIL|LICENSE|MODE val"');
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
201 endswitch
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
202 return
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
203 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
204
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
205 ## Start the editor without a file if no file is given.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
206 if (nargin < 1)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
207 if (exist (FUNCTION.HOME, "dir") == 7 && (isunix () || ! ispc ()))
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
208 system (cstrcat ("cd \"", FUNCTION.HOME, "\" ; ",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
209 sprintf (FUNCTION.EDITOR, "")),
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
210 [], FUNCTION.MODE);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
211 else
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
212 system (sprintf (FUNCTION.EDITOR,""), [], FUNCTION.MODE);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
213 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
214 return;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
215 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
216
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
217 ## Check whether the user is trying to edit a builtin of compiled function.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
218 switch (exist (file))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
219 case {3, 5}
10635
d1978e7364ad Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
220 error ("edit: unable to edit a built-in or compiled function");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
221 endswitch
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
222
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
223 ## Checks for whether the file is
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
224 ## absolute or relative should be handled inside file_in_loadpath.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
225 ## That way, it will be possible to look up files correctly given
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
226 ## partial path information. For example, you should be able to
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
227 ## edit a particular overloaded function by doing any one of
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
228 ##
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
229 ## edit classname/foo
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
230 ## edit classname/foo.m
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
231 ## edit @classname/foo
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
232 ## edit @classname/foo.m
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
233 ##
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
234 ## This functionality is needed for other functions as well (at least
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
235 ## help and type; there may be more). So the place to fix that is in
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
236 ## file_in_loadpath, possibly with some help from the load_path class.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
237
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
238 ## The code below includes a portion that serves as a place-holder for
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
239 ## the changes suggested above.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
240
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
241 ## Create list of explicit and implicit file names.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
242 filelist = {file};
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
243 ## If file has no extension, add file.m and file.cc to the list.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
244 idx = rindex (file, ".");
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
245 if (idx == 0)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
246 ## Create the list of files to look for
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
247 filelist = {file};
11032
c9b0a75b02e8 Make all regexp in Octave compatible with both POSIX and PCRE.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
248 if (isempty (regexp (file, '\.m$')))
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
249 ## No ".m" at the end of the file, add to the list.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
250 filelist{end+1} = cat (2, file, ".m");
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
251 endif
11032
c9b0a75b02e8 Make all regexp in Octave compatible with both POSIX and PCRE.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
252 if (isempty (regexp (file, '\.cc$')))
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
253 ## No ".cc" at the end of the file, add to the list.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
254 filelist{end+1} = cat (2, file, ".cc");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
255 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
256 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
257
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
258 ## If the file includes a path, it may be an overloaded function.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
259 if (! strcmp (file, "@") && index (file, filesep))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
260 ## No "@" at the beginning of the file, add to the list.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
261 numfiles = numel(filelist);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
262 for n = 1:numfiles
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
263 filelist{n+numfiles} = cat (2, "@", filelist{n});
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
264 endfor
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
265 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
266
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
267 ## Search the entire path for the 1st instance of a file in the list.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
268 fileandpath = "";
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
269 for n = 1:numel(filelist)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
270 filetoedit = file_in_path (path, filelist{n});
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
271 if (! isempty (filetoedit))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
272 ## The path is explicitly included.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
273 fileandpath = filetoedit;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
274 break;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
275 endif
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
276 endfor
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
277
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
278 if (! isempty (fileandpath))
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
279 ## If the file exists, then edit it.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
280 if (FUNCTION.EDITINPLACE)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
281 ## Edit in place even if it is protected.
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
282 system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
283 [], FUNCTION.MODE);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
284 return;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
285 else
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
286 ## If the file is modifiable in place then edit it, otherwise make
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
287 ## a copy in HOME and then edit it.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
288 fid = fopen (fileandpath, "r+t");
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
289 if (fid < 0)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
290 from = fileandpath;
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
291 fileandpath = cstrcat (FUNCTION.HOME, from (rindex (from, filesep):end));
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
292 [status, msg] = copyfile (from, fileandpath, 1);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
293 if (status == 0)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
294 error (msg);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
295 endif
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
296 else
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
297 fclose (fid);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
298 endif
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
299 system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
300 [], FUNCTION.MODE);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
301 return;
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
302 endif
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
303 endif
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
304
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
305 ## If editing a new file that is neither a m-file or an oct-file,
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
306 ## just edit it.
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
307 fileandpath = file;
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
308 idx = rindex (file, ".");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
309 name = file(1:idx-1);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
310 ext = file(idx+1:end);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
311 switch (ext)
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
312 case {"cc", "m"}
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
313 0;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
314 otherwise
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
315 system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
316 [], FUNCTION.MODE);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
317 return;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
318 endswitch
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
319
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
320 ## The file doesn't exist in path so create it, put in the function
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
321 ## template and edit it.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
322
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
323 ## Guess the email name if it was not given.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
324 if (isempty (FUNCTION.EMAIL))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
325 host = getenv("HOSTNAME");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
326 if (isempty (host) && ispc ())
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
327 host = getenv ("COMPUTERNAME");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
328 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
329 if (isempty (host))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
330 [status, host] = system ("uname -n");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
331 ## trim newline from end of hostname
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
332 if (! isempty (host))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
333 host = host(1:end-1);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
334 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
335 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
336 if (isempty (host))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
337 FUNCTION.EMAIL = " ";
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
338 else
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
339 FUNCTION.EMAIL = cstrcat ("<", default_user(0), "@", host, ">");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
340 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
341 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
342
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
343 ## Fill in the revision string.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
344 now = localtime (time);
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
345 revs = cstrcat ("Created: ", strftime ("%Y-%m-%d", now));
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
346
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
347 ## Fill in the copyright string.
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
348 copyright = cstrcat (strftime ("Copyright (C) %Y ", now), FUNCTION.AUTHOR);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
349
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
350 ## Fill in the author tag field.
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
351 author = cstrcat ("Author: ", FUNCTION.AUTHOR, " ", FUNCTION.EMAIL);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
352
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
353 ## Fill in the header.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
354 uclicense = toupper (FUNCTION.LICENSE);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
355 switch (uclicense)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
356 case "GPL"
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
357 head = cstrcat (copyright, "\n\n", "\
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
358 This program is free software; you can redistribute it and/or modify\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
359 it under the terms of the GNU General Public License as published by\n\
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
360 the Free Software Foundation; either version 3 of the License, or\n\
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
361 (at your option) any later version.\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
362 \n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
363 This program is distributed in the hope that it will be useful,\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
364 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
365 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
366 GNU General Public License for more details.\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
367 \n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
368 You should have received a copy of the GNU General Public License\n\
7444
1e1e2608da7b [project @ 2008-02-04 07:40:55 by jwe]
jwe
parents: 7434
diff changeset
369 along with Octave; see the file COPYING. If not, see\n\
1e1e2608da7b [project @ 2008-02-04 07:40:55 by jwe]
jwe
parents: 7434
diff changeset
370 <http://www.gnu.org/licenses/>.\
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
371 ");
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
372 tail = cstrcat (author, "\n", revs);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
373
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
374 case "BSD"
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
375 head = cstrcat (copyright, "\n\n", "\
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
376 This program is free software; redistribution and use in source and\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
377 binary forms, with or without modification, are permitted provided that\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
378 the following conditions are met:\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
379 \n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
380 1.Redistributions of source code must retain the above copyright\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
381 notice, this list of conditions and the following disclaimer.\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
382 2.Redistributions in binary form must reproduce the above copyright\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
383 notice, this list of conditions and the following disclaimer in the\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
384 documentation and/or other materials provided with the distribution.\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
385 \n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
386 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
387 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
388 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
389 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
390 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
391 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
392 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
393 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
394 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
395 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
396 SUCH DAMAGE.\
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
397 ");
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
398 tail = cstrcat (author, "\n", revs);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
399
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
400 case "PD"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
401 head = "";
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
402 tail = cstrcat (author, "\n", revs, "\n\n",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
403 "This program is granted to the public domain.");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
404
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
405 otherwise
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
406 head = "";
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
407 tail = cstrcat (copyright, "\n\n", FUNCTION.LICENSE, "\n",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
408 author, "\n", revs);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
409 endswitch
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
410
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
411 ## Generate the function template.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
412 exists = exist (name);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
413 switch (ext)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
414 case {"cc", "C", "cpp"}
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
415 if (isempty (head))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
416 comment = cstrcat ("/*\n", tail, "\n\n*/\n\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
417 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
418 comment = cstrcat ("/*\n", head, "\n\n", tail, "\n\n*/\n\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
419 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
420 ## If we are shadowing an m-file, paste the code for the m-file.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
421 if (any (exists == [2, 103]))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
422 code = cstrcat ("\\ ", strrep (type (name), "\n", "\n// "));
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
423 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
424 code = " ";
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
425 endif
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
426 body = cstrcat ("#include <octave/oct.h>\n\n",
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
427 "DEFUN_DLD(", name, ",args,nargout,\"\\\n",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
428 name, "\\n\\\n\")\n{\n",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
429 " octave_value_list retval;\n",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
430 " int nargin = args.length();\n\n",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
431 code, "\n return retval;\n}\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
432
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
433 text = cstrcat (comment, body);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
434 case "m"
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
435 ## If we are editing a function defined on the fly, paste the
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
436 ## code.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
437 if (any (exists == [2, 103]))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
438 body = type (name);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
439 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
440 body = cstrcat ("function [ ret ] = ", name, " ()\n\nendfunction\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
441 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
442 if (isempty (head))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
443 comment = cstrcat ("## ", name, "\n\n",
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
444 "## ", strrep (tail, "\n", "\n## "), "\n\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
445 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
446 comment = cstrcat ("## ", strrep(head,"\n","\n## "), "\n\n", ...
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
447 "## ", name, "\n\n", ...
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
448 "## ", strrep (tail, "\n", "\n## "), "\n\n");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
449 endif
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
450 text = cstrcat (comment, body);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
451 endswitch
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
452
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
453 ## Write the initial file (if there is anything to write)
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
454 fid = fopen (fileandpath, "wt");
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
455 if (fid < 0)
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
456 error ("edit: could not create %s", fileandpath);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
457 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
458 fputs (fid, text);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
459 fclose (fid);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
460
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
461 ## Finally we are ready to edit it!
7540
3422f39573b1 strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents: 7502
diff changeset
462 system (sprintf (FUNCTION.EDITOR, cstrcat ("\"", fileandpath, "\"")),
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9724
diff changeset
463 [], FUNCTION.MODE);
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
464
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
465 endfunction
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
466
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
467 function ret = default_home ()
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
468
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
469 ret = getenv ("HOME");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
470 if (isempty (ret))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
471 ret = glob ("~");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
472 if (! isempty (ret))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
473 ret = ret{1};
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
474 else
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
475 ret = "";
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
476 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
477 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
478
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
479 endfunction
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
480
7434
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
481 ## Return the name associated with the current user ID.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
482 ##
7434
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
483 ## If LONG_FORM is 1, return the full name. This will be the
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
484 ## default author. Otherwise return the login name.
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
485 ## login@host will be the default email address.
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
486
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
487 function ret = default_user (long_form)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
488
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
489 ent = getpwuid (getuid);
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
490 if (! isstruct (ent))
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
491 ret = getenv ("USER");
7330
55f35e469c43 [project @ 2007-12-20 17:53:36 by jwe]
jwe
parents: 7325
diff changeset
492 if (isempty (ret))
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
493 ret = getenv ("USERNAME");
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
494 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
495 elseif (long_form)
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
496 ret = ent.gecos;
7434
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
497 pos = strfind (ret, ",");
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
498 if (! isempty (pos))
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
499 ret = ret(1:pos-1);
600a3af7963e [project @ 2008-02-01 06:32:06 by jwe]
jwe
parents: 7340
diff changeset
500 endif
7325
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
501 else
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
502 ret = ent.name;
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
503 endif
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
504
67aef14de9c2 [project @ 2007-12-19 20:21:11 by jwe]
jwe
parents:
diff changeset
505 endfunction
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
506
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
507
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
508 %!test
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
509 %! s.editor = edit ("get", "editor");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
510 %! s.home = edit ("get", "home");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
511 %! s.author = edit ("get", "author");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
512 %! s.email = edit ("get", "email");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
513 %! s.license = edit ("get", "license");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
514 %! s.editinplace = edit ("get", "editinplace");
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
515 %! s.mode = edit ("get", "mode");
7502
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
516 %! edit editor none
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
517 %! edit home none
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
518 %! edit author none
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
519 %! edit email none
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
520 %! edit license none
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
521 %! edit ("editinplace", !s.editinplace)
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
522 %! if (s.mode(1) == "a")
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
523 %! edit mode sync
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
524 %! else
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
525 %! edit mode async
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
526 %! endif
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
527 %! edit ("editor", s.editor);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
528 %! edit ("home", s.home);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
529 %! edit ("author", s.author);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
530 %! edit ("email", s.email);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
531 %! edit ("license", s.license);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
532 %! edit ("editinplace", s.editinplace);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
533 %! edit ("mode", s.mode);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
534 %! assert (edit ("get", "editor"), s.editor);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
535 %! assert (edit ("get", "home"), s.home);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
536 %! assert (edit ("get", "author"), s.author);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
537 %! assert (edit ("get", "email"), s.email);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
538 %! assert (edit ("get", "license"), s.license);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
539 %! assert (edit ("get", "editinplace"), s.editinplace);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
540 %! assert (edit ("get", "mode"), s.mode);
2ce6b4258e96 Modified for consistency with Matlab. Modified to respect partial paths needed for overloaded functions.
Ben Abbott <bpabbott@mac.com>
parents: 7444
diff changeset
541