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