# HG changeset patch # User John W. Eaton # Date 1470123602 14400 # Node ID af0dca907fae8ff2cc2aa6e3bb5a770559859b48 # Parent f6181638f6c57aadb980c363316e902a9faadee1 get help text for operators and keywords from docstrings file * help.cc (map_type, pair_type, map_iter): Delete typedefs. (size, names, raw_help_from_map): Delete functions. (operators, keywords): Now simple list of strings. Store only name, not help text. (operators_map, keywords_map): Delete. (operator_names): New variable. (keyword_names): Simplify definition. (raw_help): Don't call raw_help_from_map to search for help text for operators or keywords. (F__operators__, F__keywords__): Simplify using operator_names and keyword_names. diff -r f6181638f6c5 -r af0dca907fae libinterp/corefcn/help.cc --- a/libinterp/corefcn/help.cc Tue Aug 02 03:10:51 2016 -0400 +++ b/libinterp/corefcn/help.cc Tue Aug 02 03:40:02 2016 -0400 @@ -92,710 +92,97 @@ // functions. static bool Vsuppress_verbose_help_message = false; -#include - -typedef std::map map_type; -typedef map_type::value_type pair_type; -typedef map_type::const_iterator map_iter; - -template -size_t -size (T const (&)[z]) -{ - return z; -} - -// FIXME: the doc strings for operators and keywords is currently -// duplicated in op-kw-docs. We should arrange for Octave to read the -// info from that file (or the generated DOCSTRINGS file) at startup -// instead and remove the data from this file. - -const static pair_type operators[] = +const static char * const operators[] = { - pair_type ("!", - "-*- texinfo -*-\n\ -@deftypefn {} {} !\n\ -Logical 'not' operator.\n\ -@seealso{~, not}\n\ -@end deftypefn"), - - pair_type ("~", - "-*- texinfo -*-\n\ -@deftypefn {} {} ~\n\ -Logical 'not' operator.\n\ -@seealso{!, not}\n\ -@end deftypefn"), - - pair_type ("!=", - "-*- texinfo -*-\n\ -@deftypefn {} {} !=\n\ -Logical 'not equals' operator.\n\ -@seealso{~=, ne}\n\ -@end deftypefn"), - - pair_type ("~=", - "-*- texinfo -*-\n\ -@deftypefn {} {} ~=\n\ -Logical 'not equals' operator.\n\ -@seealso{!=, ne}\n\ -@end deftypefn"), - - pair_type ("\"", - "-*- texinfo -*-\n\ -@deftypefn {} {} \"\n\ -String delimiter.\n\ -@end deftypefn"), - - pair_type ("#", - "-*- texinfo -*-\n\ -@deftypefn {} {} #\n\ -Begin comment character.\n\ -@seealso{%, #@\\{}\n\ -@end deftypefn"), - - pair_type ("%", - "-*- texinfo -*-\n\ -@deftypefn {} {} %\n\ -Begin comment character.\n\ -@seealso{#, %@\\{}\n\ -@end deftypefn"), - - pair_type ("#{", - "-*- texinfo -*-\n\ -@deftypefn {} {} #@{\n\ -Begin block comment. There must be nothing else, other than\n\ -whitespace, in the line both before and after @code{#@{}.\n\ -It is possible to nest block comments.\n\ -@seealso{%@\\{, #@\\}, #}\n\ -@end deftypefn"), - - pair_type ("%{", - "-*- texinfo -*-\n\ -@deftypefn {} {} %@{\n\ -Begin block comment. There must be nothing else, other than\n\ -whitespace, in the line both before and after @code{%@{}.\n\ -It is possible to nest block comments.\n\ -@seealso{#@\\{, %@\\}, %}\n\ -@end deftypefn"), - - pair_type ("#}", - "-*- texinfo -*-\n\ -@deftypefn {} {} #@}\n\ -Close block comment. There must be nothing else, other than\n\ -whitespace, in the line both before and after @code{#@}}.\n\ -It is possible to nest block comments.\n\ -@seealso{%@\\}, #@\\{, #}\n\ -@end deftypefn"), - - pair_type ("%}", - "-*- texinfo -*-\n\ -@deftypefn {} {} %@}\n\ -Close block comment. There must be nothing else, other than\n\ -whitespace, in the line both before and after @code{%@}}.\n\ -It is possible to nest block comments.\n\ -@seealso{#@\\}, %@\\{, %}\n\ -@end deftypefn"), - - pair_type ("...", - "-*- texinfo -*-\n\ -@deftypefn {} {} ...\n\ -Continuation marker. Joins current line with following line.\n\ -@end deftypefn"), - - pair_type ("&", - "-*- texinfo -*-\n\ -@deftypefn {} {} &\n\ -Element by element logical 'and' operator.\n\ -@seealso{&&, and}\n\ -@end deftypefn"), - - pair_type ("&&", - "-*- texinfo -*-\n\ -@deftypefn {} {} &&\n\ -Logical 'and' operator (with short-circuit evaluation).\n\ -@seealso{&, and}\n\ -@end deftypefn"), - - pair_type ("'", - "-*- texinfo -*-\n\ -@deftypefn {} {} '\n\ -Matrix transpose operator. For complex matrices, computes the\n\ -complex conjugate (Hermitian) transpose.\n\ -\n\ -The single quote character may also be used to delimit strings, but\n\ -it is better to use the double quote character, since that is never\n\ -ambiguous.\n\ -@seealso{.', transpose}\n\ -@end deftypefn"), - - pair_type ("(", - "-*- texinfo -*-\n\ -@deftypefn {} {} (\n\ -Array index or function argument delimiter.\n\ -@end deftypefn"), - - pair_type (")", - "-*- texinfo -*-\n\ -@deftypefn {} {})\n\ -Array index or function argument delimiter.\n\ -@end deftypefn"), - - pair_type ("*", - "-*- texinfo -*-\n\ -@deftypefn {} {} *\n\ -Multiplication operator.\n\ -@seealso{.*, times}\n\ -@end deftypefn"), - - pair_type ("**", - "-*- texinfo -*-\n\ -@deftypefn {} {} **\n\ -Power operator. This may return complex results for real inputs. Use\n\ -@code{realsqrt}, @code{cbrt}, @code{nthroot}, or @code{realroot} to obtain\n\ -real results when possible.\n\ -@seealso{power, ^, .**, .^, realpow, realsqrt, cbrt, nthroot}\n\ -@end deftypefn"), - - pair_type ("^", - "-*- texinfo -*-\n\ -@deftypefn {} {} ^\n\ -Power operator. This may return complex results for real inputs. Use\n\ -@code{realsqrt}, @code{cbrt}, @code{nthroot}, or @code{realroot} to obtain\n\ -real results when possible.\n\ -@seealso{power, **, .^, .**, realpow, realsqrt, cbrt, nthroot}\n\ -@end deftypefn"), - - pair_type ("+", - "-*- texinfo -*-\n\ -@deftypefn {} {} +\n\ -Addition operator.\n\ -@seealso{plus}\n\ -@end deftypefn"), - - pair_type ("++", - "-*- texinfo -*-\n\ -@deftypefn {} {} ++\n\ -Increment operator. As in C, may be applied as a prefix or postfix\n\ -operator.\n\ -@seealso{--}\n\ -@end deftypefn"), - - pair_type (",", - "-*- texinfo -*-\n\ -@deftypefn {} {} ,\n\ -Array index, function argument, or command separator.\n\ -@end deftypefn"), - - pair_type ("-", - "-*- texinfo -*-\n\ -@deftypefn {} {} -\n\ -Subtraction or unary negation operator.\n\ -@seealso{minus}\n\ -@end deftypefn"), - - pair_type ("--", - "-*- texinfo -*-\n\ -@deftypefn {} {} --\n\ -Decrement operator. As in C, may be applied as a prefix or postfix\n\ -operator.\n\ -@seealso{++}\n\ -@end deftypefn"), - - pair_type (".'", - "-*- texinfo -*-\n\ -@deftypefn {} {} .'\n\ -Matrix transpose operator. For complex matrices, computes the\n\ -transpose, @emph{not} the complex conjugate transpose.\n\ -@seealso{', transpose}\n\ -@end deftypefn"), - - pair_type (".*", - "-*- texinfo -*-\n\ -@deftypefn {} {} .*\n\ -Element by element multiplication operator.\n\ -@seealso{*, times}\n\ -@end deftypefn"), - - pair_type (".**", - "-*- texinfo -*-\n\ -@deftypefn {} {} .*\n\ -Element by element power operator. If several complex results are possible,\n\ -returns the one with smallest non-negative argument (angle). Use\n\ -@code{realpow}, @code{realsqrt}, @code{cbrt}, or @code{nthroot} if a\n\ -real result is preferred.\n\ -@seealso{**, ^, .^, power, realpow, realsqrt, cbrt, nthroot}\n\ -@end deftypefn"), - - pair_type (".^", - "-*- texinfo -*-\n\ -@deftypefn {} {} .^\n\ -Element by element power operator. If several complex results are possible,\n\ -returns the one with smallest non-negative argument (angle). Use\n\ -@code{realpow}, @code{realsqrt}, @code{cbrt}, or @code{nthroot} if a\n\ -real result is preferred.\n\ -@seealso{.**, ^, **, power, realpow, realsqrt, cbrt, nthroot}\n\ -@end deftypefn"), - - pair_type ("./", - "-*- texinfo -*-\n\ -@deftypefn {} {} ./\n\ -Element by element right division operator.\n\ -@seealso{/, .\\, rdivide, mrdivide}\n\ -@end deftypefn"), - - pair_type ("/", - "-*- texinfo -*-\n\ -@deftypefn {} {} /\n\ -Right division operator.\n\ -@seealso{./, \\, rdivide, mrdivide}\n\ -@end deftypefn"), - - pair_type (".\\", - "-*- texinfo -*-\n\ -@deftypefn {} {} .\\\n\ -Element by element left division operator.\n\ -@seealso{\\, ./, rdivide, mrdivide}\n\ -@end deftypefn"), - - pair_type ("\\", - "-*- texinfo -*-\n\ -@deftypefn {} {} \\\n\ -Left division operator.\n\ -@seealso{.\\, /, ldivide, mldivide}\n\ -@end deftypefn"), - - pair_type (":", - "-*- texinfo -*-\n\ -@deftypefn {} {} :\n\ -Select entire rows or columns of matrices.\n\ -@end deftypefn"), - - pair_type (";", - "-*- texinfo -*-\n\ -@deftypefn {} {} ;\n\ -Array row or command separator.\n\ -@seealso{,}\n\ -@end deftypefn"), - - pair_type ("<", - "-*- texinfo -*-\n\ -@deftypefn {} {} <\n\ -'Less than' operator.\n\ -@seealso{lt}\n\ -@end deftypefn"), - - pair_type ("<=", - "-*- texinfo -*-\n\ -@deftypefn {} {} <=\n\ -'Less than' or 'equals' operator.\n\ -@seealso{le}\n\ -@end deftypefn"), - - pair_type ("=", - "-*- texinfo -*-\n\ -@deftypefn {} {} =\n\ -Assignment operator.\n\ -@end deftypefn"), - - pair_type ("==", - "-*- texinfo -*-\n\ -@deftypefn {} {} ==\n\ -Equality test operator.\n\ -@seealso{eq}\n\ -@end deftypefn"), - - pair_type (">", - "-*- texinfo -*-\n\ -@deftypefn {} {} >\n\ -'Greater than' operator.\n\ -@seealso{gt}\n\ -@end deftypefn"), - - pair_type (">=", - "-*- texinfo -*-\n\ -@deftypefn {} {} >=\n\ -'Greater than' or 'equals' operator.\n\ -@seealso{ge}\n\ -@end deftypefn"), - - pair_type ("[", - "-*- texinfo -*-\n\ -@deftypefn {} {} [\n\ -Return list delimiter.\n\ -@seealso{]}\n\ -@end deftypefn"), - - pair_type ("]", - "-*- texinfo -*-\n\ -@deftypefn {} {} ]\n\ -Return list delimiter.\n\ -@seealso{[}\n\ -@end deftypefn"), - - pair_type ("|", - "-*- texinfo -*-\n\ -@deftypefn {} {} |\n\ -Element by element logical 'or' operator.\n\ -@seealso{||, or}\n\ -@end deftypefn"), - - pair_type ("||", - "-*- texinfo -*-\n\ -@deftypefn {} {} ||\n\ -Logical 'or' (with short-circuit evaluation) operator.\n\ -@seealso{|, or}\n\ -@end deftypefn"), + "!", + "~", + "!=", + "~=", + "\"", + "#", + "%", + "#{", + "%{", + "#}", + "%}", + "...", + "&", + "&&", + "'", + "(", + ")", + "*", + "**", + "^", + "+", + "++", + ",", + "-", + "--", + ".'", + ".*", + ".**", + ".^", + "./", + "/", + ".\\", + "\\", + ":", + ";", + "<", + "<=", + "=", + "==", + ">", + ">=", + "[", + "]", + "|", + "||", + 0 }; -const static pair_type keywords[] = -{ - pair_type ("break", - "-*- texinfo -*-\n\ -@deftypefn {} {} break\n\ -Exit the innermost enclosing do, while or for loop.\n\ -@seealso{do, while, for, parfor, continue}\n\ -@end deftypefn"), - - pair_type ("case", - "-*- texinfo -*-\n\ -@deftypefn {} {} case @var{value}\n\ -@deftypefnx {} {} case @{@var{value}, @dots{}@}\n\ -A case statement in a switch. Octave cases are exclusive and do not\n\ -fall-through as do C-language cases. A switch statement must have at least\n\ -one case. See @code{switch} for an example.\n\ -@seealso{switch}\n\ -@end deftypefn"), - - pair_type ("catch", - "-*- texinfo -*-\n\ -@deftypefn {} {} catch\n\ -@deftypefnx {} {} catch @var{value}\n\ -Begin the cleanup part of a try-catch block.\n\ -@seealso{try}\n\ -@end deftypefn"), - - pair_type ("continue", - "-*- texinfo -*-\n\ -@deftypefn {} {} continue\n\ -Jump to the end of the innermost enclosing do, while or for loop.\n\ -@seealso{do, while, for, parfor, break}\n\ -@end deftypefn"), - - pair_type ("do", - "-*- texinfo -*-\n\ -@deftypefn {} {} do\n\ -Begin a do-until loop. This differs from a do-while loop in that the\n\ -body of the loop is executed at least once.\n\ -\n\ -@example\n\ -@group\n\ -i = 0;\n\ -do\n\ - i++\n\ -until (i == 10)\n\ -@end group\n\ -@end example\n\ -@seealso{for, until, while}\n\ -@end deftypefn"), - - pair_type ("else", - "-*- texinfo -*-\n\ -@deftypefn {} {} else\n\ -Alternate action for an if block. See @code{if} for an example.\n\ -@seealso{if}\n\ -@end deftypefn"), - - pair_type ("elseif", - "-*- texinfo -*-\n\ -@deftypefn {} {} elseif (@var{condition})\n\ -Alternate conditional test for an if block. See @code{if} for an example.\n\ -@seealso{if}\n\ -@end deftypefn"), - - pair_type ("end", - "-*- texinfo -*-\n\ -@deftypefn {} {} end\n\ -Mark the end of any @code{for}, @code{parfor}, @code{if}, @code{do},\n\ -@code{while}, @code{function}, @code{switch}, @code{try}, or\n\ -@code{unwind_protect} block.\n\ -@seealso{for, parfor, if, do, while, function, switch, try, unwind_protect}\n\ -@end deftypefn"), - - pair_type ("end_try_catch", - "-*- texinfo -*-\n\ -@deftypefn {} {} end_try_catch\n\ -Mark the end of an @code{try-catch} block.\n\ -@seealso{try, catch}\n\ -@end deftypefn"), - - pair_type ("end_unwind_protect", - "-*- texinfo -*-\n\ -@deftypefn {} {} end_unwind_protect\n\ -Mark the end of an unwind_protect block.\n\ -@seealso{unwind_protect}\n\ -@end deftypefn"), - - pair_type ("endfor", - "-*- texinfo -*-\n\ -@deftypefn {} {} endfor\n\ -Mark the end of a for loop. See @code{for} for an example.\n\ -@seealso{for}\n\ -@end deftypefn"), - - pair_type ("endfunction", - "-*- texinfo -*-\n\ -@deftypefn {} {} endfunction\n\ -Mark the end of a function.\n\ -@seealso{function}\n\ -@end deftypefn"), - - pair_type ("endif", - "-*- texinfo -*-\n\ -@deftypefn {} {} endif\n\ -Mark the end of an if block. See @code{if} for an example.\n\ -@seealso{if}\n\ -@end deftypefn"), - - pair_type ("endparfor", - "-*- texinfo -*-\n\ -@deftypefn {} {} endparfor\n\ -Mark the end of a parfor loop. See @code{parfor} for an example.\n\ -@seealso{parfor}\n\ -@end deftypefn"), - - pair_type ("endswitch", - "-*- texinfo -*-\n\ -@deftypefn {} {} endswitch\n\ -Mark the end of a switch block. See @code{switch} for an example.\n\ -@seealso{switch}\n\ -@end deftypefn"), - - pair_type ("endwhile", - "-*- texinfo -*-\n\ -@deftypefn {} {} endwhile\n\ -Mark the end of a while loop. See @code{while} for an example.\n\ -@seealso{do, while}\n\ -@end deftypefn"), - - pair_type ("for", - "-*- texinfo -*-\n\ -@deftypefn {} {} for @var{i} = @var{range}\n\ -Begin a for loop.\n\ -\n\ -@example\n\ -@group\n\ -for i = 1:10\n\ - i\n\ -endfor\n\ -@end group\n\ -@end example\n\ -@seealso{do, parfor, while}\n\ -@end deftypefn"), - - pair_type ("function", - "-*- texinfo -*-\n\ -@deftypefn {} {} function @var{outputs} = function (@var{input}, @dots{})\n\ -@deftypefnx {} {} function {} function (@var{input}, @dots{})\n\ -@deftypefnx {} {} function @var{outputs} = function\n\ -Begin a function body with @var{outputs} as results and @var{inputs} as\n\ -parameters.\n\ -@seealso{return}\n\ -@end deftypefn"), +const static string_vector operator_names (operators); - pair_type ("global", - "-*- texinfo -*-\n\ -@deftypefn {} {} global @var{var}\n\ -Declare variables to have global scope.\n\ -\n\ -@example\n\ -@group\n\ -global @var{x};\n\ -if (isempty (@var{x}))\n\ - x = 1;\n\ -endif\n\ -@end group\n\ -@end example\n\ -@seealso{persistent}\n\ -@end deftypefn"), - - pair_type ("if", - "-*- texinfo -*-\n\ -@deftypefn {} {} if (@var{cond}) @dots{} endif\n\ -@deftypefnx {} {} if (@var{cond}) @dots{} else @dots{} endif\n\ -@deftypefnx {} {} if (@var{cond}) @dots{} elseif (@var{cond}) @dots{} endif\n\ -@deftypefnx {} {} if (@var{cond}) @dots{} elseif (@var{cond}) @dots{} else @dots{} endif\n\ -Begin an if block.\n\ -\n\ -@example\n\ -@group\n\ -x = 1;\n\ -if (x == 1)\n\ - disp (\"one\");\n\ -elseif (x == 2)\n\ - disp (\"two\");\n\ -else\n\ - disp (\"not one or two\");\n\ -endif\n\ -@end group\n\ -@end example\n\ -@seealso{switch}\n\ -@end deftypefn"), - - pair_type ("otherwise", - "-*- texinfo -*-\n\ -@deftypefn {} {} otherwise\n\ -The default statement in a switch block (similar to else in an if block).\n\ -@seealso{switch}\n\ -@end deftypefn"), - - pair_type ("parfor", - "-*- texinfo -*-\n\ -@deftypefn {} {} parfor @var{i} = @var{range}\n\ -@deftypefnx {} {} parfor (@var{i} = @var{range}, @var{maxproc})\n\ -Begin a for loop that may execute in parallel.\n\ -\n\ -@example\n\ -@group\n\ -parfor i = 1:10\n\ - i\n\ -endparfor\n\ -@end group\n\ -@end example\n\ -@seealso{for, do, while}\n\ -@end deftypefn"), - - pair_type ("persistent", - "-*- texinfo -*-\n\ -@deftypefn {} {} persistent @var{var}\n\ -Declare variables as persistent. A variable that has been declared\n\ -persistent within a function will retain its contents in memory between\n\ -subsequent calls to the same function. The difference between persistent\n\ -variables and global variables is that persistent variables are local in\n\ -scope to a particular function and are not visible elsewhere.\n\ -@seealso{global}\n\ -@end deftypefn"), - - pair_type ("return", - "-*- texinfo -*-\n\ -@deftypefn {} {} return\n\ -Return from a function.\n\ -@seealso{function}\n\ -@end deftypefn"), - - pair_type ("static", - "-*- texinfo -*-\n\ -@deftypefn {} {} static\n\ -This statement has been deprecated in favor of @code{persistent}.\n\ -@seealso{persistent}\n\ -@end deftypefn"), - - pair_type ("switch", - "-*- texinfo -*-\n\ -@deftypefn {} {} switch @var{statement}\n\ -Begin a switch block.\n\ -\n\ -@example\n\ -@group\n\ -yesno = \"yes\"\n\ -\n\ -switch yesno\n\ - case @{\"Yes\" \"yes\" \"YES\" \"y\" \"Y\"@}\n\ - value = 1;\n\ - case @{\"No\" \"no\" \"NO\" \"n\" \"N\"@}\n\ - value = 0;\n\ - otherwise\n\ - error (\"invalid value\");\n\ -endswitch\n\ -@end group\n\ -@end example\n\ -@seealso{if, case, otherwise}\n\ -@end deftypefn"), - - pair_type ("try", - "-*- texinfo -*-\n\ -@deftypefn {} {} try\n\ -Begin a try-catch block.\n\ -\n\ -If an error occurs within a try block, then the catch code will be run and\n\ -execution will proceed after the catch block (though it is often\n\ -recommended to use the lasterr function to re-throw the error after cleanup\n\ -is completed).\n\ -@seealso{catch, unwind_protect}\n\ -@end deftypefn"), - - pair_type ("until", - "-*- texinfo -*-\n\ -@deftypefn {} {} until (@var{cond})\n\ -End a do-until loop. See @code{do} for an example.\n\ -@seealso{do}\n\ -@end deftypefn"), - - pair_type ("unwind_protect", - "-*- texinfo -*-\n\ -@deftypefn {} {} unwind_protect\n\ -Begin an unwind_protect block.\n\ -\n\ -If an error occurs within the first part of an unwind_protect block\n\ -the commands within the unwind_protect_cleanup block are executed before\n\ -the error is thrown. If an error is not thrown, then the\n\ -unwind_protect_cleanup block is still executed (in other words, the\n\ -unwind_protect_cleanup will be run with or without an error in the\n\ -unwind_protect block).\n\ -@seealso{unwind_protect_cleanup, try}\n\ -@end deftypefn"), - - pair_type ("unwind_protect_cleanup", - "-*- texinfo -*-\n\ -@deftypefn {} {} unwind_protect_cleanup\n\ -Begin the cleanup section of an unwind_protect block.\n\ -@seealso{unwind_protect}\n\ -@end deftypefn"), - - pair_type ("varargin", - "-*- texinfo -*-\n\ -@deftypefn {} {} varargin\n\ -Pass an arbitrary number of arguments into a function.\n\ -@seealso{varargout, nargin, isargout, nargout, nthargout}\n\ -@end deftypefn"), - - pair_type ("varargout", - "-*- texinfo -*-\n\ -@deftypefn {} {} varargout\n\ -Pass an arbitrary number of arguments out of a function.\n\ -@seealso{varargin, nargin, isargout, nargout, nthargout}\n\ -@end deftypefn"), - - pair_type ("while", - "-*- texinfo -*-\n\ -@deftypefn {} {} while\n\ -Begin a while loop.\n\ -\n\ -@example\n\ -@group\n\ -i = 0;\n\ -while (i < 10)\n\ - i++\n\ -endwhile\n\ -@end group\n\ -@end example\n\ -@seealso{do, endwhile, for, until}\n\ -@end deftypefn"), +const static char * const keywords[] = +{ + "break", + "case", + "catch", + "continue", + "do", + "else", + "elseif", + "end", + "end_try_catch", + "end_unwind_protect", + "endfor", + "endfunction", + "endif", + "endparfor", + "endswitch", + "endwhile", + "for", + "function", + "global", + "if", + "otherwise", + "parfor", + "persistent", + "return", + "static", + "switch", + "try", + "until", + "unwind_protect", + "unwind_protect_cleanup", + "varargin", + "varargout", + "while", + 0 }; -// Return a copy of the operator or keyword names. -static string_vector -names (const map_type& lst) -{ - string_vector retval (lst.size ()); - int j = 0; - for (map_iter iter = lst.begin (); iter != lst.end (); iter++) - retval[j++] = iter->first; - return retval; -} - -const static map_type operators_map (operators, operators + size (operators)); -const static map_type keywords_map (keywords, keywords + size (keywords)); -const static string_vector keyword_names = names (keywords_map); +const static string_vector keyword_names (keywords); // Return a vector of all functions from this file, // for use in command line auto-completion. @@ -959,16 +346,6 @@ } static bool -raw_help_from_map (const std::string& nm, std::string& h, - const map_type& map, bool& symbol_found) -{ - map_iter idx = map.find (nm); - symbol_found = (idx != map.end ()); - h = (symbol_found) ? idx->second : ""; - return symbol_found; -} - -static bool raw_help_from_docstrings_file (const std::string& nm, std::string& h, bool& symbol_found) { @@ -1097,17 +474,7 @@ found = raw_help_from_symbol_table (nm, h, w, symbol_found); if (! found) - { - found = raw_help_from_file (nm, h, f, symbol_found); - - if (! found) - { - found = raw_help_from_map (nm, h, operators_map, symbol_found); - - if (! found) - found = raw_help_from_map (nm, h, keywords_map, symbol_found); - } - } + found = raw_help_from_file (nm, h, f, symbol_found); if (! found || h == "external-doc") raw_help_from_docstrings_file (nm, h, symbol_found); @@ -1258,7 +625,7 @@ Undocumented internal function. @end deftypefn */) { - return ovl (Cell (names (operators_map))); + return ovl (Cell (operator_names)); } // Return a cell array of strings containing the names of all @@ -1270,7 +637,7 @@ Undocumented internal function. @end deftypefn */) { - return ovl (Cell (names (keywords_map))); + return ovl (Cell (keyword_names)); } // Return a cell array of strings containing the names of all builtin