GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include <cassert>
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <new>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <sys/select.h>
#include <sys/types.h>
#include <unistd.h>
#include "cmd-edit.h"
#include "cmd-hist.h"
#include "file-ops.h"
#include "lo-error.h"
#include "lo-mappers.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "quit.h"
#include "singleton-cleanup.h"
#include "str-vec.h"
#include "defaults.h"
#include "defun.h"
#include "error.h"
#include "file-io.h"
#include "graphics.h"
#include "input.h"
#include "lex.h"
#include "load-save.h"
#include "octave-link.h"
#include "oct-conf.h"
#include "oct-conf-features.h"
#include "oct-hist.h"
#include "oct-map.h"
#include "oct-obj.h"
#include "ov.h"
#include "pager.h"
#include "parse.h"
#include "pathsearch.h"
#include "procstream.h"
#include "pt-eval.h"
#include "pt-jump.h"
#include "pt-stmt.h"
#include "sighandlers.h"
#include "sysdep.h"
#include "syswait.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "version.h"
Go to the source code of this file.
Macros | |
#define | SHELL_PATH "/bin/sh" |
Enumerations | |
enum | system_exec_type { et_sync, et_async } |
Functions | |
void | clean_up_and_exit (int retval, bool safe_to_return) |
static void | do_octave_atexit (void) |
OCTAVE_EXPORT octave_value_list | Fatexit (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Foctave_config_info (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fquit (const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fsystem (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fwarranty (const octave_value_list &, int) |
int | main_loop (void) |
void | octave_add_atexit_function (const std::string &fname) |
bool | octave_remove_atexit_function (const std::string &fname) |
void | recover_from_exception (void) |
static octave_value_list | run_command_and_return_output (const std::string &cmd_str) |
static int | wait_for_input (int fid) |
Variables | |
static const char * | bt_fieldnames [] |
static const octave_fields | bt_fields (bt_fieldnames) |
int | exit_status = 0 |
static std::list< std::string > | octave_atexit_functions |
void(* | octave_exit )(int) = ::exit |
bool | octave_initialized = false |
bool | octave_interpreter_ready = false |
bool | quit_allowed = true |
bool | quitting_gracefully = false |
enum system_exec_type |
Definition at line 728 of file toplev.cc.
References do_octave_atexit(), octave_link::exit(), and octave_exit.
Referenced by execute_eval_option_code(), octave_execute_interpreter(), and safe_source_file().
Definition at line 642 of file toplev.cc.
References command_history::clean_up_and_save(), symbol_table::cleanup(), cleanup_tmp_files(), octave_chunk_buffer::clear(), clear_mex_functions(), gh_manager::close_all_figures(), close_files(), feval(), flush_octave_stdout(), forced_interactive, command_history::ignoring_entries(), interactive, octave_finalize_hdf5(), octave_history_write_timestamp(), OCTAVE_SAFE_CALL, octave_stdout, octave_link::process_events(), quitting_gracefully, raw_mode(), remove_input_event_hook_functions(), reset_error_handler(), command_editor::restore_terminal_state(), sysdep_cleanup(), and gtk_manager::unload_all_toolkits().
Referenced by clean_up_and_exit().
OCTAVE_EXPORT octave_value_list Fatexit | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1160 of file toplev.cc.
References arg(), error(), error_state, octave_value_list::length(), octave_add_atexit_function(), octave_remove_atexit_function(), and print_usage().
OCTAVE_EXPORT octave_value_list Foctave_config_info | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 1214 of file toplev.cc.
References arg(), octave_scalar_map::assign(), octave_scalar_map::contents(), error(), error_state, oct_mach_info::float_format_as_string(), initialized, Array< T >::is_empty(), octave_scalar_map::isfield(), oct_mach_info::native_float_format(), OCTAVE_API_VERSION, OCTAVE_ARCHLIBDIR, OCTAVE_BINDIR, OCTAVE_CANONICAL_HOST_TYPE, OCTAVE_CONF_ALL_CFLAGS, OCTAVE_CONF_ALL_CXXFLAGS, OCTAVE_CONF_ALL_FFLAGS, OCTAVE_CONF_ALL_LDFLAGS, OCTAVE_CONF_AMD_CPPFLAGS, OCTAVE_CONF_AMD_LDFLAGS, OCTAVE_CONF_AMD_LIBS, OCTAVE_CONF_AR, OCTAVE_CONF_ARFLAGS, OCTAVE_CONF_ARPACK_CPPFLAGS, OCTAVE_CONF_ARPACK_LDFLAGS, OCTAVE_CONF_ARPACK_LIBS, OCTAVE_CONF_BLAS_LIBS, OCTAVE_CONF_CAMD_CPPFLAGS, OCTAVE_CONF_CAMD_LDFLAGS, OCTAVE_CONF_CAMD_LIBS, OCTAVE_CONF_CARBON_LIBS, OCTAVE_CONF_CC, OCTAVE_CONF_CC_VERSION, OCTAVE_CONF_CCOLAMD_CPPFLAGS, OCTAVE_CONF_CCOLAMD_LDFLAGS, OCTAVE_CONF_CCOLAMD_LIBS, OCTAVE_CONF_CFLAGS, OCTAVE_CONF_CHOLMOD_CPPFLAGS, OCTAVE_CONF_CHOLMOD_LDFLAGS, OCTAVE_CONF_CHOLMOD_LIBS, OCTAVE_CONF_COLAMD_CPPFLAGS, OCTAVE_CONF_COLAMD_LDFLAGS, OCTAVE_CONF_COLAMD_LIBS, OCTAVE_CONF_config_opts, OCTAVE_CONF_CPICFLAG, OCTAVE_CONF_CPPFLAGS, OCTAVE_CONF_CURL_CPPFLAGS, OCTAVE_CONF_CURL_LDFLAGS, OCTAVE_CONF_CURL_LIBS, OCTAVE_CONF_CXSPARSE_CPPFLAGS, OCTAVE_CONF_CXSPARSE_LDFLAGS, OCTAVE_CONF_CXSPARSE_LIBS, OCTAVE_CONF_CXX, OCTAVE_CONF_CXX_VERSION, OCTAVE_CONF_CXXCPP, OCTAVE_CONF_CXXFLAGS, OCTAVE_CONF_CXXPICFLAG, OCTAVE_CONF_DEFS, OCTAVE_CONF_DL_LD, OCTAVE_CONF_DL_LDFLAGS, OCTAVE_CONF_DL_LIBS, OCTAVE_CONF_ENABLE_DYNAMIC_LINKING, OCTAVE_CONF_EXEEXT, OCTAVE_CONF_F77, OCTAVE_CONF_F77_FLOAT_STORE_FLAG, OCTAVE_CONF_F77_INTEGER_8_FLAG, OCTAVE_CONF_FC, OCTAVE_CONF_FFLAGS, OCTAVE_CONF_FFTW3_CPPFLAGS, OCTAVE_CONF_FFTW3_LDFLAGS, OCTAVE_CONF_FFTW3_LIBS, OCTAVE_CONF_FFTW3F_CPPFLAGS, OCTAVE_CONF_FFTW3F_LDFLAGS, OCTAVE_CONF_FFTW3F_LIBS, OCTAVE_CONF_FLIBS, OCTAVE_CONF_FONTCONFIG_CFLAGS, OCTAVE_CONF_FPICFLAG, OCTAVE_CONF_FT2_CFLAGS, OCTAVE_CONF_FT2_LIBS, OCTAVE_CONF_GCC_VERSION, OCTAVE_CONF_GLPK_CPPFLAGS, OCTAVE_CONF_GLPK_LDFLAGS, OCTAVE_CONF_GLPK_LIBS, OCTAVE_CONF_GNUPLOT, OCTAVE_CONF_GRAPHICS_CFLAGS, OCTAVE_CONF_GRAPHICS_LIBS, OCTAVE_CONF_GXX_VERSION, OCTAVE_CONF_HDF5_CPPFLAGS, OCTAVE_CONF_HDF5_LDFLAGS, OCTAVE_CONF_HDF5_LIBS, OCTAVE_CONF_LAPACK_LIBS, OCTAVE_CONF_LD_CXX, OCTAVE_CONF_LD_STATIC_FLAG, OCTAVE_CONF_LDFLAGS, OCTAVE_CONF_LEX, OCTAVE_CONF_LEXLIB, OCTAVE_CONF_LFLAGS, OCTAVE_CONF_LIBEXT, OCTAVE_CONF_LIBFLAGS, OCTAVE_CONF_LIBOCTAVE, OCTAVE_CONF_LIBOCTINTERP, OCTAVE_CONF_LIBS, OCTAVE_CONF_LLVM_CPPFLAGS, OCTAVE_CONF_LLVM_LDFLAGS, OCTAVE_CONF_LLVM_LIBS, OCTAVE_CONF_LN_S, OCTAVE_CONF_MAGICK_CPPFLAGS, OCTAVE_CONF_MAGICK_LDFLAGS, OCTAVE_CONF_MAGICK_LIBS, OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS, OCTAVE_CONF_OCT_LINK_DEPS, OCTAVE_CONF_OCT_LINK_OPTS, OCTAVE_CONF_OCTAVE_LINK_DEPS, OCTAVE_CONF_OCTAVE_LINK_OPTS, OCTAVE_CONF_OPENGL_LIBS, OCTAVE_CONF_PCRE_CPPFLAGS, OCTAVE_CONF_PCRE_LIBS, OCTAVE_CONF_PTHREAD_CFLAGS, OCTAVE_CONF_PTHREAD_LIBS, OCTAVE_CONF_QHULL_CPPFLAGS, OCTAVE_CONF_QHULL_LDFLAGS, OCTAVE_CONF_QHULL_LIBS, OCTAVE_CONF_QRUPDATE_CPPFLAGS, OCTAVE_CONF_QRUPDATE_LDFLAGS, OCTAVE_CONF_QRUPDATE_LIBS, OCTAVE_CONF_QT_CPPFLAGS, OCTAVE_CONF_QT_LDFLAGS, OCTAVE_CONF_QT_LIBS, OCTAVE_CONF_RANLIB, OCTAVE_CONF_RDYNAMIC_FLAG, OCTAVE_CONF_READLINE_LIBS, OCTAVE_CONF_SED, OCTAVE_CONF_SH_LD, OCTAVE_CONF_SH_LDFLAGS, OCTAVE_CONF_SHARED_LIBS, OCTAVE_CONF_SHLEXT, OCTAVE_CONF_SHLEXT_VER, OCTAVE_CONF_SONAME_FLAGS, OCTAVE_CONF_STATIC_LIBS, OCTAVE_CONF_TERM_LIBS, OCTAVE_CONF_UMFPACK_CPPFLAGS, OCTAVE_CONF_UMFPACK_LDFLAGS, OCTAVE_CONF_UMFPACK_LIBS, OCTAVE_CONF_USE_64_BIT_IDX_T, OCTAVE_CONF_WARN_CFLAGS, OCTAVE_CONF_WARN_CXXFLAGS, OCTAVE_CONF_X11_INCFLAGS, OCTAVE_CONF_X11_LIBS, OCTAVE_CONF_XTRA_CFLAGS, OCTAVE_CONF_XTRA_CXXFLAGS, OCTAVE_CONF_YACC, OCTAVE_CONF_YFLAGS, OCTAVE_CONF_Z_CPPFLAGS, OCTAVE_CONF_Z_LDFLAGS, OCTAVE_CONF_Z_LIBS, octave_config_features(), OCTAVE_DATADIR, OCTAVE_DATAROOTDIR, OCTAVE_DEFAULT_PAGER, OCTAVE_EXEC_PREFIX, OCTAVE_FCNFILEDIR, OCTAVE_IMAGEDIR, OCTAVE_INCLUDEDIR, OCTAVE_INFODIR, OCTAVE_INFOFILE, OCTAVE_LIBDIR, OCTAVE_LIBEXECDIR, OCTAVE_LOCALAPIARCHLIBDIR, OCTAVE_LOCALAPIFCNFILEDIR, OCTAVE_LOCALAPIOCTFILEDIR, OCTAVE_LOCALARCHLIBDIR, OCTAVE_LOCALFCNFILEDIR, OCTAVE_LOCALOCTFILEDIR, OCTAVE_LOCALSTARTUPFILEDIR, OCTAVE_LOCALVERARCHLIBDIR, OCTAVE_LOCALVERFCNFILEDIR, OCTAVE_LOCALVEROCTFILEDIR, OCTAVE_MAN1DIR, OCTAVE_MAN1EXT, OCTAVE_MANDIR, OCTAVE_OCTETCDIR, OCTAVE_OCTFILEDIR, OCTAVE_OCTINCLUDEDIR, OCTAVE_OCTLIBDIR, OCTAVE_OCTTESTSDIR, OCTAVE_PREFIX, OCTAVE_STARTUPFILEDIR, OCTAVE_VERSION, print_usage(), subst_octave_home(), oct_mach_info::words_big_endian(), and oct_mach_info::words_little_endian().
OCTAVE_EXPORT octave_value_list Fquit | ( | const octave_value_list & | args, |
int | |||
) |
Definition at line 764 of file toplev.cc.
References error(), error_state, octave_interrupt_state, octave_throw_interrupt_exception(), quit_allowed, and quitting_gracefully.
Referenced by main_window::exit_callback().
OCTAVE_EXPORT octave_value_list Fsystem | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 956 of file toplev.cc.
References error(), error_state, et_async, et_sync, octave_wait::exitstatus(), octave_wait::ifexited(), OCTAVE_LOCAL_BUFFER, panic_impossible, print_usage(), run_command_and_return_output(), and SHELL_PATH.
OCTAVE_EXPORT octave_value_list Fwarranty | ( | const octave_value_list & | , |
int | |||
) |
Definition at line 805 of file toplev.cc.
References octave_name_version_and_copyright(), and octave_stdout.
Definition at line 529 of file toplev.cc.
References tree_statement_list::accept(), symbol_table::at_top_level(), tree_break_command::breaking, can_interrupt, current_evaluator, lexical_feedback::end_of_input, error_state, exit_status, forced_interactive, command_editor::increment_current_command_number(), interactive, octave_base_parser::lexer, octave_bad_alloc_hook, octave_catch_interrupts(), octave_completion_matches_called, octave_initialized, octave_interrupt_hook, octave_save_signal_mask(), octave_signal_handler(), octave_signal_hook, octave_stdout, parser, quitting_gracefully, recover_from_exception(), octave_base_parser::reset(), tree_evaluator::reset_debug_state(), reset_error_handler(), tree_return_command::returning, octave_parser::run(), and octave_base_parser::stmt_list.
Referenced by octave_execute_interpreter().
void octave_add_atexit_function | ( | const std::string & | fname | ) |
bool octave_remove_atexit_function | ( | const std::string & | fname | ) |
Definition at line 517 of file toplev.cc.
References can_interrupt, octave_catch_interrupts(), octave_exception_state, octave_interrupt_immediately, octave_interrupt_state, octave_no_exception, octave_restore_signal_mask(), and octave_signal_caught.
Referenced by execute_eval_option_code(), main_loop(), and safe_source_file().
|
static |
Definition at line 853 of file toplev.cc.
References action_container::add_delete(), action_container::add_fcn(), procstreambase::close(), error(), octave_wait::exitstatus(), procstreambase::file_number(), octave_wait::ifexited(), procstreambase::pid(), octave_child_list::remove(), and wait_for_input().
Referenced by Fsystem().
Definition at line 831 of file toplev.cc.
Referenced by run_command_and_return_output().
|
static |
|
static |
Referenced by octave_call_stack::do_backtrace(), and octave_call_stack::empty_backtrace().
int exit_status = 0 |
Definition at line 96 of file toplev.cc.
Referenced by execute_eval_option_code(), main_loop(), and safe_source_file().
Definition at line 88 of file toplev.cc.
Referenced by clean_up_and_exit().
bool octave_initialized = false |
Definition at line 103 of file toplev.cc.
Referenced by execute_command_line_file(), execute_eval_option_code(), main_loop(), and user_abort().
bool octave_interpreter_ready = false |
Definition at line 100 of file toplev.cc.
Referenced by execute_pkg_add_or_del(), and octave_initialize_interpreter().
bool quit_allowed = true |
Definition at line 91 of file toplev.cc.
Referenced by Fquit(), octave_initialize_interpreter(), and octave_oncleanup::~octave_oncleanup().
bool quitting_gracefully = false |
Definition at line 94 of file toplev.cc.
Referenced by do_octave_atexit(), execute_eval_option_code(), Fquit(), main_loop(), octave_execute_interpreter(), octave_base_lexer::reset(), and safe_source_file().