GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
options-usage.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://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  [--force-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 // Long options. See the comments in getopt.h for the meanings of the
50 // fields in this structure.
51 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1
52 #define DOC_CACHE_FILE_OPTION 2
53 #define EVAL_OPTION 3
54 #define EXEC_PATH_OPTION 4
55 #define FORCE_GUI_OPTION 5
56 #define IMAGE_PATH_OPTION 6
57 #define INFO_FILE_OPTION 7
58 #define INFO_PROG_OPTION 8
59 #define DEBUG_JIT_OPTION 9
60 #define JIT_COMPILER_OPTION 10
61 #define LINE_EDITING_OPTION 11
62 #define NO_GUI_OPTION 12
63 #define NO_INIT_FILE_OPTION 13
64 #define NO_INIT_PATH_OPTION 14
65 #define NO_LINE_EDITING_OPTION 15
66 #define NO_SITE_FILE_OPTION 16
67 #define PERSIST_OPTION 17
68 #define TEXI_MACROS_FILE_OPTION 18
69 #define TRADITIONAL_OPTION 19
71 {
72  { "braindead", octave_no_arg, 0, TRADITIONAL_OPTION },
73  { "built-in-docstrings-file", octave_required_arg, 0, BUILT_IN_DOCSTRINGS_FILE_OPTION },
74  { "debug", octave_no_arg, 0, 'd' },
75  { "debug-jit", octave_no_arg, 0, DEBUG_JIT_OPTION },
76  { "doc-cache-file", octave_required_arg, 0, DOC_CACHE_FILE_OPTION },
77  { "echo-commands", octave_no_arg, 0, 'x' },
78  { "eval", octave_required_arg, 0, EVAL_OPTION },
79  { "exec-path", octave_required_arg, 0, EXEC_PATH_OPTION },
80  { "force-gui", octave_no_arg, 0, FORCE_GUI_OPTION },
81  { "help", octave_no_arg, 0, 'h' },
82  { "image-path", octave_required_arg, 0, IMAGE_PATH_OPTION },
83  { "info-file", octave_required_arg, 0, INFO_FILE_OPTION },
84  { "info-program", octave_required_arg, 0, INFO_PROG_OPTION },
85  { "interactive", octave_no_arg, 0, 'i' },
86  { "jit-compiler", octave_no_arg, 0, JIT_COMPILER_OPTION },
87  { "line-editing", octave_no_arg, 0, LINE_EDITING_OPTION },
88  { "no-gui", octave_no_arg, 0, NO_GUI_OPTION },
89  { "no-history", octave_no_arg, 0, 'H' },
90  { "no-init-file", octave_no_arg, 0, NO_INIT_FILE_OPTION },
91  { "no-init-path", octave_no_arg, 0, NO_INIT_PATH_OPTION },
92  { "no-line-editing", octave_no_arg, 0, NO_LINE_EDITING_OPTION },
93  { "no-site-file", octave_no_arg, 0, NO_SITE_FILE_OPTION },
94  { "no-window-system", octave_no_arg, 0, 'W' },
95  { "norc", octave_no_arg, 0, 'f' },
96  { "path", octave_required_arg, 0, 'p' },
97  { "persist", octave_no_arg, 0, PERSIST_OPTION },
98  { "quiet", octave_no_arg, 0, 'q' },
99  { "silent", octave_no_arg, 0, 'q' },
100  { "texi-macros-file", octave_required_arg, 0, TEXI_MACROS_FILE_OPTION },
101  { "traditional", octave_no_arg, 0, TRADITIONAL_OPTION },
102  { "verbose", octave_no_arg, 0, 'V' },
103  { "version", octave_no_arg, 0, 'v' },
104  { 0, 0, 0, 0 }
105 };
106 
107 // Usage message with extra help.
108 
109 static void
111 {
113  << "\n\
114 \n\
115 Usage: octave [options] [FILE]\n\
116 \n\
117 Options:\n\
118 \n\
119  --built-in-docstrings-file FILE Use docs for built-ins from FILE.\n\
120  --debug, -d Enter parser debugging mode.\n\
121  --debug-jit Enable JIT compiler debugging/tracing.\n\
122  --doc-cache-file FILE Use doc cache file FILE.\n\
123  --echo-commands, -x Echo commands as they are executed.\n\
124  --eval CODE Evaluate CODE. Exit when done unless --persist.\n\
125  --exec-path PATH Set path for executing subprograms.\n\
126  --force-gui Force graphical user interface to start.\n\
127  --help, -h, Print short help message and exit.\n\
128  --image-path PATH Add PATH to head of image search path.\n\
129  --info-file FILE Use top-level info file FILE.\n\
130  --info-program PROGRAM Use PROGRAM for reading info files.\n\
131  --interactive, -i Force interactive behavior.\n\
132  --jit-compiler Enable the JIT compiler.\n\
133  --line-editing Force readline use for command-line editing.\n\
134  --no-gui Disable the graphical user interface.\n\
135  --no-history, -H Don't save commands to the history list\n\
136  --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\
137  --no-init-path Don't initialize function search path.\n\
138  --no-line-editing Don't use readline for command-line editing.\n\
139  --no-site-file Don't read the site-wide octaverc file.\n\
140  --no-window-system, -W Disable window system, including graphics.\n\
141  --norc, -f Don't read any initialization files.\n\
142  --path PATH, -p PATH Add PATH to head of function search path.\n\
143  --persist Go interactive after --eval or reading from FILE.\n\
144  --silent, --quiet, -q Don't print message at startup.\n\
145  --texi-macros-file FILE Use Texinfo macros in FILE for makeinfo command.\n\
146  --traditional Set variables for closer MATLAB compatibility.\n\
147  --verbose, -V Enable verbose output in some cases.\n\
148  --version, -v Print version number and exit.\n\
149 \n\
150  FILE Execute commands from FILE. Exit when done\n\
151  unless --persist is also specified.\n\
152 \n"
154  << "\n\n"
156  << "\n\n"
158  << "\n";
159 
160  exit (0);
161 }
162 
163 // Terse usage messsage.
164 
165 static void
167 {
168  std::cerr << "\nusage: " << usage_string << "\n\n";
169 
170  exit (1);
171 }
172 
173 static void
175 {
177  << "\n";
178  exit (0);
179 }
180 
181 #endif
#define LINE_EDITING_OPTION
Definition: options-usage.h:61
#define NO_GUI_OPTION
Definition: options-usage.h:62
#define octave_no_arg
static void octave_print_version_and_exit(void)
#define octave_required_arg
#define INFO_FILE_OPTION
Definition: options-usage.h:57
#define DEBUG_JIT_OPTION
Definition: options-usage.h:59
#define PERSIST_OPTION
Definition: options-usage.h:67
#define IMAGE_PATH_OPTION
Definition: options-usage.h:56
#define NO_SITE_FILE_OPTION
Definition: options-usage.h:66
#define EXEC_PATH_OPTION
Definition: options-usage.h:54
#define TRADITIONAL_OPTION
Definition: options-usage.h:69
#define NO_LINE_EDITING_OPTION
Definition: options-usage.h:65
#define TEXI_MACROS_FILE_OPTION
Definition: options-usage.h:68
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:53
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:96
static const char * short_opts
Definition: options-usage.h:47
struct octave_getopt_options long_opts[]
Definition: options-usage.h:70
#define DOC_CACHE_FILE_OPTION
Definition: options-usage.h:52
#define BUILT_IN_DOCSTRINGS_FILE_OPTION
Definition: options-usage.h:51
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:64
#define NO_INIT_FILE_OPTION
Definition: options-usage.h:63
#define INFO_PROG_OPTION
Definition: options-usage.h:58
#define FORCE_GUI_OPTION
Definition: options-usage.h:55
#define JIT_COMPILER_OPTION
Definition: options-usage.h:60
std::string octave_name_version_copyright_copying_and_warranty(bool html, const std::string &extra_info)
Definition: version.cc:80