Defines | Functions | Variables

octave.cc File Reference

#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <getopt.h>
#include <sys/types.h>
#include <unistd.h>
#include "cmd-edit.h"
#include "f77-fcn.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-error.h"
#include "oct-env.h"
#include "pathsearch.h"
#include "str-vec.h"
#include <defaults.h>
#include "Cell.h"
#include "defun.h"
#include "display.h"
#include "error.h"
#include "file-io.h"
#include "input.h"
#include "lex.h"
#include "load-path.h"
#include "octave.h"
#include "oct-hist.h"
#include "oct-map.h"
#include "oct-mutex.h"
#include "oct-obj.h"
#include "ops.h"
#include "ov.h"
#include "ov-range.h"
#include "toplev.h"
#include "parse.h"
#include "procstream.h"
#include "sighandlers.h"
#include "sysdep.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include <version.h>
Include dependency graph for octave.cc:

Go to the source code of this file.

Defines

#define DOC_CACHE_FILE_OPTION   1
#define EVAL_OPTION   2
#define EXEC_PATH_OPTION   3
#define IMAGE_PATH_OPTION   4
#define INFO_FILE_OPTION   5
#define INFO_PROG_OPTION   6
#define LINE_EDITING_OPTION   7
#define NO_INIT_FILE_OPTION   8
#define NO_INIT_PATH_OPTION   9
#define NO_LINE_EDITING_OPTION   10
#define NO_SITE_FILE_OPTION   11
#define NO_WINDOW_SYSTEM_OPTION   12
#define PERSIST_OPTION   13
#define TRADITIONAL_OPTION   14

