GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
variables.cc File Reference
#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"
Include dependency graph for variables.cc:

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_protectcurr_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_functionextract_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_functionis_valid_function (const octave_value &arg, const std::string &warn_for, bool warn)
 
octave_functionis_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__"
 

Macro Definition Documentation

◆ GET_IDX

#define GET_IDX (   LEN)     static_cast<int> (((LEN)-1) * static_cast<double> (rand ()) / RAND_MAX)

Definition at line 366 of file variables.cc.

Function Documentation

◆ curr_fcn_unwind_protect_frame()

static octave::unwind_protect* curr_fcn_unwind_protect_frame ( void  )
static

◆ do_clear_functions()

static void do_clear_functions ( octave::interpreter interp,
const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false 
)
static

◆ do_clear_globals()

◆ do_clear_symbols()

static void do_clear_symbols ( octave::interpreter interp,
const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false 
)
static

◆ do_clear_variables()

static void do_clear_variables ( octave::interpreter interp,
const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false,
bool  have_regexp = false 
)
static

◆ do_matlab_compatible_clear()

◆ extract_function()

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 
)

◆ F__varval__()

OCTAVE_EXPORT octave_value_list F__varval__ ( octave::interpreter interp,
const octave_value_list args,
int   
)

◆ Fclear()

◆ Fexist()

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().

◆ Fisglobal()

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().

◆ Fmislocked()

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().

◆ Fmissing_component_hook()

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.

◆ Fmissing_function_hook()

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.

◆ Fmlock()

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().

◆ Fmunlock()

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().

◆ get_struct_elts()

string_vector get_struct_elts ( const std::string &  text)

Definition at line 1527 of file variables.cc.

References len, n, and retval.

◆ is_valid_function() [1/2]

octave_function* is_valid_function ( const octave_value arg,
const std::string &  warn_for,
bool  warn 
)

◆ is_valid_function() [2/2]

octave_function* is_valid_function ( const std::string &  fcn_name,
const std::string &  warn_for,
bool  warn 
)

◆ maybe_missing_function_hook()

◆ maybe_warn_exclusive()

static void maybe_warn_exclusive ( bool  exclusive)
inlinestatic

Definition at line 991 of file variables.cc.

References warning().

Referenced by Fclear().

◆ name_matches_any_pattern()

static bool name_matches_any_pattern ( const std::string &  nm,
const string_vector argv,
int  argc,
int  idx,
bool  have_regexp = false 
)
inlinestatic

◆ set_internal_variable() [1/7]

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().

◆ set_internal_variable() [2/7]

octave_value set_internal_variable ( char &  var,
const octave_value_list args,
int  nargout,
const char *  nm 
)

◆ set_internal_variable() [3/7]

octave_value set_internal_variable ( double &  var,
const octave_value_list args,
int  nargout,
const char *  nm,
double  minval,
double  maxval 
)

◆ set_internal_variable() [4/7]

octave_value set_internal_variable ( int &  var,
const octave_value_list args,
int  nargout,
const char *  nm,
const char **  choices 
)

◆ set_internal_variable() [5/7]

octave_value set_internal_variable ( int &  var,
const octave_value_list args,
int  nargout,
const char *  nm,
int  minval,
int  maxval 
)

◆ set_internal_variable() [6/7]

octave_value set_internal_variable ( std::string &  var,
const octave_value_list args,
int  nargout,
const char *  nm,
bool  empty_ok 
)

◆ set_internal_variable() [7/7]

octave_value set_internal_variable ( std::string &  var,
const octave_value_list args,
int  nargout,
const char *  nm,
const char **  choices 
)

◆ symbol_exist() [1/2]

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().

◆ symbol_exist() [2/2]

◆ try_local_protect()

template<typename T >
static bool try_local_protect ( T &  var)
static

◆ unique_symbol_name()

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().

◆ wants_local_change()

static bool wants_local_change ( const octave_value_list args,
int &  nargin 
)
static

Definition at line 567 of file variables.cc.

References error_with_cfn(), and retval.

Referenced by set_internal_variable().

Variable Documentation

◆ Vmissing_component_hook

std::string Vmissing_component_hook
static

Definition at line 1491 of file variables.cc.

◆ Vmissing_function_hook

std::string Vmissing_function_hook = "__unimplemented__"
static

Definition at line 1413 of file variables.cc.

Referenced by maybe_missing_function_hook().