23 #if defined (HAVE_CONFIG_H)
65 std::map<std::string, octave_value>
68 return std::map<std::string, octave_value> ();
74 "user-defined script",
75 "user-defined script");
79 t_parsed (static_cast<time_t> (0)),
80 t_checked (static_cast<time_t> (0)),
89 t_parsed (static_cast<time_t> (0)),
90 t_checked (static_cast<time_t> (0)),
101 t_parsed (static_cast<time_t> (0)),
102 t_checked (static_cast<time_t> (0)),
116 const std::list<octave_value_list>&,
int)
118 error (
"invalid use of script %s in index expression",
file_name.c_str ());
129 if (args.
length () != 0 || nargout != 0)
138 error (
"max_recursion_depth exceeded");
176 "user-defined function",
177 "user-defined function");
186 param_list (pl), ret_list (rl), cmd_list (cl),
187 lead_comm (), trail_comm (), file_name (),
188 location_line (0), location_column (0),
189 parent_name (), t_parsed (static_cast<time_t> (0)),
190 t_checked (static_cast<time_t> (0)),
192 num_named_args (param_list ? param_list->length () : 0),
193 subfunction (
false), inline_function (
false),
194 anonymous_function (
false), nested_function (
false),
195 class_constructor (none), class_method (
false),
196 parent_scope (-1), local_scope (sid),
197 curr_unwind_protect_frame (0)
198 #if defined (HAVE_LLVM)
203 cmd_list->mark_as_function_body ();
205 if (local_scope >= 0)
220 #if defined (HAVE_LLVM)
277 new_eof_line = next_to_last_stmt->
line ();
278 new_eof_col = next_to_last_stmt->
column ();
281 last_stmt->
set_location (new_eof_line + 1, new_eof_col);
289 std::map<std::string, octave_value> fcns =
subfunctions ();
293 for (std::map<std::string, octave_value>::iterator
p = fcns.begin ();
294 p != fcns.end ();
p++)
309 std::ostringstream
result;
319 result <<
"@" <<
name ();
326 return result.str ();
376 std::map<std::string, octave_value>
390 (
const std::list<std::string>& names)
392 subfcn_names = names;
410 const std::list<octave_value_list>& idx,
418 const std::list<octave_value_list>& idx,
420 const std::list<octave_lvalue>* lvalue_list)
428 int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
431 idx.size () == 1 ? lvalue_list : 0);
439 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
467 const std::list<octave_lvalue>* lvalue_list)
484 ret_args = args.
slice (0, 1,
true);
491 #if defined (HAVE_LLVM)
503 error (
"max_recursion_depth exceeded");
534 error (
"%s: invalid classdef constructor, no output argument defined",
604 retval = (lvalue_list
605 ? expr->
rvalue (nargout, lvalue_list)
606 : expr->
rvalue (nargout));
636 varargout = varargout_varval.
xcell_value (
"varargout must be a cell array object");
665 if (Voptimize_subsasgn_calls
672 retval = par1->
name () == ret1->
name ();
680 octave_user_function::print_symtab_info (std::ostream& os)
const
706 const std::list<octave_lvalue> *lvalue_list)
708 if (! arg_names.
empty ())
739 if (takes_varargs ())
748 for (std::list<octave_lvalue>::const_iterator
p = lvalue_list->begin ();
749 p != lvalue_list->end ();
p++)
750 nbh +=
p->is_black_hole ();
758 for (std::list<octave_lvalue>::const_iterator
759 p = lvalue_list->begin ();
p != lvalue_list->end ();
p++)
761 if (
p->is_black_hole ())
830 int nargin =
args.length ();
846 error (
"nargin: invalid function name: %s", name.c_str ());
851 error (
"nargin: FCN must be a string or function handle");
861 error (
"nargin: number of input arguments unavailable for %s objects",
867 retval = param_list ? param_list->
length () : 0;
869 retval = -1 - retval;
937 int nargin =
args.length ();
953 error (
"nargout: invalid function name: %s", name.c_str ());
970 error (
"nargout: FCN must be a string or function handle");
980 error (
"nargout: number of output arguments unavailable for %s objects",
986 retval = ret_list ? ret_list->
length () : 0;
989 retval = -1 - retval;
994 error (
"nargout: invalid call at top level");
1005 DEFUN (optimize_subsasgn_calls,
args, nargout,
1025 static bool val_in_table (
const Matrix& table,
double val)
1031 return (i > 0 && table(i-1) == val);
1034 static bool isargout1 (
int nargout,
const Matrix& ignored,
double k)
1037 error (
"isargout: K must be a positive integer");
1039 return (k == 1 || k <= nargout) && ! val_in_table (ignored, k);
1060 if (
args.length () != 1)
1064 error (
"isargout: invalid call at top level");
1073 if (
args(0).is_scalar_type ())
1075 double k =
args(0).double_value ();
1077 return ovl (isargout1 (nargout1, ignored, k));
1079 else if (
args(0).is_numeric_type ())
1085 r(i) = isargout1 (nargout1, ignored, ka(i));
virtual std::map< std::string, octave_value > subfunctions(void) const
~octave_user_function(void)
bool has_subfunctions(void) const
int beginning_line(void) const
octave::unwind_protect * curr_unwind_protect_frame
static bool Voptimize_subsasgn_calls
symbol_table::scope_id local_scope
const Cell & contents(const_iterator p) const
bool is_empty(void) const
void accept(tree_walker &tw)
octave_user_function * user_function_value(bool=false)
static const std::string anonymous
std::list< std::string > subfcn_names
bool takes_var_return(void) const
static bool at_top_level(void)
virtual void visit_octave_user_function(octave_user_function &)=0
octave_comment_list * trail_comm
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
void set_location(int l, int c)
tree_parameter_list * parameter_list(void)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
void visit_octave_user_function_header(octave_user_function &)
octave_idx_type numel(void) const
Number of elements in the array.
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
octave_idx_type length(void) const
void accept(tree_walker &tw)
virtual void visit_octave_user_script(octave_user_script &)=0
octave_map map_value(void) const
OCTINTERP_API std::string fcn_file_in_path(const std::string &)
void bind_automatic_vars(const string_vector &arg_names, int nargin, int nargout, const octave_value_list &va_args, const std::list< octave_lvalue > *lvalue_list)
Cell xcell_value(const char *fmt,...) const
bool is_defined(void) const
bool is_classdef_constructor(const std::string &cname="") const
static bool execute(tree_simple_for_command &cmd, const octave_value &bounds)
octave_value_list all_va_args(const octave_value_list &args)
void maybe_relocate_end_internal(void)
int int_value(bool req_int=false, bool frc_str_conv=false) const
string_vector name_tags(void) const
bool is_inline_function(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
std::string name(void) const
#define SET_INTERNAL_VARIABLE(NM)
bool is_special_expr(void) const
std::string Vfcn_file_dir
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
octave_comment_list * lead_comm
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
bool is_class_method(const std::string &cname="") const
static void lock_subfunctions(scope_id scope=xcurrent_scope)
octave_idx_type numel(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
bool is_end_of_file(void) const
void restore_warning_states(void)
static void set_location(int l, int c)
static void mark_automatic(const std::string &name, scope_id scope=xcurrent_scope)
octave_fcn_handle * fcn_handle_value(bool silent=false) const
void add_method(T *obj, void(T::*method)(void))
static octave_value find_function(const std::string &name, const octave_value_list &args=octave_value_list(), bool local_funcs=true)
#define END_PROFILER_BLOCK
symbol_table::context_id active_context() const
std::list< tree_statement * >::reverse_iterator reverse_iterator
static octave_value varval(const std::string &name, scope_id scope=xcurrent_scope, context_id context=xdefault_context)
static void clear_variables(void)
octave_idx_type lookup(const T &value, sortmode mode=UNSORTED) const
Do a binary lookup in a sorted array.
bool is_function_handle(void) const
bool takes_varargs(void) const
std::string dispatch_class(void) const
bool is_subfunction(void) const
tree_identifier * ident(void)
bool is_class_constructor(const std::string &cname="") const
Cell cell_value(void) const
static void set_curr_fcn(octave_user_function *curr_fcn, scope_id scope=xcurrent_scope)
static void push_context(scope_id scope=xcurrent_scope)
tree_evaluator * current_evaluator
void define_from_arg_vector(const octave_value_list &args)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void print_code_function_header(void)
reverse_iterator rbegin(void)
bool is_anonymous_function(void) const
std::string profiler_name(void) const
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
virtual octave_user_function * user_function_value(bool silent=false)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
void add_fcn(void(*fcn)(void))
void lock_subfunctions(void)
static llvm::LLVMContext & context
std::string string_value(bool force=false) const
void mark_as_system_fcn_file(void)
tree_parameter_list * return_list(void)
nd deftypefn *octave_map m
std::string name(void) const
void maybe_relocate_end(void)
void stash_subfunction_names(const std::list< std::string > &names)
bool is_string(void) const
static void force_assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context)
bool is_inline_function(void) const
octave_value_list do_multi_index_op(int nargout, const octave_value_list &args)
octave_value_list convert_to_const_vector(int nargout, const Cell &varargout)
void unlock_subfunctions(void)
static void pop_context(void)
octave_user_function(symbol_table::scope_id sid=-1, tree_parameter_list *pl=0, tree_parameter_list *rl=0, tree_statement_list *cl=0)
#define panic_impossible()
static void assign(const std::string &name, const octave_value &value=octave_value(), scope_id scope=xcurrent_scope, context_id context=xdefault_context, bool force_add=false)
static void push(octave_function *f, symbol_table::scope_id scope=symbol_table::current_scope(), symbol_table::context_id context=symbol_table::current_context())
tree_statement_list * cmd_list
std::string fcn_file_name(void) const
tree_expression * special_expr(void)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Matrix matrix_value(bool frc_str_conv=false) const
void err_wrong_type_arg(const char *name, const char *s)
With real return the complex result
bool takes_varargs(void) const
octave_function * function_value(bool silent=false) const
octave::unwind_protect frame
bool is_end_of_fcn_or_script(void) const
void visit_octave_user_function_trailer(octave_user_function &)
bool subsasgn_optimization_ok(void)
static void mark_hidden(const std::string &name, scope_id scope=xcurrent_scope)
OCTINTERP_API octave_value_list Fwarning(const octave_value_list &=octave_value_list(), int=0)
std::string type_name(void) const
jit_function_info * jit_info
octave_value_list do_multi_index_op(int nargout, const octave_value_list &args)
=val(i)}if ode{val(i)}occurs in table i
void initialize_undefined_elements(const std::string &warnfor, int nargout, const octave_value &val)
tree_expression * expression(void)
size_t length(void) const
virtual std::string type_name(void) const
tree_statement_list * cmd_list
virtual octave_value_list rvalue(int nargout)
octave_user_function * define_ret_list(tree_parameter_list *t)
bool is_undefined(void) const
tree_parameter_list * param_list
std::map< std::string, octave_value > subfunctions(void) const
void print_code_function_trailer(void)
static stmt_list_type statement_context
~octave_user_script(void)
void stash_fcn_file_name(const std::string &nm)
static void unlock_subfunctions(scope_id scope=xcurrent_scope)
int beginning_column(void) const
bp_table::intmap remove_all_breakpoints(const std::string &file)
std::string parent_fcn_name(void) const
reverse_iterator rend(void)
static std::map< std::string, octave_value > subfunctions_defined_in_scope(scope_id scope=xcurrent_scope)
tree_parameter_list * ret_list
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
void mark_as_script_body(void)
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
#define BEGIN_PROFILER_BLOCK(classname)
static void erase_scope(scope_id scope)
std::string fcn_name(void) const
void accept(tree_walker &tw)