GNU Octave  3.8.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) \
{ \
print_usage (); \
return retval; \
} \
} \
while (0)

Definition at line 2266 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 492 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 1908 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
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 552 of file variables.cc.

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

OCTAVE_EXPORT octave_value_list Fisglobal ( const octave_value_list args,
int   
)

Definition at line 368 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 2649 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 2572 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 1784 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 1862 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 2553 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 609 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 192 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 229 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 2093 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 2058 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 374 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 620 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 637 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 496 of file variables.cc.

References GET_IDX, and symbol_exist().

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

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

Definition at line 645 of file variables.cc.

References error_with_cfn().

Referenced by set_internal_variable().

Variable Documentation

std::string Vmissing_component_hook
static

Definition at line 2623 of file variables.cc.

std::string Vmissing_function_hook = "__unimplemented__"
static

Definition at line 2558 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().