GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Functions | Variables
variables.cc File Reference
#include <cstdio>
#include <cstring>
#include <iomanip>
#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 <defaults.h>
#include "Cell.h"
#include "defun.h"
#include "dirfns.h"
#include "error.h"
#include "gripes.h"
#include "help.h"
#include "input.h"
#include "lex.h"
#include "load-path.h"
#include "octave-link.h"
#include "oct-map.h"
#include "oct-obj.h"
#include "ov.h"
#include "ov-class.h"
#include "ov-usr-fcn.h"
#include "pager.h"
#include "parse.h"
#include "symtab.h"
#include "toplev.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.

Classes

struct  symbol_info_list::symbol_info
 
class  symbol_info_list
 
struct  whos_parameter
 

Macros

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

Functions

void bind_ans (const octave_value &val, bool print)
 
void bind_internal_variable (const std::string &fname, const octave_value &val)
 
void clear_function (const std::string &nm)
 
void clear_mex_functions (void)
 
void clear_symbol (const std::string &nm)
 
void clear_variable (const std::string &nm)
 
static void do_clear_functions (const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_globals (const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_symbols (const string_vector &argv, int argc, int idx, bool exclusive=false)
 
static void do_clear_variables (const string_vector &argv, int argc, int idx, bool exclusive=false, bool have_regexp=false)
 
static octave_value do_isglobal (const octave_value_list &args)
 
static void do_matlab_compatible_clear (const string_vector &argv, int argc, int idx)
 
static octave_value do_who (int argc, const string_vector &argv, bool return_list, bool verbose=false, std::string msg=std::string())
 
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__ (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fclear (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fexist (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fisglobal (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fmislocked (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 (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fmunlock (const octave_value_list &args, int)
 
OCTAVE_EXPORT octave_value_list Fwho (const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Fwhos (const octave_value_list &args, int nargout)
 
OCTAVE_EXPORT octave_value_list Fwhos_line_format (const octave_value_list &args, int nargout)
 
string_vector generate_struct_completions (const std::string &text, std::string &prefix, std::string &hint)
 
std::string get_dims_str (const octave_value &val)
 
octave_value get_global_value (const std::string &nm, bool silent)
 
string_vector get_struct_elts (const std::string &text)
 
octave_value get_top_level_value (const std::string &nm, bool silent)
 
octave_functionis_valid_function (const std::string &fcn_name, const std::string &warn_for, bool warn)
 
octave_functionis_valid_function (const octave_value &arg, const std::string &warn_for, bool warn)
 
static bool is_variable (const std::string &name)
 
bool looks_like_struct (const std::string &text)
 
octave_value lookup_function_handle (const std::string &nm)
 
void maybe_missing_function_hook (const std::string &name)
 
static void maybe_warn_exclusive (bool exclusive)
 
bool mislocked (const std::string &nm)
 
void mlock (void)
 
void munlock (const std::string &nm)
 
static bool name_matches_any_pattern (const std::string &nm, const string_vector &argv, int argc, int idx, bool have_regexp=false)
 
static void print_descriptor (std::ostream &os, std::list< whos_parameter > params)
 
static octave_value safe_symbol_lookup (const std::string &symbol_name)
 
void set_global_value (const std::string &nm, const octave_value &val)
 
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 (int &var, const octave_value_list &args, int nargout, const char *nm, int minval, int maxval)
 
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 (std::string &var, const octave_value_list &args, int nargout, const char *nm, bool empty_ok)
 
octave_value set_internal_variable (int &var, const octave_value_list &args, int nargout, const char *nm, const char **choices)
 
void set_top_level_value (const std::string &nm, const octave_value &val)
 
int symbol_exist (const std::string &name, const std::string &type)
 
template<class T >
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__"
 
static std::string Vwhos_line_format = " %a:4; %ln:6; %cs:16:6:1; %rb:12; %lc:-1;\n"
 

Macro Definition Documentation

#define CLEAR_OPTION_ERROR (   cond)
Value:
do \
{ \
if (cond) \
{ \
return retval; \
} \
} \
while (0)
OCTINTERP_API void print_usage(void)
Definition: defun.cc:51

Definition at line 2367 of file variables.cc.

Referenced by Fclear().

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

Definition at line 491 of file variables.cc.

Referenced by unique_symbol_name().

Function Documentation

void bind_ans ( const octave_value val,
bool  print 
)
void bind_internal_variable ( const std::string &  fname,
const octave_value val 
)

Definition at line 2004 of file variables.cc.

References feval().

void clear_function ( const std::string &  nm)
void clear_mex_functions ( void  )

Definition at line 71 of file variables.cc.

References symbol_table::clear_mex_functions().

Referenced by do_octave_atexit().

void clear_symbol ( const std::string &  nm)

Definition at line 89 of file variables.cc.

References symbol_table::clear_symbol().

void clear_variable ( const std::string &  nm)

Definition at line 83 of file variables.cc.

References symbol_table::clear_variable().

Referenced by symbol_table::clear(), and symbol_table::clear_symbol().

static void do_clear_functions ( const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false 
)
static
static void do_clear_globals ( const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false 
)
static
static void do_clear_symbols ( const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false 
)
static
static void do_clear_variables ( const string_vector argv,
int  argc,
int  idx,
bool  exclusive = false,
bool  have_regexp = false 
)
static
static octave_value do_isglobal ( const octave_value_list args)
static

Definition at line 329 of file variables.cc.

References error(), symbol_table::is_global(), octave_value_list::length(), and print_usage().

Referenced by Fisglobal().

static void do_matlab_compatible_clear ( const string_vector argv,
int  argc,
int  idx 
)
static
static octave_value do_who ( int  argc,
const string_vector argv,
bool  return_list,
bool  verbose = false,
std::string  msg = std::string () 
)
static
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__ ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fclear ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fexist ( const octave_value_list args,
int   
)

Definition at line 581 of file variables.cc.

References error(), octave_value::length(), print_usage(), symbol_exist(), and warning().

OCTAVE_EXPORT octave_value_list Fisglobal ( const octave_value_list args,
int   
)

Definition at line 367 of file variables.cc.

References do_isglobal().

OCTAVE_EXPORT octave_value_list Fmislocked ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fmissing_component_hook ( const octave_value_list args,
int  nargout 
)

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

References SET_INTERNAL_VARIABLE.

OCTAVE_EXPORT octave_value_list Fmlock ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fmunlock ( const octave_value_list args,
int   
)
OCTAVE_EXPORT octave_value_list Fwho ( const octave_value_list args,
int  nargout 
)

Definition at line 1877 of file variables.cc.

References do_who(), error_state, and print_usage().

OCTAVE_EXPORT octave_value_list Fwhos ( const octave_value_list args,
int  nargout 
)

Definition at line 1958 of file variables.cc.

References do_who(), error_state, and print_usage().

OCTAVE_EXPORT octave_value_list Fwhos_line_format ( const octave_value_list args,
int  nargout 
)

Definition at line 2659 of file variables.cc.

References SET_INTERNAL_VARIABLE.

string_vector generate_struct_completions ( const std::string &  text,
std::string &  prefix,
std::string &  hint 
)
std::string get_dims_str ( const octave_value val)
octave_value get_global_value ( const std::string &  nm,
bool  silent 
)

Definition at line 697 of file variables.cc.

References error(), symbol_table::global_varval(), and octave_value::is_undefined().

Referenced by mexGetVariable().

string_vector get_struct_elts ( const std::string &  text)

Definition at line 189 of file variables.cc.

References Array< T >::length().

octave_value get_top_level_value ( const std::string &  nm,
bool  silent 
)
octave_function* is_valid_function ( const std::string &  fcn_name,
const std::string &  warn_for,
bool  warn 
)
octave_function* is_valid_function ( const octave_value arg,
const std::string &  warn_for,
bool  warn 
)
static bool is_variable ( const std::string &  name)
inlinestatic

Definition at line 226 of file variables.cc.

References octave_value::is_defined(), and symbol_table::varval().

Referenced by generate_struct_completions().

bool looks_like_struct ( const std::string &  text)
octave_value lookup_function_handle ( const std::string &  nm)
void maybe_missing_function_hook ( const std::string &  name)
static void maybe_warn_exclusive ( bool  exclusive)
inlinestatic

Definition at line 2193 of file variables.cc.

References warning().

Referenced by Fclear().

bool mislocked ( const std::string &  nm)
void mlock ( void  )
void munlock ( const std::string &  nm)
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 2158 of file variables.cc.

References is_regexp_match(), and glob_match::match().

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

static void print_descriptor ( std::ostream &  os,
std::list< whos_parameter params 
)
static
static octave_value safe_symbol_lookup ( const std::string &  symbol_name)
static

Definition at line 373 of file variables.cc.

References error_state, symbol_table::find(), and interpreter_try().

Referenced by symbol_exist().

void set_global_value ( const std::string &  nm,
const octave_value val 
)

Definition at line 708 of file variables.cc.

References symbol_table::global_assign().

Referenced by mexPutVariable().

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 ( int var,
const octave_value_list args,
int  nargout,
const char nm,
int  minval,
int  maxval 
)
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 ( std::string &  var,
const octave_value_list args,
int  nargout,
const char nm,
bool  empty_ok 
)
octave_value set_internal_variable ( int var,
const octave_value_list args,
int  nargout,
const char nm,
const char **  choices 
)
void set_top_level_value ( const std::string &  nm,
const octave_value val 
)

Definition at line 725 of file variables.cc.

References symbol_table::top_level_assign().

int symbol_exist ( const std::string &  name,
const std::string &  type 
)
template<class T >
bool try_local_protect ( T &  var)
std::string unique_symbol_name ( const std::string &  basename)

Definition at line 495 of file variables.cc.

References GET_IDX, and symbol_exist().

Referenced by Farrayfun(), Fcellfun(), Fdaspk(), Fdasrt(), Fdassl(), Flsode(), Fquad(), Fquadcc(), and G__eigs__().

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

Definition at line 733 of file variables.cc.

References error_with_cfn().

Referenced by set_internal_variable().

Variable Documentation

std::string Vmissing_component_hook
static

Definition at line 2729 of file variables.cc.

std::string Vmissing_function_hook = "__unimplemented__"
static

Definition at line 2664 of file variables.cc.

Referenced by maybe_missing_function_hook().

std::string Vwhos_line_format = " %a:4; %ln:6; %cs:16:6:1; %rb:12; %lc:-1;\n"
static

Definition at line 68 of file variables.cc.

Referenced by symbol_info_list::parse_whos_line_format().