annotate scripts/miscellaneous/recycle.m @ 20164:df437a52bcaf stable

doc: Update more docstrings to have one sentence summary as first line. Reviewed miscellaneous, sparse, strings in scripts directory. * scripts/miscellaneous/bzip2.m, scripts/miscellaneous/citation.m, scripts/miscellaneous/compare_versions.m, scripts/miscellaneous/computer.m, scripts/miscellaneous/debug.m, scripts/miscellaneous/dir.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/error_ids.m, scripts/miscellaneous/fileattrib.m, scripts/miscellaneous/fullfile.m, scripts/miscellaneous/genvarname.m, scripts/miscellaneous/gzip.m, scripts/miscellaneous/mkoctfile.m, scripts/miscellaneous/news.m, scripts/miscellaneous/open.m, scripts/miscellaneous/parseparams.m, scripts/miscellaneous/recycle.m, scripts/miscellaneous/run.m, scripts/miscellaneous/swapbytes.m, scripts/miscellaneous/tar.m, scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m, scripts/miscellaneous/what.m, scripts/sparse/bicg.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/colperm.m, scripts/sparse/eigs.m, scripts/sparse/etreeplot.m, scripts/sparse/gmres.m, scripts/sparse/gplot.m, scripts/sparse/ichol.m, scripts/sparse/ilu.m, scripts/sparse/pcg.m, scripts/sparse/pcr.m, scripts/sparse/qmr.m, scripts/sparse/spaugment.m, scripts/sparse/spconvert.m, scripts/sparse/spdiags.m, scripts/sparse/spfun.m, scripts/sparse/spones.m, scripts/sparse/sprandsym.m, scripts/sparse/spstats.m, scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/sparse/treelayout.m, scripts/sparse/treeplot.m, scripts/strings/base2dec.m, scripts/strings/bin2dec.m, scripts/strings/blanks.m, scripts/strings/cstrcat.m, scripts/strings/deblank.m, scripts/strings/dec2base.m, scripts/strings/dec2bin.m, scripts/strings/dec2hex.m, scripts/strings/findstr.m, scripts/strings/hex2dec.m, scripts/strings/index.m, scripts/strings/isletter.m, scripts/strings/isstrprop.m, scripts/strings/mat2str.m, scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m, scripts/strings/rindex.m, scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strchr.m, scripts/strings/strjoin.m, scripts/strings/strjust.m, scripts/strings/strmatch.m, scripts/strings/strsplit.m, scripts/strings/strtok.m, scripts/strings/strtrim.m, scripts/strings/strtrunc.m, scripts/strings/substr.m, scripts/strings/untabify.m, scripts/time/datenum.m: Update more docstrings to have one sentence summary as first line.
author Rik <rik@octave.org>
date Mon, 04 May 2015 14:22:02 -0700
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19597
diff changeset
1 ## Copyright (C) 2012-2015 John W. Eaton
13840
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 ## your option) any later version.
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ## General Public License for more details.
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
15776
169a47c5e254 recycle.m: Fix docstring.
Rik <rik@octave.org>
parents: 15467
diff changeset
20 ## @deftypefn {Function File} {@var{current_state} =} recycle ()
169a47c5e254 recycle.m: Fix docstring.
Rik <rik@octave.org>
parents: 15467
diff changeset
21 ## @deftypefnx {Function File} {@var{old_state} =} recycle (@var{new_state})
13918
043aead8ed89 Remove recycle from list of unimplemented functions
Rik <octave@nomad.inbox5.com>
parents: 13840
diff changeset
22 ## Query or set the preference for recycling deleted files.
13840
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 ##
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
24 ## When recycling is enabled, commands which would permanently erase files
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
25 ## instead move them to a temporary location (such as the directory labeled
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
26 ## Trash).
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
27 ##
19405
cbce5d1bcaf9 doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 19191
diff changeset
28 ## Programming Note: This function is provided for @sc{matlab} compatibility,
cbce5d1bcaf9 doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 19191
diff changeset
29 ## but recycling is not implemented in Octave. To help avoid accidental data
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## loss an error will be raised if an attempt is made to enable file recycling.
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
31 ## @seealso{delete, rmdir}
13840
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 ## @end deftypefn
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 ## Author: jwe
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 function retval = recycle (state)
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 persistent current_state = "off";
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 if (nargin > 1)
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 print_usage ();
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 endif
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 if (nargin == 0 || nargout > 0)
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 retval = current_state;
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 endif
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 if (nargin == 1)
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
49 if (! ischar (state))
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
50 error ("recycle: STATE must be a character string");
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
51 endif
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19405
diff changeset
52
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
53 if (strcmpi (state, "on"))
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
54 error ("recycle: recycling files is not implemented");
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
55 elseif (strcmpi (state, "off"))
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
56 current_state = "off";
13840
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 else
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
58 error ("recycle: invalid value of STATE = '%s'", state);
13840
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 endif
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 endif
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 endfunction
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 %!test
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 %! recycle ("off");
69afe121f07e provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 %! assert (recycle ("off"), "off");
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
68
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
69 %!error recycle ("on", "and I mean it")
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
70 %!error <STATE must be a character string> recycle (1)
19191
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
71 %!error <recycling files is not implemented> recycle ("on")
6cf253a39fde recycle.m: Overhaul function.
Rik <rik@octave.org>
parents: 17744
diff changeset
72 %!error <invalid value of STATE = 'foobar'> recycle ("foobar")
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
73