GNU Octave  8.1.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_protect * curr_fcn_unwind_protect_frame (void)
 
static void do_clear_functions (interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_globals (interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_symbols (interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_variables (interpreter &interp, const string_vector &argv, int argc, int idx, bool exclusive=false, bool have_regexp=false)
 
static void do_matlab_compatible_clear (interpreter &interp, const string_vector &argv, int argc, int idx)
 
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)
 
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 (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 336 of file variables.cc.

Function Documentation

◆ curr_fcn_unwind_protect_frame()

static octave::unwind_protect* curr_fcn_unwind_protect_frame ( void  )
static

Definition at line 561 of file variables.cc.

References __get_evaluator__().

Referenced by try_local_protect().

◆ do_clear_functions()

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

◆ do_clear_globals()

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

◆ do_clear_symbols()

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

◆ do_clear_variables()

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

◆ do_matlab_compatible_clear()

static void do_matlab_compatible_clear ( interpreter interp,
const string_vector argv,
int  argc,
int  idx 
)
static

◆ 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 433 of file variables.cc.

References btyp_unknown, ovl(), print_usage(), and symbol_exist().

Referenced by 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 139 of file variables.cc.

References ovl(), and print_usage().

◆ Fmislocked()

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

Definition at line 911 of file variables.cc.

References 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 1517 of file variables.cc.

References set_internal_variable(), and Vmissing_component_hook.

◆ Fmissing_function_hook()

OCTAVE_EXPORT octave_value_list Fmissing_function_hook ( const octave_value_list args,
int  nargout 
)

Definition at line 1403 of file variables.cc.

References set_internal_variable(), and Vmissing_function_hook.

◆ Fmlock()

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

Definition at line 864 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 883 of file variables.cc.

References ovl(), and print_usage().

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

std::string maybe_missing_function_hook ( const std::string &  name)

◆ maybe_warn_exclusive()

static void maybe_warn_exclusive ( bool  exclusive)
inlinestatic

Definition at line 967 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

Definition at line 932 of file variables.cc.

References regexp::is_match(), and glob_match::match().

Referenced by do_clear_functions(), do_clear_globals(), and do_clear_variables().

◆ 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 584 of file variables.cc.

References octave_value_list::length(), print_usage(), try_local_protect(), wants_local_change(), and warning().

Referenced by error_system::backtrace_on_warning(), error_system::beep_on_error(), load_save_system::crash_dumps_octave_core(), error_system::debug_on_caught(), error_system::debug_on_error(), error_system::debug_on_warning(), error_system::discard_warning_messages(), settings::display_tokens(), environment::editor(), environment::exec_path(), F__enable_vm_eval__(), F__parser_debug_flag__(), Fconfirm_recursive_rmdir(), Fdebug_on_interrupt(), Ffixed_point_format(), Fhistory_control(), Fhistory_file(), Fhistory_save(), Fhistory_size(), Fmissing_component_hook(), Fmissing_function_hook(), Foptimize_subsasgn_calls(), Foutput_precision(), Fprint_empty_dimensions(), Fprint_struct_array_contents(), Fsave_precision(), Fsighup_dumps_octave_core(), Fsigquit_dumps_octave_core(), Fsigterm_dumps_octave_core(), Fsplit_long_rows(), Fstruct_levels_to_print(), Fsvd_driver(), environment::image_path(), history_system::input_from_tmp_file(), error_system::last_error_id(), error_system::last_error_message(), error_system::last_warning_id(), error_system::last_warning_message(), settings::lexer_debug_flag(), tree_evaluator::max_recursion_depth(), call_stack::max_stack_depth(), load_save_system::octave_core_file_limit(), load_save_system::octave_core_file_name(), load_save_system::octave_core_file_options(), output_system::page_output_immediately(), output_system::page_screen_output(), output_system::PAGER(), output_system::PAGER_FLAGS(), tree_evaluator::PS4(), error_system::quiet_warning(), load_save_system::save_default_options(), load_save_system::save_header_format_string(), tree_evaluator::silent_functions(), tree_evaluator::string_fill_char(), history_system::timestamp_format_string(), error_system::verbose_warning(), and 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 328 of file variables.cc.

References __get_interpreter__(), and symbol_exist().

◆ symbol_exist() [2/2]

◆ try_local_protect()

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

Definition at line 570 of file variables.cc.

References curr_fcn_unwind_protect_frame().

Referenced by set_internal_variable().

◆ unique_symbol_name()

std::string unique_symbol_name ( const std::string &  basename)

Definition at line 340 of file variables.cc.

References __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 544 of file variables.cc.

References error_with_cfn().

Referenced by set_internal_variable().

Variable Documentation

◆ Vmissing_component_hook

std::string Vmissing_component_hook
static

Definition at line 1489 of file variables.cc.

Referenced by Fmissing_component_hook().

◆ Vmissing_function_hook

std::string Vmissing_function_hook = "__unimplemented__"
static

Definition at line 1389 of file variables.cc.

Referenced by Fmissing_function_hook(), and maybe_missing_function_hook().