Mercurial > octave
annotate libinterp/corefcn/help.cc @ 29961:7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
Files affected: __betainc__.cc, __contourc__.cc, __eigs__.cc,
__expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, balance.cc,
besselj.cc, bsxfun.cc, call-stack.cc, ccolamd.cc, cellfun.cc, chol.cc,
colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
defaults.cc, dirfns.cc, display.cc, dlmread.cc, dmperm.cc, dot.cc,
eig.cc, ellipj.cc, environment.cc, error.cc, event-manager.cc, fft.cc,
fft2.cc, fftn.cc, file-io.cc, find.cc, gcd.cc, getgrent.cc,
getpwent.cc, getrusage.cc, gsvd.cc, hash.cc, help.cc, hess.cc,
hex2num.cc, input.cc, inv.cc, jsondecode.cc, jsonencode.cc,
load-path.cc, load-save.cc, lookup.cc, lsode.cc, lu.cc, max.cc,
mgorth.cc, oct-hist.cc, ordqz.cc, ordschur.cc, pager.cc, pr-output.cc,
psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, regexp.cc,
schur.cc, settings.cc, sighandlers.cc, sparse.cc, spparms.cc,
sqrtm.cc, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc,
symbfact.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, toplev.cc,
tril.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, ov-cell.cc, ov-class.cc,
ov-classdef.cc, ov-fcn-handle.cc, ov-struct.cc, ov-typeinfo.cc,
ov-usr-fcn.cc, octave.cc, lex.ll, oct-parse.yy, profiler.cc,
andpt-eval.cc.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Aug 2021 22:48:52 -0400 |
parents | 939bef0b66e0 |
children | bfbe6e528af5 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29006
diff
changeset
|
3 // Copyright (C) 1993-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
1 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
1 | 28 #endif |
29 | |
1343 | 30 #include <cstdlib> |
31 #include <cstring> | |
32 | |
5769 | 33 #include <algorithm> |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
34 #include <fstream> |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25395
diff
changeset
|
35 #include <istream> |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
36 #include <map> |
5765 | 37 #include <sstream> |
1755 | 38 #include <string> |
39 | |
3295 | 40 #include "cmd-edit.h" |
41 #include "file-ops.h" | |
6253 | 42 #include "file-stat.h" |
25548
d6050ba12c0c
Call get_ASCII_filename for std::ifstream (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25460
diff
changeset
|
43 #include "lo-sysdep.h" |
2926 | 44 #include "oct-env.h" |
19269
65554f5847ac
don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents:
19152
diff
changeset
|
45 #include "oct-locbuf.h" |
1755 | 46 #include "str-vec.h" |
47 | |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
48 #include "Cell.h" |
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
49 #include "builtin-defun-decls.h" |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
50 #include "defaults.h" |
1352 | 51 #include "defun.h" |
52 #include "error.h" | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21017
diff
changeset
|
53 #include "errwarn.h" |
1352 | 54 #include "help.h" |
2177 | 55 #include "input.h" |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
56 #include "interpreter-private.h" |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
57 #include "interpreter.h" |
5832 | 58 #include "load-path.h" |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
59 #include "ov-fcn-handle.h" |
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
60 #include "ov-usr-fcn.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20939
diff
changeset
|
61 #include "ovl.h" |
1352 | 62 #include "pager.h" |
3018 | 63 #include "parse.h" |
1466 | 64 #include "pathsearch.h" |
3295 | 65 #include "procstream.h" |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
66 #include "quit.h" |
529 | 67 #include "sighandlers.h" |
68 #include "symtab.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" |
529 | 73 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
74 #include "default-defs.h" |
2189 | 75 |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
76 OCTAVE_NAMESPACE_BEGIN |
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
77 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
78 const static char * const operators[] = |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
79 { |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
80 "!", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
81 "~", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
82 "!=", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
83 "~=", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
84 R"(")", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
85 "#", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
86 "%", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
87 "#{", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
88 "%{", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
89 "#}", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
90 "%}", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
91 "...", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
92 "&", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
93 "&&", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
94 "'", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
95 "(", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
96 ")", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
97 "*", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
98 "**", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
99 "^", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
100 "+", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
101 "++", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
102 ",", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
103 "-", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
104 "--", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
105 ".'", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
106 ".*", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
107 ".**", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
108 ".^", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
109 "./", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
110 "/", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
111 R"(.\)", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
112 R"(\)", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
113 ":", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
114 ";", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
115 "<", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
116 "<=", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
117 "=", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
118 "==", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
119 ">", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
120 ">=", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
121 "[", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
122 "]", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
123 "|", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
124 "||", |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
125 nullptr |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
126 }; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
127 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
128 const static string_vector operator_names (operators); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
129 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
130 static bool |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
131 looks_like_html (const std::string& msg) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
132 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
133 const std::size_t p1 = msg.find ('\n'); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
134 std::string t = msg.substr (0, p1); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
135 // FIXME: this comparison should be case-insensitive |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
136 const std::size_t p2 = t.find ("<html"); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
137 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
138 return (p2 != std::string::npos); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
139 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
140 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
141 static bool |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
142 looks_like_texinfo (const std::string& msg, std::size_t& p1) |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
143 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
144 p1 = msg.find ('\n'); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
145 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
146 std::string t = msg.substr (0, p1); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
147 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
148 if (p1 == std::string::npos) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
149 p1 = 0; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
150 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
151 std::size_t p2 = t.find ("-*- texinfo -*-"); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
152 |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
153 return (p2 != std::string::npos); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
154 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27037
diff
changeset
|
155 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
156 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
157 help_system::built_in_docstrings_file (const octave_value_list& args, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
158 int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
159 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
160 return set_internal_variable (m_built_in_docstrings_file, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
161 "built_in_docstrings_file", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
162 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
163 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
164 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
165 help_system::doc_cache_file (const octave_value_list& args, int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
166 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
167 return set_internal_variable (m_doc_cache_file, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
168 "doc_cache_file", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
169 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
170 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
171 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
172 help_system::info_file (const octave_value_list& args, int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
173 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
174 return set_internal_variable (m_info_file, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
175 "info_file", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
176 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
177 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
178 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
179 help_system::info_program (const octave_value_list& args, int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
180 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
181 return set_internal_variable (m_info_program, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
182 "info_program", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
183 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
184 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
185 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
186 help_system::makeinfo_program (const octave_value_list& args, int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
187 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
188 return set_internal_variable (m_makeinfo_program, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
189 "makeinfo_program", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
190 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
191 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
192 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
193 help_system::suppress_verbose_help_message (const octave_value_list& args, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
194 int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
195 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
196 return set_internal_variable (m_suppress_verbose_help_message, args, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
197 nargout, "suppress_verbose_help_message"); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
198 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
199 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
200 octave_value |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
201 help_system::texi_macros_file (const octave_value_list& args, int nargout) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
202 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
203 return set_internal_variable (m_texi_macros_file, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
204 "texi_macros_file", false); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
205 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
206 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
207 std::string |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
208 help_system::raw_help (const std::string& nm, bool& symbol_found) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
209 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
210 std::string h; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
211 std::string w; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
212 std::string f; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
213 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
214 bool found; |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
215 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
216 found = raw_help_from_symbol_table (nm, h, w, symbol_found); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
217 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
218 if (! found) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
219 found = raw_help_from_file (nm, h, f, symbol_found); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
220 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
221 bool external_doc = h.compare (0, 12, "external-doc") == 0; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
222 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
223 if (! found || external_doc) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
224 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
225 std::string tmp_nm = nm; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
226 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
227 if (external_doc && h.length () > 12 && h[12] == ':') |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
228 tmp_nm = h.substr (13); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
229 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
230 raw_help_from_docstrings_file (tmp_nm, h, symbol_found); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
231 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
232 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
233 return h; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
234 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
235 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
236 std::string help_system::which (const std::string& name, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
237 std::string& type) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
238 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
239 std::string file; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
240 |
26594
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
241 if (name.empty ()) |
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
242 return file; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
243 |
26594
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
244 type = ""; |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
245 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
246 if (name.find_first_of ('.') == std::string::npos) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
247 { |
26594
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
248 symbol_table& symtab = m_interpreter.get_symbol_table (); |
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
249 |
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
250 octave_value val = symtab.find_function (name); |
088b8a2dcb06
use @CLASS name when searching for @CLASS/METHOD (bug #55501)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
251 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
252 if (val.is_defined ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
253 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
254 octave_function *fcn = val.function_value (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
255 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
256 if (fcn) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
257 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
258 file = fcn->fcn_file_name (); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
259 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
260 if (file.empty ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
261 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
262 if (fcn->is_user_function ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
263 type = "command-line function"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
264 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
265 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
266 file = fcn->src_file_name (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
267 type = "built-in function"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
268 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
269 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
270 else |
23829
01899bdd2a3a
Eliminate unnecessary std::string ("...") constructor calls when "..." suffices.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
271 type = val.is_user_script () ? "script" : "function"; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
272 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
273 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
274 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
275 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
276 // We might find a file that contains only a doc string. |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
277 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
278 load_path& lp = m_interpreter.get_load_path (); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
279 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
280 file = lp.find_fcn_file (name); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
281 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
282 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
283 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
284 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
285 // File query. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
286 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
287 load_path& lp = m_interpreter.get_load_path (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
288 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
289 // For compatibility: "file." queries "file". |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
290 if (name.size () > 1 && name[name.size () - 1] == '.') |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
291 file = lp.find_file (name.substr (0, name.size () - 1)); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
292 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
293 file = lp.find_file (name); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
294 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
295 file = sys::env::make_absolute (file); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
296 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
297 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
298 return file; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
299 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
300 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
301 std::string help_system::which (const std::string& name) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
302 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
303 std::string type; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
304 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
305 return which (name, type); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
306 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
307 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
308 string_vector help_system::make_name_list (void) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
309 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
310 const static string_vector keywords |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
311 = Fiskeyword ()(0).string_vector_value (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
312 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
313 const static int key_len = keywords.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
314 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
315 symbol_table& symtab = m_interpreter.get_symbol_table (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
316 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
317 const string_vector bif = symtab.built_in_function_names (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
318 const int bif_len = bif.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
319 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
320 const string_vector cfl = symtab.cmdline_function_names (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
321 const int cfl_len = cfl.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
322 |
26661
cf9e10ce3351
move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents:
26594
diff
changeset
|
323 const string_vector lcl = m_interpreter.variable_names (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
324 const int lcl_len = lcl.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
325 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
326 load_path& lp = m_interpreter.get_load_path (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
327 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
328 const string_vector ffl = lp.fcn_names (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
329 const int ffl_len = ffl.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
330 |
27016
9b261300a001
move file-scope static autoload map variable and functions to evaluator
John W. Eaton <jwe@octave.org>
parents:
26679
diff
changeset
|
331 const string_vector afl = m_interpreter.autoloaded_functions (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
332 const int afl_len = afl.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
333 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
334 const string_vector lfl = local_functions (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
335 const int lfl_len = lfl.numel (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
336 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
337 const int total_len |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
338 = key_len + bif_len + cfl_len + lcl_len + ffl_len + afl_len + lfl_len; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
339 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
340 string_vector list (total_len); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
341 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
342 // Put all the symbols in one big list. |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
343 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
344 int j = 0; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
345 int i = 0; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
346 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
347 for (i = 0; i < key_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
348 list[j++] = keywords[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
349 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
350 for (i = 0; i < bif_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
351 list[j++] = bif[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
352 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
353 for (i = 0; i < cfl_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
354 list[j++] = cfl[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
355 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
356 for (i = 0; i < lcl_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
357 list[j++] = lcl[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
358 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
359 for (i = 0; i < ffl_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
360 list[j++] = ffl[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
361 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
362 for (i = 0; i < afl_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
363 list[j++] = afl[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
364 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
365 for (i = 0; i < lfl_len; i++) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
366 list[j++] = lfl[i]; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
367 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
368 return list; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
369 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
370 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
371 void help_system::get_help_text (const std::string& name, std::string& text, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
372 std::string& format) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
373 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
374 bool symbol_found = false; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
375 text = raw_help (name, symbol_found); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
376 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
377 format = "Not found"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
378 if (symbol_found) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
379 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
380 std::size_t idx = -1; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
381 if (text.empty ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
382 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
383 format = "Not documented"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
384 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
385 else if (looks_like_texinfo (text, idx)) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
386 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
387 format = "texinfo"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
388 text.erase (0, idx); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
389 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
390 else if (looks_like_html (text)) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
391 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
392 format = "html"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
393 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
394 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
395 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
396 format = "plain text"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
397 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
398 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
399 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
400 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
401 void help_system::get_help_text_from_file (const std::string& fname, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
402 std::string& text, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
403 std::string& format) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
404 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
405 bool symbol_found = false; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
406 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
407 std::string f; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
408 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
409 raw_help_from_file (fname, text, f, symbol_found); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
410 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
411 format = "Not found"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
412 if (symbol_found) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
413 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
414 std::size_t idx = -1; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
415 if (text.empty ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
416 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
417 format = "Not documented"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
418 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
419 else if (looks_like_texinfo (text, idx)) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
420 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
421 format = "texinfo"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
422 text.erase (0, idx); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
423 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
424 else if (looks_like_html (text)) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
425 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
426 format = "html"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
427 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
428 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
429 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
430 format = "plain text"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
431 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
432 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
433 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
434 |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
435 std::string help_system::init_built_in_docstrings_file (void) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
436 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
437 std::string df = sys::env::getenv ("OCTAVE_BUILT_IN_DOCSTRINGS_FILE"); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
438 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
439 std::string dir_sep = sys::file_ops::dir_sep_str (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
440 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
441 if (df.empty ()) |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
442 df = config::oct_etc_dir () + dir_sep + "built-in-docstrings"; |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
443 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
444 return df; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
445 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
446 |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
447 std::string help_system::init_doc_cache_file (void) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
448 { |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
449 std::string def_file = config::prepend_octave_home (OCTAVE_DOC_CACHE_FILE); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
450 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
451 std::string env_file = sys::env::getenv ("OCTAVE_DOC_CACHE_FILE"); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
452 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
453 return (env_file.empty () ? def_file : env_file); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
454 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
455 |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
456 std::string help_system::init_info_file (void) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
457 { |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
458 std::string std_info_file = config::prepend_octave_home (OCTAVE_INFOFILE); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
459 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
460 std::string oct_info_file = sys::env::getenv ("OCTAVE_INFO_FILE"); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
461 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
462 return (oct_info_file.empty () ? std_info_file : oct_info_file); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
463 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
464 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
465 std::string help_system::init_info_program (void) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
466 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
467 std::string info_prog = sys::env::getenv ("OCTAVE_INFO_PROGRAM"); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
468 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
469 if (info_prog.empty ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
470 info_prog = "info"; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
471 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
472 return info_prog; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
473 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
474 |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
475 std::string help_system::init_texi_macros_file (void) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
476 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
477 std::string def_file |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
478 = config::prepend_octave_home (OCTAVE_TEXI_MACROS_FILE); |
22295
12f1d273d22a
maint: Remove trailing spaces from code.
Rik <rik@octave.org>
parents:
22199
diff
changeset
|
479 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
480 std::string env_file = sys::env::getenv ("OCTAVE_TEXI_MACROS_FILE"); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
481 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
482 return (env_file.empty () ? def_file : env_file); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
483 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
484 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
485 // Return a vector of all functions from this file, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
486 // for use in command line auto-completion. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
487 string_vector help_system::local_functions (void) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
488 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
489 string_vector retval; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
490 |
27202
23962b243bad
eliminate direct access to call stack in help functions
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
491 tree_evaluator& tw = m_interpreter.get_evaluator (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
492 |
27202
23962b243bad
eliminate direct access to call stack in help functions
John W. Eaton <jwe@octave.org>
parents:
27102
diff
changeset
|
493 octave_user_code *curr_fcn = tw.current_user_code (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
494 |
25394
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
495 if (! curr_fcn) |
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
496 return retval; |
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
497 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
498 // All subfunctions are listed in the top-level function of this file. |
25394
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
499 // If curr_fcn is a subfunction, then there must be a parent and |
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
500 // curr_fcn will always be valid in and after executing this loop. |
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
501 |
9e39a53b4e00
make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents:
25388
diff
changeset
|
502 while (curr_fcn->is_subfunction ()) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
503 { |
24361
8bcfddad15ec
use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents:
24270
diff
changeset
|
504 symbol_scope pscope = curr_fcn->parent_fcn_scope (); |
27745
7a45100a40c4
allow private scripts to be called from other private scripts
John W. Eaton <jwe@octave.org>
parents:
27461
diff
changeset
|
505 curr_fcn = pscope.user_code (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
506 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
507 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
508 // Get subfunctions. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
509 const std::list<std::string> names = curr_fcn->subfunction_names (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
510 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
511 std::size_t sz = names.size (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
512 retval.resize (sz); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
513 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
514 // Loop over them. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
515 std::size_t i = 0; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
516 for (const auto& nm : names) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
517 retval(i++) = nm; |
22556
121e9639b604
doc: Correctly get last entry from DOCSTRINGS file (bug #49224).
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
518 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
519 return retval; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
520 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
521 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
522 bool help_system::raw_help_from_symbol_table (const std::string& nm, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
523 std::string& h, std::string& w, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
524 bool& symbol_found) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
525 { |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
526 std::string meth_nm; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
527 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
528 symbol_table& symtab = m_interpreter.get_symbol_table (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
529 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
530 octave_value val = symtab.find_function (nm); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
531 |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
532 if (! val.is_defined ()) |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
533 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
534 std::size_t pos = nm.rfind ('.'); |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
535 |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
536 if (pos != std::string::npos) |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
537 { |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
538 meth_nm = nm.substr (pos+1); |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
539 |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
540 val = symtab.find_function (nm.substr (0, pos)); |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
541 } |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
542 } |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
543 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
544 if (val.is_defined ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
545 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
546 octave_function *fcn = val.function_value (); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
547 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
548 if (fcn) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
549 { |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
550 // FCN may actually be a classdef_meta object. |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
551 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
552 symbol_found = true; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
553 |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
554 h = fcn->doc_string (meth_nm); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
555 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
556 w = fcn->fcn_file_name (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
557 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
558 if (w.empty ()) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
559 w = fcn->is_user_function () ? "command-line function" |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
560 : "built-in function"; |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
561 |
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
562 return true; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
563 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
564 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
565 |
28514
fab862fedf85
allow help to find docstrings for classdef classes and methods (bug #43047)
John W. Eaton <jwe@octave.org>
parents:
28432
diff
changeset
|
566 return false; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
567 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
568 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
569 bool help_system::raw_help_from_file (const std::string& nm, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
570 std::string& h, std::string& file, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
571 bool& symbol_found) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
572 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
573 bool retval = false; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
574 |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
575 h = get_help_from_file (nm, symbol_found, file); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
576 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
577 if (h.length () > 0) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
578 retval = true; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
579 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
580 return retval; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
581 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
582 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
583 bool |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
584 help_system::raw_help_from_docstrings_file (const std::string& nm, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
585 std::string& h, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
586 bool& symbol_found) const |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
587 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
588 typedef std::pair<std::streampos, std::streamoff> txt_limits_type; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
589 typedef std::map<std::string, txt_limits_type> help_txt_map_type; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
590 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
591 static help_txt_map_type help_txt_map; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
592 static bool initialized = false; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
593 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
594 h = ""; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
595 symbol_found = false; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
596 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
597 // FIXME: Should we cache the timestamp of the file and reload the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
598 // offsets if it changes? Or just warn about that? Or just ignore |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
599 // it, and assume it won't change? |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
600 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
601 if (! initialized) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
602 { |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28880
diff
changeset
|
603 std::ifstream file = sys::ifstream (m_built_in_docstrings_file.c_str (), |
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28880
diff
changeset
|
604 std::ios::in | std::ios::binary); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
605 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
606 if (! file) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
607 error ("failed to open docstrings file: %s", |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
608 m_built_in_docstrings_file.c_str ()); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
609 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
610 // Ignore header; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
611 file.ignore (std::numeric_limits<std::streamsize>::max(), 0x1d); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
612 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
613 if (file.eof ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
614 error ("invalid built-in-docstrings file!"); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
615 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
616 // FIXME: eliminate fixed buffer size. |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
617 std::size_t bufsize = 1000; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
618 OCTAVE_LOCAL_BUFFER (char, buf, bufsize); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
619 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
620 while (! file.eof ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
621 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
622 std::string name; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
623 int i = 0; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
624 int c; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
625 while (file && (c = file.get ()) != std::istream::traits_type::eof ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
626 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
627 if (c == '\n' || c == '\r') |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
628 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
629 buf[i] = '\0'; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
630 name = buf; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
631 break; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
632 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
633 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
634 buf[i++] = c; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
635 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
636 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
637 // Skip @c FILENAME which is part of current DOCSTRINGS |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
638 // syntax. This may disappear if a specific format for |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
639 // docstring files is developed. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
640 while (file |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
641 && (c = file.get ()) != std::istream::traits_type::eof () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
642 && c != '\n' && c != '\r') |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
643 ; // skip text |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
644 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
645 // skip newline characters |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
646 while (file |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
647 && (c = file.get ()) != std::istream::traits_type::eof () |
26347
09a793a92c11
help.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
25604
diff
changeset
|
648 && (c == '\n' || c == '\r')) |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
649 ; // skip text |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
650 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
651 file.unget (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
652 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
653 // Position of beginning of help text. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
654 std::streampos beg = file.tellg (); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
655 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
656 // Skip help text. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
657 file.ignore (std::numeric_limits<std::streamsize>::max(), 0x1d); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
658 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
659 // Position of end of help text. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
660 std::streamoff len; |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
661 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
662 if (! file.eof ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
663 len = file.tellg () - beg - 1; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
664 else |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
665 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
666 file.seekg (0, file.end); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
667 len = file.tellg () - beg - 1; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
668 file.setstate (file.eofbit); // reset eof flag |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
669 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
670 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
671 help_txt_map[name] = txt_limits_type (beg, len); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
672 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
673 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
674 initialized = true; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
675 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
676 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
677 help_txt_map_type::const_iterator it = help_txt_map.find (nm); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
678 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
679 if (it != help_txt_map.end ()) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
680 { |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
681 txt_limits_type txt_limits = it->second; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
682 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
683 std::streampos beg = txt_limits.first; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
684 std::streamoff len = txt_limits.second; |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
685 |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28880
diff
changeset
|
686 std::ifstream file = sys::ifstream (m_built_in_docstrings_file.c_str (), |
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28880
diff
changeset
|
687 std::ios::in | std::ios::binary); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
688 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
689 if (! file) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
690 error ("failed to open docstrings file: %s", |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
691 m_built_in_docstrings_file.c_str ()); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
692 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
693 file.seekg (beg); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
694 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
695 std::size_t txt_len = len; |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
696 OCTAVE_LOCAL_BUFFER (char, buf, txt_len + 1); |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
697 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
698 file.read (buf, txt_len); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
699 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
700 buf[txt_len] = '\0'; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
701 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
702 h = buf; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
703 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
704 symbol_found = true; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
705 } |
22198
f6181638f6c5
search docstrings file for built-in and dld function help text (bug #48554)
John W. Eaton <jwe@octave.org>
parents:
22172
diff
changeset
|
706 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
707 return symbol_found; |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
708 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
709 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
710 // FIXME: It's not likely that this does the right thing now. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
711 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
712 string_vector make_name_list (void) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
713 { |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
714 help_system& help_sys = __get_help_system__ ("make_name_list"); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
715 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
716 return help_sys.make_name_list (); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
717 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29670
diff
changeset
|
718 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
719 DEFMETHOD (get_help_text, interp, args, , |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
720 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
721 @deftypefn {} {[@var{text}, @var{format}] =} get_help_text (@var{name}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
722 Return the raw help text of function @var{name}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
723 |
27438
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
724 The raw help text is returned in @var{text} and the format in @var{format}. |
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
725 The format is a string which is one of @qcode{"texinfo"}, @qcode{"html"}, or |
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
726 @w{@qcode{"plain text"}}. |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
727 @seealso{get_help_text_from_file} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
728 @end deftypefn */) |
529 | 729 { |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
730 if (args.length () != 1) |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
731 print_usage (); |
1755 | 732 |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
733 const std::string name = args(0).xstring_value ("get_help_text: NAME must be a string"); |
529 | 734 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
735 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
736 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20922
diff
changeset
|
737 std::string text, format; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
738 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
739 help_sys.get_help_text (name, text, format); |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
740 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20922
diff
changeset
|
741 return ovl (text, format); |
529 | 742 } |
743 | |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
744 DEFMETHOD (get_help_text_from_file, interp, args, , |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
745 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
746 @deftypefn {} {[@var{text}, @var{format}] =} get_help_text_from_file (@var{fname}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
747 Return the raw help text from the file @var{fname}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
748 |
27438
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
749 The raw help text is returned in @var{text} and the format in @var{format}. |
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
750 The format is a string which is one of @qcode{"texinfo"}, @qcode{"html"}, or |
7db34a40cd23
doc: Improve documentation for get_help_text, get_help_text_from_file.
Rik <rik@octave.org>
parents:
27361
diff
changeset
|
751 @w{@qcode{"plain text"}}. |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
752 @seealso{get_help_text} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
753 @end deftypefn */) |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9416
diff
changeset
|
754 { |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
755 if (args.length () != 1) |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
756 print_usage (); |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9416
diff
changeset
|
757 |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
758 const std::string fname = args(0).xstring_value ("get_help_text_from_file: NAME must be a string"); |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9416
diff
changeset
|
759 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
760 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
761 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20922
diff
changeset
|
762 std::string text, format; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
763 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
764 help_sys.get_help_text_from_file (fname, text, format); |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
765 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20922
diff
changeset
|
766 return ovl (text, format); |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9416
diff
changeset
|
767 } |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9416
diff
changeset
|
768 |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
769 // Return a cell array of strings containing the names of all operators. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
770 |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
771 DEFUN (__operators__, , , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
772 doc: /* -*- texinfo -*- |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
773 @deftypefn {} {} __operators__ () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
774 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
775 @end deftypefn */) |
3355 | 776 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
777 return ovl (Cell (operator_names)); |
3355 | 778 } |
779 | |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
780 // Return a cell array of strings containing the names of all keywords. |
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
781 // iskeyword() function is located in lex.ll and is based on what the parser |
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
782 // thinks is a keyword. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
783 |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
784 DEFALIAS (__keywords__, iskeyword) |
581 | 785 |
23065
7c7a61c2e0ed
Replace out-of-date __keywords__ with alias to iskeyword.
Rik <rik@octave.org>
parents:
23052
diff
changeset
|
786 // Return a cell array of strings with the names of all builtin functions. |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
787 |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
788 DEFMETHOD (__builtins__, interp, , , |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
789 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
790 @deftypefn {} {} __builtins__ () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
791 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
792 @end deftypefn */) |
3355 | 793 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
794 symbol_table& symtab = interp.get_symbol_table (); |
23599
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
795 |
5cb3a2bb5e1e
don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents:
23553
diff
changeset
|
796 const string_vector bif = symtab.built_in_function_names (); |
3355 | 797 |
21127
df7891224709
maint: Use "return ovl (...)" in DEFUN macros.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
798 return ovl (Cell (bif)); |
3355 | 799 } |
800 | |
23553
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23466
diff
changeset
|
801 DEFMETHOD (localfunctions, interp, args, , |
14723784b9f2
don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents:
23466
diff
changeset
|
802 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
803 @deftypefn {} {} localfunctions () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
804 Return a list of all local functions, i.e., subfunctions, within the current |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
805 file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
806 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
807 The return value is a column cell array of function handles to all local |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
808 functions accessible from the function from which @code{localfunctions} is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
809 called. Nested functions are @emph{not} included in the list. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
810 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
811 If the call is from the command line, an anonymous function, or a script, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
812 the return value is an empty cell array. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
813 |
22974
ecc5eeada8dc
Don't mark nested functions in primary function as subfunctions.
Rik <rik@octave.org>
parents:
22885
diff
changeset
|
814 @seealso{functions} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
815 @end deftypefn */) |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
816 { |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
817 if (args.length () != 0) |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
818 print_usage (); |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
819 |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
820 Cell retval; |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
821 |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
822 // Find the main function we are in. |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
823 tree_evaluator& tw = interp.get_evaluator (); |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
824 octave_user_code *caller = tw.debug_user_code (); |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
825 |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
826 if (! caller) |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
827 return ovl (retval); |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
828 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
829 symbol_scope scope = caller->scope (); |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
830 |
28432
71c34141cc2d
refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
831 return ovl (Cell (scope.localfunctions ())); |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
832 } |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
833 |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
834 /* |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
835 %!test |
26679
2b6aa96a5c82
create BIST temporary files in tempdir instead of P_tmpdir (bug #55565)
Mike Miller <mtmiller@octave.org>
parents:
26677
diff
changeset
|
836 %! f = tempname (tempdir (), "oct_"); |
27361
a7d21a6a7922
BIST should not rely on the current directory to be writable.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
26594
diff
changeset
|
837 %! [~, fcn_name] = fileparts (f); |
22016
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
838 %! f = [f ".m"]; |
26677
33f79d94f21f
Create any BIST temporary files in writable temporary directory (bug #55565).
Rik <rik@octave.org>
parents:
26661
diff
changeset
|
839 %! save_path = path (); |
22016
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
840 %! unwind_protect |
26679
2b6aa96a5c82
create BIST temporary files in tempdir instead of P_tmpdir (bug #55565)
Mike Miller <mtmiller@octave.org>
parents:
26677
diff
changeset
|
841 %! addpath (tempdir ()); |
22016
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
842 %! fid = fopen (f, "w+"); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
843 %! fprintf (fid, "function z = %s\n z = localfunctions; end\n", fcn_name); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
844 %! fprintf (fid, "function z = b(x)\n z = x+1; end\n"); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
845 %! fprintf (fid, "function z = c(x)\n z = 2*x; end\n"); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
846 %! fclose (fid); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
847 %! d = eval (fcn_name); |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
848 %! assert (size (d), [2, 1]); |
22974
ecc5eeada8dc
Don't mark nested functions in primary function as subfunctions.
Rik <rik@octave.org>
parents:
22885
diff
changeset
|
849 %! assert (d{1} (3), 4); |
ecc5eeada8dc
Don't mark nested functions in primary function as subfunctions.
Rik <rik@octave.org>
parents:
22885
diff
changeset
|
850 %! assert (d{2} (3), 6); |
22016
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
851 %! unwind_protect_cleanup |
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
852 %! unlink (f); |
26677
33f79d94f21f
Create any BIST temporary files in writable temporary directory (bug #55565).
Rik <rik@octave.org>
parents:
26661
diff
changeset
|
853 %! path (save_path); |
22016
d4ce10f57918
Clean up localfunctions BIST test
Mike Miller <mtmiller@octave.org>
parents:
21966
diff
changeset
|
854 %! end_unwind_protect |
21765
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
855 */ |
23a610a3f001
Implement localfunctions Matlab command (bug #47705).
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21733
diff
changeset
|
856 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
857 DEFMETHOD (__which__, interp, args, , |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
858 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
859 @deftypefn {} {} __which__ (@var{name}, @dots{}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
860 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
861 @end deftypefn */) |
581 | 862 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
863 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
864 |
20996 | 865 string_vector argv = args.make_argv (); |
1755 | 866 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
867 int nargin = argv.numel (); |
581 | 868 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
869 octave_map m (dim_vector (1, nargin)); |
581 | 870 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
871 Cell names (1, nargin); |
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
872 Cell files (1, nargin); |
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
873 Cell types (1, nargin); |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
874 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
875 for (int i = 0; i < nargin; i++) |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
876 { |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
877 std::string name = argv[i]; |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
878 |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
879 std::string type; |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
880 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
881 std::string file = help_sys.which (name, type); |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
882 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
883 names(i) = name; |
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
884 files(i) = file; |
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
885 types(i) = type; |
20803
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
886 } |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
887 |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
888 m.assign ("name", names); |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
889 m.assign ("file", files); |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
890 m.assign ("type", types); |
c22206c1a88f
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20714
diff
changeset
|
891 |
20922
49081851fddc
Eliminate duplicate input arg checking in which.m and __which__.
Rik <rik@octave.org>
parents:
20884
diff
changeset
|
892 return ovl (m); |
581 | 893 } |
894 | |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
895 // 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
|
896 // 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
|
897 // the current path. |
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8672
diff
changeset
|
898 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
899 DEFMETHOD (__list_functions__, interp, args, , |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
900 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
901 @deftypefn {} {@var{retval} =} __list_functions__ () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
902 @deftypefnx {} {@var{retval} =} __list_functions__ (@var{directory}) |
22337
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
903 Return a list of all functions (.m and .oct functions) in the load path. |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
904 |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
905 If the optional argument @var{directory} is given then list only the functions |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
906 in that directory. |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
907 @seealso{path} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
908 @end deftypefn */) |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
8503
diff
changeset
|
909 { |
8863
34a821854961
pkg.m (generate_lookfor_cache): generate a DOC file for each directory
Jason Riedy <jason@acm.org>
parents:
8861
diff
changeset
|
910 octave_value retval; |
5447 | 911 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
912 load_path& lp = interp.get_load_path (); |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
913 |
22337
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
914 if (args.length () == 0) |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
915 { |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
916 // Get list of all functions |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
917 string_vector ffl = lp.fcn_names (); |
27016
9b261300a001
move file-scope static autoload map variable and functions to evaluator
John W. Eaton <jwe@octave.org>
parents:
26679
diff
changeset
|
918 string_vector afl = interp.autoloaded_functions (); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
919 |
22337
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
920 retval = Cell (ffl.append (afl)); |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
921 } |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20232
diff
changeset
|
922 else |
5447 | 923 { |
20700
68e3a747ca02
rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents:
20678
diff
changeset
|
924 std::string dir = args(0).xstring_value ("__list_functions__: DIRECTORY argument must be a string"); |
8863
34a821854961
pkg.m (generate_lookfor_cache): generate a DOC file for each directory
Jason Riedy <jason@acm.org>
parents:
8861
diff
changeset
|
925 |
23438
d24d01273bd0
eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
926 string_vector fl = lp.files (dir, true); |
19403
03067dab10ca
Use stricter input validation when looking for a string as input (bug #42651).
Rik <rik@octave.org>
parents:
19269
diff
changeset
|
927 |
22337
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
928 // Return a sorted list with unique entries (in case of .m and .oct |
77c209d63b75
Update __list_functions__ internal function.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
929 // versions of the same function in a given directory, for example). |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20232
diff
changeset
|
930 fl.sort (true); |
8863
34a821854961
pkg.m (generate_lookfor_cache): generate a DOC file for each directory
Jason Riedy <jason@acm.org>
parents:
8861
diff
changeset
|
931 |
20581
fd0efcdb3718
use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents:
20232
diff
changeset
|
932 retval = Cell (fl); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11572
diff
changeset
|
933 } |
5447 | 934 |
935 return retval; | |
936 } | |
937 | |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
938 DEFMETHOD (built_in_docstrings_file, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
939 doc: /* -*- texinfo -*- |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
940 @deftypefn {} {@var{val} =} built_in_docstrings_file () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
941 @deftypefnx {} {@var{old_val} =} built_in_docstrings_file (@var{new_val}) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
942 @deftypefnx {} {} built_in_docstrings_file (@var{new_val}, "local") |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
943 Query or set the internal variable that specifies the name of the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
944 file containing docstrings for built-in Octave functions. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
945 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
946 The default value is |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
947 @file{@var{octave-home}/share/octave/@var{version}/etc/built-in-docstrings}, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
948 in which @var{octave-home} is the root directory of the Octave installation, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
949 and @var{version} is the Octave version number. The default value may be |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
950 overridden by the environment variable |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
951 @w{@env{OCTAVE_BUILT_IN_DOCSTRINGS_FILE}}, or the command line argument |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
952 @option{--built-in-docstrings-file FNAME}. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
953 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
954 Note: This variable is only used when Octave is initializing itself. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
955 Modifying it during a running session of Octave will have no effect. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
956 @end deftypefn */) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
957 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
958 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
959 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
960 return help_sys.built_in_docstrings_file (args, nargout); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
961 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
962 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
963 DEFMETHOD (doc_cache_file, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
964 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
965 @deftypefn {} {@var{val} =} doc_cache_file () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
966 @deftypefnx {} {@var{old_val} =} doc_cache_file (@var{new_val}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
967 @deftypefnx {} {} doc_cache_file (@var{new_val}, "local") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
968 Query or set the internal variable that specifies the name of the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
969 Octave documentation cache file. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
970 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
971 A cache file significantly improves the performance of the @code{lookfor} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
972 command. The default value is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
973 @file{@var{octave-home}/share/octave/@var{version}/etc/doc-cache}, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
974 in which @var{octave-home} is the root directory of the Octave installation, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
975 and @var{version} is the Octave version number. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
976 The default value may be overridden by the environment variable |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
977 @w{@env{OCTAVE_DOC_CACHE_FILE}}, or the command line argument |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
978 @option{--doc-cache-file FNAME}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
979 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
980 When called from inside a function with the @qcode{"local"} option, the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
981 variable is changed locally for the function and any subroutines it calls. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
982 The original variable value is restored when exiting the function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
983 @seealso{doc_cache_create, lookfor, info_program, doc, help, makeinfo_program} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
984 @seealso{lookfor} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
985 @end deftypefn */) |
8861 | 986 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
987 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
988 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
989 return help_sys.doc_cache_file (args, nargout); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
990 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
991 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
992 DEFMETHOD (info_file, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
993 doc: /* -*- texinfo -*- |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
994 @deftypefn {} {@var{val} =} info_file () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
995 @deftypefnx {} {@var{old_val} =} info_file (@var{new_val}) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
996 @deftypefnx {} {} info_file (@var{new_val}, "local") |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
997 Query or set the internal variable that specifies the name of the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
998 Octave info file. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
999 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1000 The default value is |
28880
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28514
diff
changeset
|
1001 @file{@var{octave-home}/share/info/octave.info}, in |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1002 which @var{octave-home} is the root directory of the Octave installation. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1003 The default value may be overridden by the environment variable |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1004 @w{@env{OCTAVE_INFO_FILE}}, or the command line argument |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1005 @option{--info-file FNAME}. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1006 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1007 When called from inside a function with the @qcode{"local"} option, the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1008 variable is changed locally for the function and any subroutines it calls. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1009 The original variable value is restored when exiting the function. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1010 @seealso{info_program, doc, help, makeinfo_program} |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1011 @end deftypefn */) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1012 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1013 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1014 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1015 return help_sys.info_file (args, nargout); |
8861 | 1016 } |
1017 | |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1018 DEFMETHOD (info_program, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1019 doc: /* -*- texinfo -*- |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1020 @deftypefn {} {@var{val} =} info_program () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1021 @deftypefnx {} {@var{old_val} =} info_program (@var{new_val}) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1022 @deftypefnx {} {} info_program (@var{new_val}, "local") |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1023 Query or set the internal variable that specifies the name of the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1024 info program to run. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1025 |
29668
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29654
diff
changeset
|
1026 The default value is @file{info}. The default value may be |
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29654
diff
changeset
|
1027 overridden by the environment variable @w{@env{OCTAVE_INFO_PROGRAM}}, or the |
f17b1f0141ed
doc: Grammarcheck documentation ahead of 6.3 release.
Rik <rik@octave.org>
parents:
29654
diff
changeset
|
1028 command line argument @option{--info-program NAME}. |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1029 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1030 When called from inside a function with the @qcode{"local"} option, the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1031 variable is changed locally for the function and any subroutines it calls. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1032 The original variable value is restored when exiting the function. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1033 @seealso{info_file, doc, help, makeinfo_program} |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1034 @end deftypefn */) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1035 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1036 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1037 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1038 return help_sys.info_program (args, nargout); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1039 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1040 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1041 DEFMETHOD (makeinfo_program, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1042 doc: /* -*- texinfo -*- |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1043 @deftypefn {} {@var{val} =} makeinfo_program () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1044 @deftypefnx {} {@var{old_val} =} makeinfo_program (@var{new_val}) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1045 @deftypefnx {} {} makeinfo_program (@var{new_val}, "local") |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1046 Query or set the internal variable that specifies the name of the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1047 program that Octave runs to format help text containing |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1048 Texinfo markup commands. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1049 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1050 The default value is @code{makeinfo}. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1051 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1052 When called from inside a function with the @qcode{"local"} option, the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1053 variable is changed locally for the function and any subroutines it calls. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1054 The original variable value is restored when exiting the function. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1055 @seealso{texi_macros_file, info_file, info_program, doc, help} |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1056 @end deftypefn */) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1057 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1058 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1059 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1060 return help_sys.makeinfo_program (args, nargout); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1061 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1062 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1063 DEFMETHOD (suppress_verbose_help_message, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1064 doc: /* -*- texinfo -*- |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1065 @deftypefn {} {@var{val} =} suppress_verbose_help_message () |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1066 @deftypefnx {} {@var{old_val} =} suppress_verbose_help_message (@var{new_val}) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1067 @deftypefnx {} {} suppress_verbose_help_message (@var{new_val}, "local") |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1068 Query or set the internal variable that controls whether Octave |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1069 will add additional help information to the end of the output from |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1070 the @code{help} command and usage messages for built-in commands. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1071 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1072 When called from inside a function with the @qcode{"local"} option, the |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1073 variable is changed locally for the function and any subroutines it calls. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1074 The original variable value is restored when exiting the function. |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1075 @end deftypefn */) |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1076 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1077 help_system& help_sys = interp.get_help_system (); |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1078 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1079 return help_sys.suppress_verbose_help_message (args, nargout); |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1080 } |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1081 |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1082 DEFMETHOD (texi_macros_file, interp, args, nargout, |
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1083 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1084 @deftypefn {} {@var{val} =} texi_macros_file () |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1085 @deftypefnx {} {@var{old_val} =} texi_macros_file (@var{new_val}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1086 @deftypefnx {} {} texi_macros_file (@var{new_val}, "local") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1087 Query or set the internal variable that specifies the name of the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1088 file containing Texinfo macros that are prepended to documentation strings |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1089 before they are passed to makeinfo. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1090 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1091 The default value is |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1092 @file{@var{octave-home}/share/octave/@var{version}/etc/macros.texi}, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1093 in which @var{octave-home} is the root directory of the Octave installation, |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1094 and @var{version} is the Octave version number. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1095 The default value may be overridden by the environment variable |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1096 @w{@env{OCTAVE_TEXI_MACROS_FILE}}, or the command line argument |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1097 @option{--texi-macros-file FNAME}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1098 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1099 When called from inside a function with the @qcode{"local"} option, the |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1100 variable is changed locally for the function and any subroutines it calls. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1101 The original variable value is restored when exiting the function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1102 @seealso{makeinfo_program} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1103 @end deftypefn */) |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14360
diff
changeset
|
1104 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
1105 help_system& help_sys = interp.get_help_system (); |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21921
diff
changeset
|
1106 |
23721
b2d55b52ee51
new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
1107 return help_sys.texi_macros_file (args, nargout); |
5794 | 1108 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29670
diff
changeset
|
1109 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29670
diff
changeset
|
1110 OCTAVE_NAMESPACE_END |