annotate scripts/help/gen_doc_cache.m @ 16403:1de4ec2a856d

Matlab compatibility for strsplit() * scripts/strings/strsplit.m: Matlab compatible version. * NEWS: Mention break in backward compatibility. * scripts/deprecated/javafields.m: Modify call to strsplit(). * scripts/deprecated/javamethods.m: ditto * scripts/general/fieldnames.m: ditto * scripts/general/int2str.m: ditto * scripts/general/methods.m: ditto * scripts/general/num2str.m: ditto * scripts/help/gen_doc_cache.m: ditto * scripts/help/help.m: ditto * scripts/help/lookfor.m: ditto * scripts/io/strread.m: ditto * scripts/java/javaclasspath.m: ditto * scripts/miscellaneous/compare_versions.m: ditto * scripts/miscellaneous/computer.m: ditto * scripts/miscellaneous/fact.m: ditto * scripts/miscellaneous/tar.m: ditto * scripts/miscellaneous/unpack.m: ditto * scripts/miscellaneous/what.m: ditto * scripts/miscellaneous/zip.m: ditto * scripts/pkg/private/configure_make.m: ditto * scripts/pkg/private/fix_depends.m: ditto * scripts/pkg/private/generate_lookfor_cache.m: ditto * scripts/pkg/private/list_forge_packages.m: ditto * scripts/pkg/private/unload_packages.m: ditto * scripts/pkg/private/write_index.m: ditto * scripts/plot/private/__file_filter__.m: ditto * scripts/plot/private/__fltk_file_filter__.m: ditto * scripts/plot/private/__go_draw_axes__.m: ditto * scripts/plot/private/__next_line_style__.m: ditto * scripts/strings/untabify.m: ditto * scripts/testfun/rundemos.m: ditto * scripts/testfun/runtests.m: ditto
author Ben Abbott <bpabbott@mac.com>
date Sun, 31 Mar 2013 19:19:04 -0400
parents 86854d032a37
children b7667fcb9fbc
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: 13067
diff changeset
1 ## Copyright (C) 2009-2012 S�ren Hauberg
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
2 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
3 ## This file is part of Octave.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
4 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
8 ## your option) any later version.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
9 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
13 ## General Public License for more details.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
14 ##
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
18
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
19 ## -*- texinfo -*-
11472
1740012184f9 Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents: 11104
diff changeset
20 ## @deftypefn {Function File} {} gen_doc_cache (@var{out_file}, @var{directory})
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
21 ## Generate documentation caches for all functions in a given directory.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
22 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
23 ## A documentation cache is generated for all functions in @var{directory}.
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 9051
diff changeset
24 ## The
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
25 ## resulting cache is saved in the file @var{out_file}.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
26 ## The cache is used to speed up @code{lookfor}.
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
27 ##
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
28 ## If no directory is given (or it is the empty matrix), a cache for builtin
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
29 ## operators, etc. is generated.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
30 ##
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
31 ## @seealso{lookfor, path}
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
32 ## @end deftypefn
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
33
8940
6994961bf1f4 use doc-cache instead of DOC for doc cache file name
John W. Eaton <jwe@octave.org>
parents: 8863
diff changeset
34 function gen_doc_cache (out_file = "doc-cache", directory = [])
13067
875577a19d70 codesprint: Add 1 input validation test for gen_doc_cache()
Rik <octave@nomad.inbox5.com>
parents: 11588
diff changeset
35
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
36 ## Check input
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
37 if (! ischar (out_file))
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
38 print_usage ();
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
39 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
40
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
41 ## Generate cache
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
42 if (isempty (directory))
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
43 cache = gen_builtin_cache ();
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
44 elseif (iscell (directory))
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
45 if (all (cellfun (@ischar, directory)))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
46 cache = gen_doc_cache_in_dir (directory);
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
47 else
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
48 error ("gen_doc_cache: cell must contain only strings");
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
49 endif
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
50 elseif (ischar (directory))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
51 cache = gen_doc_cache_in_dir (directory);
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
52 else
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
53 error ("gen_doc_cache: second input argument must be a string or a cell of strings");
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
54 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
55
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
56 ## Save cache
8863
34a821854961 pkg.m (generate_lookfor_cache): generate a DOC file for each directory
Jason Riedy <jason@acm.org>
parents: 8861
diff changeset
57 if (! isempty (cache))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
58 save ("-text", out_file, "cache");
8863
34a821854961 pkg.m (generate_lookfor_cache): generate a DOC file for each directory
Jason Riedy <jason@acm.org>
parents: 8861
diff changeset
59 endif
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
60
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
61 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
62
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
63 function [text, first_sentence, status] = handle_function (f, text, format)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
64 first_sentence = "";
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
65 ## Skip functions that start with __ as these shouldn't be searched by lookfor
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
66 if (length (f) > 2 && all (f (1:2) == "_"))
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
67 status = 1;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
68 return;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
69 endif
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
70
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
71 ## Take action depending on help text format
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
72 switch (lower (format))
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
73 case "plain text"
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
74 status = 0;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
75 case "texinfo"
8860
257ed585b471 gen_doc_cache.m: call __makeinfo__, not makeinfo
Jason Riedy <jason@acm.org>
parents: 8729
diff changeset
76 [text, status] = __makeinfo__ (text, "plain text");
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
77 case "html"
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
78 [text, status] = strip_html_tags (text);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
79 otherwise
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
80 status = 1;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
81 endswitch
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
82
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
83 ## Did we get the help text?
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
84 if (status != 0 || isempty (text))
11588
d5bd2766c640 style fixes for warning and error messages in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
85 warning ("gen_doc_cache: unusable help text found in file '%s'", f);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
86 return;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
87 endif
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
88
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
89 ## Get first sentence of help text
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
90 first_sentence = get_first_help_sentence (f);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
91 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
92
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
93 function cache = create_cache (list)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
94 cache = {};
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
95
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
96 ## For each function:
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
97 for n = 1:length (list)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
98 f = list {n};
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
99
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
100 ## Get help text
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
101 [text, format] = get_help_text (f);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
102
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
103 [text, first_sentence, status] = handle_function (f, text, format);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
104
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
105 ## Did we get the help text?
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
106 if (status != 0)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
107 continue;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
108 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
109
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
110 ## Store the help text
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
111 cache (1, end+1) = f;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
112 cache (2, end) = text;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
113 cache (3, end) = first_sentence;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
114 endfor
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
115 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
116
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
117 function cache = gen_doc_cache_in_dir (directory)
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
118
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
119 ## If 'directory' is not in the current path, add it so we search it
16403
1de4ec2a856d Matlab compatibility for strsplit()
Ben Abbott <bpabbott@mac.com>
parents: 14552
diff changeset
120 dir_in_path = ismember (directory, strsplit (path (), pathsep (), false));
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
121
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
122 # dirs not in path
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
123 if (! iscell (directory))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
124 directory = {directory};
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
125 endif
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
126 dirs_notpath = {directory{!dir_in_path}};
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
127
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
128 # add them
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
129 if (! isempty (dirs_notpath))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
130 cellfun (@addpath, dirs_notpath);
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
131 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
132
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
133 # create cache
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
134 func = @(s_) create_cache (__list_functions__ (s_));
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
135 cache = cellfun (func, directory, 'UniformOutput', false);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
136
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
137 # concatenate results
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
138 cache = [cache{:}];
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
139
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
140 #remove dirs form path
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
141 if (! isempty (dirs_notpath))
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
142 cellfun (@rmpath, dirs_notpath);
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14486
diff changeset
143 endif
14486
6bed5141fdad Let gen_doc_cache_in_dir accept multiple directories as input.
Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
parents: 14138
diff changeset
144
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
145 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
146
8729
d65a0a1780b6 Simplify documentation cache generation to only handle one directory per call to 'gen_doc_cache'
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
147 function cache = gen_builtin_cache ()
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
148 operators = __operators__ ();
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
149 keywords = __keywords__ ();
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
150 builtins = __builtins__ ();
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
151 list = {operators{:}, keywords{:}, builtins{:}};
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
152
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
153 cache = create_cache (list);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
154 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
155
13067
875577a19d70 codesprint: Add 1 input validation test for gen_doc_cache()
Rik <octave@nomad.inbox5.com>
parents: 11588
diff changeset
156
875577a19d70 codesprint: Add 1 input validation test for gen_doc_cache()
Rik <octave@nomad.inbox5.com>
parents: 11588
diff changeset
157 %% No true tests desirable for this function.
875577a19d70 codesprint: Add 1 input validation test for gen_doc_cache()
Rik <octave@nomad.inbox5.com>
parents: 11588
diff changeset
158 %% Test input validation
875577a19d70 codesprint: Add 1 input validation test for gen_doc_cache()
Rik <octave@nomad.inbox5.com>
parents: 11588
diff changeset
159 %!error gen_doc_cache (1)