Mercurial > octave
changeset 22337:77c209d63b75
Update __list_functions__ internal function.
* help.cc (__list_functions__): Add a DOCSTRING. Declare variables only in the
scope they are required. Re-format comment lines.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 18 Aug 2016 06:47:32 -0700 |
parents | 47629df12b79 |
children | e318739b0edd |
files | libinterp/corefcn/help.cc |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc Thu Aug 18 13:16:31 2016 +0200 +++ b/libinterp/corefcn/help.cc Thu Aug 18 06:47:32 2016 -0700 @@ -864,26 +864,31 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{retval} =} __list_functions__ () @deftypefnx {} {@var{retval} =} __list_functions__ (@var{directory}) -Undocumented internal function. +Return a list of all functions (.m and .oct functions) in the load path. + +If the optional argument @var{directory} is given then list only the functions +in that directory. +@seealso{path} @end deftypefn */) { octave_value retval; - // Get list of functions - string_vector ffl = load_path::fcn_names (); - string_vector afl = autoloaded_functions (); + if (args.length () == 0) + { + // Get list of all functions + string_vector ffl = load_path::fcn_names (); + string_vector afl = autoloaded_functions (); - if (args.length () == 0) - retval = Cell (ffl.append (afl)); + retval = Cell (ffl.append (afl)); + } else { std::string dir = args(0).xstring_value ("__list_functions__: DIRECTORY argument must be a string"); string_vector fl = load_path::files (dir, true); - // Return a sorted list with unique entries (in case of - // .m and .oct versions of the same function in a given - // directory, for example). + // Return a sorted list with unique entries (in case of .m and .oct + // versions of the same function in a given directory, for example). fl.sort (true); retval = Cell (fl);