Mercurial > octave
annotate libinterp/octave.cc @ 31605:e88a07dec498 stable
maint: Use macros to begin/end C++ namespaces.
* oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE,
OCTAVE_END_NAMESPACE) that can be used to start/end a namespace.
* mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc,
__dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc,
__ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc,
auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc,
colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc,
defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc,
display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h,
event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc,
ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc,
getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc,
gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc,
graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc,
help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h,
mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc,
oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy,
ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc,
pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h,
sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc,
sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h,
stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h,
symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h,
text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc,
toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc,
url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh,
mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc,
ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h,
ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h,
ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc,
op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc,
op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc,
op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc,
op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc,
op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc,
oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h,
pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h,
pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h,
pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc,
pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc,
pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc,
pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc,
pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc,
pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h,
range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc,
chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h,
lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h,
oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h,
oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc,
qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc,
sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc,
child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc,
file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h,
mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h,
oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc,
oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h,
base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h,
file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc,
lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h,
oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h,
pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h,
url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:23:45 -0800 |
parents | 4b80982e0af8 |
children | aac27ad79be6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30160
diff
changeset
|
3 // Copyright (C) 1993-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
1 | 25 |
26 // Born February 20, 1992. | |
27 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21723
diff
changeset
|
28 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21220
diff
changeset
|
29 # include "config.h" |
1 | 30 #endif |
31 | |
25438
cb1606f78f6b
prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
32 #include <iostream> |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
22090
diff
changeset
|
33 #include <string> |
1355 | 34 |
4097 | 35 #include "file-ops.h" |
22064
bd4f3d2ce52f
provide wrapper for getopt
John W. Eaton <jwe@octave.org>
parents:
22051
diff
changeset
|
36 #include "getopt-wrapper.h" |
240 | 37 #include "lo-error.h" |
2926 | 38 #include "oct-env.h" |
1907 | 39 #include "str-vec.h" |
223 | 40 |
3933 | 41 #include "Cell.h" |
1355 | 42 #include "defun.h" |
9335
f2d354df53ee
new option, --no-window-system
John W. Eaton <jwe@octave.org>
parents:
9321
diff
changeset
|
43 #include "display.h" |
1355 | 44 #include "error.h" |
1 | 45 #include "input.h" |
22094
9203833cab7d
move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
22090
diff
changeset
|
46 #include "interpreter.h" |
4113 | 47 #include "octave.h" |
1742 | 48 #include "oct-hist.h" |
5654 | 49 #include "oct-map.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20939
diff
changeset
|
50 #include "ovl.h" |
29898
dffd1c943f1a
main.cc: Use getopt to parse command line arguments (bug #60886).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29654
diff
changeset
|
51 #include "options.h" |
10613
e103fb2182ce
use internal variable instead of warning state to control whether to allow non-integer ranges as indices
John W. Eaton <jwe@octave.org>
parents:
10605
diff
changeset
|
52 #include "ov.h" |
1 | 53 #include "parse.h" |
22186
9aff1ce307b1
do system dependent and default variable inits early (bug #)
John W. Eaton <jwe@octave.org>
parents:
22101
diff
changeset
|
54 #include "sysdep.h" |
29898
dffd1c943f1a
main.cc: Use getopt to parse command line arguments (bug #60886).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29654
diff
changeset
|
55 #include "usage.h" |
1410 | 56 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31535
diff
changeset
|
57 OCTAVE_BEGIN_NAMESPACE(octave) |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
58 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
59 cmdline_options::cmdline_options (void) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
60 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
61 m_all_args.resize (1); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
62 m_all_args[0] = ""; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
63 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
64 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
65 cmdline_options::cmdline_options (int argc, char **argv) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
66 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
67 // Save raw program arguments. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
68 m_all_args = string_vector (argv, argc); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
69 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
70 while (true) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
71 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
72 int long_idx; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
73 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
74 int optc = octave_getopt_long_wrapper (argc, argv, short_opts, |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
75 long_opts, &long_idx); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
76 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
77 if (optc < 0) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
78 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
79 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
80 switch (optc) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
81 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
82 case '?': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
83 // Unrecognized option. getopt_long already printed a message about |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
84 // it, so we will just print the usage string and exit. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
85 octave_print_terse_usage_and_exit (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
86 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
87 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
88 case 'H': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
89 m_read_history_file = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
90 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
91 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
92 case 'W': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
93 m_no_window_system = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
94 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
95 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
96 case 'V': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
97 m_verbose_flag = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
98 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
99 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
100 case 'd': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
101 // This is the same as yydebug in parse.y. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
102 octave_debug++; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
103 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
104 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
105 case 'f': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
106 m_read_init_files = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
107 m_read_site_files = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
108 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
109 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
110 case 'h': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
111 octave_print_verbose_usage_and_exit (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
112 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
113 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
114 case 'i': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
115 m_forced_interactive = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
116 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
117 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
118 case 'p': |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
119 if (octave_optarg_wrapper ()) |
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
120 m_command_line_path.push_back (octave_optarg_wrapper ()); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
121 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
122 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
123 case 'q': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
124 m_inhibit_startup_message = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
125 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
126 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
127 case 'x': |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
128 m_echo_commands = true; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
129 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
130 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
131 case 'v': |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
132 octave_print_version_and_exit (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
133 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
134 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
135 case BUILT_IN_DOCSTRINGS_FILE_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
136 if (octave_optarg_wrapper ()) |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
137 m_docstrings_file = octave_optarg_wrapper ();; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
138 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
139 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
140 case DOC_CACHE_FILE_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
141 if (octave_optarg_wrapper ()) |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
142 m_doc_cache_file = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
143 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
144 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
145 case EVAL_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
146 if (octave_optarg_wrapper ()) |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
147 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
148 if (m_code_to_eval.empty ()) |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
149 m_code_to_eval = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
150 else |
23857
4d4ba038d103
Restore processing multiple '--eval' lines when launching Octave (bug #51708).
Rik <rik@octave.org>
parents:
23819
diff
changeset
|
151 m_code_to_eval += (std::string (" ") |
4d4ba038d103
Restore processing multiple '--eval' lines when launching Octave (bug #51708).
Rik <rik@octave.org>
parents:
23819
diff
changeset
|
152 + octave_optarg_wrapper ()); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
153 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
154 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
155 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
156 case EXEC_PATH_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
157 if (octave_optarg_wrapper ()) |
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
158 m_exec_path = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
159 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
160 |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
161 case EXPERIMENTAL_TERMINAL_WIDGET_OPTION: |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30888
diff
changeset
|
162 #if defined (HAVE_QSCINTILLA) |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
163 m_experimental_terminal_widget = true; |
31222
1a0756f7c90a
disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30888
diff
changeset
|
164 #endif |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
165 break; |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
166 |
27823
83dd2bc500f0
Remove deprecated FORCE_GUI_OPTION from getopts parsing.
Rik <rik@octave.org>
parents:
27301
diff
changeset
|
167 case GUI_OPTION: |
24874
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
168 m_gui = true; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
169 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
170 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
171 case IMAGE_PATH_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
172 if (octave_optarg_wrapper ()) |
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
173 m_image_path = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
174 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
175 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
176 case INFO_FILE_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
177 if (octave_optarg_wrapper ()) |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
178 m_info_file = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
179 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
180 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
181 case INFO_PROG_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
182 if (octave_optarg_wrapper ()) |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
183 m_info_program = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
184 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
185 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
186 case LINE_EDITING_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
187 m_forced_line_editing = m_line_editing = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
188 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
189 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
190 case NO_GUI_OPTION: |
24878
4fdb160b47fb
Keep the '--no-gui' option as the inverse of '--gui'
Mike Miller <mtmiller@octave.org>
parents:
24874
diff
changeset
|
191 m_gui = false; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
192 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
193 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
194 case NO_INIT_FILE_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
195 m_read_init_files = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
196 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
197 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
198 case NO_INIT_PATH_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
199 m_set_initial_path = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
200 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
201 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
202 case NO_LINE_EDITING_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
203 m_line_editing = false; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
204 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
205 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
206 case NO_SITE_FILE_OPTION: |
26701
e000879eabef
maint: Use bool values true/false rather than 0/1 in C++.
Rik <rik@octave.org>
parents:
26377
diff
changeset
|
207 m_read_site_files = false; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
208 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
209 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
210 case PERSIST_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
211 m_persist = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
212 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
213 |
29254
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
214 case SERVER_OPTION: |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
215 m_server = true; |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
216 break; |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
217 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
218 case TEXI_MACROS_FILE_OPTION: |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
219 if (octave_optarg_wrapper ()) |
23711
5a97aafb12a9
don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents:
23696
diff
changeset
|
220 m_texi_macros_file = octave_optarg_wrapper (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
221 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
222 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
223 case TRADITIONAL_OPTION: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
224 m_traditional = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
225 m_persist = true; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
226 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
227 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
228 default: |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
229 // getopt_long should print a message about unrecognized options and |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
230 // return '?', which is handled above. If we end up here, it is |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
231 // because there was an option but we forgot to handle it. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
232 // That should be fatal. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
233 panic_impossible (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
234 break; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
235 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
236 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
237 |
22090
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
238 m_remaining_args = string_vector (argv+octave_optind_wrapper (), |
66db9a493c84
avoid accessing optarg and optind directly (bug #48454)
John W. Eaton <jwe@octave.org>
parents:
22089
diff
changeset
|
239 argc-octave_optind_wrapper ()); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
240 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
241 |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
242 octave_value cmdline_options::as_octave_value (void) const |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
243 { |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
244 octave_scalar_map m; |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
245 |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
246 m.assign ("sys_argc", sys_argc ()); |
30409
6b17822663f8
Return cell array of strings rather than char arrays in cmdline_options().
Rik <rik@octave.org>
parents:
30160
diff
changeset
|
247 m.assign ("sys_argv", Cell (string_vector (sys_argv ()))); |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
248 m.assign ("echo_commands", echo_commands ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
249 m.assign ("forced_interactive", forced_interactive ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
250 m.assign ("forced_line_editing", forced_line_editing ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
251 m.assign ("gui", gui ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
252 m.assign ("inhibit_startup_message", inhibit_startup_message ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
253 m.assign ("line_editing", line_editing ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
254 m.assign ("no_window_system", no_window_system ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
255 m.assign ("persist", persist ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
256 m.assign ("read_history_file", read_history_file ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
257 m.assign ("read_init_files", read_init_files ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
258 m.assign ("read_site_files", read_site_files ()); |
29254
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
259 m.assign ("server", server ()); |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
260 m.assign ("set_initial_path", set_initial_path ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
261 m.assign ("traditional", traditional ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
262 m.assign ("verbose_flag", verbose_flag ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
263 m.assign ("code_to_eval", code_to_eval ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
264 m.assign ("command_line_path", string_vector (command_line_path ())); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
265 m.assign ("docstrings_file", docstrings_file ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
266 m.assign ("doc_cache_file", doc_cache_file ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
267 m.assign ("exec_path", exec_path ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
268 m.assign ("image_path", image_path ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
269 m.assign ("info_file", info_file ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
270 m.assign ("info_program", info_program ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
271 m.assign ("texi_macros_file", texi_macros_file ()); |
30409
6b17822663f8
Return cell array of strings rather than char arrays in cmdline_options().
Rik <rik@octave.org>
parents:
30160
diff
changeset
|
272 m.assign ("all_args", Cell (all_args ())); |
6b17822663f8
Return cell array of strings rather than char arrays in cmdline_options().
Rik <rik@octave.org>
parents:
30160
diff
changeset
|
273 m.assign ("remaining_args", Cell (remaining_args ())); |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
274 |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
275 return m; |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
276 } |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
277 |
30160
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
278 application *application::s_instance = nullptr; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
279 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
280 application::application (int argc, char **argv) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
281 : m_options (argc, argv) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
282 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
283 init (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
284 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
285 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
286 application::application (const cmdline_options& opts) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
287 : m_options (opts) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
288 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
289 init (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
290 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
291 |
29547
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
292 // Note: Although the application destructor doesn't explicitly |
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
293 // perform any actions, it can't be declared "default" in the header |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
294 // file if the interpreter is an incomplete type. Providing |
29547
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
295 // an explicit definition of the destructor here is much simpler than |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
296 // including the full declaration of interpreter in the |
29547
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
297 // octave.h header file. |
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
298 application::~application (void) { } |
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
299 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
300 void |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
301 application::set_program_names (const std::string& pname) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
302 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
303 m_program_invocation_name = pname; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
304 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29545
diff
changeset
|
305 std::size_t pos = pname.find_last_of (sys::file_ops::dir_sep_chars ()); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
306 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
307 m_program_name = (pos != std::string::npos) ? pname.substr (pos+1) : pname; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
308 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
309 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
310 void |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
311 application::intern_argv (const string_vector& args) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
312 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
313 octave_idx_type nargs = args.numel (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
314 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
315 if (nargs > 0) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
316 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
317 // Skip first argument (program name). |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
318 nargs--; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
319 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
320 m_argv.resize (nargs); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
321 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
322 for (octave_idx_type i = 0; i < nargs; i++) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
323 m_argv[i] = args[i+1]; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
324 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
325 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
326 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
327 bool application::forced_interactive (void) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
328 { |
30160
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
329 return s_instance ? s_instance->m_options.forced_interactive () : false; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
330 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
331 |
29503
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
332 // Provided for convenience. Will be removed once we eliminate the |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
333 // old terminal widget. |
3bfec185c9e2
experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
334 bool application::experimental_terminal_widget (void) const |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
335 { |
30160
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
336 return (s_instance |
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
337 ? s_instance->m_options.experimental_terminal_widget () : false); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
338 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
339 |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
340 bool application::interpreter_initialized (void) |
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
341 { |
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
342 return m_interpreter ? m_interpreter->initialized () : false; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
343 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
344 |
23773
5ff24576b783
defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents:
23721
diff
changeset
|
345 interpreter& application::create_interpreter (void) |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
346 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
347 if (! m_interpreter) |
29547
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
348 m_interpreter = std::unique_ptr<interpreter> (new interpreter (this)); |
23773
5ff24576b783
defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents:
23721
diff
changeset
|
349 |
5ff24576b783
defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents:
23721
diff
changeset
|
350 return *m_interpreter; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
351 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
352 |
23819
5d8ef9b859f8
defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
353 void application::initialize_interpreter (void) |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
354 { |
23819
5d8ef9b859f8
defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
355 if (m_interpreter) |
5d8ef9b859f8
defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents:
23807
diff
changeset
|
356 m_interpreter->initialize (); |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
357 } |
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
358 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
359 int application::execute_interpreter (void) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
360 { |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
361 return m_interpreter ? m_interpreter->execute () : -1; |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
362 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
363 |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
364 void application::delete_interpreter (void) |
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
365 { |
29547
60af3f38f4b1
use std::unique_ptr to manage interpreter object in application object
John W. Eaton <jwe@octave.org>
parents:
29546
diff
changeset
|
366 m_interpreter.reset (); |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
367 } |
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
368 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
369 void application::init (void) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
370 { |
30160
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
371 if (s_instance) |
23511
232c8d69d934
manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents:
23460
diff
changeset
|
372 throw std::runtime_error |
232c8d69d934
manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents:
23460
diff
changeset
|
373 ("only one Octave application object may be active"); |
232c8d69d934
manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents:
23460
diff
changeset
|
374 |
30160
9c4e8c3bf41d
maint: use "s_" prefix for static member variables in class application.
Rik <rik@octave.org>
parents:
29961
diff
changeset
|
375 s_instance = this; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
376 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
377 string_vector all_args = m_options.all_args (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
378 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
379 set_program_names (all_args[0]); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
380 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
381 string_vector remaining_args = m_options.remaining_args (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
382 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
383 std::string code_to_eval = m_options.code_to_eval (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
384 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
385 m_have_script_file = ! remaining_args.empty (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
386 |
23102
373771419d51
refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents:
23087
diff
changeset
|
387 m_have_eval_option_code = ! code_to_eval.empty (); |
373771419d51
refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents:
23087
diff
changeset
|
388 |
373771419d51
refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents:
23087
diff
changeset
|
389 if (m_have_eval_option_code && m_have_script_file) |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
390 { |
24344
cac0f8a1c696
Stop segfault when starting Octave with conflicting options (bug #52567).
Rik <rik@octave.org>
parents:
23857
diff
changeset
|
391 std::cerr << R"(error: --eval "CODE" and script file are mutually exclusive options)" << std::endl; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
392 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
393 octave_print_terse_usage_and_exit (); |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
394 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
395 |
24874
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
396 if (m_options.gui ()) |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
397 { |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
398 if (m_options.no_window_system ()) |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
399 { |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
400 std::cerr << "error: --gui and --no-window-system are mutually exclusive options" << std::endl; |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
401 octave_print_terse_usage_and_exit (); |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
402 } |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
403 if (! m_options.line_editing ()) |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
404 { |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
405 std::cerr << "error: --gui and --no-line-editing are mutually exclusive options" << std::endl; |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
406 octave_print_terse_usage_and_exit (); |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
407 } |
29254
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
408 if (m_options.server ()) |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
409 { |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
410 std::cerr << "error: --gui and --server are mutually exclusive options" << std::endl; |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
411 octave_print_terse_usage_and_exit (); |
11343ca3c125
allow Octave to operate as a server, executing commands from a queue
John W. Eaton <jwe@octave.org>
parents:
29152
diff
changeset
|
412 } |
24874
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
413 } |
a4dc2ef8741c
Don't start GUI by default, require new '--gui' option
Carnë Draug <carandraug@octave.org>
parents:
24534
diff
changeset
|
414 |
23102
373771419d51
refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents:
23087
diff
changeset
|
415 m_is_octave_program = ((m_have_script_file || m_have_eval_option_code) |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
416 && ! m_options.persist () |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
417 && ! m_options.traditional ()); |
23460
b605146ed2ed
do sysdep init and init global vars in app, not interpreter (bug #50880)
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
418 |
b605146ed2ed
do sysdep init and init global vars in app, not interpreter (bug #50880)
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
419 // This should probably happen early. |
b605146ed2ed
do sysdep init and init global vars in app, not interpreter (bug #50880)
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
420 sysdep_init (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
421 } |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
422 |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
423 int cli_application::execute (void) |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
424 { |
23773
5ff24576b783
defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents:
23721
diff
changeset
|
425 interpreter& interp = create_interpreter (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
426 |
23773
5ff24576b783
defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents:
23721
diff
changeset
|
427 int status = interp.execute (); |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
428 |
23117
17a3567a7b01
separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents:
23111
diff
changeset
|
429 return status; |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
430 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29949
diff
changeset
|
431 |
15702
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
432 DEFUN (isguirunning, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
433 doc: /* -*- texinfo -*- |
30559
841a10208c38
doc: Use TF for output variable in documentation for isXXX functions in libinterp/ directory.
Rik <rik@octave.org>
parents:
30409
diff
changeset
|
434 @deftypefn {} {@var{tf} =} isguirunning () |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
435 Return true if Octave is running in GUI mode and false otherwise. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
436 @seealso{have_window_system} |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
437 @end deftypefn */) |
15702
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
438 { |
20849
994c0859ab8b
maint: Refactor C++ calls to print_usage to resemble m-files (2015 code sprint)
Mike Miller <mtmiller@octave.org>
parents:
20756
diff
changeset
|
439 if (args.length () != 0) |
15702
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
440 print_usage (); |
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
441 |
22089
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
442 // FIXME: This isn't quite right, it just says that we intended to |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
443 // start the GUI, not that it is actually running. |
c2c668b3051b
use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents:
22081
diff
changeset
|
444 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
445 return ovl (application::is_gui_running ()); |
15702
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
446 } |
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
447 |
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
448 /* |
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
449 %!assert (islogical (isguirunning ())) |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
450 %!error <Invalid call> isguirunning (1) |
15702
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
451 */ |
534b6f7108b7
Add isguirunning function to query whether the GUI is running
Mike Miller <mtmiller@ieee.org>
parents:
15490
diff
changeset
|
452 |
5780 | 453 DEFUN (argv, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
454 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
455 @deftypefn {} {@var{args} =} argv () |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
456 Return the command line arguments passed to Octave. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
457 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
458 For example, if you invoked Octave using the command |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
459 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
460 @example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
461 octave --no-line-editing --silent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
462 @end example |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
463 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
464 @noindent |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
465 @code{argv} would return a cell array of strings with the elements |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
466 @option{--no-line-editing} and @option{--silent}. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
467 |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
468 If you write an executable Octave script, @code{argv} will return the list |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
469 of arguments passed to the script. @xref{Executable Octave Programs}, for |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
470 an example of how to create an executable Octave script. |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
471 @seealso{program_name, cmdline_options} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
472 @end deftypefn */) |
5780 | 473 { |
20849
994c0859ab8b
maint: Refactor C++ calls to print_usage to resemble m-files (2015 code sprint)
Mike Miller <mtmiller@octave.org>
parents:
20756
diff
changeset
|
474 if (args.length () != 0) |
5823 | 475 print_usage (); |
5780 | 476 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
477 return ovl (Cell (application::argv ())); |
5780 | 478 } |
479 | |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
480 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14160
diff
changeset
|
481 %!assert (iscellstr (argv ())) |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
482 %!error <Invalid call> argv (1) |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
483 */ |
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
484 |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
485 DEFUN (cmdline_options, args, , |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
486 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
487 @deftypefn {} {@var{opt_struct} =} cmdline_options () |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
488 Return a structure containing detailed information about the command line |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
489 arguments passed to Octave. |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
490 |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
491 Programming Note: This function provides copious amounts of information about |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
492 Octave's parsing of command line options and may be more useful for debugging |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
493 Octave rather than for general use. |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
494 @seealso{argv, program_name} |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
495 @end deftypefn */) |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
496 { |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
497 if (args.length () != 0) |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
498 print_usage (); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
499 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
500 application *app = application::app (); |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
501 |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
502 if (! app) |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
503 error ("invalid application context!"); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
504 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
505 cmdline_options opts = app->options (); |
29152
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
506 |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
507 return ovl (opts.as_octave_value ()); |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
508 } |
556f20454064
make all command line option info available in scripting language
John W. Eaton <jwe@octave.org>
parents:
28349
diff
changeset
|
509 |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
510 /* |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
511 %!assert (isstruct (cmdline_options ())) |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
512 %!error <Invalid call> cmdline_options (1) |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
513 */ |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
514 |
5780 | 515 DEFUN (program_invocation_name, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
516 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
517 @deftypefn {} {@var{name} =} program_invocation_name () |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
518 Return the string that was typed at the shell prompt to run Octave. |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
519 |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
520 The string may include path components as well as the program filename. |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
521 |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
522 If executing a script from the command line (e.g., @code{octave foo.m}) or |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
523 using an executable Octave script, the program name is set to the name of the |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
524 script. @xref{Executable Octave Programs}, for an example of how to create an |
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
525 executable Octave script. |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
526 @seealso{program_name, argv} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
527 @end deftypefn */) |
5780 | 528 { |
20849
994c0859ab8b
maint: Refactor C++ calls to print_usage to resemble m-files (2015 code sprint)
Mike Miller <mtmiller@octave.org>
parents:
20756
diff
changeset
|
529 if (args.length () != 0) |
5823 | 530 print_usage (); |
5780 | 531 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
532 return ovl (application::program_invocation_name ()); |
5780 | 533 } |
534 | |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
535 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14160
diff
changeset
|
536 %!assert (ischar (program_invocation_name ())) |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
537 %!error <Invalid call> program_invocation_name (1) |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
538 */ |
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
539 |
5780 | 540 DEFUN (program_name, args, , |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
541 doc: /* -*- texinfo -*- |
30888
32d2b6604a9f
doc: Ensure documentation lists output argument when it exists for functions in libinterp/
Rik <rik@octave.org>
parents:
30565
diff
changeset
|
542 @deftypefn {} {@var{name} =} program_name () |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
543 Return the filename component of the value returned by |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
544 @code{program_invocation_name}. |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
545 |
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
546 @seealso{program_invocation_name, argv} |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21938
diff
changeset
|
547 @end deftypefn */) |
5780 | 548 { |
20849
994c0859ab8b
maint: Refactor C++ calls to print_usage to resemble m-files (2015 code sprint)
Mike Miller <mtmiller@octave.org>
parents:
20756
diff
changeset
|
549 if (args.length () != 0) |
5823 | 550 print_usage (); |
5780 | 551 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29960
diff
changeset
|
552 return ovl (application::program_name ()); |
5780 | 553 } |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
554 |
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
555 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14160
diff
changeset
|
556 %!assert (ischar (program_name ())) |
31535
4b80982e0af8
doc: Add undocumented functions to Octave manual for 8.1 release.
Rik <rik@octave.org>
parents:
31222
diff
changeset
|
557 %!error <Invalid call> program_name (1) |
12848
e3323dda983b
codesprint: new tests for octave.cc
John W. Eaton <jwe@octave.org>
parents:
12335
diff
changeset
|
558 */ |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29949
diff
changeset
|
559 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31535
diff
changeset
|
560 OCTAVE_END_NAMESPACE(octave) |