annotate libinterp/corefcn/interpreter.cc @ 24534:194eb4bd202b

maint: Update punctuation for GPL v3 license text. * COPYING, Makefile.am, README, bootstrap, bootstrap.conf, OctJavaQry.java, changelog.tmpl, check-subst-vars.in.sh, find-defun-files.sh, find-files-with-tests.sh, get-source-mtime.sh, mk-hg-id.sh, mk-octave-config-h.sh, mk-opts.pl, stl_algo.h-fixed, subst-config-vals.in.sh, subst-cross-config-vals.in.sh, subst-default-vals.in.sh, subst-script-vals.in.sh, configure.ac, Doxyfile.in, arith.txi, audio.txi, basics.txi, bugs.txi, config-images.sh, container.txi, cp-idx.txi, data.txi, debug.txi, diagperm.txi, diffeq.txi, add_to_aspell_dict, mk_undocumented_list, spellcheck, errors.txi, eval.txi, expr.txi, external.txi, fn-idx.txi, func.txi, genpropdoc.m, geometry.txi, geometryimages.m, grammar.txi, gui.txi, image.txi, images.awk, install.txi, interp.txi, interpimages.m, intro.txi, io.txi, linalg.txi, macros.texi, matrix.txi, mk-doc-cache.pl, mkcontrib.awk, mkoctfile.1, munge-texi.pl, nonlin.txi, numbers.txi, obsolete.txi, octave-cli.1, octave-config.1, octave.1, octave.css, octave.texi, oop.txi, op-idx.txi, optim.txi, package.txi, plot.txi, plotimages.m, poly.txi, preface.txi, quad.txi, set.txi, signal.txi, sparse.txi, sparseimages.m, splineimages.m, stats.txi, stmt.txi, strings.txi, system.txi, testfun.txi, var.txi, vectorize.txi, array.texi, bugs.texi, cp-idx.texi, dae.texi, diffeq.texi, error.texi, factor.texi, fn-idx.texi, gpl.texi, install.texi, intro.texi, liboctave.texi, matvec.texi, nleqn.texi, nlfunc.texi, ode.texi, optim.texi, preface.texi, quad.texi, range.texi, refcard-a4.tex, refcard-legal.tex, refcard-letter.tex, refcard.tex, HACKING.md, octave.appdata.xml.in, Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc, TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h, annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h, liboctgui-build-info.h, liboctgui-build-info.in.cc, mk-default-qt-settings.in.sh, QTerminal.cc, QTerminal.h, BlockArray.cpp, BlockArray.h, Character.h, CharacterColor.h, Emulation.cpp, Emulation.h, Filter.cpp, Filter.h, History.cpp, History.h, KeyboardTranslator.cpp, KeyboardTranslator.h, QUnixTerminalImpl.cpp, QUnixTerminalImpl.h, Screen.cpp, Screen.h, ScreenWindow.cpp, ScreenWindow.h, SelfListener.cpp, SelfListener.h, TerminalCharacterDecoder.cpp, TerminalCharacterDecoder.h, TerminalModel.cpp, TerminalModel.h, TerminalView.cpp, TerminalView.h, Vt102Emulation.cpp, Vt102Emulation.h, kpty.cpp, kpty.h, kpty_p.h, QTerminalColors.cpp, QTerminalColors.h, QWinTerminalImpl.cpp, QWinTerminalImpl.h, main.cpp, color-picker.cc, color-picker.h, dialog.cc, dialog.h, documentation-dock-widget.cc, documentation-dock-widget.h, external-editor-interface.cc, external-editor-interface.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, find-files-model.cc, find-files-model.h, history-dock-widget.cc, history-dock-widget.h, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h, octave-gui.cc, octave-gui.h, octave-qt-link.cc, octave-qt-link.h, octave-settings.h, texinfo-parser.cc, texinfo-parser.h, webinfo.cc, webinfo.h, resource-manager.cc, resource-manager.h, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h, terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc, thread-manager.h, variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h, build-env.h, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, base-text-renderer.h, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, default-defs.in.h, defaults.cc, defaults.h, defun-dld.h, defun-int.h, defun.cc, defun.h, det.cc, dirfns.cc, dirfns.h, display.cc, display.h, dlmread.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, file-io.h, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gammainc.cc, gcd.cc, genprops.awk, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-handle.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gripes.cc, gripes.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, kron.cc, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc, ls-hdf5.h, ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, ls-mat5.h, ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h, mexproto.h, mgorth.cc, mk-errno-list.sh, mk-mxarray-h.in.sh, mxarray.in.h, nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.in.yy, oct.h, octave-default-image.h, octave-link.cc, octave-link.h, ordschur.cc, pager.cc, pager.h, pinv.cc, pr-output.cc, pr-output.h, procstream.cc, procstream.h, psi.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc, txt-eng.h, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, workspace-element.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, zfstream.cc, zfstream.h, deprecated-config.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, config-module.awk, config-module.sh, convhulln.cc, dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, mk-doc.pl, mk-pkg-add.sh, mk-version-h.in.sh, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.cc, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int-traits.h, ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc, ov-int64.h, ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h, ov-uint64.cc, ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, op-kw-docs, 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-cdm-cm.cc, op-cdm-cs.cc, op-cdm-dm.cc, op-cdm-m.cc, op-cdm-s.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-pm.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-cdm.cc, op-dm-cm.cc, op-dm-cs.cc, op-dm-dm.cc, op-dm-m.cc, op-dm-s.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fcs.cc, op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcdm-fs.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fcs.cc, op-fdm-fdm.cc, op-fdm-fm.cc, op-fdm-fs.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc, op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.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-int.h, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc, op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-cm.cc, op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.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, options-usage.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.in.yy, octave.gperf, parse.h, profiler.cc, profiler.h, pt-all.h, pt-arg-list.cc, pt-arg-list.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-funcall.cc, pt-funcall.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-jit.h, pt-jump.cc, 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-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Array-jit.cc, Array-tc.cc, version.cc, version.in.h, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc, Array-util.h, Array-voidp.cc, Array.cc, Array.h, CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h, DiagArray2.cc, DiagArray2.h, MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse-C.cc, MSparse-d.cc, MSparse.cc, MSparse.h, Matrix.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.cc, chMatrix.h, chNDArray.cc, chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc, idx-vector.h, int16NDArray.cc, int16NDArray.h, int32NDArray.cc, int32NDArray.h, int64NDArray.cc, int64NDArray.h, int8NDArray.cc, int8NDArray.h, intNDArray.cc, intNDArray.h, uint16NDArray.cc, uint16NDArray.h, uint32NDArray.cc, uint32NDArray.h, uint64NDArray.cc, uint64NDArray.h, uint8NDArray.cc, uint8NDArray.h, cconv2.f, cdotc3.f, cmatm3.f, csconv2.f, dconv2.f, ddot3.f, dmatm3.f, sconv2.f, sdot3.f, smatm3.f, zconv2.f, zdconv2.f, zdotc3.f, zmatm3.f, crsf2csf.f, zrsf2csf.f, mk-f77-def.in.sh, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK-opts.in, DASPK.cc, DASPK.h, DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, DASSL.h, DET.h, EIG.cc, EIG.h, LSODE-opts.in, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.cc, ODES.h, ODESFunc.h, Quad-opts.in, Quad.cc, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, base-min.h, bsxfun-decl.h, bsxfun-defs.cc, bsxfun.h, chol.cc, chol.h, eigs-base.cc, eigs-base.h, fEIG.cc, fEIG.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-amos-proto.h, lo-arpack-proto.h, lo-blas-proto.h, lo-fftpack-proto.h, lo-lapack-proto.h, lo-mappers.cc, lo-mappers.h, lo-qrupdate-proto.h, lo-ranlib-proto.h, lo-slatec-proto.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-dmsolve.cc, sparse-dmsolve.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, config-ops.sh, mk-ops.awk, mx-base.h, mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mx-ops, smx-ops, vx-ops, child-list.cc, child-list.h, cmach-info.c, cmach-info.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, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-passwd.cc, oct-passwd.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.h, base-list.h, blaswrap.c, byte-swap.h, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, cquit.c, data-conv.cc, data-conv.h, f2c-main.c, f77-fcn.c, f77-fcn.h, file-info.cc, file-info.h, functor.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-cutils.c, lo-cutils.h, lo-error.c, lo-error.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-traits.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.cc, oct-glob.h, oct-inttypes-fwd.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-rl-edit.c, oct-rl-edit.h, oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, oct-sparse.h, oct-string.cc, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, singleton-cleanup.cc, singleton-cleanup.h, sparse-sort.cc, sparse-sort.h, sparse-util.cc, sparse-util.h, str-vec.cc, str-vec.h, sun-utils.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, areadlink-wrapper.c, areadlink-wrapper.h, async-system-wrapper.c, async-system-wrapper.h, base64-wrappers.c, base64-wrappers.h, canonicalize-file-name-wrapper.c, canonicalize-file-name-wrapper.h, dirent-wrappers.c, dirent-wrappers.h, fcntl-wrappers.c, fcntl-wrappers.h, filepos-wrappers.c, filepos-wrappers.h, fpucw-wrappers.c, fpucw-wrappers.h, gen-tempname-wrapper.c, gen-tempname-wrapper.h, getopt-wrapper.c, getopt-wrapper.h, glob-wrappers.c, glob-wrappers.h, hash-wrappers.c, hash-wrappers.h, localcharset-wrapper.c, localcharset-wrapper.h, math-wrappers.c, math-wrappers.h, mkostemp-wrapper.c, mkostemp-wrapper.h, nanosleep-wrapper.c, nanosleep-wrapper.h, nproc-wrapper.c, nproc-wrapper.h, octave-popen2.c, octave-popen2.h, putenv-wrapper.c, putenv-wrapper.h, set-program-name-wrapper.c, set-program-name-wrapper.h, signal-wrappers.c, signal-wrappers.h, stat-wrappers.c, stat-wrappers.h, strdup-wrapper.c, strdup-wrapper.h, strftime-wrapper.c, strftime-wrapper.h, strmode-wrapper.c, strmode-wrapper.h, strptime-wrapper.c, strptime-wrapper.h, time-wrappers.c, time-wrappers.h, tmpfile-wrapper.c, tmpfile-wrapper.h, uname-wrapper.c, uname-wrapper.h, uniconv-wrappers.c, uniconv-wrappers.h, unistd-wrappers.c, unistd-wrappers.h, unsetenv-wrapper.c, unsetenv-wrapper.h, vasprintf-wrapper.c, vasprintf-wrapper.h, wait-for-input.c, wait-for-input.h, wait-wrappers.c, wait-wrappers.h, acinclude.m4, ax_blas.m4, ax_lapack.m4, ax_openmp.m4, ax_pthread.m4, octave_blas_f77_func.m4, pkg.m4, oct-conf-post.in.h, run-octave.in, Map.m, ascii.m, binary.m, cd.m, close.m, delete.m, dir.m, disp.m, ftp.m, loadobj.m, mget.m, mkdir.m, mput.m, rename.m, rmdir.m, saveobj.m, __get_properties__.m, audioplayer.m, disp.m, get.m, isplaying.m, pause.m, play.m, playblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, __get_properties__.m, audiorecorder.m, disp.m, get.m, getaudiodata.m, getplayer.m, isrecording.m, pause.m, play.m, record.m, recordblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, lin2mu.m, mu2lin.m, record.m, sound.m, soundsc.m, bitmax.m, chop.m, comma.m, isstr.m, mahalanobis.m, md5sum.m, octave_config_info.m, onenormest.m, paren.m, semicolon.m, sleep.m, usleep.m, wavread.m, wavwrite.m, acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m, atan2d.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, cell2mat.m, celldisp.m, circshift.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m, deg2rad.m, del2.m, divergence.m, flip.m, flipdim.m, fliplr.m, flipud.m, gradient.m, idivide.m, int2str.m, integral.m, integral2.m, integral3.m, interp1.m, interp2.m, interp3.m, interpft.m, interpn.m, isequal.m, isequaln.m, logspace.m, nextpow2.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m, __splinen__.m, quad2d.m, quadgk.m, quadl.m, quadv.m, rad2deg.m, randi.m, rat.m, repelem.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sortrows.m, sph2cart.m, structfun.m, subsindex.m, trapz.m, triplequad.m, xor.m, convhull.m, delaunay.m, delaunayn.m, dsearch.m, dsearchn.m, griddata.m, griddata3.m, griddatan.m, inpolygon.m, rectint.m, tsearchn.m, voronoi.m, voronoin.m, dialog.m, errordlg.m, getappdata.m, guidata.m, guihandles.m, helpdlg.m, inputdlg.m, isappdata.m, listdlg.m, msgbox.m, __file_filter__.m, __fltk_file_filter__.m, __get_funcname__.m, __is_function__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m, __uiputfile_fltk__.m, questdlg.m, rmappdata.m, setappdata.m, uibuttongroup.m, uicontextmenu.m, uicontrol.m, uigetdir.m, uigetfile.m, uimenu.m, uipanel.m, uipushtool.m, uiputfile.m, uiresume.m, uitoggletool.m, uitoolbar.m, uiwait.m, waitbar.m, waitforbuttonpress.m, warndlg.m, __gripe_missing_component__.m, __makeinfo__.m, __unimplemented__.m, ans.m, debug.m, doc.m, doc_cache_create.m, error_ids.m, get_first_help_sentence.m, help.m, lookfor.m, print_usage.m, __additional_help_message__.m, __strip_html_tags__.m, slash.m, type.m, warning_ids.m, which.m, autumn.m, bone.m, brighten.m, cmpermute.m, cmunique.m, colorcube.m, colormap.m, contrast.m, cool.m, copper.m, cubehelix.m, flag.m, frame2im.m, getframe.m, gray.m, gray2ind.m, hot.m, hsv.m, hsv2rgb.m, im2double.m, im2frame.m, image.m, imagesc.m, imfinfo.m, imformats.m, imread.m, imshow.m, imwrite.m, ind2gray.m, ind2rgb.m, iscolormap.m, jet.m, lines.m, ntsc2rgb.m, ocean.m, pink.m, prism.m, __imfinfo__.m, __imread__.m, __imwrite__.m, colorspace_conversion_input_check.m, colorspace_conversion_revert.m, imageIO.m, imwrite_filename.m, ind2x.m, rainbow.m, rgb2hsv.m, rgb2ind.m, rgb2ntsc.m, rgbplot.m, spinmap.m, spring.m, summer.m, viridis.m, white.m, winter.m, beep.m, csvread.m, csvwrite.m, dlmwrite.m, fileread.m, importdata.m, is_valid_file_id.m, strread.m, textread.m, javaArray.m, java_get.m, java_set.m, javaaddpath.m, javachk.m, javaclasspath.m, javamem.m, javarmpath.m, ClassHelper.java, Matrix.java, OctClassLoader.java, Octave.java, OctaveReference.java, usejava.m, bandwidth.m, commutation_matrix.m, cond.m, condeig.m, condest.m, cross.m, duplication_matrix.m, expm.m, gls.m, housh.m, isbanded.m, isdefinite.m, isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m, krylov.m, linsolve.m, logm.m, lscov.m, normest.m, normest1.m, null.m, ols.m, orth.m, planerot.m, qzhess.m, rank.m, rref.m, subspace.m, trace.m, vech.m, vecnorm.m, bug_report.m, bunzip2.m, cast.m, citation.m, compare_versions.m, computer.m, copyfile.m, delete.m, desktop.m, dir.m, dos.m, edit.m, fact.m, fieldnames.m, fileattrib.m, fileparts.m, fullfile.m, genvarname.m, getfield.m, grabcode.m, gunzip.m, info.m, inputParser.m, inputname.m, isdeployed.m, isdir.m, ismac.m, ispc.m, isunix.m, license.m, list_primes.m, loadobj.m, ls.m, ls_command.m, menu.m, methods.m, mex.m, mexext.m, mkdir.m, mkoctfile.m, movefile.m, namelengthmax.m, nargchk.m, narginchk.m, nargoutchk.m, news.m, nthargout.m, open.m, orderfields.m, pack.m, parseparams.m, perl.m, __publish_html_output__.m, __publish_latex_output__.m, __w2mpth__.m, display_info_file.m, publish.m, python.m, recycle.m, run.m, saveobj.m, setfield.m, substruct.m, swapbytes.m, symvar.m, tar.m, tempdir.m, tmpnam.m, unix.m, unpack.m, untar.m, unzip.m, validateattributes.m, ver.m, version.m, what.m, zip.m, mk-doc.pl, mk-pkg-add.sh, decic.m, ode15i.m, ode15s.m, ode23.m, ode45.m, odeget.m, odeplot.m, odeset.m, AbsRel_norm.m, check_default_input.m, integrate_adaptive.m, kahan.m, ode_event_handler.m, odedefaults.m, odemergeopts.m, runge_kutta_23.m, runge_kutta_45_dorpri.m, runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m, fminsearch.m, fminunc.m, fsolve.m, fzero.m, glpk.m, humps.m, lsqnonneg.m, optimget.m, optimset.m, pqpnonneg.m, __fdjac__.m, qp.m, sqp.m, import.m, matlabroot.m, pathdef.m, getsavepath.m, savepath.m, pkg.m, build.m, configure_make.m, default_prefix.m, describe.m, dirempty.m, get_description.m, get_forge_download.m, get_forge_pkg.m, get_unsatisfied_deps.m, getarch.m, getarchdir.m, install.m, installed_packages.m, list_forge_packages.m, load_packages.m, load_packages_and_dependencies.m, rebuild.m, save_order.m, uninstall.m, unload_packages.m, __clabel__.m, __getlegenddata__.m, __rotate_around_axis__.m, annotation.m, axis.m, box.m, camlookat.m, camorbit.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, caxis.m, clabel.m, daspect.m, datetick.m, diffuse.m, grid.m, gtext.m, hidden.m, legend.m, lighting.m, material.m, orient.m, pbaspect.m, __axis_label__.m, __axis_limits__.m, rticks.m, shading.m, specular.m, text.m, thetaticks.m, title.m, view.m, whitebg.m, xlabel.m, xlim.m, xticklabels.m, xticks.m, ylabel.m, ylim.m, yticklabels.m, yticks.m, zlabel.m, zlim.m, zticklabels.m, zticks.m, area.m, bar.m, barh.m, camlight.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourc.m, contourf.m, cylinder.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m, isosurface.m, light.m, line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m, pcolor.m, peaks.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, __add_datasource__.m, __bar__.m, __calc_isovalue_from_data__.m, __contour__.m, __errplot__.m, __ezplot__.m, __interp_cube__.m, __line__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __quiver__.m, __scatter__.m, __stem__.m, __unite_shared_vertices__.m, quiver.m, quiver3.m, rectangle.m, reducepatch.m, reducevolume.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shrinkfaces.m, slice.m, smooth3.m, sombrero.m, sphere.m, stairs.m, stem.m, stem3.m, stemleaf.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m, tetramesh.m, trimesh.m, triplot.m, trisurf.m, waterfall.m, __actual_axis_position__.m, __default_plot_options__.m, __gnuplot_drawnow__.m, __next_line_color__.m, __next_line_style__.m, __opengl_info__.m, __plt_get_axis_arg__.m, __pltopt__.m, allchild.m, ancestor.m, axes.m, cla.m, clf.m, close.m, closereq.m, colstyle.m, copyobj.m, figure.m, findall.m, findfigs.m, findobj.m, gca.m, gcbf.m, gcbo.m, gcf.m, gco.m, ginput.m, gnuplot_binary.in.m, graphics_toolkit.m, groot.m, hdl2struct.m, hggroup.m, hgload.m, hgsave.m, hgtransform.m, hold.m, isaxes.m, isfigure.m, isgraphics.m, ishandle.m, ishold.m, isprop.m, linkaxes.m, linkprop.m, meshgrid.m, ndgrid.m, newplot.m, pan.m, print.m, printd.m, __add_default_menu__.m, __ghostscript__.m, __gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, __gnuplot_get_var__.m, __gnuplot_ginput__.m, __gnuplot_has_feature__.m, __gnuplot_has_terminal__.m, __gnuplot_open_stream__.m, __gnuplot_print__.m, __gnuplot_version__.m, __opengl_print__.m, __print_parse_opts__.m, __set_default_mouse_modes__.m, refresh.m, refreshdata.m, rotate.m, rotate3d.m, saveas.m, shg.m, struct2hdl.m, subplot.m, zoom.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, padecoef.m, pchip.m, poly.m, polyaffine.m, polyder.m, polyeig.m, polyfit.m, polygcd.m, polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, unmkpp.m, addpref.m, getpref.m, ispref.m, prefdir.m, preferences.m, loadprefs.m, prefsfile.m, saveprefs.m, rmpref.m, setpref.m, style.css, profexplore.m, profexport.m, profile.m, profshow.m, intersect.m, ismember.m, powerset.m, validsetargs.m, setdiff.m, setxor.m, union.m, unique.m, arch_fit.m, arch_rnd.m, arch_test.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, diffpara.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, filter2.m, fractdiff.m, freqz.m, freqz_plot.m, hamming.m, hanning.m, hurst.m, ifftshift.m, periodogram.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, triangle_sw.m, sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicg.m, bicgstab.m, cgs.m, colperm.m, eigs.m, etreeplot.m, gmres.m, gplot.m, ichol.m, ilu.m, nonzeros.m, pcg.m, pcr.m, __sprand__.m, qmr.m, spaugment.m, spconvert.m, spdiags.m, speye.m, spfun.m, spones.m, sprand.m, sprandn.m, sprandsym.m, spstats.m, spy.m, svds.m, treelayout.m, treeplot.m, bessel.m, beta.m, betaln.m, ellipke.m, expint.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m, nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m, gallery.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m, toeplitz.m, vander.m, wilkinson.m, __finish__.m, center.m, cloglog.m, corr.m, corrcoef.m, cov.m, crosstab.m, histc.m, iqr.m, kendall.m, kurtosis.m, logit.m, mean.m, meansq.m, median.m, mode.m, moment.m, ppplot.m, prctile.m, probit.m, qqplot.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m, skewness.m, spearman.m, statistics.m, std.m, var.m, zscore.m, betacdf.m, betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m, cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m, chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m, fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m, geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m, kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m, laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m, logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m, nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m, poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m, stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m, unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m, wblinv.m, wblpdf.m, wblrnd.m, wienrnd.m, logistic_regression.m, logistic_regression_derivatives.m, logistic_regression_likelihood.m, anova.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, cor_test.m, f_test_regression.m, hotelling_test.m, hotelling_test_2.m, kolmogorov_smirnov_test.m, kolmogorov_smirnov_test_2.m, kruskal_wallis_test.m, manova.m, mcnemar_test.m, prop_test_2.m, run_test.m, sign_test.m, t_test.m, t_test_2.m, t_test_regression.m, u_test.m, var_test.m, welch_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, erase.m, findstr.m, hex2dec.m, index.m, isletter.m, isstring.m, isstrprop.m, mat2str.m, native2unicode.m, ostrsplit.m, regexptranslate.m, rindex.m, str2num.m, strcat.m, strchr.m, strjoin.m, strjust.m, strmatch.m, strsplit.m, strtok.m, strtrim.m, strtrunc.m, substr.m, unicode2native.m, untabify.m, validatestring.m, __have_feature__.m, __printf_assert__.m, __prog_output_assert__.m, __run_test_suite__.m, assert.m, demo.m, example.m, fail.m, compare_plot_demos.m, dump_demos.m, html_compare_plot_demos.m, rundemos.m, runtests.m, speed.m, test.m, addtodate.m, asctime.m, calendar.m, clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m, is_leap_year.m, now.m, weekday.m, display-available.c, display-available.h, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc, octave-config.in.cc, shared-fcns.h, args.tst, bug-31371.tst, bug-35448.tst, bug-35881.tst, bug-36025.tst, bug-38236.tst, bug-38565.tst, bug-38576.tst, bug-38691.tst, bug-41723.tst, bug-44940.tst, bug-46330.tst, bug-46660.tst, bug-50014.tst, bug-50035.tst, bug-50716.tst, bug-51192.tst, bug-51532.tst, bug-51534.tst, bug-51599.tst, bug-52075.tst, class-concat.tst, classdef-multiple-inheritance.tst, classdef.tst, classes.tst, colormaps.tst, command.tst, complex.tst, ctor-vs-method.tst, deprecate-props.tst, diag-perm.tst, error.tst, eval-catch.tst, fcn-handle-derived-resolution.tst, fntests.m, for.tst, func.tst, global.tst, if.tst, index.tst, io.tst, jit.tst, leftdiv.tst, line-continue.tst, logical-index.tst, mk-bc-overloads-tst.sh, mk-conv-tst.sh, mk-sparse-tst.sh, nest.tst, null-assign.tst, parser.tst, prefer.tst, publish.tst, range.tst, recursion.tst, return.tst, show-failures.awk, single-index.tst, slice.tst, struct.tst, switch.tst, system.tst, transpose.tst, try.tst, unwind.tst, while.tst: Changed punctuation of GPL license text to match that suggested by FSF.
author Rik <rik@octave.org>
date Sat, 06 Jan 2018 07:57:19 -0800
parents c5c11b07598a
children 2b273df71aa0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1993-2017 John W. Eaton
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
10 (at your option) any later version.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22718
diff changeset
15 GNU General Public License for more details.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
19 <https://www.gnu.org/licenses/>.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 #if defined (HAVE_CONFIG_H)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 # include "config.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #endif
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #include <string>
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #include <iostream>
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include "cmd-edit.h"
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
31 #include "cmd-hist.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "file-ops.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "file-stat.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "fpucw-wrappers.h"
22322
93b3cdd36854 move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents: 22196
diff changeset
35 #include "lo-blas-proto.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 #include "lo-error.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 #include "oct-env.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 #include "str-vec.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 #include "signal-wrappers.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 #include "unistd-wrappers.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
42 #include "builtin-defun-decls.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 #include "builtins.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 #include "defaults.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 #include "Cell.h"
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
46 #include "call-stack.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 #include "defun.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 #include "display.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 #include "error.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 #include "file-io.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 #include "graphics.h"
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
52 #include "help.h"
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
53 #include "interpreter-private.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 #include "interpreter.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 #include "load-path.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 #include "load-save.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 #include "octave-link.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 #include "octave.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 #include "oct-hist.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 #include "oct-map.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 #include "oct-mutex.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 #include "ops.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 #include "ovl.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 #include "ov.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 #include "ov-classdef.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 #include "parse.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 #include "pt-eval.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 #include "pt-jump.h"
23127
5a91168a30be avoid including parse tree headers in other header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 23117
diff changeset
69 #include "pt-mat.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 #include "pt-stmt.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 #include "sighandlers.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 #include "sysdep.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 #include "unwind-prot.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 #include "utils.h"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 #include "variables.h"
23466
5da300c55e89 use "" instead of <> for including defaults.h and version.h
John W. Eaton <jwe@octave.org>
parents: 23460
diff changeset
76 #include "version.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 // TRUE means the quit() call is allowed.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 bool quit_allowed = true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 // TRUE means we are ready to interpret commands, but not everything
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 // is ready for interactive use.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 bool octave_interpreter_ready = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 // TRUE means we've processed all the init code and we are good to go.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 bool octave_initialized = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 DEFUN (__version_info__, args, ,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 doc: /* -*- texinfo -*-
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 @deftypefn {} {retval =} __version_info__ (@var{name}, @var{version}, @var{release}, @var{date})
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 Undocumented internal function.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 @end deftypefn */)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 static octave_map vinfo;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 int nargin = args.length ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 if (nargin != 0 && nargin != 4)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 print_usage ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 octave_value retval;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 if (nargin == 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 retval = vinfo;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 else if (nargin == 4)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 if (vinfo.nfields () == 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 vinfo.assign ("Name", args(0));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 vinfo.assign ("Version", args(1));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 vinfo.assign ("Release", args(2));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 vinfo.assign ("Date", args(3));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 else
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 octave_idx_type n = vinfo.numel () + 1;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 vinfo.resize (dim_vector (n, 1));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 octave_value idx (n);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 vinfo.assign (idx, "Name", Cell (octave_value (args(0))));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 vinfo.assign (idx, "Version", Cell (octave_value (args(1))));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 vinfo.assign (idx, "Release", Cell (octave_value (args(2))));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 vinfo.assign (idx, "Date", Cell (octave_value (args(3))));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 return retval;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 static void
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 initialize_version_info (void)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135 octave_value_list args;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 args(3) = OCTAVE_RELEASE_DATE;
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
138 args(2) = octave::config::release ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139 args(1) = OCTAVE_VERSION;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 args(0) = "GNU Octave";
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 F__version_info__ (args, 0);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 OCTAVE_NORETURN static void
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146 lo_error_handler (const char *fmt, ...)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148 va_list args;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
149 va_start (args, fmt);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 verror_with_cfn (fmt, args);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151 va_end (args);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153 octave_throw_execution_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 OCTAVE_NORETURN static void
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 lo_error_with_id_handler (const char *id, const char *fmt, ...)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 va_list args;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160 va_start (args, fmt);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 verror_with_id_cfn (id, fmt, args);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 va_end (args);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 octave_throw_execution_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167 static void
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 initialize_error_handlers ()
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 set_liboctave_error_handler (lo_error_handler);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 set_liboctave_error_with_id_handler (lo_error_with_id_handler);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 set_liboctave_warning_handler (warning);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 set_liboctave_warning_with_id_handler (warning_with_id);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 DEFUN (quit, args, ,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 doc: /* -*- texinfo -*-
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 @deftypefn {} {} exit
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 @deftypefnx {} {} exit (@var{status})
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 @deftypefnx {} {} quit
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 @deftypefnx {} {} quit (@var{status})
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 Exit the current Octave session.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 If the optional integer value @var{status} is supplied, pass that value to
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 the operating system as Octave's exit status. The default value is zero.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 When exiting, Octave will attempt to run the m-file @file{finish.m} if it
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188 exists. User commands to save the workspace or clean up temporary files
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189 may be placed in that file. Alternatively, another m-file may be scheduled
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190 to run using @code{atexit}.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191 @seealso{atexit}
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 @end deftypefn */)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194 // Confirm OK to shutdown. Note: A dynamic function installation similar
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 // to overriding polymorphism for which the GUI can install its own "quit"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196 // yet call this base "quit" could be nice. No link would be needed here.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197 if (! octave_link::confirm_shutdown ())
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 return ovl ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 if (! quit_allowed)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201 error ("quit: not supported in embedded mode");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203 int exit_status = 0;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 if (args.length () > 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206 exit_status = args(0).nint_value ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208 // Instead of simply calling exit, we thrown an exception so that no
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 // matter where the call to quit occurs, we will run the
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210 // unwind_protect stack, clear the OCTAVE_LOCAL_BUFFER allocations,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 // etc. before exiting.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
213 throw octave::exit_exception (exit_status);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 return ovl ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 DEFALIAS (exit, quit);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 DEFUN (atexit, args, nargout,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 doc: /* -*- texinfo -*-
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 @deftypefn {} {} atexit (@var{fcn})
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 @deftypefnx {} {} atexit (@var{fcn}, @var{flag})
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 Register a function to be called when Octave exits.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226 For example,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 @example
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229 @group
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 function last_words ()
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 disp ("Bye bye");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232 endfunction
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 atexit ("last_words");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 @end group
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235 @end example
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237 @noindent
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 will print the message @qcode{"Bye bye"} when Octave exits.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240 The additional argument @var{flag} will register or unregister @var{fcn}
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 from the list of functions to be called when Octave exits. If @var{flag} is
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242 true, the function is registered, and if @var{flag} is false, it is
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243 unregistered. For example, after registering the function @code{last_words}
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244 above,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 @example
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 atexit ("last_words", false);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
248 @end example
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
250 @noindent
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
251 will remove the function from the list and Octave will not call
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
252 @code{last_words} when it exits.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254 Note that @code{atexit} only removes the first occurrence of a function
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 from the list, so if a function was placed in the list multiple times with
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256 @code{atexit}, it must also be removed from the list multiple times.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257 @seealso{quit}
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
258 @end deftypefn */)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
260 int nargin = args.length ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 if (nargin < 1 || nargin > 2)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 print_usage ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265 std::string arg = args(0).xstring_value ("atexit: FCN argument must be a string");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 bool add_mode = (nargin == 2)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268 ? args(1).xbool_value ("atexit: FLAG argument must be a logical value")
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
269 : true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271 octave_value_list retval;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 if (add_mode)
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
274 octave::interpreter::add_atexit_function (arg);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275 else
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 {
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
277 bool found = octave::interpreter::remove_atexit_function (arg);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279 if (nargout > 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280 retval = ovl (found);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283 return retval;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
284 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 // Execute commands from a file and catch potential exceptions in a consistent
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287 // way. This function should be called anywhere we might parse and execute
22173
8de49f15e182 doc: Fix "doubled words" typos (\b(\w+)\s+\1\b)
Andreas Weber <andy.weber.aw@gmail.com>
parents: 22133
diff changeset
288 // commands from a file before we have entered the main loop in
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
289 // toplev.cc.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
291 static int
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 safe_source_file (const std::string& file_name,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293 const std::string& context = "",
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 bool verbose = false, bool require_file = true,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 const std::string& warn_for = "")
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
297 try
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298 {
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23060
diff changeset
299 octave::source_file (file_name, context, verbose, require_file, warn_for);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
301 catch (const octave::interrupt_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 {
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
303 octave::interpreter::recover_from_exception ();
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
304
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
305 return 1;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306 }
23537
94968aa621a8 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23533
diff changeset
307 catch (const octave::execution_exception& e)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308 {
23537
94968aa621a8 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23533
diff changeset
309 std::string stack_trace = e.info ();
23536
14b61de53028 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23219
diff changeset
310
14b61de53028 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23219
diff changeset
311 if (! stack_trace.empty ())
14b61de53028 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23219
diff changeset
312 std::cerr << stack_trace;
14b61de53028 show stack trace for errors in command line and startup files (bug #49346)
John W. Eaton <jwe@octave.org>
parents: 23219
diff changeset
313
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
314 octave::interpreter::recover_from_exception ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
316 return 1;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317 }
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
318
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
319 return 0;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
321
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322 static void
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323 execute_pkg_add (const std::string& dir)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 std::string file_name = octave::sys::file_ops::concat (dir, "PKG_ADD");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
326
23445
8e310ef0fa97 move load_path class to octave namespace
John W. Eaton <jwe@octave.org>
parents: 23438
diff changeset
327 octave::load_path& lp = octave::__get_load_path__ ("execute_pkg_add");
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
328
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329 try
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
330 {
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
331 lp.execute_pkg_add (dir);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
332 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
333 catch (const octave::interrupt_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334 {
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
335 octave::interpreter::recover_from_exception ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
337 catch (const octave::execution_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
338 {
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
339 octave::interpreter::recover_from_exception ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
341 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
343 namespace octave
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344 {
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
345 // Create an interpreter object and perform initialization up to the
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
346 // point of setting reading command history and setting the load
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
347 // path.
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
348
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
349 interpreter::interpreter (application *app_context)
23627
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
350 : m_app_context (app_context),
23719
69a111259a2c eliminate some global variables
John W. Eaton <jwe@octave.org>
parents: 23717
diff changeset
351 m_environment (),
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
352 m_help_system (*this),
23627
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
353 m_dynamic_loader (*this),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
354 m_load_path (),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
355 m_symbol_table (),
23630
8a47d4735655 avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents: 23627
diff changeset
356 m_evaluator (*this),
23738
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
357 m_stream_list (*this),
23742
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
358 m_url_handle_manager (),
23651
5c6cceef132b don't use singleton for cdef_manager object
John W. Eaton <jwe@octave.org>
parents: 23630
diff changeset
359 m_cdef_manager (*this),
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23753
diff changeset
360 m_gtk_manager (),
23627
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
361 m_interactive (false),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
362 m_read_site_files (true),
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
363 m_read_init_files (m_app_context != nullptr),
23627
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
364 m_verbose (false),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
365 m_inhibit_startup_message (false),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
366 m_load_path_initialized (false),
0a6e87804cab don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents: 23611
diff changeset
367 m_history_initialized (false),
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
368 m_initialized (false)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
369 {
23511
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
370 if (instance)
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
371 throw std::runtime_error
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
372 ("only one Octave interpreter object may be active");
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
373
23511
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
374 instance = this;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
375
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376 // Matlab uses "C" locale for LC_NUMERIC class regardless of local setting
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
377 setlocale (LC_NUMERIC, "C");
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
378 setlocale (LC_TIME, "C");
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
379 sys::env::putenv ("LC_NUMERIC", "C");
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
380 sys::env::putenv ("LC_TIME", "C");
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
381
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
382 // Initialize the default floating point unit control state.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
383 octave_set_default_fpucw ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
384
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
385 thread::init ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
386
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387 set_default_prompts ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
389 // Initialize default warning state before --traditional option
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
390 // that may reset them.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
391
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392 initialize_default_warning_state ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
393
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
394 octave_ieee_init ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
396 octave_prepare_hdf5 ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
398 // The idea here is to force xerbla to be referenced so that we will link to
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399 // our own version instead of the one provided by the BLAS library. But
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
400 // numeric_limits<double>::NaN () should never be -1, so we
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401 // should never actually call xerbla. FIXME (again!): If this
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
402 // becomes a constant expression the test might be optimized away and
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403 // then the reference to the function might also disappear.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
404
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
405 if (numeric_limits<double>::NaN () == -1)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
406 F77_FUNC (xerbla, XERBLA) ("octave", 13 F77_CHAR_ARG_LEN (6));
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
407
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408 initialize_error_handlers ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
409
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
410 if (m_app_context)
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
411 install_signal_handlers ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
412 else
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
413 quit_allowed = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415 install_types ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
417 install_ops ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419 install_builtins ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420
23651
5c6cceef132b don't use singleton for cdef_manager object
John W. Eaton <jwe@octave.org>
parents: 23630
diff changeset
421 m_cdef_manager.initialize ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
422
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
423 bool line_editing = false;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
424 bool traditional = false;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
426 if (m_app_context)
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
427 {
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
428 // Embedded interpeters don't execute command line options.
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
429 const cmdline_options& options = m_app_context->options ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
431 // Make all command-line arguments available to startup files,
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
432 // including PKG_ADD files.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
433
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
434 string_vector args = options.all_args ();
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
435
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
436 m_app_context->intern_argv (args);
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
437 intern_nargin (args.numel () - 1);
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
438
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
439 bool is_octave_program = m_app_context->is_octave_program ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
440
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
441 std::list<std::string> command_line_path = options.command_line_path ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
443 for (const auto& pth : command_line_path)
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
444 m_load_path.set_command_line_path (pth);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
446 std::string exec_path = options.exec_path ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
447 if (! exec_path.empty ())
23719
69a111259a2c eliminate some global variables
John W. Eaton <jwe@octave.org>
parents: 23717
diff changeset
448 m_environment.exec_path (exec_path);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
450 std::string image_path = options.image_path ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
451 if (! image_path.empty ())
23719
69a111259a2c eliminate some global variables
John W. Eaton <jwe@octave.org>
parents: 23717
diff changeset
452 m_environment.image_path (image_path);
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
453
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
454 if (options.no_window_system ())
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
455 display_info::no_window_system ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
456
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
457 // Is input coming from a terminal? If so, we are probably
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
458 // interactive.
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
459
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
460 // If stdin is not a tty, then we are reading commands from a
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
461 // pipe or a redirected file.
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
462 bool stdin_is_tty = octave_isatty_wrapper (fileno (stdin));
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
464 m_interactive = (! is_octave_program && stdin_is_tty
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
465 && octave_isatty_wrapper (fileno (stdout)));
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
466
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
467 // Check if the user forced an interactive session.
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
468 if (options.forced_interactive ())
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
469 m_interactive = true;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
471 line_editing = options.line_editing ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
472 if ((! m_interactive || options.forced_interactive ())
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
473 && ! options.forced_line_editing ())
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
474 line_editing = false;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
476 traditional = options.traditional ();
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
477
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
478 // FIXME: if possible, perform the following actions directly
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
479 // instead of using the interpreter-level functions.
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
480
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
481 if (options.echo_commands ())
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
482 m_evaluator.echo
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
483 (tree_evaluator::ECHO_SCRIPTS | tree_evaluator::ECHO_FUNCTIONS);
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
484
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
485 std::string docstrings_file = options.docstrings_file ();
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
486 if (! docstrings_file.empty ())
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
487 Fbuilt_in_docstrings_file (*this, octave_value (docstrings_file));
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
488
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
489 std::string doc_cache_file = options.doc_cache_file ();
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
490 if (! doc_cache_file.empty ())
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
491 Fdoc_cache_file (*this, octave_value (doc_cache_file));
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
492
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
493 std::string info_file = options.info_file ();
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
494 if (! info_file.empty ())
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
495 Finfo_file (*this, octave_value (info_file));
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
496
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
497 std::string info_program = options.info_program ();
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
498 if (! info_program.empty ())
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
499 Finfo_program (*this, octave_value (info_program));
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
500
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
501 if (options.debug_jit ())
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
502 Fdebug_jit (octave_value (true));
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
503
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
504 if (options.jit_compiler ())
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
505 Fjit_enable (octave_value (true));
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
506
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
507 std::string texi_macros_file = options.texi_macros_file ();
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
508 if (! texi_macros_file.empty ())
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23719
diff changeset
509 Ftexi_macros_file (*this, octave_value (texi_macros_file));
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
510 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
511
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512 // Force default line editor if we don't want readline editing.
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
513 if (line_editing)
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
514 initialize_command_input ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
515 else
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
516 command_editor::force_default_editor ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
517
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
518 // These can come after command line args since none of them set any
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519 // defaults that might be changed by command line options.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
520
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521 initialize_version_info ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
522
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
523 // This should be done before initializing the load path because
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
524 // some PKG_ADD files might need --traditional behavior.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
526 if (traditional)
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
527 maximum_braindamage ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
528
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
529 octave_interpreter_ready = true;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
531
23511
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
532 interpreter *interpreter::instance = nullptr;
232c8d69d934 manage interpreter instance in interpreter object
John W. Eaton <jwe@octave.org>
parents: 23466
diff changeset
533
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
534 interpreter::~interpreter (void)
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
535 {
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
536 cleanup ();
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
537 }
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
538
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
539 void interpreter::intern_nargin (octave_idx_type nargs)
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
540 {
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23609
diff changeset
541 // FIXME: should this explicitly be top_scope?
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
542 symbol_scope scope = m_symbol_table.current_scope ();
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23609
diff changeset
543
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23609
diff changeset
544 if (scope)
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23609
diff changeset
545 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
546 scope.assign (".nargin.", nargs);
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
547 scope.mark_hidden (".nargin.");
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23609
diff changeset
548 }
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
549 }
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22186
diff changeset
550
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
551 // Read the history file unless a command-line option inhibits that.
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
552
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
553 void interpreter::initialize_history (bool read_history_file)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554 {
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
555 if (! m_history_initialized)
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
556 {
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
557 // Allow command-line option to override.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
559 if (m_app_context)
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
560 {
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
561 const cmdline_options& options = m_app_context->options ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
562
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
563 read_history_file = options.read_history_file ();
23711
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
564
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
565 if (! read_history_file)
5a97aafb12a9 don't call built-in interpreter functions from the application context
John W. Eaton <jwe@octave.org>
parents: 23703
diff changeset
566 command_history::ignore_entries ();
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
567 }
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
568
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
569 ::initialize_history (read_history_file);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
570
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
571 if (! m_app_context)
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
572 command_history::ignore_entries ();
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
573
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
574 m_history_initialized = true;
23092
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
575 }
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
576 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
577
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
578 // Set the initial path to the system default unless command-line
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
579 // option says to leave it empty.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
580
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
581 void interpreter::initialize_load_path (bool set_initial_path)
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
582 {
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
583 if (! m_load_path_initialized)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
584 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
585 // Allow command-line option to override.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
586
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
587 if (m_app_context)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
588 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
589 const cmdline_options& options = m_app_context->options ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
590
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
591 set_initial_path = options.set_initial_path ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
592 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
593
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
594 // Temporarily set the execute_pkg_add function to one that
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
595 // catches exceptions. This is better than wrapping
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
596 // load_path::initialize in a try-catch block because it will
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
597 // not stop executing PKG_ADD files at the first exception.
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
598 // It's also better than changing the default execute_pkg_add
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
599 // function to use safe_source file because that will normally
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
600 // be evaluated from the normal intepreter loop where exceptions
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
601 // are already handled.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
602
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
603 unwind_protect frame;
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
604
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
605 frame.add_method (m_load_path, &load_path::set_add_hook,
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
606 m_load_path.get_add_hook ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
607
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
608 m_load_path.set_add_hook (execute_pkg_add);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
609
23438
d24d01273bd0 eliminate load-path singleton
John W. Eaton <jwe@octave.org>
parents: 23435
diff changeset
610 m_load_path.initialize (set_initial_path);
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
611
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
612 m_load_path_initialized = true;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
613 }
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
614 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
615
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
616 // This may be called separately from execute
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
617
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
618 void interpreter::initialize (void)
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
619 {
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
620 if (m_initialized)
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
621 return;
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
622
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
623 display_startup_message ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
624
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
625 // Wait to read the history file until the interpreter reads input
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
626 // files and begins evaluating commands.
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
627
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
628 initialize_history ();
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
629
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
630 // Initializing the load path may execute PKG_ADD files, so can't be
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
631 // done until the interpreter is ready to execute commands.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
632
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
633 // Deferring it to the execute step also allows the path to be
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
634 // initialized between creating and execute the interpreter, for
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
635 // example, to set a custom path for an embedded interpreter.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
636
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
637 initialize_load_path ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
638
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
639 m_initialized = true;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
640 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
641
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
642 // FIXME: this function is intended to be executed only once. Should
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
643 // we enforce that restriction?
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
644
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
645 int interpreter::execute (void)
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
646 {
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
647 try
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
648 {
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
649 initialize ();
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
650
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
651 // We ignore errors in startup files.
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
652
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
653 execute_startup_files ();
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
654
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
655 int exit_status = 0;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
656
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
657 if (m_app_context)
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
658 {
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
659 const cmdline_options& options = m_app_context->options ();
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
660
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
661 if (m_app_context->have_eval_option_code ())
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
662 {
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
663 int status = execute_eval_option_code ();
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
664
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
665 if (status )
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
666 exit_status = status;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
667
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
668 if (! options.persist ())
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
669 return exit_status;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
670 }
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
671
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
672 // If there is an extra argument, see if it names a file to
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
673 // read. Additional arguments are taken as command line options
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
674 // for the script.
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
675
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
676 if (m_app_context->have_script_file ())
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
677 {
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
678 int status = execute_command_line_file ();
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
679
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
680 if (status)
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
681 exit_status = status;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
682
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
683 if (! options.persist ())
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
684 return exit_status;
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
685 }
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
686
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
687 if (options.forced_interactive ())
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
688 command_editor::blink_matching_paren (false);
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
689 }
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
690
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
691 // Avoid counting commands executed from startup or script files.
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
692
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23795
diff changeset
693 command_editor::reset_current_command_number (1);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
694
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
695 return main_loop ();
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
696 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
697 catch (const exit_exception& ex)
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
698 {
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
699 return ex.exit_status ();
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
700 }
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
701 }
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
702
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
703 void interpreter::display_startup_message (void) const
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
704 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
705 bool inhibit_startup_message = false;
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
706
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
707 if (m_app_context)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
708 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
709 const cmdline_options& options = m_app_context->options ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
710
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
711 inhibit_startup_message = options.inhibit_startup_message ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
712 }
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
713
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
714 if (m_interactive && ! inhibit_startup_message)
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
715 std::cout << octave_startup_message () << "\n" << std::endl;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
716 }
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
717
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
718 // Initialize by reading startup files. Return non-zero if an exception
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
719 // occurs when reading any of them, but don't exit early because of an
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
720 // exception.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
721
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
722 int interpreter::execute_startup_files (void) const
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
723 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
724 bool read_site_files = m_read_site_files;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
725 bool read_init_files = m_read_init_files;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
726 bool verbose = m_verbose;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
727 bool inhibit_startup_message = m_inhibit_startup_message;
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
728
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
729 if (m_app_context)
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
730 {
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
731 const cmdline_options& options = m_app_context->options ();
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
732
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
733 read_site_files = options.read_site_files ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
734 read_init_files = options.read_init_files ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
735 verbose = options.verbose_flag ();
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
736 inhibit_startup_message = options.inhibit_startup_message ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
737 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
738
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
739 verbose = (verbose && ! inhibit_startup_message);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
740
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
741 bool require_file = false;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
742
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
743 std::string context;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
744
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
745 int exit_status = 0;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
746
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
747 if (read_site_files)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
748 {
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
749 // Execute commands from the site-wide configuration file.
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
750 // First from the file $(prefix)/lib/octave/site/m/octaverc
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
751 // (if it exists), then from the file
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
752 // $(prefix)/share/octave/$(version)/m/octaverc (if it exists).
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
753
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
754 int status = safe_source_file (config::local_site_defaults_file (),
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
755 context, verbose, require_file);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
756
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
757 if (status)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
758 exit_status = status;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
759
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
760 status = safe_source_file (config::site_defaults_file (),
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
761 context, verbose, require_file);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
762
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
763 if (status)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
764 exit_status = status;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
765 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
766
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
767 if (read_init_files)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
768 {
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
769 // Try to execute commands from $HOME/$OCTAVE_INITFILE and
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
770 // $OCTAVE_INITFILE. If $OCTAVE_INITFILE is not set,
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
771 // .octaverc is assumed.
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
772
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
773 bool home_rc_already_executed = false;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
774
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
775 std::string initfile = sys::env::getenv ("OCTAVE_INITFILE");
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
776
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
777 if (initfile.empty ())
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
778 initfile = ".octaverc";
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
779
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
780 std::string home_dir = sys::env::get_home_directory ();
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
781
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
782 std::string home_rc = sys::env::make_absolute (initfile, home_dir);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
783
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
784 std::string local_rc;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
785
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
786 if (! home_rc.empty ())
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
787 {
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
788 int status = safe_source_file (home_rc, context, verbose,
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
789 require_file);
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
790
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
791 if (status)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
792 exit_status = status;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
793
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
794 // Names alone are not enough.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
795
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
796 sys::file_stat fs_home_rc (home_rc);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
797
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
798 if (fs_home_rc)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
799 {
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
800 // We want to check for curr_dir after executing home_rc
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
801 // because doing that may change the working directory.
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
802
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
803 local_rc = sys::env::make_absolute (initfile);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
804
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
805 home_rc_already_executed = same_file (home_rc, local_rc);
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
806 }
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
807 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
808
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
809 if (! home_rc_already_executed)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
810 {
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
811 if (local_rc.empty ())
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
812 local_rc = sys::env::make_absolute (initfile);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
813
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
814 int status = safe_source_file (local_rc, context, verbose,
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
815 require_file);
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
816
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
817 if (status)
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
818 exit_status = status;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
819 }
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
820 }
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
821
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
822 if (m_interactive && verbose)
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
823 std::cout << std::endl;
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
824
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
825 return exit_status;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
826 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
827
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
828 // Execute any code specified with --eval 'CODE'
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
829
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
830 int interpreter::execute_eval_option_code (void)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
831 {
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
832 const cmdline_options& options = m_app_context->options ();
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
833
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
834 std::string code_to_eval = options.code_to_eval ();
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
835
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
836 unwind_protect frame;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
837
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
838 octave_save_signal_mask ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
839
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
840 can_interrupt = true;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
841
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24361
diff changeset
842 octave_signal_hook = respond_to_pending_signals;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
843 octave_interrupt_hook = nullptr;
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
844 octave_bad_alloc_hook = nullptr;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
845
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
846 catch_interrupts ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
847
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
848 octave_initialized = true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
849
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
850 frame.add_method (this, &interpreter::interactive, m_interactive);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
851
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
852 m_interactive = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
853
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
854 int parse_status = 0;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
855
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
856 try
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
857 {
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
858 eval_string (code_to_eval, false, parse_status, 0);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
859 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
860 catch (const interrupt_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
861 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
862 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
863
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
864 return 1;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
865 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
866 catch (const execution_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
867 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
868 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
869
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
870 return 1;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
871 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
872
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
873 return parse_status;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
874 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
875
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
876 int interpreter::execute_command_line_file (void)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
877 {
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
878 const cmdline_options& options = m_app_context->options ();
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
879
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
880 unwind_protect frame;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
881
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
882 octave_save_signal_mask ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
883
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
884 can_interrupt = true;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
885
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24361
diff changeset
886 octave_signal_hook = respond_to_pending_signals;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
887 octave_interrupt_hook = nullptr;
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
888 octave_bad_alloc_hook = nullptr;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
889
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
890 catch_interrupts ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
891
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
892 octave_initialized = true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
893
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
894 frame.add_method (this, &interpreter::interactive, m_interactive);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
895
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
896 string_vector args = options.all_args ();
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
897
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
898 frame.add_method (m_app_context, &application::intern_argv, args);
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
899
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
900 frame.add_method (this, &interpreter::intern_nargin, args.numel () - 1);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
901
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
902 frame.add_method (m_app_context,
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
903 &application::program_invocation_name,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
904 application::program_invocation_name ());
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
905
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
906 frame.add_method (m_app_context,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
907 &application::program_name,
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
908 application::program_name ());
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
909
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
910 m_interactive = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
911
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
912 // If we are running an executable script (#! /bin/octave) then
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
913 // we should only see the args passed to the script.
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
914
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
915 string_vector script_args = options.remaining_args ();
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
916
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
917 m_app_context->intern_argv (script_args);
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
918 intern_nargin (script_args.numel () - 1);
23102
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
919
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
920 std::string fname = script_args[0];
373771419d51 refactor interpreter::execute
John W. Eaton <jwe@octave.org>
parents: 23100
diff changeset
921
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
922 m_app_context->set_program_names (fname);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
923
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
924 std::string context;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
925 bool verbose = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
926 bool require_file = true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
927
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
928 return safe_source_file (fname, context, verbose, require_file, "octave");
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
929 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
930
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
931 int interpreter::main_loop (void)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
932 {
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
933 if (! m_app_context)
23104
2805cc365a86 fix thinko in previous change
John W. Eaton <jwe@octave.org>
parents: 23102
diff changeset
934 return 0;
2805cc365a86 fix thinko in previous change
John W. Eaton <jwe@octave.org>
parents: 23102
diff changeset
935
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
936 octave_save_signal_mask ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
937
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
938 can_interrupt = true;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
939
24520
c5c11b07598a refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents: 24361
diff changeset
940 octave_signal_hook = respond_to_pending_signals;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
941 octave_interrupt_hook = nullptr;
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23775
diff changeset
942 octave_bad_alloc_hook = nullptr;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
943
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
944 catch_interrupts ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
945
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
946 octave_initialized = true;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
947
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
948 // The big loop.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
949
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
950 lexer *lxr = (application::interactive ()
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
951 ? new lexer ()
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
952 : new lexer (stdin));
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
953
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
954 parser parser (*lxr);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
955
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
956 int retval = 0;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
957 do
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
958 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
959 try
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
960 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
961 reset_error_handler ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
962
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
963 parser.reset ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
964
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
965 if (m_symbol_table.at_top_level ())
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
966 tree_evaluator::reset_debug_state ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
967
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
968 retval = parser.run ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
969
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
970 if (retval == 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
971 {
23694
4a62da62af09 use m_ prefix for member variables in parser
John W. Eaton <jwe@octave.org>
parents: 23651
diff changeset
972 if (parser.m_stmt_list)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
973 {
23694
4a62da62af09 use m_ prefix for member variables in parser
John W. Eaton <jwe@octave.org>
parents: 23651
diff changeset
974 parser.m_stmt_list->accept (m_evaluator);
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
975
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
976 octave_quit ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
977
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
978 if (! application::interactive ())
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
979 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
980 bool quit = (tree_return_command::returning
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
981 || tree_break_command::breaking);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
982
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
983 if (tree_return_command::returning)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
984 tree_return_command::returning = 0;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
985
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
986 if (tree_break_command::breaking)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
987 tree_break_command::breaking--;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
988
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
989 if (quit)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
990 break;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
991 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
992
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
993 if (octave_completion_matches_called)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
994 octave_completion_matches_called = false;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
995 else
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
996 command_editor::increment_current_command_number ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
997 }
23694
4a62da62af09 use m_ prefix for member variables in parser
John W. Eaton <jwe@octave.org>
parents: 23651
diff changeset
998 else if (parser.m_lexer.end_of_input)
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
999 {
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1000 retval = EOF;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1001 break;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1002 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1003 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1004 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1005 catch (const interrupt_exception&)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1006 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1007 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1008
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1009 // Required newline when the user does Ctrl+C at the prompt.
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1010 if (application::interactive ())
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1011 octave_stdout << "\n";
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1012 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1013 catch (const index_exception& e)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1014 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1015 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1016
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1017 std::cerr << "error: unhandled index exception: "
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1018 << e.message () << " -- trying to return to prompt"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1019 << std::endl;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1020 }
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1021 catch (const execution_exception& e)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1022 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1023 std::string stack_trace = e.info ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1024
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1025 if (! stack_trace.empty ())
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1026 std::cerr << stack_trace;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1027
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1028 if (application::interactive ())
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1029 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1030 else
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1031 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1032 // We should exit with a nonzero status.
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1033 retval = 1;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1034 break;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1035 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1036 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1037 catch (const std::bad_alloc&)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1038 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1039 recover_from_exception ();
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1040
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1041 std::cerr << "error: out of memory -- trying to return to prompt"
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1042 << std::endl;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1043 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1044
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1045 #if defined (DBSTOP_NANINF)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1046 if (Vdebug_on_naninf)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1047 {
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1048 if (setjump (naninf_jump) != 0)
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1049 debug_or_throw_exception (true); // true = stack trace
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1050 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1051 #endif
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1052 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1053 while (retval == 0);
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1054
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1055 if (retval == EOF)
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1056 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1057 if (application::interactive ())
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1058 octave_stdout << "\n";
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1059
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1060 retval = 0;
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1061 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1062
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1063 return retval;
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1064 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1065
23106
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1066 // Call a function with exceptions handled to avoid problems with
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1067 // errors while shutting down.
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1068
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1069 #define OCTAVE_IGNORE_EXCEPTION(E) \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1070 catch (E) \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1071 { \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1072 recover_from_exception (); \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1073 \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1074 std::cerr << "error: ignoring " #E " while preparing to exit" \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1075 << std::endl; \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1076 }
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1077
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1078 #define OCTAVE_SAFE_CALL(F, ARGS) \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1079 do \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1080 { \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1081 try \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1082 { \
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1083 unwind_protect frame; \
23106
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1084 \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1085 frame.protect_var (Vdebug_on_error); \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1086 frame.protect_var (Vdebug_on_warning); \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1087 \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1088 Vdebug_on_error = false; \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1089 Vdebug_on_warning = false; \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1090 \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1091 F ARGS; \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1092 } \
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1093 OCTAVE_IGNORE_EXCEPTION (const exit_exception&) \
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1094 OCTAVE_IGNORE_EXCEPTION (const interrupt_exception&) \
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1095 OCTAVE_IGNORE_EXCEPTION (const execution_exception&) \
23106
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1096 OCTAVE_IGNORE_EXCEPTION (const std::bad_alloc&) \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1097 } \
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1098 while (0)
1a53f9d42ec1 move OCTAVE_SAFE_CALL macro out of header file
John W. Eaton <jwe@octave.org>
parents: 23105
diff changeset
1099
23087
9f406f0b36da rework clean_up_and_exit (bug #50068)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1100 void interpreter::cleanup (void)
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1101 {
23092
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
1102 // If we are attached to a GUI, process pending events and
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
1103 // disconnect the link.
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
1104
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
1105 octave_link::process_events (true);
0fed4c678795 additional restructuring of startup and shutdown
John W. Eaton <jwe@octave.org>
parents: 23087
diff changeset
1106 octave_link::disconnect_link ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1107
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1108 OCTAVE_SAFE_CALL (remove_input_event_hook_functions, ());
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1109
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1110 while (! atexit_functions.empty ())
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1111 {
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1112 std::string fcn = atexit_functions.front ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1113
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1114 atexit_functions.pop_front ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1115
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1116 OCTAVE_SAFE_CALL (reset_error_handler, ());
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1117
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1118 OCTAVE_SAFE_CALL (feval, (fcn, octave_value_list (), 0));
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1119
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1120 OCTAVE_SAFE_CALL (flush_stdout, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1121 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1122
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1123 // Do this explicitly so that destructors for mex file objects
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1124 // are called, so that functions registered with mexAtExit are
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1125 // called.
23699
b29904962d2d deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents: 23696
diff changeset
1126 OCTAVE_SAFE_CALL (m_symbol_table.clear_mex_functions, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1127
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1128 OCTAVE_SAFE_CALL (command_editor::restore_terminal_state, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1129
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1130 OCTAVE_SAFE_CALL (octave_history_write_timestamp, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1131
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1132 if (! command_history::ignoring_entries ())
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1133 OCTAVE_SAFE_CALL (command_history::clean_up_and_save, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1134
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1135 OCTAVE_SAFE_CALL (gh_manager::close_all_figures, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1136
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23753
diff changeset
1137 m_gtk_manager.unload_all_toolkits ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1138
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1139 OCTAVE_SAFE_CALL (cleanup_tmp_files, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1140
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
1141 // FIXME: May still need something like this to ensure that
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
1142 // destructors for class objects will run properly. Should that be
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
1143 // done earlier? Before or after atexit functions are executed?
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23553
diff changeset
1144 m_symbol_table.cleanup ();
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1145
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1146 OCTAVE_SAFE_CALL (sysdep_cleanup, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1147
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1148 OCTAVE_SAFE_CALL (octave_finalize_hdf5, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1149
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1150 OCTAVE_SAFE_CALL (flush_stdout, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1151
23117
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1152 // Don't call singleton_cleanup_list::cleanup until we have the
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1153 // problems with registering/unregistering types worked out. For
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1154 // example, uncomment the following line, then use the make_int
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1155 // function from the examples directory to create an integer
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1156 // object and then exit Octave. Octave should crash with a
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1157 // segfault when cleaning up the typinfo singleton. We need some
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1158 // way to force new octave_value_X types that are created in
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1159 // .oct files to be unregistered when the .oct file shared library
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1160 // is unloaded.
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1161 //
17a3567a7b01 separate final interpreter initialization from execution
John W. Eaton <jwe@octave.org>
parents: 23111
diff changeset
1162 // OCTAVE_SAFE_CALL (singleton_cleanup_list::cleanup, ());
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1163 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1164
23532
084245f9bd03 pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents: 23511
diff changeset
1165 tree_evaluator& interpreter::get_evaluator (void)
084245f9bd03 pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents: 23511
diff changeset
1166 {
23630
8a47d4735655 avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents: 23627
diff changeset
1167 return m_evaluator;
23532
084245f9bd03 pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents: 23511
diff changeset
1168 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1169
23738
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
1170 stream_list& interpreter::get_stream_list (void)
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
1171 {
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
1172 return m_stream_list;
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
1173 }
8acd390d16c9 don't use singleton for stream_list object
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
1174
23742
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
1175 url_handle_manager& interpreter::get_url_handle_manager (void)
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
1176 {
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
1177 return m_url_handle_manager;
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
1178 }
1f0daaf81955 don't use singleton for ch_manager, rename to url_handle_manager
John W. Eaton <jwe@octave.org>
parents: 23738
diff changeset
1179
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
1180 symbol_scope
23609
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1181 interpreter::get_current_scope (void)
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1182 {
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1183 return m_symbol_table.current_scope ();
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1184 }
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1185
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
1186 symbol_scope
23609
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1187 interpreter::require_current_scope (const std::string& who)
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1188 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
1189 symbol_scope scope = get_current_scope ();
23609
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1190
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1191 if (! scope)
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1192 error ("%s: symbol table scope missing", who.c_str ());
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1193
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1194 return scope;
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1195 }
99989ab8f142 new convenience functions for accessing current scope
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
1196
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
1197 call_stack& interpreter::get_call_stack (void)
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
1198 {
23630
8a47d4735655 avoid memory leak in interpreter
John W. Eaton <jwe@octave.org>
parents: 23627
diff changeset
1199 return m_evaluator.get_call_stack ();
23553
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
1200 }
14723784b9f2 don't use singleton for call_stack
John W. Eaton <jwe@octave.org>
parents: 23552
diff changeset
1201
23753
c3828bd031cd move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23742
diff changeset
1202 profiler& interpreter::get_profiler (void)
c3828bd031cd move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23742
diff changeset
1203 {
c3828bd031cd move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23742
diff changeset
1204 return m_evaluator.get_profiler ();
c3828bd031cd move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23742
diff changeset
1205 }
c3828bd031cd move profiler inside evaluator and inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23742
diff changeset
1206
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1207 void interpreter::mlock (void)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1208 {
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1209 call_stack& cs = get_call_stack ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1210
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1211 octave_function *fcn = cs.current ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1212
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1213 if (! fcn)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1214 error ("mlock: invalid use outside a function");
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1215
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1216 fcn->lock ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1217 }
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1218
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1219 void interpreter::munlock (const std::string& nm)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1220 {
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1221 octave_value val = m_symbol_table.find_function (nm);
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1222
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1223 if (val.is_defined ())
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1224 {
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1225 octave_function *fcn = val.function_value ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1226
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1227 if (fcn)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1228 fcn->unlock ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1229 }
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1230 }
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1231
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1232 bool interpreter::mislocked (const std::string& nm)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1233 {
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1234 bool retval = false;
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1235
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1236 octave_value val = m_symbol_table.find_function (nm);
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1237
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1238 if (val.is_defined ())
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1239 {
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1240 octave_function *fcn = val.function_value ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1241
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1242 if (fcn)
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1243 retval = fcn->islocked ();
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1244 }
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1245
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1246 return retval;
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1247 }
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23699
diff changeset
1248
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1249 void interpreter::recover_from_exception (void)
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1250 {
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1251 can_interrupt = true;
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1252 octave_interrupt_state = 0;
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1253 octave_signal_caught = 0;
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1254 octave_exception_state = octave_no_exception;
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1255 octave_restore_signal_mask ();
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23694
diff changeset
1256 catch_interrupts ();
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1257 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1258
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1259 // Functions to call when the interpreter exits.
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1260
23111
252975fdc444 more refactoring of interpreter and application classes
John W. Eaton <jwe@octave.org>
parents: 23110
diff changeset
1261 std::list<std::string> interpreter::atexit_functions;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1262
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1263 void interpreter::add_atexit_function (const std::string& fname)
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1264 {
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1265 atexit_functions.push_front (fname);
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1266 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1267
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1268 bool interpreter::remove_atexit_function (const std::string& fname)
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1269 {
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1270 bool found = false;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1271
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1272 for (auto it = atexit_functions.begin ();
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1273 it != atexit_functions.end (); it++)
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1274 {
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1275 if (*it == fname)
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1276 {
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1277 atexit_functions.erase (it);
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1278 found = true;
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1279 break;
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1280 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1281 }
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1282
23110
af48d8be62b3 move recover_from_exception and atexit functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23109
diff changeset
1283 return found;
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1284 }
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1285
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1286 // What internal options get configured by --traditional.
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1287
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1288 void interpreter::maximum_braindamage (void)
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1289 {
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1290 FPS1 (octave_value (">> "));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1291 FPS2 (octave_value (""));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1292
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1293 m_evaluator.PS4 ("");
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1294
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1295 Fbeep_on_error (octave_value (true));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1296 Fconfirm_recursive_rmdir (octave_value (false));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1297 Fcrash_dumps_octave_core (octave_value (false));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1298 Fdisable_diagonal_matrix (octave_value (true));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1299 Fdisable_permutation_matrix (octave_value (true));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1300 Fdisable_range (octave_value (true));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1301 Ffixed_point_format (octave_value (true));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1302 Fhistory_timestamp_format_string (octave_value ("%%-- %D %I:%M %p --%%"));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1303 Fpage_screen_output (octave_value (false));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1304 Fprint_empty_dimensions (octave_value (false));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1305 Fsave_default_options (octave_value ("-mat-binary"));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1306 Fstruct_levels_to_print (octave_value (0));
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1307
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1308 disable_warning ("Octave:abbreviated-property-match");
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1309 disable_warning ("Octave:data-file-in-path");
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1310 disable_warning ("Octave:function-name-clash");
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1311 disable_warning ("Octave:possible-matlab-short-circuit-operator");
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
1312 }
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1313 }