# HG changeset patch # User Rik # Date 1471528052 25200 # Node ID 77c209d63b75f5fc8bf012fbc1d5c80482d45f6a # Parent 47629df12b79ac06de65f2e03c57cda2455027e5 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. diff -r 47629df12b79 -r 77c209d63b75 libinterp/corefcn/help.cc --- 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);