comparison scripts/help/doc_cache_create.m @ 21529:8d894e463de6

doc_cache_create.m: Tweak docstring, improve performance. * doc_cache_create.m: List explicitly what will be created if no directory is given. Improve performance by using strncmp. Correct typo in comment.
author Rik <rik@octave.org>
date Thu, 24 Mar 2016 15:23:51 -0700
parents 516bb87ea72e
children ffad2baa90f7
comparison
equal deleted inserted replaced
21528:ffbd3e86e0be 21529:8d894e463de6
28 ## 28 ##
29 ## The cache is saved in the file @var{out_file} which defaults to the value 29 ## The cache is saved in the file @var{out_file} which defaults to the value
30 ## @file{doc-cache} if not given. 30 ## @file{doc-cache} if not given.
31 ## 31 ##
32 ## If no directory is given (or it is the empty matrix), a cache for built-in 32 ## If no directory is given (or it is the empty matrix), a cache for built-in
33 ## operators, etc. is generated. 33 ## functions, operators, and keywords is generated.
34 ## 34 ##
35 ## @seealso{doc_cache_file, lookfor, path} 35 ## @seealso{doc_cache_file, lookfor, path}
36 ## @end deftypefn 36 ## @end deftypefn
37 37
38 function doc_cache_create (out_file = "doc-cache", directory = []) 38 function doc_cache_create (out_file = "doc-cache", directory = [])
65 65
66 endfunction 66 endfunction
67 67
68 function [text, first_sentence, status] = handle_function (f, text, format) 68 function [text, first_sentence, status] = handle_function (f, text, format)
69 first_sentence = ""; 69 first_sentence = "";
70 ## Skip functions that start with __ as these shouldn't be searched by lookfor 70 ## Skip internal functions starting with "__"
71 if (length (f) > 2 && all (f (1:2) == "_")) 71 if (strncmp (f, "__", 2))
72 status = 1; 72 status = 1;
73 return; 73 return;
74 endif 74 endif
75 75
76 ## Take action depending on help text format 76 ## Take action depending on help text format
140 cache = cellfun (func, directory, "UniformOutput", false); 140 cache = cellfun (func, directory, "UniformOutput", false);
141 141
142 ## concatenate results 142 ## concatenate results
143 cache = [cache{:}]; 143 cache = [cache{:}];
144 144
145 ## remove dirs form path 145 ## remove dirs from path
146 if (! isempty (dirs_notpath)) 146 if (! isempty (dirs_notpath))
147 rmpath (dirs_notpath{:}); 147 rmpath (dirs_notpath{:});
148 endif 148 endif
149 149
150 endfunction 150 endfunction