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