#include <cstdio>
#include <cstring>
#include <iomanip>
#include <list>
#include <set>
#include <string>
#include "file-stat.h"
#include "oct-env.h"
#include "file-ops.h"
#include "glob-match.h"
#include "lo-regexp.h"
#include "str-vec.h"
#include "Cell.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "event-manager.h"
#include "help.h"
#include "input.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "lex.h"
#include "load-path.h"
#include "octave-preserve-stream-state.h"
#include "oct-map.h"
#include "ovl.h"
#include "ov.h"
#include "ov-class.h"
#include "ov-usr-fcn.h"
#include "pager.h"
#include "parse.h"
#include "pt-eval.h"
#include "syminfo.h"
#include "symtab.h"
#include "sysdep.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
Go to the source code of this file.
Macros | |
#define | GET_IDX(LEN) static_cast<int> (((LEN)-1) * static_cast<double> (rand ()) / RAND_MAX) |
Functions | |
static octave::unwind_protect * | curr_fcn_unwind_protect_frame (void) |
static void | do_clear_functions (octave::interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false) |
static void | do_clear_globals (octave::interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false) |
static void | do_clear_symbols (octave::interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false) |
static void | do_clear_variables (octave::interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false, bool have_regexp=false) |
static void | do_matlab_compatible_clear (octave::interpreter &interp, const string_vector &argv, int argc, int idx) |
octave_function * | extract_function (const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer) |
OCTAVE_EXPORT octave_value_list | F__varval__ (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fclear (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fexist (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fisglobal (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fmislocked (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fmissing_component_hook (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fmissing_function_hook (const octave_value_list &args, int nargout) |
OCTAVE_EXPORT octave_value_list | Fmlock (octave::interpreter &interp, const octave_value_list &args, int) |
OCTAVE_EXPORT octave_value_list | Fmunlock (octave::interpreter &interp, const octave_value_list &args, int) |
string_vector | get_struct_elts (const std::string &text) |
octave_function * | is_valid_function (const octave_value &arg, const std::string &warn_for, bool warn) |
octave_function * | is_valid_function (const std::string &fcn_name, const std::string &warn_for, bool warn) |
std::string | maybe_missing_function_hook (const std::string &name) |
static void | maybe_warn_exclusive (bool exclusive) |
static bool | name_matches_any_pattern (const std::string &nm, const string_vector &argv, int argc, int idx, bool have_regexp=false) |
octave_value | set_internal_variable (bool &var, const octave_value_list &args, int nargout, const char *nm) |
octave_value | set_internal_variable (char &var, const octave_value_list &args, int nargout, const char *nm) |
octave_value | set_internal_variable (double &var, const octave_value_list &args, int nargout, const char *nm, double minval, double maxval) |
octave_value | set_internal_variable (int &var, const octave_value_list &args, int nargout, const char *nm, const char **choices) |
octave_value | set_internal_variable (int &var, const octave_value_list &args, int nargout, const char *nm, int minval, int maxval) |
octave_value | set_internal_variable (std::string &var, const octave_value_list &args, int nargout, const char *nm, bool empty_ok) |
octave_value | set_internal_variable (std::string &var, const octave_value_list &args, int nargout, const char *nm, const char **choices) |
int | symbol_exist (const std::string &name, const std::string &type) |
static int | symbol_exist (octave::interpreter &interp, const std::string &name, const std::string &type="any") |
template<typename T > | |
static bool | try_local_protect (T &var) |
std::string | unique_symbol_name (const std::string &basename) |
static bool | wants_local_change (const octave_value_list &args, int &nargin) |
Variables | |
static std::string | Vmissing_component_hook |
static std::string | Vmissing_function_hook = "__unimplemented__" |
#define GET_IDX | ( | LEN | ) | static_cast<int> (((LEN)-1) * static_cast<double> (rand ()) / RAND_MAX) |
Definition at line 366 of file variables.cc.
|
static |
Definition at line 584 of file variables.cc.
References octave::__get_evaluator__(), and octave::tree_evaluator::curr_fcn_unwind_protect_frame().
Referenced by try_local_protect().
|
static |
Definition at line 998 of file variables.cc.
References octave::interpreter::clear_function(), octave::interpreter::clear_function_pattern(), octave::interpreter::clear_functions(), name, name_matches_any_pattern(), and octave::interpreter::user_function_names().
Referenced by do_clear_symbols(), do_matlab_compatible_clear(), and Fclear().
|
static |
Definition at line 1025 of file variables.cc.
References octave::interpreter::clear_global_variable(), octave::interpreter::clear_global_variable_pattern(), octave::interpreter::clear_variable(), octave::interpreter::clear_variable_pattern(), octave::interpreter::global_variable_names(), name, and name_matches_any_pattern().
Referenced by do_matlab_compatible_clear(), and Fclear().
|
static |
Definition at line 1100 of file variables.cc.
References octave::interpreter::clear_symbol_pattern(), octave::interpreter::clear_variables(), do_clear_functions(), and do_clear_variables().
Referenced by Fclear().
|
static |
Definition at line 1068 of file variables.cc.
References octave::interpreter::clear_variable(), octave::interpreter::clear_variable_pattern(), octave::interpreter::clear_variable_regexp(), octave::interpreter::clear_variables(), name, name_matches_any_pattern(), and octave::interpreter::variable_names().
Referenced by do_clear_symbols(), and Fclear().
|
static |
Definition at line 1129 of file variables.cc.
References octave::interpreter::clear_all(), octave_class::clear_exemplar_map(), octave::interpreter::clear_objects(), octave::interpreter::clear_symbol_pattern(), octave::interpreter::clear_variables(), do_clear_functions(), do_clear_globals(), and octave::interpreter::is_local_variable().
Referenced by Fclear().
octave_function* extract_function | ( | const octave_value & | arg, |
const std::string & | warn_for, | ||
const std::string & | fname, | ||
const std::string & | header, | ||
const std::string & | trailer | ||
) |
Definition at line 124 of file variables.cc.
References octave::__get_interpreter__(), error(), octave::interpreter::eval_string(), is_valid_function(), retval, warning(), and octave_value::xstring_value().
OCTAVE_EXPORT octave_value_list F__varval__ | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 1470 of file variables.cc.
References octave::stack_frame::ARG_NAMES, octave::tree_evaluator::get_auto_fcn_var(), name, and print_usage().
OCTAVE_EXPORT octave_value_list Fclear | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 1257 of file variables.cc.
References octave_class::clear_exemplar_map(), octave::event_manager::clear_workspace(), do_clear_functions(), do_clear_globals(), do_clear_symbols(), do_clear_variables(), do_matlab_compatible_clear(), maybe_warn_exclusive(), ovl(), print_usage(), and warning().
Referenced by octave::main_window::handle_clear_workspace_request().
OCTAVE_EXPORT octave_value_list Fexist | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 465 of file variables.cc.
References name, ovl(), print_usage(), symbol_exist(), and warning().
Referenced by octave::main_window::handle_edit_mfile_request().
OCTAVE_EXPORT octave_value_list Fisglobal | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 178 of file variables.cc.
References name, ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fmislocked | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 935 of file variables.cc.
References name, ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fmissing_component_hook | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1519 of file variables.cc.
References SET_INTERNAL_VARIABLE.
OCTAVE_EXPORT octave_value_list Fmissing_function_hook | ( | const octave_value_list & | args, |
int | nargout | ||
) |
Definition at line 1427 of file variables.cc.
References SET_INTERNAL_VARIABLE.
OCTAVE_EXPORT octave_value_list Fmlock | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 888 of file variables.cc.
References ovl(), and print_usage().
OCTAVE_EXPORT octave_value_list Fmunlock | ( | octave::interpreter & | interp, |
const octave_value_list & | args, | ||
int | |||
) |
Definition at line 907 of file variables.cc.
References name, ovl(), and print_usage().
string_vector get_struct_elts | ( | const std::string & | text | ) |
Definition at line 1527 of file variables.cc.
octave_function* is_valid_function | ( | const octave_value & | arg, |
const std::string & | warn_for, | ||
bool | warn | ||
) |
Definition at line 102 of file variables.cc.
References error(), octave_value::is_string(), is_valid_function(), and octave_value::string_value().
octave_function* is_valid_function | ( | const std::string & | fcn_name, |
const std::string & | warn_for, | ||
bool | warn | ||
) |
Definition at line 77 of file variables.cc.
References octave::__get_symbol_table__(), error(), octave::symbol_table::find_function(), octave_value::function_value(), and octave_value::is_defined().
Referenced by extract_function(), named_hook_function::is_valid(), and is_valid_function().
std::string maybe_missing_function_hook | ( | const std::string & | name | ) |
Definition at line 1433 of file variables.cc.
References octave::__get_interpreter__(), octave::feval(), octave::symbol_table::find_function(), octave::interpreter::get_symbol_table(), octave_value::is_defined(), octave_value_list::length(), name, octave::action_container::protect_var(), and Vmissing_function_hook.
Referenced by octave::tree_identifier::eval_undefined_error().
|
inlinestatic |
|
inlinestatic |
Definition at line 956 of file variables.cc.
References octave::regexp::is_match(), glob_match::match(), and retval.
Referenced by do_clear_functions(), do_clear_globals(), and do_clear_variables().
octave_value set_internal_variable | ( | bool & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm | ||
) |
Definition at line 608 of file variables.cc.
References octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
Referenced by octave::error_system::backtrace_on_warning(), octave::error_system::beep_on_error(), octave::load_save_system::crash_dumps_octave_core(), octave::error_system::debug_on_caught(), octave::error_system::debug_on_error(), octave::error_system::debug_on_warning(), octave::error_system::discard_warning_messages(), octave::settings::display_tokens(), octave::environment::editor(), octave::environment::exec_path(), F__parser_debug_flag__(), Fdebug_on_interrupt(), Fhistory_control(), Fhistory_file(), Fhistory_save(), Fhistory_size(), Fsighup_dumps_octave_core(), Fsigquit_dumps_octave_core(), Fsigterm_dumps_octave_core(), octave::environment::image_path(), octave::history_system::input_from_tmp_file(), octave::error_system::last_error_id(), octave::error_system::last_error_message(), octave::error_system::last_warning_id(), octave::error_system::last_warning_message(), octave::settings::lexer_debug_flag(), octave::tree_evaluator::max_recursion_depth(), octave::call_stack::max_stack_depth(), octave::load_save_system::octave_core_file_limit(), octave::load_save_system::octave_core_file_name(), octave::load_save_system::octave_core_file_options(), octave::output_system::page_output_immediately(), octave::output_system::page_screen_output(), octave::output_system::PAGER(), octave::output_system::PAGER_FLAGS(), octave::tree_evaluator::PS4(), octave::error_system::quiet_warning(), octave::load_save_system::save_default_options(), octave::load_save_system::save_header_format_string(), octave::tree_evaluator::silent_functions(), octave::tree_evaluator::string_fill_char(), octave::history_system::timestamp_format_string(), octave::error_system::verbose_warning(), and octave::tree_evaluator::whos_line_format().
octave_value set_internal_variable | ( | char & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm | ||
) |
Definition at line 638 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
octave_value set_internal_variable | ( | double & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm, | ||
double | minval, | ||
double | maxval | ||
) |
Definition at line 717 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
octave_value set_internal_variable | ( | int & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm, | ||
const char ** | choices | ||
) |
Definition at line 786 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
octave_value set_internal_variable | ( | int & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm, | ||
int | minval, | ||
int | maxval | ||
) |
Definition at line 681 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
octave_value set_internal_variable | ( | std::string & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm, | ||
bool | empty_ok | ||
) |
Definition at line 753 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
octave_value set_internal_variable | ( | std::string & | var, |
const octave_value_list & | args, | ||
int | nargout, | ||
const char * | nm, | ||
const char ** | choices | ||
) |
Definition at line 831 of file variables.cc.
References error(), octave_value_list::length(), print_usage(), retval, try_local_protect(), wants_local_change(), and warning().
int symbol_exist | ( | const std::string & | name, |
const std::string & | type | ||
) |
Definition at line 358 of file variables.cc.
References octave::__get_interpreter__(), name, and symbol_exist().
|
static |
Definition at line 200 of file variables.cc.
References octave::drive_or_unc_share(), error(), octave::file_in_path(), octave::symbol_table::find_cmdline_function(), octave::load_path::find_fcn(), octave::load_path::find_method(), octave::interpreter::get_evaluator(), octave::interpreter::get_load_path(), octave::interpreter::get_symbol_table(), octave_value::is_anonymous_function(), octave::symbol_table::is_built_in_function_name(), octave_value::is_constant(), octave_value::is_defined(), octave::sys::base_file_stat::is_dir(), octave_value::is_function_handle(), octave_value::is_inline_function(), octave::iskeyword(), octave_value::isobject(), len, octave::tree_evaluator::lookup_autoload(), name, and octave::interpreter::varval().
Referenced by Fexist(), octave::interpreter::quit(), octave::variable_editor_model::retrieve_variable(), symbol_exist(), and unique_symbol_name().
|
static |
Definition at line 594 of file variables.cc.
References curr_fcn_unwind_protect_frame(), and octave::action_container::protect_var().
Referenced by set_internal_variable().
std::string unique_symbol_name | ( | const std::string & | basename | ) |
Definition at line 370 of file variables.cc.
References octave::__get_interpreter__(), basename(), GET_IDX, len, and symbol_exist().
|
static |
Definition at line 567 of file variables.cc.
References error_with_cfn(), and retval.
Referenced by set_internal_variable().
|
static |
Definition at line 1491 of file variables.cc.
|
static |
Definition at line 1413 of file variables.cc.
Referenced by maybe_missing_function_hook().