# HG changeset patch # User John W. Eaton # Date 1312391067 14400 # Node ID d6151d774283d5ea47ee48fc4bfab8d609ef4764 # Parent e77284b6dac6c36c9344eb38e3ee954e526daeff make completion work for command-line functions * help.cc (make_name_list): Include command-line functions in the list. * symtab.h (symbol_table::fcn_info::find_cmdline_function): New function. (symbol_table::cmdline_function_names): New function. diff -r e77284b6dac6 -r d6151d774283 src/help.cc --- a/src/help.cc Wed Aug 03 16:28:21 2011 +0200 +++ b/src/help.cc Wed Aug 03 13:04:27 2011 -0400 @@ -749,6 +749,9 @@ const string_vector bif = symbol_table::built_in_function_names (); const int bif_len = bif.length (); + const string_vector cfl = symbol_table::cmdline_function_names (); + const int cfl_len = cfl.length (); + const string_vector lcl = symbol_table::variable_names (); const int lcl_len = lcl.length (); @@ -758,7 +761,8 @@ const string_vector afl = autoloaded_functions (); const int afl_len = afl.length (); - const int total_len = key_len + bif_len + lcl_len + ffl_len + afl_len; + const int total_len + = key_len + bif_len + cfl_len + lcl_len + ffl_len + afl_len; string_vector list (total_len); @@ -772,6 +776,9 @@ for (i = 0; i < bif_len; i++) list[j++] = bif[i]; + for (i = 0; i < cfl_len; i++) + list[j++] = cfl[i]; + for (i = 0; i < lcl_len; i++) list[j++] = lcl[i]; diff -r e77284b6dac6 -r d6151d774283 src/symtab.h --- a/src/symtab.h Wed Aug 03 16:28:21 2011 +0200 +++ b/src/symtab.h Wed Aug 03 13:04:27 2011 -0400 @@ -790,6 +790,11 @@ return rep->built_in_function; } + octave_value find_cmdline_function (void) const + { + return rep->cmdline_function; + } + octave_value find_autoload (void) { return rep->find_autoload (); @@ -1787,6 +1792,25 @@ return retval; } + static std::list cmdline_function_names (void) + { + std::list retval; + + for (fcn_table_const_iterator p = fcn_table.begin (); + p != fcn_table.end (); p++) + { + octave_value fcn = p->second.find_cmdline_function (); + + if (fcn.is_defined ()) + retval.push_back (p->first); + } + + if (! retval.empty ()) + retval.sort (); + + return retval; + } + static bool is_local_variable (const std::string& name) { if (xcurrent_scope == xglobal_scope)