Functions

 DEFUN (__version_info__, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {retval =} __version_info__ (@var{name}, @var{version}, @var{release}, @var{date})\n\ Undocumented internal function.\n\ @end deftypefn")
 DEFUN (argv, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} argv ()\n\ Return the command line arguments passed to Octave. For example,\n\ if you invoked Octave using the command\n\ \n\ @example\n\ octave --no-line-editing --silent\n\ @end example\n\ \n\ @noindent\n\ @code{argv} would return a cell array of strings with the elements\n\ @option{--no-line-editing} and @option{--silent}.\n\ \n\ If you write an executable Octave script, @code{argv} will return the\n\ list of arguments passed to the script. @xref{Executable Octave Programs},\n\ for an example of how to create an executable Octave script.\n\ @end deftypefn")
 DEFUN (program_invocation_name, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} program_invocation_name ()\n\ Return the name that was typed at the shell prompt to run Octave.\n\ \n\ If executing a script from the command line (e.g., @code{octave foo.m})\n\ or using an executable Octave script, the program name is set to the\n\ name of the script. @xref{Executable Octave Programs}, for an example of\n\ how to create an executable Octave script.\n\ @seealso{program_name}\n\ @end deftypefn")
 DEFUN (program_name, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} program_name ()\n\ Return the last component of the value returned by\n\ @code{program_invocation_name}.\n\ @seealso{program_invocation_name}\n\ @end deftypefn")
static void execute_command_line_file (const std::string &fname)
static int execute_eval_option_code (const std::string &code)
static void execute_startup_files (void)
F77_RET_T F77_FUNC (xerbla, XERBLA)(F77_CONST_CHAR_ARG_DECL
static void gripe_safe_source_exception (const std::string &file, const std::string &msg)
static void initialize_error_handlers ()
static void initialize_pathsearch (void)
static void initialize_version_info (void)
void install_builtins (void)
static void intern_argv (int argc, char **argv)
static void lo_error_handler (const char *fmt,...)
static void lo_error_with_id_handler (const char *id, const char *fmt,...)
static void maximum_braindamage (void)
int octave_main (int argc, char **argv, int embedded)
static void print_version_and_exit (void)
static void safe_source_file (const std::string &file_name, const std::string &context=std::string(), bool verbose=false, bool require_file=true, const std::string &warn_for=std::string())
static void usage (void)
static void verbose_usage (void)

Variables

static std::string code_to_eval
F77_RET_T const octave_idx_typeF77_CHAR_ARG_LEN_DECL
static bool inhibit_startup_message = false
struct option long_opts []
static string_vector octave_argv
static std::string octave_program_invocation_name
static std::string octave_program_name
static bool persist = false
static bool read_init_files = true
static bool read_site_files = true
static bool set_initial_path = true
static const charshort_opts = "+HVdfhip:qvx"
static bool traditional = false
static const charusage_string
static bool verbose_flag = false

Define Documentation

#define DOC_CACHE_FILE_OPTION   1

Definition at line 140 of file octave.cc.

Referenced by octave_main().

#define EVAL_OPTION   2

Definition at line 141 of file octave.cc.

Referenced by octave_main().

#define EXEC_PATH_OPTION   3

Definition at line 142 of file octave.cc.

Referenced by octave_main().

#define IMAGE_PATH_OPTION   4

Definition at line 143 of file octave.cc.

Referenced by octave_main().

#define INFO_FILE_OPTION   5

Definition at line 144 of file octave.cc.

Referenced by octave_main().

#define INFO_PROG_OPTION   6

Definition at line 145 of file octave.cc.

Referenced by octave_main().

#define LINE_EDITING_OPTION   7

Definition at line 146 of file octave.cc.

Referenced by octave_main().

#define NO_INIT_FILE_OPTION   8

Definition at line 147 of file octave.cc.

Referenced by octave_main().

#define NO_INIT_PATH_OPTION   9

Definition at line 148 of file octave.cc.

Referenced by octave_main().

#define NO_LINE_EDITING_OPTION   10

Definition at line 149 of file octave.cc.

Referenced by octave_main().

#define NO_SITE_FILE_OPTION   11

Definition at line 150 of file octave.cc.

Referenced by octave_main().

#define NO_WINDOW_SYSTEM_OPTION   12

Definition at line 151 of file octave.cc.

Referenced by octave_main().

#define PERSIST_OPTION   13

Definition at line 152 of file octave.cc.

Referenced by octave_main().

#define TRADITIONAL_OPTION   14

Definition at line 153 of file octave.cc.

Referenced by octave_main().


Function Documentation

DEFUN ( __version_info__  ,
args   
)
DEFUN ( argv  ,
args   
)

Definition at line 955 of file octave.cc.

References print_usage().

DEFUN ( program_invocation_name  ,
args   
)

Definition at line 989 of file octave.cc.

References octave_program_invocation_name, and print_usage().

DEFUN ( program_name  ,
args   
)

Definition at line 1016 of file octave.cc.

References octave_program_name, and print_usage().

static void execute_command_line_file ( const std::string &  fname  )  [static]
static int execute_eval_option_code ( const std::string &  code  )  [static]
static void execute_startup_files ( void   )  [static]
F77_RET_T F77_FUNC ( xerbla  ,
XERBLA   
)
static void gripe_safe_source_exception ( const std::string &  file,
const std::string &  msg 
) [static]

Definition at line 282 of file octave.cc.

Referenced by safe_source_file().

static void initialize_error_handlers (  )  [static]
static void initialize_pathsearch ( void   )  [static]

Definition at line 208 of file octave.cc.

References file_ops::dir_sep_str(), octave_env::getenv(), Vdata_dir, and Vlibexec_dir.

Referenced by octave_main().

static void initialize_version_info ( void   )  [static]

Definition at line 269 of file octave.cc.

Referenced by octave_main().

void install_builtins ( void   ) 
static void intern_argv ( int  argc,
char **  argv 
) [static]
static void lo_error_handler ( const char fmt,
  ... 
) [static]

Definition at line 568 of file octave.cc.

References octave_throw_execution_exception(), and verror_with_cfn().

Referenced by initialize_error_handlers().

static void lo_error_with_id_handler ( const char id,
const char fmt,
  ... 
) [static]

Definition at line 579 of file octave.cc.

References octave_throw_execution_exception(), and verror_with_id_cfn().

Referenced by initialize_error_handlers().

static void maximum_braindamage ( void   )  [static]

Definition at line 601 of file octave.cc.

References bind_internal_variable(), and disable_warning().

Referenced by octave_main().

int octave_main ( int  argc,
char **  argv,
int  embedded 
)

Definition at line 629 of file octave.cc.

References bind_internal_variable(), command_editor::blink_matching_paren(), clean_up_and_exit(), code_to_eval, create_buffer(), do_octave_atexit(), DOC_CACHE_FILE_OPTION, ECHO_CMD_LINE, ECHO_FUNCTIONS, ECHO_SCRIPTS, error_state, EVAL_OPTION, EXEC_PATH_OPTION, execute_command_line_file(), execute_eval_option_code(), execute_startup_files(), F77_CHAR_ARG_LEN, F77_FUNC(), command_editor::force_default_editor(), forced_interactive, get_input_from_stdin(), octave_env::get_program_invocation_name(), octave_env::get_program_name(), IMAGE_PATH_OPTION, INFO_FILE_OPTION, INFO_PROG_OPTION, octave_thread::init(), init_signals(), load_path::initialize(), initialize_command_input(), initialize_default_warning_state(), initialize_error_handlers(), initialize_file_io(), initialize_history(), initialize_pathsearch(), initialize_version_info(), install_builtins(), install_defaults(), install_ops(), install_signal_handlers(), install_types(), interactive, intern_argv(), line_editing, LINE_EDITING_OPTION, long_opts, main_loop(), maximum_braindamage(), NO_INIT_FILE_OPTION, NO_INIT_PATH_OPTION, NO_LINE_EDITING_OPTION, NO_SITE_FILE_OPTION, display_info::no_window_system(), NO_WINDOW_SYSTEM_OPTION, octave_debug, octave_ieee_init(), octave_interpreter_ready, octave_NaN, octave_program_invocation_name, octave_program_name, panic_impossible, PERSIST_OPTION, print_version_and_exit(), quit_allowed, quitting_gracefully, reading_startup_message_printed, command_editor::reset_current_command_number(), load_path::set_command_line_path(), set_exec_path(), set_image_path(), octave_env::set_program_name(), stdin_is_tty, switch_to_buffer(), sysdep_init(), TRADITIONAL_OPTION, usage(), verbose_usage(), and XERBLA().

Referenced by main().

static void print_version_and_exit ( void   )  [static]

Definition at line 561 of file octave.cc.

Referenced by octave_main().

static void safe_source_file ( const std::string &  file_name,
const std::string &  context = std::string (),
bool  verbose = false,
bool  require_file = true,
const std::string &  warn_for = std::string () 
) [static]
static void usage ( void   )  [static]

Definition at line 554 of file octave.cc.

static void verbose_usage ( void   )  [static]

Definition at line 506 of file octave.cc.

Referenced by octave_main().


Variable Documentation

std::string code_to_eval [static]

Definition at line 133 of file octave.cc.

Referenced by octave_main().

Definition at line 80 of file octave.cc.

bool inhibit_startup_message = false [static]

Definition at line 108 of file octave.cc.

struct option long_opts[]
Initial value:
  {
    { "braindead",        no_argument,       0, TRADITIONAL_OPTION },
    { "debug",            no_argument,       0, 'd' },
    { "doc-cache-file",   required_argument, 0, DOC_CACHE_FILE_OPTION },
    { "echo-commands",    no_argument,       0, 'x' },
    { "eval",             required_argument, 0, EVAL_OPTION },
    { "exec-path",        required_argument, 0, EXEC_PATH_OPTION },
    { "help",             no_argument,       0, 'h' },
    { "image-path",       required_argument, 0, IMAGE_PATH_OPTION },
    { "info-file",        required_argument, 0, INFO_FILE_OPTION },
    { "info-program",     required_argument, 0, INFO_PROG_OPTION },
    { "interactive",      no_argument,       0, 'i' },
    { "line-editing",     no_argument,       0, LINE_EDITING_OPTION },
    { "no-history",       no_argument,       0, 'H' },
    { "no-init-file",     no_argument,       0, NO_INIT_FILE_OPTION },
    { "no-init-path",     no_argument,       0, NO_INIT_PATH_OPTION },
    { "no-line-editing",  no_argument,       0, NO_LINE_EDITING_OPTION },
    { "no-site-file",     no_argument,       0, NO_SITE_FILE_OPTION },
    { "no-window-system", no_argument,       0, NO_WINDOW_SYSTEM_OPTION },
    { "norc",             no_argument,       0, 'f' },
    { "path",             required_argument, 0, 'p' },
    { "persist",          no_argument,       0, PERSIST_OPTION },
    { "quiet",            no_argument,       0, 'q' },
    { "silent",           no_argument,       0, 'q' },
    { "traditional",      no_argument,       0, TRADITIONAL_OPTION },
    { "verbose",          no_argument,       0, 'V' },
    { "version",          no_argument,       0, 'v' },
    { 0,                  0,                 0, 0 }
  }

Definition at line 154 of file octave.cc.

Referenced by octave_main().

Definition at line 85 of file octave.cc.

std::string octave_program_invocation_name [static]

Definition at line 89 of file octave.cc.

Referenced by DEFUN(), execute_command_line_file(), and octave_main().

std::string octave_program_name [static]

Definition at line 92 of file octave.cc.

Referenced by DEFUN(), execute_command_line_file(), and octave_main().

bool persist = false [static]

Definition at line 136 of file octave.cc.

bool read_init_files = true [static]

Definition at line 96 of file octave.cc.

bool read_site_files = true [static]

Definition at line 100 of file octave.cc.

bool set_initial_path = true [static]

Definition at line 104 of file octave.cc.

Referenced by load_path::initialize().

const char* short_opts = "+HVdfhip:qvx" [static]

Definition at line 130 of file octave.cc.

bool traditional = false [static]

Definition at line 112 of file octave.cc.

const char* usage_string [static]
Initial value:
"octave [-HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\
       [--exec-path path] [--help] [--image-path path] [--info-file file]\n\
       [--info-program prog] [--interactive] [--line-editing]\n\
       [--no-history] [--no-init-file] [--no-init-path] [--no-line-editing]\n\
       [--no-site-file] [--no-window-system] [-p path] [--path path]\n\
       [--silent] [--traditional] [--verbose] [--version] [file]"

Definition at line 119 of file octave.cc.

bool verbose_flag = false [static]

Definition at line 116 of file octave.cc.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines