Mercurial > hg > octave-lyh
diff src/symtab.h @ 12911:d6151d774283
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.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 03 Aug 2011 13:04:27 -0400 (2011-08-03) |
parents | 3229572cbe23 |
children | 7dd7cccf0757 |
line wrap: on
line diff
--- a/src/symtab.h +++ b/src/symtab.h @@ -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<std::string> cmdline_function_names (void) + { + std::list<std::string> 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)