GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
help.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_help_h)
27#define octave_help_h 1
28
29#include "octave-config.h"
30
31#include <iosfwd>
32#include <string>
33
34class string_vector;
35
36class octave_value;
38
39OCTAVE_NAMESPACE_BEGIN
40
41 class interpreter;
42
44 {
45 public:
46
48 : m_interpreter (interp),
53 m_makeinfo_program ("makeinfo"),
56 { }
57
59 built_in_docstrings_file (const octave_value_list& args, int nargout);
60
61 std::string
63
64 std::string built_in_docstrings_file (const std::string& file)
65 {
66 return set (m_built_in_docstrings_file, file);
67 }
68
69 octave_value doc_cache_file (const octave_value_list& args, int nargout);
70
71 std::string doc_cache_file (void) const { return m_doc_cache_file; }
72
73 std::string doc_cache_file (const std::string& file)
74 {
75 return set (m_doc_cache_file, file);
76 }
77
78 octave_value info_file (const octave_value_list& args, int nargout);
79
80 std::string info_file (void) const { return m_info_file; }
81
82 std::string info_file (const std::string& file)
83 {
84 return set (m_info_file, file);
85 }
86
87 octave_value info_program (const octave_value_list& args, int nargout);
88
89 std::string info_program (void) const { return m_info_program; }
90
91 std::string info_program (const std::string& file)
92 {
93 return set (m_info_program, file);
94 }
95
97
98 std::string makeinfo_program (void) const { return m_makeinfo_program; }
99
100 std::string makeinfo_program (const std::string& file)
101 {
102 return set (m_makeinfo_program, file);
103 }
104
107
109 {
111 }
112
114 {
116 }
117
119
120 std::string texi_macros_file (void) const { return m_texi_macros_file; }
121
122 std::string texi_macros_file (const std::string& file)
123 {
124 return set (m_texi_macros_file, file);
125 }
126
127 std::string raw_help (const std::string&, bool&) const;
128
129 std::string which (const std::string& name) const;
130 std::string which (const std::string& name, std::string& type) const;
131
133
134 void get_help_text (const std::string& name, std::string& text,
135 std::string& format) const;
136
137 void get_help_text_from_file (const std::string& fname, std::string& text,
138 std::string& format) const;
139
140 private:
141
143
144 // Name of the file containing doc strings for built-in functions.
145 // (--built-in-docstrings-file file)
147
148 // Name of the doc cache file specified on the command line.
149 // (--doc-cache-file file)
150 std::string m_doc_cache_file;
151
152 // Name of the info file specified on command line.
153 // (--info-file file)
154 std::string m_info_file;
155
156 // Name of the info reader we'd like to use.
157 // (--info-program program)
158 std::string m_info_program;
159
160 // Name of the makeinfo program to run.
162
163 // If TRUE, don't print additional help message in help and usage
164 // functions.
166
167 // Name of the file containing local Texinfo macros that are prepended
168 // to doc strings before processing.
169 // (--texi-macros-file)
171
172 static std::string init_built_in_docstrings_file (void);
173
174 static std::string init_doc_cache_file (void);
175
176 static std::string init_info_file (void);
177
178 static std::string init_info_program (void);
179
180 static std::string init_texi_macros_file (void);
181
182 template <typename T>
183 T set (T& var, const T& new_val)
184 {
185 T old_val = var;
186 var = new_val;
187 return old_val;
188 }
189
191
192 bool raw_help_from_symbol_table (const std::string& nm,
193 std::string& h, std::string& w,
194 bool& symbol_found) const;
195
196 bool raw_help_from_file (const std::string& nm,
197 std::string& h, std::string& file,
198 bool& symbol_found) const;
199
200 bool raw_help_from_docstrings_file (const std::string& nm, std::string& h,
201 bool& symbol_found) const;
202 };
203
205
206OCTAVE_NAMESPACE_END
207
208#endif
std::string m_makeinfo_program
Definition: help.h:161
bool m_suppress_verbose_help_message
Definition: help.h:165
static std::string init_texi_macros_file(void)
bool raw_help_from_symbol_table(const std::string &nm, std::string &h, std::string &w, bool &symbol_found) const
void get_help_text_from_file(const std::string &fname, std::string &text, std::string &format) const
bool raw_help_from_file(const std::string &nm, std::string &h, std::string &file, bool &symbol_found) const
std::string info_program(void) const
Definition: help.h:89
std::string makeinfo_program(const std::string &file)
Definition: help.h:100
std::string m_doc_cache_file
Definition: help.h:150
string_vector make_name_list(void) const
void get_help_text(const std::string &name, std::string &text, std::string &format) const
octave_value built_in_docstrings_file(const octave_value_list &args, int nargout)
std::string raw_help(const std::string &, bool &) const
bool raw_help_from_docstrings_file(const std::string &nm, std::string &h, bool &symbol_found) const
T set(T &var, const T &new_val)
Definition: help.h:183
std::string m_info_file
Definition: help.h:154
static std::string init_info_program(void)
bool suppress_verbose_help_message(bool flag)
Definition: help.h:113
std::string m_built_in_docstrings_file
Definition: help.h:146
interpreter & m_interpreter
Definition: help.h:142
std::string which(const std::string &name) const
octave_value info_file(const octave_value_list &args, int nargout)
std::string info_program(const std::string &file)
Definition: help.h:91
std::string doc_cache_file(void) const
Definition: help.h:71
static std::string init_doc_cache_file(void)
static std::string init_built_in_docstrings_file(void)
std::string which(const std::string &name, std::string &type) const
std::string texi_macros_file(const std::string &file)
Definition: help.h:122
std::string m_texi_macros_file
Definition: help.h:170
std::string makeinfo_program(void) const
Definition: help.h:98
help_system(interpreter &interp)
Definition: help.h:47
static std::string init_info_file(void)
octave_value info_program(const octave_value_list &args, int nargout)
bool suppress_verbose_help_message(void) const
Definition: help.h:108
std::string texi_macros_file(void) const
Definition: help.h:120
std::string built_in_docstrings_file(void) const
Definition: help.h:62
std::string built_in_docstrings_file(const std::string &file)
Definition: help.h:64
std::string info_file(void) const
Definition: help.h:80
string_vector local_functions(void) const
octave_value suppress_verbose_help_message(const octave_value_list &args, int nargout)
octave_value doc_cache_file(const octave_value_list &args, int nargout)
std::string info_file(const std::string &file)
Definition: help.h:82
std::string doc_cache_file(const std::string &file)
Definition: help.h:73
std::string m_info_program
Definition: help.h:158
octave_value makeinfo_program(const octave_value_list &args, int nargout)
octave_value texi_macros_file(const octave_value_list &args, int nargout)
QString name
string_vector make_name_list(void)
std::complex< double > w(std::complex< double > z, double relerr=0)
std::size_t format(std::ostream &os, const char *fmt,...)
Definition: utils.cc:1471