GNU Octave  4.4.1
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-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_options_usage_h)
24 #define octave_options_usage_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 
30 #include "version.h"
31 
32 // Usage message
33 static const char *usage_string =
34  "octave [-HVWdfhiqvx] [--debug] [--debug-jit] [--doc-cache-file file]\n\
35  [--echo-commands] [--eval CODE] [--exec-path path]\n\
36  [--gui] [--help] [--image-path path]\n\
37  [--info-file file] [--info-program prog] [--interactive]\n\
38  [--jit-compiler] [--line-editing] [--no-gui] [--no-history]\n\
39  [--no-init-file] [--no-init-path] [--no-line-editing]\n\
40  [--no-site-file] [--no-window-system] [--norc] [-p path]\n\
41  [--path path] [--persist] [--silent] [--traditional]\n\
42  [--verbose] [--version] [file]";
43 
44 // This is here so that it's more likely that the usage message and
45 // the real set of options will agree. Note: the '+' must come first
46 // to prevent getopt from permuting arguments!
47 static const char *short_opts = "+HWVdfhip:qvx";
48 
49 
50 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
51  // Disable warning temporarily.
52 # pragma GCC diagnostic push
53 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
54 #endif
55 
56 // Long options. See the comments in getopt.h for the meanings of the
57 // fields in this structure.
58 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1
59 #define DOC_CACHE_FILE_OPTION 2
60 #define EVAL_OPTION 3
61 #define EXEC_PATH_OPTION 4
62 // FIXME: DEPRECATED: ignored since Octave 4.4, remove for version 6.
63 #define FORCE_GUI_OPTION 5
64 #define GUI_OPTION 5
65 #define IMAGE_PATH_OPTION 6
66 #define INFO_FILE_OPTION 7
67 #define INFO_PROG_OPTION 8
68 #define DEBUG_JIT_OPTION 9
69 #define JIT_COMPILER_OPTION 10
70 #define LINE_EDITING_OPTION 11
71 #define NO_GUI_OPTION 12
72 #define NO_INIT_FILE_OPTION 13
73 #define NO_INIT_PATH_OPTION 14
74 #define NO_LINE_EDITING_OPTION 15
75 #define NO_SITE_FILE_OPTION 16
76 #define PERSIST_OPTION 17
77 #define TEXI_MACROS_FILE_OPTION 18
78 #define TRADITIONAL_OPTION 19
80 {
81  { "braindead", octave_no_arg, 0, TRADITIONAL_OPTION },
82  { "built-in-docstrings-file", octave_required_arg, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION },
83  { "debug", octave_no_arg, 0, 'd' },
84  { "debug-jit", octave_no_arg, 0, DEBUG_JIT_OPTION },
85  { "doc-cache-file", octave_required_arg, 0, DOC_CACHE_FILE_OPTION },
86  { "echo-commands", octave_no_arg, 0, 'x' },
87  { "eval", octave_required_arg, 0, EVAL_OPTION },
88  { "exec-path", octave_required_arg, 0, EXEC_PATH_OPTION },
89  { "force-gui", octave_no_arg, 0, FORCE_GUI_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 messsage.
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 LINE_EDITING_OPTION
Definition: options-usage.h:70
#define NO_GUI_OPTION
Definition: options-usage.h:71
#define octave_no_arg
static void octave_print_version_and_exit(void)
#define octave_required_arg
#define INFO_FILE_OPTION
Definition: options-usage.h:66
#define GUI_OPTION
Definition: options-usage.h:64
#define DEBUG_JIT_OPTION
Definition: options-usage.h:68
#define PERSIST_OPTION
Definition: options-usage.h:76
#define IMAGE_PATH_OPTION
Definition: options-usage.h:65
#define NO_SITE_FILE_OPTION
Definition: options-usage.h:75
#define EXEC_PATH_OPTION
Definition: options-usage.h:61
#define TRADITIONAL_OPTION
Definition: options-usage.h:78
#define NO_LINE_EDITING_OPTION
Definition: options-usage.h:74
#define TEXI_MACROS_FILE_OPTION
Definition: options-usage.h:77
std::string octave_bugs_statement(bool html)
Definition: version.cc:62
static void octave_print_terse_usage_and_exit(void)
#define EVAL_OPTION
Definition: options-usage.h:60
std::string octave_www_statement(bool html)
Definition: version.cc:47
std::string octave_contrib_statement(bool html)
Definition: version.cc:54
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
Definition: version.cc:98
static const char * short_opts
Definition: options-usage.h:47
struct octave_getopt_options long_opts[]
Definition: options-usage.h:79
#define DOC_CACHE_FILE_OPTION
Definition: options-usage.h:59
#define BUILT_IN_DOCSTRINGS_FILE_OPTION
Definition: options-usage.h:58
static void octave_print_verbose_usage_and_exit(void)
static const char * usage_string
Definition: options-usage.h:33
#define NO_INIT_PATH_OPTION
Definition: options-usage.h:73
#define NO_INIT_FILE_OPTION
Definition: options-usage.h:72
#define INFO_PROG_OPTION
Definition: options-usage.h:67
#define FORCE_GUI_OPTION
Definition: options-usage.h:63
#define JIT_COMPILER_OPTION
Definition: options-usage.h:69
std::string octave_name_version_copyright_copying_and_warranty(bool html, const std::string &extra_info)
Definition: version.cc:80