Mercurial > hg > octave-nkf
annotate src/help.cc @ 8812:7d48766c21a5
use consistent format for doc strings of internal functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Feb 2009 02:16:34 -0500 |
parents | 2a49c32d4322 |
children | 31f864877246 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
4 2002, 2003, 2004, 2005, 2006, 2007 John W. Eaton | |
1 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
1 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
1 | 21 |
22 */ | |
23 | |
240 | 24 #ifdef HAVE_CONFIG_H |
1192 | 25 #include <config.h> |
1 | 26 #endif |
27 | |
1343 | 28 #include <cstdlib> |
29 #include <cstring> | |
30 | |
5769 | 31 #include <algorithm> |
3503 | 32 #include <iostream> |
33 #include <fstream> | |
5765 | 34 #include <sstream> |
1755 | 35 #include <string> |
36 | |
1350 | 37 #ifdef HAVE_UNISTD_H |
2442 | 38 #ifdef HAVE_SYS_TYPES_H |
1295 | 39 #include <sys/types.h> |
2442 | 40 #endif |
1295 | 41 #include <unistd.h> |
42 #endif | |
1343 | 43 |
3295 | 44 #include "cmd-edit.h" |
45 #include "file-ops.h" | |
6253 | 46 #include "file-stat.h" |
2926 | 47 #include "oct-env.h" |
1755 | 48 #include "str-vec.h" |
49 | |
2492 | 50 #include <defaults.h> |
1352 | 51 #include "defun.h" |
52 #include "dirfns.h" | |
53 #include "error.h" | |
2202 | 54 #include "gripes.h" |
1352 | 55 #include "help.h" |
2177 | 56 #include "input.h" |
5832 | 57 #include "load-path.h" |
1755 | 58 #include "oct-obj.h" |
2976 | 59 #include "ov-usr-fcn.h" |
1352 | 60 #include "pager.h" |
3018 | 61 #include "parse.h" |
1466 | 62 #include "pathsearch.h" |
3295 | 63 #include "procstream.h" |
7336 | 64 #include "pt-pr-code.h" |
529 | 65 #include "sighandlers.h" |
66 #include "symtab.h" | |
2694 | 67 #include "syswait.h" |
1755 | 68 #include "toplev.h" |
8672
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
69 #include "unwind-prot.h" |
242 | 70 #include "utils.h" |
1352 | 71 #include "variables.h" |
3301 | 72 #include "version.h" |
5447 | 73 #include "quit.h" |
529 | 74 |
2202 | 75 // Name of the info file specified on command line. |
76 // (--info-file file) | |
3523 | 77 std::string Vinfo_file; |
2202 | 78 |
79 // Name of the info reader we'd like to use. | |
80 // (--info-program program) | |
5794 | 81 std::string Vinfo_program; |
2202 | 82 |
3686 | 83 // Name of the makeinfo program to run. |
5794 | 84 static std::string Vmakeinfo_program = "makeinfo"; |
3686 | 85 |
2189 | 86 // If TRUE, don't print additional help message in help and usage |
87 // functions. | |
5794 | 88 static bool Vsuppress_verbose_help_message = false; |
2189 | 89 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
90 #include <map> |
3016 | 91 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
92 typedef std::map<std::string, std::string> map_type; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
93 typedef map_type::value_type pair_type; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
94 typedef map_type::const_iterator map_iter; |
3016 | 95 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
96 template<typename T, std::size_t z> |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
97 std::size_t |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
98 size (T const (&)[z]) |
1 | 99 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
100 return z; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
101 } |
1 | 102 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
103 // FIXME -- The descriptions could easily be in texinfo -- should they? |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
104 const static pair_type operators[] = |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
105 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
106 pair_type ("!", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
107 "Logical not operator. See also `~'.\n"), |
1 | 108 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
109 pair_type ("!=", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
110 "Logical not equals operator. See also `~='.\n"), |
1 | 111 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
112 pair_type ("\"", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
113 "String delimiter.\n"), |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
114 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
115 pair_type ("#", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
116 "Begin comment character. See also `%'."), |
1 | 117 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
118 pair_type ("%", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
119 "Begin comment charcter. See also `#'."), |
1 | 120 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
121 pair_type ("&", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
122 "Element by element logical and operator. See also `&&'."), |
1 | 123 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
124 pair_type ("&&", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
125 "Logical and operator (with short-circuit evaluation). See also `&'."), |
1 | 126 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
127 pair_type ("'", |
1 | 128 "Matrix transpose operator. For complex matrices, computes the\n\ |
129 complex conjugate (Hermitian) transpose. See also `.''\n\ | |
130 \n\ | |
131 The single quote character may also be used to delimit strings, but\n\ | |
132 it is better to use the double quote character, since that is never\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
133 ambiguous"), |
1 | 134 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
135 pair_type ("(", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
136 "Array index or function argument delimiter."), |
1 | 137 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
138 pair_type (")", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
139 "Array index or function argument delimiter."), |
1 | 140 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
141 pair_type ("*", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
142 "Multiplication operator. See also `.*'"), |
1 | 143 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
144 pair_type ("**", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
145 "Power operator. See also `^', `.**', and `.^'"), |
1 | 146 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
147 pair_type ("+", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
148 "Addition operator."), |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
149 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
150 pair_type ("++", |
5339 | 151 "Increment operator. As in C, may be applied as a prefix or postfix\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
152 operator."), |
1 | 153 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
154 pair_type (",", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
155 "Array index, function argument, or command separator."), |
1 | 156 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
157 pair_type ("-", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
158 "Subtraction or unary negation operator."), |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
159 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
160 pair_type ("--", |
5339 | 161 "Decrement operator. As in C, may be applied as a prefix or postfix\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
162 operator."), |
1 | 163 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
164 pair_type (".'", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
165 "Matrix transpose operator. For complex matrices, computes the\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
166 transpose, *not* the complex conjugate transpose. See also `''."), |
1 | 167 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
168 pair_type (".*", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
169 "Element by element multiplication operator. See also `*'."), |
1 | 170 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
171 pair_type (".**", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
172 "Element by element power operator. See also `**', `^', and `.^'."), |
1 | 173 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
174 pair_type ("./", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
175 "Element by element division operator. See also `/' and `\\'."), |
1 | 176 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
177 pair_type (".^", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
178 "Element by element power operator. See also `**', `^', and `.^'."), |
1 | 179 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
180 pair_type ("/", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
181 "Right division. See also `\\' and `./'."), |
1 | 182 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
183 pair_type (":", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
184 "Select entire rows or columns of matrices."), |
1 | 185 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
186 pair_type (";", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
187 "Array row or command separator. See also `,'."), |
1 | 188 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
189 pair_type ("<", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
190 "Less than operator."), |
1 | 191 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
192 pair_type ("<=", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
193 "Less than or equals operator."), |
1 | 194 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
195 pair_type ("=", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
196 "Assignment operator."), |
1 | 197 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
198 pair_type ("==", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
199 "Equality test operator."), |
1 | 200 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
201 pair_type (">", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
202 "Greater than operator."), |
1 | 203 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
204 pair_type (">=", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
205 "Greater than or equals operator."), |
1 | 206 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
207 pair_type ("[", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
208 "Return list delimiter. See also `]'."), |
1 | 209 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
210 pair_type ("\\", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
211 "Left division operator. See also `/' and `./'."), |
1 | 212 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
213 pair_type ("]", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
214 "Return list delimiter. See also `['."), |
1 | 215 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
216 pair_type ("^", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
217 "Power operator. See also `**', `.^', and `.**.'"), |
1 | 218 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
219 pair_type ("|", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
220 "Element by element logical or operator. See also `||'."), |
1 | 221 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
222 pair_type ("||", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
223 "Logical or operator (with short-circuit evaluation). See also `|'."), |
1 | 224 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
225 pair_type ("~", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
226 "Logical not operator. See also `!' and `~'."), |
1 | 227 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
228 pair_type ("~=", |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
229 "Logical not equals operator. See also `!='."), |
1 | 230 }; |
231 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
232 const static pair_type keywords[] = |
1 | 233 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
234 pair_type ("break", |
5818 | 235 "-*- texinfo -*-\n\ |
236 @deffn Keyword break\n\ | |
237 Exit the innermost enclosing do, while or for loop.\n\ | |
238 @seealso{do, while, for, continue}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
239 @end deffn"), |
5040 | 240 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
241 pair_type ("case", |
5818 | 242 "-*- texinfo -*-\n\ |
243 @deffn Keyword case @{@var{value}@}\n\ | |
244 A case statement in an switch. Octave cases are exclusive and do not\n\ | |
5040 | 245 fall-through as do C-language cases. A switch statement must have at least\n\ |
5818 | 246 one case. See @code{switch} for an example.\n\ |
247 @seealso{switch}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
248 @end deffn"), |
1 | 249 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
250 pair_type ("catch", |
5818 | 251 "-*- texinfo -*-\n\ |
252 @deffn Keyword catch\n\ | |
253 Begin the cleanup part of a try-catch block.\n\ | |
254 @seealso{try}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
255 @end deffn"), |
1489 | 256 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
257 pair_type ("continue", |
5818 | 258 "-*- texinfo -*-\n\ |
259 @deffn Keyword continue\n\ | |
260 Jump to the end of the innermost enclosing do, while or for loop.\n\ | |
261 @seealso{do, while, for, break}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
262 @end deffn"), |
5040 | 263 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
264 pair_type ("do", |
5818 | 265 "-*- texinfo -*-\n\ |
266 @deffn Keyword do\n\ | |
267 Begin a do-until loop. This differs from a do-while loop in that the\n\ | |
268 body of the loop is executed at least once.\n\ | |
269 @seealso{while}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
270 @end deffn"), |
1 | 271 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
272 pair_type ("else", |
5818 | 273 "-*- texinfo -*-\n\ |
274 @deffn Keyword else\n\ | |
275 Alternate action for an if block. See @code{if} for an example.\n\ | |
276 @seealso{if}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
277 @end deffn"), |
1 | 278 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
279 pair_type ("elseif", |
5818 | 280 "-*- texinfo -*-\n\ |
281 @deffn Keyword elseif (@var{condition})\n\ | |
282 Alternate conditional test for an if block. See @code{if} for an example.\n\ | |
283 @seealso{if}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
284 @end deffn"), |
1 | 285 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
286 pair_type ("end", |
5818 | 287 "-*- texinfo -*-\n\ |
288 @deffn Keyword end\n\ | |
289 Mark the end of any @code{for}, @code{if}, @code{do}, @code{while}, or @code{function} block.\n\ | |
290 @seealso{for, if, do, while, function}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
291 @end deffn"), |
928 | 292 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
293 pair_type ("end_try_catch", |
5818 | 294 "-*- texinfo -*-\n\ |
295 @deffn Keyword end_try_catch\n\ | |
296 Mark the end of an @code{try-catch} block.\n\ | |
297 @seealso{try, catch}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
298 @end deffn"), |
1489 | 299 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
300 pair_type ("end_unwind_protect", |
5818 | 301 "-*- texinfo -*-\n\ |
302 @deffn Keyword end_unwind_protect\n\ | |
303 Mark the end of an unwind_protect block.\n\ | |
304 @seealso{unwind_protect}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
305 @end deffn"), |
1 | 306 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
307 pair_type ("endfor", |
5818 | 308 "-*- texinfo -*-\n\ |
309 @deffn Keyword endfor\n\ | |
310 Mark the end of a for loop. See @code{for} for an example.\n\ | |
311 @seealso{for}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
312 @end deffn"), |
1 | 313 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
314 pair_type ("endfunction", |
5818 | 315 "-*- texinfo -*-\n\ |
316 @deffn Keyword endfunction\n\ | |
317 Mark the end of a function.\n\ | |
318 @seealso{function}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
319 @end deffn"), |
1 | 320 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
321 pair_type ("endif", |
5818 | 322 "-*- texinfo -*-\n\ |
323 @deffn Keyword endif\n\ | |
324 Mark the end of an if block. See @code{if} for an example.\n\ | |
325 @seealso{if}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
326 @end deffn"), |
1 | 327 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
328 pair_type ("endswitch", |
5818 | 329 "-*- texinfo -*-\n\ |
330 @deffn Keyword endswitch\n\ | |
331 Mark the end of a switch block. See @code{switch} for an example.\n\ | |
332 @seealso{switch}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
333 @end deffn"), |
5122 | 334 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
335 pair_type ("endwhile", |
5818 | 336 "-*- texinfo -*-\n\ |
337 @deffn Keyword endwhile\n\ | |
338 Mark the end of a while loop. See @code{while} for an example.\n\ | |
339 @seealso{do, while}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
340 @end deffn"), |
1 | 341 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
342 pair_type ("for", |
5818 | 343 "-*- texinfo -*-\n\ |
344 @deffn Keyword for @var{i} = @var{range}\n\ | |
345 Begin a for loop.\n\ | |
346 @example\n\ | |
347 for i = 1:10\n\ | |
348 i\n\ | |
349 endfor\n\ | |
350 @end example\n\ | |
351 @seealso{do, while}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
352 @end deffn"), |
1 | 353 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
354 pair_type ("function", |
5818 | 355 "-*- texinfo -*-\n\ |
356 @deffn Keyword function @var{outputs} = function (@var{input}, ...)\n\ | |
357 @deffnx Keyword function {} function (@var{input}, ...)\n\ | |
358 @deffnx Keyword function @var{outputs} = function\n\ | |
359 Begin a function body with @var{outputs} as results and @var{inputs} as\n\ | |
360 parameters.\n\ | |
361 @seealso{return}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
362 @end deffn"), |
1 | 363 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
364 pair_type ("global", |
5818 | 365 "-*- texinfo -*-\n\ |
366 @deffn Keyword global\n\ | |
367 Declare variables to have global scope.\n\ | |
368 @example\n\ | |
369 global @var{x};\n\ | |
370 if isempty (@var{x})\n\ | |
371 x = 1;\n\ | |
372 endif\n\ | |
373 @end example\n\ | |
374 @seealso{persistent}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
375 @end deffn"), |
1 | 376 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
377 pair_type ("if", |
5393 | 378 "-*- texinfo -*-\n\ |
379 @deffn Keyword if (@var{cond}) @dots{} endif\n\ | |
380 @deffnx Keyword if (@var{cond}) @dots{} else @dots{} endif\n\ | |
381 @deffnx Keyword if (@var{cond}) @dots{} elseif (@var{cond}) @dots{} endif\n\ | |
382 @deffnx Keyword if (@var{cond}) @dots{} elseif (@var{cond}) @dots{} else @dots{} endif\n\ | |
383 Begin an if block.\n\ | |
5818 | 384 @example\n\ |
385 x = 1;\n\ | |
386 if (x == 1)\n\ | |
387 disp (\"one\");\n\ | |
388 elseif (x == 2)\n\ | |
389 disp (\"two\");\n\ | |
390 else\n\ | |
391 disp (\"not one or two\");\n\ | |
392 endif\n\ | |
393 @end example\n\ | |
5646 | 394 @seealso{switch}\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
395 @end deffn"), |
1 | 396 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
397 pair_type ("otherwise", |
5818 | 398 "-*- texinfo -*-\n\ |
399 @deffn Keyword otherwise\n\ | |
400 The default statement in a switch block (similar to else in an if block).\n\ | |
401 @seealso{switch}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
402 @end deffn"), |
5040 | 403 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
404 pair_type ("persistent", |
5818 | 405 "-*- texinfo -*-\n\ |
406 @deffn Keyword persistent @var{var}\n\ | |
407 Declare variables as persistent. A variable that has been declared\n\ | |
5623 | 408 persistent within a function will retain its contents in memory between\n\ |
409 subsequent calls to the same function. The difference between persistent\n\ | |
5818 | 410 variables and global variables is that persistent variables are local in \n\ |
411 scope to a particular function and are not visible elsewhere.\n\ | |
412 @seealso{global}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
413 @end deffn"), |
4686 | 414 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
415 pair_type ("replot", |
5818 | 416 "-*- texinfo -*-\n\ |
417 @deffn Keyword replot\n\ | |
418 Replot a graphic.\n\ | |
419 @seealso{plot}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
420 @end deffn"), |
5040 | 421 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
422 pair_type ("return", |
5818 | 423 "-*- texinfo -*-\n\ |
424 @deffn Keyword return\n\ | |
425 Return from a function.\n\ | |
426 @seealso{function}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
427 @end deffn"), |
928 | 428 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
429 pair_type ("static", |
5818 | 430 "-*- texinfo -*-\n\ |
431 @deffn Keyword static\n\ | |
432 This function has been deprecated in favor of persistent.\n\ | |
433 @seealso{persistent}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
434 @end deffn"), |
5040 | 435 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
436 pair_type ("switch", |
5818 | 437 "-*- texinfo -*-\n\ |
438 @deffn Keyword switch @var{statement}\n\ | |
439 Begin a switch block.\n\ | |
440 @example\n\ | |
441 yesno = \"yes\"\n\ | |
442 \n\ | |
443 switch yesno\n\ | |
5832 | 444 case @{\"Yes\" \"yes\" \"YES\" \"y\" \"Y\"@}\n\ |
5818 | 445 value = 1;\n\ |
5832 | 446 case @{\"No\" \"no\" \"NO\" \"n\" \"N\"@}\n\ |
5818 | 447 value = 0;\n\ |
448 otherwise\n\ | |
449 error (\"invalid value\");\n\ | |
450 endswitch\n\ | |
451 @end example\n\ | |
452 @seealso{if, case, otherwise}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
453 @end deffn"), |
5040 | 454 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
455 pair_type ("try", |
5818 | 456 "-*- texinfo -*-\n\ |
457 @deffn Keyword try\n\ | |
458 Begin a try-catch block.\n\ | |
6138 | 459 \n\ |
460 If an error occurs within a try block, then the catch code will be run and\n\ | |
461 execution will proceed after the catch block (though it is often\n\ | |
462 recommended to use the lasterr function to re-throw the error after cleanup\n\ | |
463 is completed).\n\ | |
464 @seealso{catch,unwind_protect}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
465 @end deffn"), |
1489 | 466 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
467 pair_type ("until", |
5818 | 468 "-*- texinfo -*-\n\ |
469 @deffn Keyword until\n\ | |
470 End a do-until loop.\n\ | |
471 @seealso{do}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
472 @end deffn"), |
5040 | 473 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
474 pair_type ("unwind_protect", |
5818 | 475 "-*- texinfo -*-\n\ |
476 @deffn Keyword unwind_protect\n\ | |
477 Begin an unwind_protect block.\n\ | |
6138 | 478 \n\ |
479 If an error occurs within the first part of an unwind_protect block\n\ | |
480 the commands within the unwind_protect_cleanup block are executed before\n\ | |
481 the error is thrown. If an error is not thrown, then the\n\ | |
482 unwind_protect_cleanup block is still executed (in other words, the\n\ | |
483 unwind_protect_cleanup will be run with or without an error in the\n\ | |
484 unwind_protect block).\n\ | |
485 @seealso{unwind_protect_cleanup,try}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
486 @end deffn"), |
928 | 487 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
488 pair_type ("unwind_protect_cleanup", |
5818 | 489 "-*- texinfo -*-\n\ |
490 @deffn Keyword unwind_protect_cleanup\n\ | |
491 Begin the cleanup section of an unwind_protect block.\n\ | |
492 @seealso{unwind_protect}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
493 @end deffn"), |
1 | 494 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
495 pair_type ("varargin", |
5818 | 496 "-*- texinfo -*-\n\ |
497 @deffn Keyword varargin\n\ | |
498 Pass an arbitrary number of arguments into a function.\n\ | |
499 @seealso{varargout, nargin, nargout}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
500 @end deffn"), |
5040 | 501 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
502 pair_type ("varargout", |
5818 | 503 "-*- texinfo -*-\n\ |
504 @deffn Keyword varargout\n\ | |
505 Pass an arbitrary number of arguments out of a function.\n\ | |
506 @seealso{varargin, nargin, nargout}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
507 @end deffn"), |
5040 | 508 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
509 pair_type ("while", |
5818 | 510 "-*- texinfo -*-\n\ |
511 @deffn Keyword while\n\ | |
512 Begin a while loop.\n\ | |
513 @seealso{do}\n\ | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
514 @end deffn"), |
1 | 515 }; |
516 | |
581 | 517 // Return a copy of the operator or keyword names. |
3016 | 518 static string_vector |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
519 names (const map_type& lst) |
1 | 520 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
521 string_vector retval (lst.size ()); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
522 int j = 0; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
523 for (map_iter iter = lst.begin (); iter != lst.end (); iter ++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
524 retval [j++] = iter->first; |
1755 | 525 return retval; |
1 | 526 } |
527 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
528 const static map_type operators_map (operators, operators + size (operators)); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
529 const static map_type keywords_map (keywords, keywords + size (keywords)); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
530 const static string_vector keyword_names = names (keywords_map); |
1 | 531 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
532 // FIXME -- It's not likely that this does the right thing now. |
3016 | 533 |
534 string_vector | |
535 make_name_list (void) | |
536 { | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
537 const int key_len = keyword_names.length (); |
3016 | 538 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
539 const string_vector bif = symbol_table::built_in_function_names (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
540 const int bif_len = bif.length (); |
4009 | 541 |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7438
diff
changeset
|
542 // FIXME -- is this really necessary here? |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
543 const string_vector glb = symbol_table::global_variable_names (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
544 const int glb_len = glb.length (); |
3016 | 545 |
7752
40c428ea3408
initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents:
7438
diff
changeset
|
546 // FIXME -- is this really necessary here? |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
547 const string_vector top = symbol_table::top_level_variable_names (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
548 const int top_len = top.length (); |
3016 | 549 |
3355 | 550 string_vector lcl; |
7336 | 551 if (! symbol_table::at_top_level ()) |
552 lcl = symbol_table::variable_names (); | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
553 const int lcl_len = lcl.length (); |
3016 | 554 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
555 const string_vector ffl = load_path::fcn_names (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
556 const int ffl_len = ffl.length (); |
3016 | 557 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
558 const string_vector afl = autoloaded_functions (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
559 const int afl_len = afl.length (); |
5592 | 560 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
561 const int total_len = key_len + bif_len + glb_len + top_len + lcl_len |
7336 | 562 + ffl_len + afl_len; |
3016 | 563 |
564 string_vector list (total_len); | |
565 | |
566 // Put all the symbols in one big list. | |
567 | |
568 int j = 0; | |
569 int i = 0; | |
570 for (i = 0; i < key_len; i++) | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
571 list[j++] = keyword_names[i]; |
3016 | 572 |
7336 | 573 for (i = 0; i < bif_len; i++) |
574 list[j++] = bif[i]; | |
4009 | 575 |
3016 | 576 for (i = 0; i < glb_len; i++) |
577 list[j++] = glb[i]; | |
578 | |
579 for (i = 0; i < top_len; i++) | |
580 list[j++] = top[i]; | |
581 | |
582 for (i = 0; i < lcl_len; i++) | |
583 list[j++] = lcl[i]; | |
584 | |
585 for (i = 0; i < ffl_len; i++) | |
586 list[j++] = ffl[i]; | |
587 | |
5592 | 588 for (i = 0; i < afl_len; i++) |
589 list[j++] = afl[i]; | |
590 | |
3016 | 591 return list; |
592 } | |
593 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
594 static bool |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
595 looks_like_html (const std::string& msg) |
3014 | 596 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
597 const size_t p1 = msg.find ('\n'); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
598 std::string t = msg.substr (0, p1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
599 const size_t p2 = t.find ("<html"); // FIXME: this comparison should be case-insensitive |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
600 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
601 return (p2 != std::string::npos); |
2470 | 602 } |
3014 | 603 |
604 static bool | |
3523 | 605 looks_like_texinfo (const std::string& msg, size_t& p1) |
3295 | 606 { |
607 p1 = msg.find ('\n'); | |
608 | |
3523 | 609 std::string t = msg.substr (0, p1); |
3295 | 610 |
8021 | 611 if (p1 == std::string::npos) |
3295 | 612 p1 = 0; |
613 | |
614 size_t p2 = t.find ("-*- texinfo -*-"); | |
615 | |
8021 | 616 return (p2 != std::string::npos); |
3295 | 617 } |
618 | |
3355 | 619 static bool |
6243 | 620 raw_help_from_symbol_table (const std::string& nm, std::string& h, |
621 std::string& w, bool& symbol_found) | |
3355 | 622 { |
623 bool retval = false; | |
624 | |
7336 | 625 octave_value val = symbol_table::find_function (nm); |
3355 | 626 |
7336 | 627 if (val.is_defined ()) |
3355 | 628 { |
7336 | 629 octave_function *fcn = val.function_value (); |
630 | |
631 if (fcn) | |
632 { | |
633 symbol_found = true; | |
5399 | 634 |
7336 | 635 h = fcn->doc_string (); |
636 | |
8631
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
637 retval = true; |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
638 |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
639 w = fcn->fcn_file_name (); |
6243 | 640 |
8631
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
641 if (w.empty ()) |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
642 w = fcn->is_user_function () |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
643 ? "command-line function" : "built-in function"; |
6243 | 644 } |
645 } | |
3355 | 646 |
6243 | 647 return retval; |
648 } | |
649 | |
650 static bool | |
651 raw_help_from_file (const std::string& nm, std::string& h, | |
652 std::string& file, bool& symbol_found) | |
653 { | |
654 bool retval = false; | |
655 | |
8672
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
656 // FIXME -- this is a bit of a kluge... |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
657 unwind_protect_bool (reading_script_file); |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
658 reading_script_file = true; |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
659 |
6243 | 660 h = get_help_from_file (nm, symbol_found, file); |
661 | |
8672
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
662 unwind_protect::run (); |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
663 |
6243 | 664 if (h.length () > 0) |
665 retval = true; | |
666 | |
667 return retval; | |
668 } | |
669 | |
670 static bool | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
671 raw_help_from_map (const std::string& nm, std::string& h, |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
672 const map_type& map, bool& symbol_found) |
3355 | 673 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
674 map_iter idx = map.find (nm); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
675 symbol_found = (idx != map.end ()); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
676 h = (symbol_found) ? idx->second : ""; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
677 return symbol_found; |
3355 | 678 } |
679 | |
6243 | 680 std::string |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
681 raw_help (const std::string& nm, bool& symbol_found) |
6243 | 682 { |
683 std::string h; | |
684 std::string w; | |
685 std::string f; | |
686 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
687 (raw_help_from_symbol_table (nm, h, w, symbol_found) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
688 || raw_help_from_file (nm, h, f, symbol_found) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
689 || raw_help_from_map (nm, h, operators_map, symbol_found) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
690 || raw_help_from_map (nm, h, keywords_map, symbol_found)); |
6243 | 691 |
692 return h; | |
693 } | |
694 | |
1140 | 695 static void |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
696 do_get_help_text (const std::string name, std::string& text, |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
697 std::string& format) |
1140 | 698 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
699 bool symbol_found = false; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
700 text = raw_help (name, symbol_found); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
701 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
702 format = "Not found"; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
703 if (symbol_found) |
1140 | 704 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
705 size_t idx = -1; |
8631
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
706 if (text.empty ()) |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
707 { |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
708 format = "Not documented"; |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
709 } |
52956d669506
Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents:
8630
diff
changeset
|
710 else if (looks_like_texinfo (text, idx)) |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
711 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
712 format = "texinfo"; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
713 text.erase (0, idx); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
714 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
715 else if (looks_like_html (text)) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
716 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
717 format = "html"; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
718 } |
5399 | 719 else |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
720 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
721 format = "plain text"; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
722 } |
1140 | 723 } |
724 } | |
725 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
726 DEFUN (get_help_text, args, , "-*- texinfo -*-\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
727 @deftypefn {Loadable Function} {[@var{text}, @var{format}] =} get_help_text (@var{name})\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
728 Returns the help text of a given function.\n\ |
3168 | 729 \n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
730 This function returns the raw help text @var{text} and an indication of\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
731 its format for the function @var{name}. The format indication @var{format}\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
732 is a string that can be either @t{\"texinfo\"}, @t{\"html\"}, or\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
733 @t{\"plain text\"}.\n\ |
3332 | 734 \n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
735 To convert the help text to other formats, use the @code{makeinfo} function.\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
736 \n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
737 @seealso{makeinfo}\n\ |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
738 @end deftypefn") |
529 | 739 { |
2086 | 740 octave_value_list retval; |
529 | 741 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
742 if (args.length () == 1) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
743 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
744 const std::string name = args (0).string_value (); |
1755 | 745 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
746 if (! error_state) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
747 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
748 std::string text; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
749 std::string format; |
529 | 750 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
751 do_get_help_text (name, text, format); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
752 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
753 retval(1) = format; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
754 retval(0) = text; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
755 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
756 else |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
757 error ("get_help_text: invalid input"); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
758 } |
529 | 759 else |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
760 print_usage (); |
529 | 761 |
762 return retval; | |
763 } | |
764 | |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
765 // Return a cell array of strings containing the names of all |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
766 // operators. |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
767 |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
768 DEFUN (__operators__, , , |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
769 "-*- texinfo -*-\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
770 @deftypefn {Function File} __operators__ ()\n\ |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
771 Undocumented internal function.\n\ |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
772 @end deftypefn") |
3355 | 773 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
774 return octave_value (Cell (names (operators_map))); |
3355 | 775 } |
776 | |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
777 // Return a cell array of strings containing the names of all |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
778 // keywords. |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
779 |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
780 DEFUN (__keywords__, , , |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
781 "-*- texinfo -*-\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
782 @deftypefn {Function File} __keywords__ ()\n\ |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
783 Undocumented internal function.\n\ |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
784 @end deftypefn") |
581 | 785 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
786 return octave_value (Cell (names (keywords_map))); |
581 | 787 } |
788 | |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
789 // Return a cell array of strings containing the names of all builtin |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
790 // functions. |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
791 |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
792 DEFUN (__builtins__, , , |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
793 "-*- texinfo -*-\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
794 @deftypefn {Function File} __builtins__ ()\n\ |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
795 Undocumented internal function.\n\ |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
796 @end deftypefn") |
3355 | 797 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
798 const string_vector bif = symbol_table::built_in_function_names (); |
3355 | 799 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
800 return octave_value (Cell (bif)); |
3355 | 801 } |
802 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
803 static std::string |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
804 do_which (const std::string& name, std::string& type) |
3355 | 805 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
806 std::string file; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
807 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
808 type = std::string (); |
3355 | 809 |
7336 | 810 octave_value val = symbol_table::find_function (name); |
811 | |
812 if (val.is_defined ()) | |
3355 | 813 { |
7336 | 814 octave_function *fcn = val.function_value (); |
815 | |
816 if (fcn) | |
817 { | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
818 file = fcn->fcn_file_name (); |
3355 | 819 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
820 if (file.empty ()) |
7336 | 821 { |
822 if (fcn->is_user_function ()) | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
823 type = "command-line function"; |
7336 | 824 else |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
825 type = "built-in function"; |
7336 | 826 } |
827 else | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
828 type = val.is_user_script () |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
829 ? std::string ("script") : std::string ("function"); |
7336 | 830 } |
831 } | |
8672
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
832 else |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
833 { |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
834 // We might find a file that contains only a doc string. |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
835 |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
836 file = load_path::find_fcn_file (name); |
2a49c32d4322
allow help to work with files containing only comments
John W. Eaton <jwe@octave.org>
parents:
8631
diff
changeset
|
837 } |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
838 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
839 return file; |
3355 | 840 } |
841 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
842 std::string |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
843 do_which (const std::string& name) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
844 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
845 std::string retval; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
846 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
847 std::string type; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
848 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
849 retval = do_which (name, type); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
850 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
851 return retval; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
852 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
853 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
854 DEFUN (__which__, args, , |
3361 | 855 "-*- texinfo -*-\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
856 @deftypefn {Built-in Function} {} __which__ (@var{name}, @dots{})\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
857 Undocumented internal function.\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
858 @end deftypefn") |
581 | 859 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
860 octave_value retval; |
581 | 861 |
1968 | 862 string_vector argv = args.make_argv ("which"); |
1755 | 863 |
3355 | 864 if (! error_state) |
865 { | |
866 int argc = argv.length (); | |
581 | 867 |
3355 | 868 if (argc > 1) |
581 | 869 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
870 Octave_map m (dim_vector (1, argc-1)); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
871 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
872 Cell names (1, argc-1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
873 Cell files (1, argc-1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
874 Cell types (1, argc-1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
875 |
3355 | 876 for (int i = 1; i < argc; i++) |
581 | 877 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
878 std::string name = argv[i]; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
879 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
880 std::string type; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
881 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
882 std::string file = do_which (name, type); |
3141 | 883 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
884 names(i-1) = name; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
885 files(i-1) = file; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
886 types(i-1) = type; |
581 | 887 } |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
888 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
889 m.assign ("name", names); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
890 m.assign ("file", files); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
891 m.assign ("type", types); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
892 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
893 retval = m; |
581 | 894 } |
3355 | 895 else |
5823 | 896 print_usage (); |
581 | 897 } |
898 | |
899 return retval; | |
900 } | |
901 | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
902 // FIXME -- Are we sure this function always does the right thing? |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
903 inline bool |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
904 file_is_in_dir (const std::string filename, const std::string dir) |
5447 | 905 { |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
906 if (filename.find (dir) == 0) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
907 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
908 const int dir_len = dir.size (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
909 const int filename_len = filename.size (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
910 const int max_allowed_seps = file_ops::is_dir_sep (dir [dir_len-1]) ? 0 : 1; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
911 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
912 int num_seps = 0; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
913 for (int i = dir_len; i < filename_len; i++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
914 if (file_ops::is_dir_sep (filename [i])) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
915 num_seps ++; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
916 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
917 return (num_seps <= max_allowed_seps); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
918 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
919 else |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
920 return false; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
921 } |
5447 | 922 |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
923 // Return a cell array of strings containing the names of all |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
924 // functions available in DIRECTORY. If no directory is given, search |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
925 // the current path. |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
926 |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
927 DEFUN (__list_functions__, args, , |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
928 "-*- texinfo -*-\n\ |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
929 @deftypefn {Function File} {@var{retval} =} __list_functions__ ()\n\ |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
930 @deftypefnx{Function File} {@var{retval} =} __list_functions__ (@var{directory})\n\ |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
931 Undocumented internal function.\n\ |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
932 @end deftypefn") |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
933 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
934 octave_value_list retval; |
5447 | 935 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
936 // Get list of functions |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
937 const string_vector ffl = load_path::fcn_names (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
938 const int ffl_len = ffl.length (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
939 const string_vector afl = autoloaded_functions (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
940 const int afl_len = afl.length (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
941 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
942 if (args.length () == 0) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
943 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
944 Cell C (ffl_len + afl_len, 1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
945 int j = 0; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
946 for (int i = 0; i < ffl_len; i++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
947 C (j++, 0) = octave_value (ffl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
948 for (int i = 0; i < afl_len; i++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
949 C (j++, 0) = octave_value (afl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
950 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
951 retval.append (octave_value (C)); |
5447 | 952 } |
953 else | |
954 { | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
955 // Get input |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
956 std::string dir = args (0).string_value (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
957 if (error_state) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
958 error ("__list_functions__: input must be a string"); |
5447 | 959 else |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
960 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
961 dir = file_ops::canonicalize_file_name (dir); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
962 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
963 // FIXME -- This seems very inefficient. Is there a better way? |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
964 std::list<std::string> list; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
965 for (int i = 0; i < ffl_len; i++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
966 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
967 const std::string filename = do_which (ffl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
968 if (file_is_in_dir (filename, dir)) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
969 list.push_back (ffl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
970 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
971 for (int i = 0; i < afl_len; i++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
972 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
973 const std::string filename = do_which (afl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
974 if (file_is_in_dir (filename, dir)) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
975 list.push_back (afl [i]); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
976 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
977 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
978 Cell C (list.size (), 1); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
979 int j = 0; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
980 for (std::list<std::string>::const_iterator iter = list.begin (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
981 iter != list.end (); iter++) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
982 { |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
983 C (j++, 0) = octave_value (*iter); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
984 } |
5447 | 985 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
986 retval.append (octave_value (C)); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
987 } |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
988 } |
5447 | 989 |
990 return retval; | |
991 } | |
992 | |
5794 | 993 DEFUN (info_file, args, nargout, |
994 "-*- texinfo -*-\n\ | |
995 @deftypefn {Built-in Function} {@var{val} =} info_file ()\n\ | |
996 @deftypefnx {Built-in Function} {@var{old_val} =} info_file (@var{new_val})\n\ | |
997 Query or set the internal variable that specifies the name of the\n\ | |
998 Octave info file. The default value is\n\ | |
999 @code{\"@var{octave-home}/info/octave.info\"}, in\n\ | |
1000 which @var{octave-home} is the directory where all of Octave is installed.\n\ | |
1001 @seealso{info_program, doc, help, makeinfo_program}\n\ | |
1002 @end deftypefn") | |
2202 | 1003 { |
5794 | 1004 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (info_file); |
2202 | 1005 } |
1006 | |
5794 | 1007 DEFUN (info_program, args, nargout, |
1008 "-*- texinfo -*-\n\ | |
1009 @deftypefn {Built-in Function} {@var{val} =} info_program ()\n\ | |
1010 @deftypefnx {Built-in Function} {@var{old_val} =} info_program (@var{new_val})\n\ | |
1011 Query or set the internal variable that specifies the name of the\n\ | |
7096 | 1012 info program to run. The default value is\n\ |
3686 | 1013 @code{\"@var{octave-home}/libexec/octave/@var{version}/exec/@var{arch}/info\"}\n\ |
1014 in which @var{octave-home} is the directory where all of Octave is\n\ | |
1015 installed, @var{version} is the Octave version number, and @var{arch}\n\ | |
1016 is the system type (for example, @code{i686-pc-linux-gnu}). The\n\ | |
1017 default initial value may be overridden by the environment variable\n\ | |
1018 @code{OCTAVE_INFO_PROGRAM}, or the command line argument\n\ | |
5794 | 1019 @code{--info-program NAME}.\n\ |
1020 @seealso{info_file, doc, help, makeinfo_program}\n\ | |
1021 @end deftypefn") | |
1022 { | |
1023 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (info_program); | |
1024 } | |
3686 | 1025 |
5794 | 1026 DEFUN (makeinfo_program, args, nargout, |
1027 "-*- texinfo -*-\n\ | |
1028 @deftypefn {Built-in Function} {@var{val} =} makeinfo_program ()\n\ | |
1029 @deftypefnx {Built-in Function} {@var{old_val} =} makeinfo_program (@var{new_val})\n\ | |
1030 Query or set the internal variable that specifies the name of the\n\ | |
1031 makeinfo program that Octave runs to format help text containing\n\ | |
1032 Texinfo markup commands. The default initial value is @code{\"makeinfo\"}.\n\ | |
1033 @seealso{info_file, info_program, doc, help}\n\ | |
1034 @end deftypefn") | |
1035 { | |
1036 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (makeinfo_program); | |
1037 } | |
2202 | 1038 |
5794 | 1039 DEFUN (suppress_verbose_help_message, args, nargout, |
1040 "-*- texinfo -*-\n\ | |
1041 @deftypefn {Built-in Function} {@var{val} =} suppress_verbose_help_message ()\n\ | |
1042 @deftypefnx {Built-in Function} {@var{old_val} =} suppress_verbose_help_message (@var{new_val})\n\ | |
7001 | 1043 Query or set the internal variable that controls whether Octave\n\ |
5794 | 1044 will add additional help information to the end of the output from\n\ |
3332 | 1045 the @code{help} command and usage messages for built-in commands.\n\ |
5794 | 1046 @end deftypefn") |
1047 { | |
1048 return SET_INTERNAL_VARIABLE (suppress_verbose_help_message); | |
2189 | 1049 } |
1050 | |
1 | 1051 /* |
1052 ;;; Local Variables: *** | |
1053 ;;; mode: C++ *** | |
1054 ;;; End: *** | |
1055 */ |