26 #if defined (HAVE_CONFIG_H)
36 #include "builtin-defun-decls.h"
96 warning (
"function file '%s' changed since it was parsed",
109 std::deque<std::string>
126 warning (
"help text for function is newer than function");
131 std::map<std::string, octave_value>
134 return std::map<std::string, octave_value> ();
140 std::map<std::string, octave_value>
m
153 "user-defined script",
154 "user-defined script");
161 (
const std::string& fnm,
const std::string& nm,
163 const std::string& ds)
171 (
const std::string& fnm,
const std::string& nm,
189 return execute (tw, nargout, args);
208 "user-defined function",
209 "user-defined function");
218 param_list (pl), ret_list (rl),
219 lead_comm (), trail_comm (),
220 location_line (0), location_column (0),
221 parent_name (), system_fcn_file (false),
222 num_named_args (param_list ? param_list->
length () : 0),
223 subfunction (false), inline_function (false),
224 anonymous_function (false), nested_function (false),
225 class_constructor (none), class_method (none)
226 #if defined (HAVE_LLVM)
241 #if defined (HAVE_LLVM)
289 new_eof_line = next_to_last_stmt->
line ();
290 new_eof_col = next_to_last_stmt->
column ();
293 last_stmt->
set_location (new_eof_line + 1, new_eof_col);
301 std::map<std::string, octave_value> fcns =
subfunctions ();
305 for (
auto& nm_fnval : fcns)
310 f->maybe_relocate_end_internal ();
326 std::ostringstream result;
336 result <<
'@' <<
name ();
343 return result.str ();
408 std::map<std::string, octave_value>
421 std::string subfuns = subfuns_arg;
423 std::string first_fun = subfuns;
425 size_t pos = subfuns.find (
'>');
427 if (pos == std::string::npos)
431 first_fun = subfuns.substr (0, pos-1);
432 subfuns = subfuns.substr (pos+1);
437 if (subfuns.empty ())
457 std::list<std::string>
489 return execute (tw, nargout, args);
552 retval =
"unrecognized enum value";
579 retval =
"unrecognized enum value";
589 std::map<std::string, octave_value>
m
645 Cell ids =
m.contents (
"identifier");
646 Cell states =
m.contents (
"state");
686 int nargin = args.length ();
704 error (
"nargin: invalid function name: %s",
name.c_str ());
709 error (
"nargin: FCN must be a string or function handle");
719 error (
"nargin: number of input arguments unavailable for %s objects",
735 if (
retval.is_undefined ())
797 int nargin = args.length ();
815 error (
"nargout: invalid function name: %s",
name.c_str ());
831 error (
"nargout: FCN must be a string or function handle");
841 error (
"nargout: number of output arguments unavailable for %s objects",
854 if (interp.at_top_level ())
855 error (
"nargout: invalid call at top level");
861 if (
retval.is_undefined ())
868 DEFUN (optimize_subsasgn_calls, args, nargout,
894 return (i > 0 && table(i-1) == val);
900 error (
"isargout: K must be a positive integer");
902 return (k == 1 || k <= nargout) && !
val_in_table (ignored, k);
923 if (args.length () != 1)
926 if (interp.at_top_level ())
927 error (
"isargout: invalid call at top level");
943 if (args(0).is_scalar_type ())
945 double k = args(0).double_value ();
949 else if (args(0).isnumeric ())
951 const NDArray ka = args(0).array_value ();
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type lookup(const T &value, sortmode mode=UNSORTED) const
Do a binary lookup in a sorted array.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
bool isempty(void) const
Size of the specified dimension.
size_t length(void) const
std::list< tree_statement * >::reverse_iterator reverse_iterator
reverse_iterator rend(void)
reverse_iterator rbegin(void)
Provides threadsafe access to octave.
std::string get_line(size_t line) const
std::deque< std::string > get_lines(size_t line, size_t num_lines) const
tree_evaluator & get_evaluator(void)
std::map< std::string, octave_value > subfunctions(void) const
void set_user_code(octave_user_code *code)
octave_value find_subfunction(const std::string &name) const
std::list< std::string > subfunction_names(void) const
void erase_subfunctions(void)
void unlock_subfunctions(void)
void set_parent(const symbol_scope &p)
void mark_subfunctions_in_scope_as_private(const std::string &class_name)
void stash_subfunction_names(const std::list< std::string > &names)
void lock_subfunctions(void)
bool has_subfunctions(void) const
octave_value dump(void) const
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
sys::time mtime(void) const
tree_identifier * ident(void)
octave_value_list execute_user_script(octave_user_script &user_script, int nargout, const octave_value_list &args)
octave_value_list execute_user_function(octave_user_function &user_function, int nargout, const octave_value_list &args)
void pop_stack_frame(void)
octave_value get_auto_fcn_var(stack_frame::auto_var_type avt) const
void push_stack_frame(const symbol_scope &scope)
std::string name(void) const
bool takes_varargs(void) const
void visit_octave_user_function_trailer(octave_user_function &)
void visit_octave_user_function_header(octave_user_function &)
void mark_as_script_body(void)
bp_table::intmap remove_all_breakpoints(event_manager &evmgr, const std::string &file)
void mark_as_function_body(void)
bool is_end_of_fcn_or_script(void) const
tree_expression * expression(void)
bool is_end_of_file(void) const
void set_location(int l, int c)
virtual void visit_octave_user_script(octave_user_script &)
virtual void visit_octave_user_function(octave_user_function &)
virtual octave_user_function * user_function_value(bool silent=false)
virtual std::string type_name(void) const
friend class octave_value
bool is_anonymous(void) const
std::string dispatch_class(void) const
bool is_class_method(const std::string &cname="") const
bool is_class_constructor(const std::string &cname="") const
virtual void mark_as_private_function(const std::string &cname="")
std::string name(void) const
octave_value dump(void) const
std::string get_code_line(size_t line)
std::string fcn_file_name(void) const
octave::file_info * m_file_info
octave::sys::time time_parsed(void) const
void cache_function_text(const std::string &text, const octave::sys::time ×tamp)
std::deque< std::string > get_code_lines(size_t line, size_t num_lines)
octave::sys::time t_parsed
virtual std::map< std::string, octave_value > subfunctions(void) const
octave::symbol_scope m_scope
octave::sys::time t_checked
octave::tree_statement_list * cmd_list
std::string parent_fcn_name(void) const
void restore_warning_states(void)
octave::tree_parameter_list * ret_list
octave::tree_expression * special_expr(void)
void unlock_subfunctions(void)
void erase_subfunctions(void)
void mark_as_system_fcn_file(void)
octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave::comment_list * trail_comm
bool is_special_expr(void) const
octave::tree_parameter_list * return_list(void)
void stash_parent_fcn_scope(const octave::symbol_scope &ps)
void maybe_relocate_end(void)
octave_user_function * define_ret_list(octave::tree_parameter_list *t)
octave_value_list all_va_args(const octave_value_list &args)
void stash_subfunction_names(const std::list< std::string > &names)
std::string profiler_name(void) const
bool is_classdef_constructor(const std::string &cname="") const
bool takes_varargs(void) const
octave_value_list execute(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave::tree_parameter_list * parameter_list(void)
bool takes_var_return(void) const
class_method_type class_constructor
void mark_as_private_function(const std::string &cname="")
std::list< std::string > subfunction_names(void) const
int beginning_column(void) const
void print_code_function_header(const std::string &prefix)
void accept(octave::tree_walker &tw)
octave::jit_function_info * jit_info
bool is_inline_function(void) const
void print_code_function_trailer(const std::string &prefix)
std::map< std::string, octave_value > subfunctions(void) const
bool has_subfunctions(void) const
octave::comment_list * lead_comm
~octave_user_function(void)
octave_value find_subfunction(const std::string &subfuns) const
octave_user_function(const octave::symbol_scope &scope=octave::symbol_scope(), octave::tree_parameter_list *pl=nullptr, octave::tree_parameter_list *rl=nullptr, octave::tree_statement_list *cl=nullptr)
bool is_subfunction(void) const
bool subsasgn_optimization_ok(void)
int beginning_line(void) const
void lock_subfunctions(void)
std::string method_type_str(void) const
std::string ctor_type_str(void) const
octave::tree_parameter_list * param_list
octave_value dump(void) const
bool is_anonymous_function(void) const
class_method_type class_method
void maybe_relocate_end_internal(void)
void accept(octave::tree_walker &tw)
octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave_value_list execute(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave_idx_type length(void) const
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
octave_user_function * user_function_value(bool silent=false) const
int int_value(bool req_int=false, bool frc_str_conv=false) const
bool is_string(void) const
bool is_defined(void) const
bool is_function_handle(void) const
octave_function * function_value(bool silent=false) const
bool isstruct(void) const
octave_fcn_handle * fcn_handle_value(bool silent=false) const
std::string string_value(bool force=false) const
octave_map map_value(void) const
bool is_undefined(void) const
bool is_inline_function(void) const
Matrix matrix_value(bool frc_str_conv=false) const
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
OCTAVE_EXPORT octave_value_list Fwarning(octave::interpreter &interp, const octave_value_list &args, int nargout)
void error(const char *fmt,...)
#define panic_impossible()
void err_wrong_type_arg(const char *name, const char *s)
F77_RET_T const F77_DBLE const F77_DBLE * f
std::string fcn_file_dir(void)
interpreter & __get_interpreter__(const std::string &who)
event_manager & __get_event_manager__(const std::string &who)
std::string fcn_file_in_path(const std::string &name)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
static bool Voptimize_subsasgn_calls
static bool val_in_table(const Matrix &table, double val)
static bool isargout1(int nargout, const Matrix &ignored, double k)
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
#define SET_INTERNAL_VARIABLE(NM)