Mercurial > hg > octave-nkf
annotate scripts/miscellaneous/recycle.m @ 15144:9cc337ced51a
build: Update OCTAVE_UMFPACK_SEPARATE_SPLIT macro to look for SuiteSparse header file.
* acinclude.m4: Update OCTAVE_UMFPACK_SEPARATE_SPLIT macro to look for
SuiteSparse header file.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 10 Aug 2012 12:56:15 -0700 |
parents | f3d52523cde1 |
children | 049e8bbff782 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13929
diff
changeset
|
1 ## Copyright (C) 2012 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 -*- |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {@var{current_state}} recycle () |
13929
9cae456085c2
Grammarcheck of documentation before 3.6.0 release.
Rik <octave@nomad.inbox5.com>
parents:
13918
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 ## |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 ## Recycling files instead of permanently deleting them is currently not |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 ## implemented in Octave. To help avoid accidental data loss it |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 ## is an error to attempt enable file recycling. |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 ## @seealso{delete} |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 ## @end deftypefn |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 ## Author: jwe |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 function retval = recycle (state) |
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 persistent current_state = "off"; |
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 if (nargin > 1) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 print_usage (); |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 endif |
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 == 0 || nargout > 0) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 retval = current_state; |
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 == 1) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 if (ischar (state)) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 if (strcmpi (state, "on")) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 error ("recycle: recycling files is not implemented"); |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 elseif (strcmpi (state, "off")) |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 current_state = "off"; |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 else |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 error ("recycle: invalid value of STATE = `%s'", state); |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 endif |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 else |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
54 error ("recycle: STATE must be a character string"); |
13840
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 endif |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 endif |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 endfunction |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 %!test |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 %! recycle ("off"); |
69afe121f07e
provide parial implementation of the recycle function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 %! 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
|
64 |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
65 %!error <recycling files is not implemented> recycle ("on") |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
66 %!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
|
67 %!error <STATE must be a character string> recycle (1) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
68 |