GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
options-usage.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2021 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_options_usage_h)
27 #define octave_options_usage_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 #include "version.h"
34 
35 // Usage message
36 static const char *usage_string =
37  "octave [-HVWdfhiqvx] [--debug] [--debug-jit] [--doc-cache-file file]\n\
38  [--echo-commands] [--eval CODE] [--exec-path path]\n\
39  [--gui] [--help] [--image-path path]\n\
40  [--info-file file] [--info-program prog] [--interactive]\n\
41  [--jit-compiler] [--line-editing] [--no-gui] [--no-history]\n\
42  [--no-init-file] [--no-init-path] [--no-line-editing]\n\
43  [--no-site-file] [--no-window-system] [--norc] [-p path]\n\
44  [--path path] [--persist] [--silent] [--traditional]\n\
45  [--verbose] [--version] [file]";
46 
47 // This is here so that it's more likely that the usage message and
48 // the real set of options will agree. Note: the '+' must come first
49 // to prevent getopt from permuting arguments!
50 static const char *short_opts = "+HWVdfhip:qvx";
51 
52 
53 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
54  // Disable warning temporarily.
55 # pragma GCC diagnostic push
56 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
57 #endif
58 
59 // Long options. See the comments in getopt.h for the meanings of the
60 // fields in this structure.
61 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1
62 #define DOC_CACHE_FILE_OPTION 2
63 #define EVAL_OPTION 3
64 #define EXEC_PATH_OPTION 4
65 #define GUI_OPTION 5
66 #define IMAGE_PATH_OPTION 6
67 #define INFO_FILE_OPTION 7
68 #define INFO_PROG_OPTION 8
69 #define DEBUG_JIT_OPTION 9
70 #define JIT_COMPILER_OPTION 10
71 #define LINE_EDITING_OPTION 11
72 #define NO_GUI_OPTION 12
73 #define NO_INIT_FILE_OPTION 13
74 #define NO_INIT_PATH_OPTION 14
75 #define NO_LINE_EDITING_OPTION 15
76 #define NO_SITE_FILE_OPTION 16
77 #define PERSIST_OPTION 17
78 #define TEXI_MACROS_FILE_OPTION 18
79 #define TRADITIONAL_OPTION 19
81 {
82  { "braindead", octave_no_arg, 0, TRADITIONAL_OPTION },
83  { "built-in-docstrings-file", octave_required_arg, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION },
84  { "debug", octave_no_arg, 0, 'd' },
85  { "debug-jit", octave_no_arg, 0, DEBUG_JIT_OPTION },
86  { "doc-cache-file", octave_required_arg, 0, DOC_CACHE_FILE_OPTION },
87  { "echo-commands", octave_no_arg, 0, 'x' },
88  { "eval", octave_required_arg, 0, EVAL_OPTION },
89  { "exec-path", octave_required_arg, 0, EXEC_PATH_OPTION },
90  { "gui", octave_no_arg, 0, GUI_OPTION },
91  { "help", octave_no_arg, 0, 'h' },
92  { "image-path", octave_required_arg, 0, IMAGE_PATH_OPTION },
93  { "info-file", octave_required_arg, 0, INFO_FILE_OPTION },
94  { "info-program", octave_required_arg, 0, INFO_PROG_OPTION },
95  { "interactive", octave_no_arg, 0, 'i' },
96  { "jit-compiler", octave_no_arg, 0, JIT_COMPILER_OPTION },
97  { "line-editing", octave_no_arg, 0, LINE_EDITING_OPTION },
98  { "no-gui", octave_no_arg, 0, NO_GUI_OPTION },
99  { "no-history", octave_no_arg, 0, 'H' },
100  { "no-init-file", octave_no_arg, 0, NO_INIT_FILE_OPTION },
101  { "no-init-path", octave_no_arg, 0, NO_INIT_PATH_OPTION },
102  { "no-line-editing", octave_no_arg, 0, NO_LINE_EDITING_OPTION },
103  { "no-site-file", octave_no_arg, 0, NO_SITE_FILE_OPTION },
104  { "no-window-system", octave_no_arg, 0, 'W' },
105  { "norc", octave_no_arg, 0, 'f' },
106  { "path", octave_required_arg, 0, 'p' },
107  { "persist", octave_no_arg, 0, PERSIST_OPTION },
108  { "quiet", octave_no_arg, 0, 'q' },
109  { "silent", octave_no_arg, 0, 'q' },
110  { "texi-macros-file", octave_required_arg, 0, TEXI_MACROS_FILE_OPTION },
111  { "traditional", octave_no_arg, 0, TRADITIONAL_OPTION },
112  { "verbose", octave_no_arg, 0, 'V' },
113  { "version", octave_no_arg, 0, 'v' },
114  { 0, 0, 0, 0 }
115 };
116 
117 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
118  // Restore prevailing warning state for remainder of the file.
119 # pragma GCC diagnostic pop
120 #endif
121 
122 // Usage message with extra help.
123 
124 static void
126 {
128  << "\n\
129 \n\
130 Usage: octave [options] [FILE]\n\
131 \n\
132 Options:\n\
133 \n\
134  --built-in-docstrings-file FILE Use docs for built-ins from FILE.\n\
135  --debug, -d Enter parser debugging mode.\n\
136  --debug-jit Enable JIT compiler debugging/tracing.\n\
137  --doc-cache-file FILE Use doc cache file FILE.\n\
138  --echo-commands, -x Echo commands as they are executed.\n\
139  --eval CODE Evaluate CODE. Exit when done unless --persist.\n\
140  --exec-path PATH Set path for executing subprograms.\n\
141  --gui Start the graphical user interface.\n\
142  --help, -h, Print short help message and exit.\n\
143  --image-path PATH Add PATH to head of image search path.\n\
144  --info-file FILE Use top-level info file FILE.\n\
145  --info-program PROGRAM Use PROGRAM for reading info files.\n\
146  --interactive, -i Force interactive behavior.\n\
147  --jit-compiler Enable the JIT compiler.\n\
148  --line-editing Force readline use for command-line editing.\n\
149  --no-gui Disable the graphical user interface.\n\
150  --no-history, -H Don't save commands to the history list\n\
151  --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\
152  --no-init-path Don't initialize function search path.\n\
153  --no-line-editing Don't use readline for command-line editing.\n\
154  --no-site-file Don't read the site-wide octaverc file.\n\
155  --no-window-system, -W Disable window system, including graphics.\n\
156  --norc, -f Don't read any initialization files.\n\
157  --path PATH, -p PATH Add PATH to head of function search path.\n\
158  --persist Go interactive after --eval or reading from FILE.\n\
159  --silent, --quiet, -q Don't print message at startup.\n\
160  --texi-macros-file FILE Use Texinfo macros in FILE for makeinfo command.\n\
161  --traditional Set variables for closer MATLAB compatibility.\n\
162  --verbose, -V Enable verbose output in some cases.\n\
163  --version, -v Print version number and exit.\n\
164 \n\
165  FILE Execute commands from FILE. Exit when done\n\
166  unless --persist is also specified.\n\
167 \n"
169  << "\n\n"
171  << "\n\n"
173  << "\n";
174 
175  exit (0);
176 }
177 
178 // Terse usage message.
179 
180 static void
182 {
183  std::cerr << "\nusage: " << usage_string << "\n\n";
184 
185  exit (1);
186 }
187 
188 static void
190 {
192  << "\n";
193  exit (0);
194 }
195 
196 #endif
#define octave_required_arg
#define octave_no_arg
#define INFO_FILE_OPTION
Definition: options-usage.h:67
#define NO_INIT_PATH_OPTION
Definition: options-usage.h:74
#define NO_GUI_OPTION
Definition: options-usage.h:72
static const char * usage_string
Definition: options-usage.h:36
#define LINE_EDITING_OPTION
Definition: options-usage.h:71
#define TRADITIONAL_OPTION
Definition: options-usage.h:79
#define INFO_PROG_OPTION
Definition: options-usage.h:68
static const char * short_opts
Definition: options-usage.h:50
#define BUILT_IN_DOCSTRINGS_FILE_OPTION
Definition: options-usage.h:61
#define DOC_CACHE_FILE_OPTION
Definition: options-usage.h:62
static void octave_print_verbose_usage_and_exit(void)
#define GUI_OPTION
Definition: options-usage.h:65
#define DEBUG_JIT_OPTION
Definition: options-usage.h:69
#define JIT_COMPILER_OPTION
Definition: options-usage.h:70
#define NO_SITE_FILE_OPTION
Definition: options-usage.h:76
#define NO_LINE_EDITING_OPTION
Definition: options-usage.h:75
#define TEXI_MACROS_FILE_OPTION
Definition: options-usage.h:78
struct octave_getopt_options long_opts[]
Definition: options-usage.h:80
#define EXEC_PATH_OPTION
Definition: options-usage.h:64
#define IMAGE_PATH_OPTION
Definition: options-usage.h:66
#define PERSIST_OPTION
Definition: options-usage.h:77
#define EVAL_OPTION
Definition: options-usage.h:63
static void octave_print_version_and_exit(void)
#define NO_INIT_FILE_OPTION
Definition: options-usage.h:73
static void octave_print_terse_usage_and_exit(void)
std::string octave_name_version_copyright_copying_and_warranty(bool html, const std::string &extra_info)
Definition: version.cc:82
std::string octave_bugs_statement(bool html)
Definition: version.cc:64
std::string octave_www_statement(bool html)
Definition: version.cc:49
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
Definition: version.cc:100
std::string octave_contrib_statement(bool html)
Definition: version.cc:56