# HG changeset patch # User Jason Riedy # Date 1235540500 18000 # Node ID 34a8218549610c6adb5e1ddeddd3f24d6f5b5b94 # Parent f71b749be1c1fc7efe49baf92772478abb268802 pkg.m (generate_lookfor_cache): generate a DOC file for each directory diff -r f71b749be1c1 -r 34a821854961 scripts/ChangeLog --- a/scripts/ChangeLog Wed Feb 25 00:39:09 2009 -0500 +++ b/scripts/ChangeLog Wed Feb 25 00:41:40 2009 -0500 @@ -1,11 +1,15 @@ 2009-02-24 John W. Eaton * help/gen_doc_cache.m: Don't compress output file. By default, - write to DOC, not DOC.gz. + write to DOC, not DOC.gz. Don't save empty cache. + * help/lookfor.m: Use doc_cache_file to get location of DOC file. 2009-02-24 Jason Riedy + * pkg/pkg.m (generate_lookfor_cache): Generate a DOC file for each + directory. + * help/gen_doc_cache.m: Call __makeinfo__, not makeinfo. 2009-02-24 Jaroslav Hajek diff -r f71b749be1c1 -r 34a821854961 scripts/help/gen_doc_cache.m --- a/scripts/help/gen_doc_cache.m Wed Feb 25 00:39:09 2009 -0500 +++ b/scripts/help/gen_doc_cache.m Wed Feb 25 00:41:40 2009 -0500 @@ -44,7 +44,9 @@ endif ## Save cache - save ("-text", out_file, "cache"); + if (! isempty (cache)) + save ("-text", out_file, "cache"); + endif endfunction function [text, first_sentence, status] = handle_function (f, text, format) diff -r f71b749be1c1 -r 34a821854961 scripts/pkg/pkg.m --- a/scripts/pkg/pkg.m Wed Feb 25 00:39:09 2009 -0500 +++ b/scripts/pkg/pkg.m Wed Feb 25 00:41:40 2009 -0500 @@ -1585,7 +1585,10 @@ endfunction function generate_lookfor_cache (desc) - gen_doc_cache (genpath (desc.dir)); + dirs = split_by (genpath (desc.dir), pathsep ()); + for i = 1 : length (dirs) + gen_doc_cache (fullfile (dirs{i}, "DOC"), dirs{i}); + endfor endfunction ## Make sure the package contains the essential files. diff -r f71b749be1c1 -r 34a821854961 src/ChangeLog --- a/src/ChangeLog Wed Feb 25 00:39:09 2009 -0500 +++ b/src/ChangeLog Wed Feb 25 00:41:40 2009 -0500 @@ -1,10 +1,10 @@ 2009-02-25 John W. Eaton + * help.cc (__list_functions__): Simplify + * input.cc (get_debug_input): Don't pass arbitrary input to message as a format string. - * help.cc (__list_functions__): Simplify - 2009-02-24 John W. Eaton * help.cc, help.h (Vdoc_cache_file): New global variable. diff -r f71b749be1c1 -r 34a821854961 src/help.cc --- a/src/help.cc Wed Feb 25 00:39:09 2009 -0500 +++ b/src/help.cc Wed Feb 25 00:41:40 2009 -0500 @@ -935,60 +935,27 @@ Undocumented internal function.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; // Get list of functions - const string_vector ffl = load_path::fcn_names (); - const int ffl_len = ffl.length (); - const string_vector afl = autoloaded_functions (); - const int afl_len = afl.length (); + string_vector ffl = load_path::fcn_names (); + string_vector afl = autoloaded_functions (); if (args.length () == 0) - { - Cell C (ffl_len + afl_len, 1); - int j = 0; - for (int i = 0; i < ffl_len; i++) - C (j++, 0) = octave_value (ffl [i]); - for (int i = 0; i < afl_len; i++) - C (j++, 0) = octave_value (afl [i]); - - retval.append (octave_value (C)); - } + retval = Cell (ffl.append (afl)); else { - // Get input std::string dir = args (0).string_value (); - if (error_state) - error ("__list_functions__: input must be a string"); + + if (! error_state) + { + string_vector fl = load_path::files (dir); + + if (! error_state) + retval = Cell (fl); + } else - { - dir = file_ops::canonicalize_file_name (dir); - - // FIXME -- This seems very inefficient. Is there a better way? - std::list list; - for (int i = 0; i < ffl_len; i++) - { - const std::string filename = do_which (ffl [i]); - if (file_is_in_dir (filename, dir)) - list.push_back (ffl [i]); - } - for (int i = 0; i < afl_len; i++) - { - const std::string filename = do_which (afl [i]); - if (file_is_in_dir (filename, dir)) - list.push_back (afl [i]); - } - - Cell C (list.size (), 1); - int j = 0; - for (std::list::const_iterator iter = list.begin (); - iter != list.end (); iter++) - { - C (j++, 0) = octave_value (*iter); - } - - retval.append (octave_value (C)); - } + error ("__list_functions__: input must be a string"); } return retval;