26 #if defined (HAVE_CONFIG_H)
32 #include <condition_variable>
92 bool all (
void)
const {
return m_all; }
118 void repl (
const std::string& prompt =
"debug> ");
197 catch (
const interrupt_exception&)
210 std::cerr <<
"error: unhandled index exception: "
211 << e.message () <<
" -- trying to return to prompt"
239 catch (
const std::bad_alloc&)
243 std::cerr <<
"error: out of memory -- trying to return to prompt"
247 while (exit_status == 0);
249 if (exit_status == EOF)
279 std::string fcn_file_nm, fcn_nm;
284 fcn_nm = fcn_file_nm.empty () ? caller->
name () : fcn_file_nm;
289 std::ostringstream buf;
295 if (! fcn_nm.empty ())
299 static char ctrl_z =
'Z' & 0x1f;
301 buf << ctrl_z << ctrl_z << fcn_nm <<
':' << curr_debug_line;
313 frm->display_stopped_in_message (buf);
321 fcn_nm, curr_debug_line);
325 std::string line_buf;
330 if (! line_buf.empty ())
331 buf << curr_debug_line <<
": " << line_buf;
339 std::string stopped_in_msg = buf.str ();
343 if (! stopped_in_msg.empty ())
352 std::shared_ptr<push_parser>
361 if (! stopped_in_msg.empty ())
362 std::cerr << stopped_in_msg << std::endl;
364 std::string tmp_prompt = prompt_arg;
366 tmp_prompt =
"[" + std::to_string (
m_level) +
"]" + prompt_arg;
369 input_sys.
PS1 (tmp_prompt);
387 void (
application::*forced_interactive_fptr) (bool)
389 frame.
add (forced_interactive_fptr, app,
396 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
420 debug_parser.
reset ();
422 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
432 std::string input_line = reader.
get_input (prompt, eof);
440 retval = debug_parser.
run (input_line,
false);
448 int retval = debug_parser.
run ();
463 std::shared_ptr<tree_statement_list> stmt_list
467 stmt_list->accept (tw);
551 fname = fcn->
name ();
554 if (opt ==
"fullpathext")
558 std::size_t epos = fname.rfind (
'.');
561 epos = std::string::npos;
563 if (epos != std::string::npos)
564 fname = fname.substr (0, epos);
566 if (opt ==
"fullpath")
569 if (dpos != std::string::npos)
570 fname = fname.substr (dpos+1);
576 bool& incomplete_parse)
578 incomplete_parse =
false;
610 std::shared_ptr<tree_statement_list>
611 stmt_list =
m_parser->statement_list ();
621 else if (
m_parser->at_end_of_input ())
625 incomplete_parse =
true;
642 std::unique_lock<std::mutex> lock (mtx);
643 std::condition_variable cv;
644 bool incomplete_parse =
false;
645 bool evaluation_pending =
false;
646 bool exiting =
false;
657 std::string ps = incomplete_parse ? input_sys.
PS2 () : input_sys.
PS1 ();
662 std::getline (std::cin,
input);
667 incomplete_parse =
false;
668 evaluation_pending =
true;
676 std::lock_guard<std::mutex> local_lock (mtx);
682 catch (
const exit_exception&)
684 evaluation_pending =
false;
700 evaluation_pending =
false;
705 evaluation_pending =
false;
707 throw exit_exception (1);
712 evaluation_pending =
false;
717 evaluation_pending =
false;
724 cv.wait (lock, [&] {
return ! evaluation_pending; });
744 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
745 static bool use_command_line_push_parser =
true;
747 static bool use_command_line_push_parser =
false;
755 std::shared_ptr<base_parser> repl_parser;
759 if (use_command_line_push_parser)
765 repl_parser = std::shared_ptr<base_parser> (pp);
770 repl_parser = std::shared_ptr<base_parser> (pp);
776 repl_parser = std::shared_ptr<base_parser> (pp);
785 repl_parser->reset ();
793 exit_status = repl_parser->run ();
795 if (exit_status == 0)
797 std::shared_ptr<tree_statement_list>
798 stmt_list = repl_parser->statement_list ();
806 else if (repl_parser->at_end_of_input ())
813 catch (
const interrupt_exception&)
825 std::cerr <<
"error: unhandled index exception: "
826 << ie.message () <<
" -- trying to return to prompt"
851 catch (
const std::bad_alloc&)
855 std::cerr <<
"error: out of memory -- trying to return to prompt"
859 while (exit_status == 0);
861 if (exit_status == EOF)
909 catch (
const interrupt_exception&)
924 std::cerr <<
"error: unhandled index exception: "
925 << e.message () <<
" -- trying to return to prompt"
953 catch (
const exit_exception& xe)
958 catch (
const std::bad_alloc&)
963 std::cerr <<
"error: out of memory -- trying to return to prompt"
985 stmt_list->accept (*
this);
1014 int& parse_status,
int nargout)
1022 eval_parser.
reset ();
1033 parse_status = eval_parser.
run ();
1035 if (parse_status == 0)
1037 std::shared_ptr<tree_statement_list> stmt_list
1044 if (stmt_list->length () == 1
1045 && (stmt = stmt_list->front ())
1055 bool do_bind_ans =
false;
1062 if (do_bind_ans && ! retval.
empty ())
1068 else if (nargout == 0)
1069 stmt_list->accept (*
this);
1071 error (
"eval: invalid use of statement list");
1080 while (parse_status == 0);
1086 bool silent,
int& parse_status)
1099 bool silent,
int& parse_status,
1102 std::string s = arg.
xstring_value (
"eval: expecting string argument");
1104 return eval_string (s, silent, parse_status, nargout);
1110 int parse_status = 0;
1112 return eval_string (try_code, nargout > 0, parse_status, nargout);
1116 const std::string& catch_code,
1123 int parse_status = 0;
1125 bool execution_error =
false;
1131 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1138 execution_error =
true;
1141 if (parse_status != 0 || execution_error)
1143 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1155 if (execution_error)
1163 const std::string& try_code,
1171 if (context ==
"caller")
1173 else if (context ==
"base")
1176 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1178 int parse_status = 0;
1180 return eval_string (try_code, nargout > 0, parse_status, nargout);
1184 const std::string& try_code,
1185 const std::string& catch_code,
1195 if (context ==
"caller")
1197 else if (context ==
"base")
1200 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1204 int parse_status = 0;
1206 bool execution_error =
false;
1212 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1219 execution_error =
true;
1222 if (parse_status != 0 || execution_error)
1224 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1236 if (execution_error)
1258 warning (
"function arguments validation blocks are not supported; INCORRECT RESULTS ARE POSSIBLE");
1314 int line = cmd.
line ();
1327 error (
"break must appear in a loop in the same file as loop command");
1341 int line = cmd.
line ();
1417 frame.
add ([=] (
void)
1424 dbgr->
repl (prompt);
1451 for (
const auto& lval : *lvalues)
1452 nbh += lval.is_black_hole ();
1461 for (
const auto& lval : *lvalues)
1463 if (lval.is_black_hole ())
1489 std::size_t
len = name.length ();
1491 if (
len == 3 && name ==
".**")
1527 else if (name[1] ==
'=')
1548 else if (name ==
"**")
1561 return "ctranspose";
1621 bool name_is_operator = fcn_name != name;
1623 std::size_t pos = fcn_name.find (
'.');
1625 if (pos != std::string::npos)
1644 std::string meth_nm = fcn_name.substr (pos+1);
1646 if (meth_nm.find (
'.') == std::string::npos)
1648 std::string obj_nm = fcn_name.substr (0, pos);
1655 if (
object.
is_defined () &&
object.is_classdef_object ())
1678 fcn_name = class_nm +
'.' + meth_nm;
1727 bool skip_first = name_is_operator;
1736 if (! name_is_operator)
1741 std::shared_ptr<stack_frame> frame
1757 && (fcn_name == curr_fcn->
name ()
1759 frame = frame->access_link ();
1868 std::shared_ptr<stack_frame> frame
1871 return frame->is_variable (name);
1877 std::shared_ptr<stack_frame> frame
1880 return frame->is_local_variable (name);
1917 std::shared_ptr<stack_frame> frame
1920 return frame->is_variable (sym);
1926 std::shared_ptr<stack_frame> frame
1929 return frame->is_defined (sym);
1934 std::shared_ptr<stack_frame> frame
1937 return frame->is_global (name);
1943 std::shared_ptr<stack_frame> frame
1946 return frame->varval (sym);
1952 std::shared_ptr<stack_frame> frame
1955 return frame->varval (name);
1962 std::shared_ptr<stack_frame> frame
1965 return frame->install_variable (name, value, global);
2003 std::shared_ptr<stack_frame> frame
2006 frame->assign (name, val);
2022 if (context ==
"caller")
2024 else if (context ==
"base")
2027 error (R
"(assignin: CONTEXT must be "caller" or "base")");
2036 error (
"assignin: invalid assignment to keyword '%s'",
2042 error (
"assignin: invalid variable name '%s'", name.c_str ());
2047 const std::string& context,
2048 bool verbose,
bool require_file)
2083 static std::map<std::string, int> source_call_depth;
2085 std::string file_full_name
2091 std::string dir_name = file_full_name.substr (0, pos);
2097 if (source_call_depth.find (file_full_name) == source_call_depth.end ())
2098 source_call_depth[file_full_name] = -1;
2100 frame.
protect_var (source_call_depth[file_full_name]);
2102 source_call_depth[file_full_name]++;
2105 error (
"max_recursion_depth exceeded");
2107 if (! context.empty ())
2112 if (context ==
"caller")
2114 else if (context ==
"base")
2117 error (R
"(source: CONTEXT must be "caller" or "base")");
2123 dir_end = (dir_end == std::string::npos) ? 0 : dir_end + 1;
2125 std::size_t extension = file_name.find_last_of (
'.');
2126 if (extension == std::string::npos)
2127 extension = file_name.length ();
2129 std::string symbol = file_name.substr (dir_end, extension - dir_end);
2165 file_name, dir_name,
"",
"",
2166 require_file,
true,
false,
false);
2170 error (ee,
"source: error sourcing file '%s'",
2171 file_full_name.c_str ());
2181 error (
"source: %s is not a script", full_name.c_str ());
2185 octave_stdout <<
"executing commands from " << full_name <<
" ... ";
2227 if (args(i).
is_defined () && args(i).is_magic_colon ())
2230 error (
"no default value for argument %d", i+1);
2298 std::list<octave_value> arg_vals;
2300 for (
auto elt : *args)
2314 arg_vals.push_back (tmp_ovl(i));
2317 arg_vals.push_back (tmp);
2326 const Cell& varargout)
2338 int num_ignored = ignored_outputs.
numel ();
2339 int ignored = num_ignored > 0 ? ignored_outputs(k) - 1 : -1;
2343 int nout = nargout > 0 ? nargout : 1;
2348 if (nargout == 0 && !
is_defined (elt->ident ()))
2351 if (ignored >= 0 && i == ignored)
2355 ignored = k < num_ignored ? ignored_outputs(k) - 1 : -1;
2372 if (ignored >= 0 && i == ignored)
2376 ignored = k < num_ignored ? ignored_outputs(k) - 1 : -1;
2383 retval(i++) = varargout(j);
2393 bool retval =
false;
2422 if (label_value.
iscell ())
2430 bool match = val.
is_equal (cell(i, j));
2450 const std::shared_ptr<stack_frame>& closure_frames)
2457 const std::shared_ptr<stack_frame>& closure_frames)
2501 frm->display_stopped_in_message (os);
2571 std::list<std::shared_ptr<stack_frame>>
2577 std::list<std::shared_ptr<stack_frame>>
2583 std::list<frame_info>
2585 bool print_subfn)
const
2597 bool print_subfn)
const
2616 std::ostringstream buf;
2618 for (
const auto& frm : frames)
2620 buf <<
" " << frm.fcn_name ();
2622 int line = frm.line ();
2626 buf <<
" at line " << line;
2628 int column = frm.column ();
2631 buf <<
" column " << column;
2667 error (
"mlock: invalid use outside a function");
2671 warning (
"mlock: locking built-in function has no effect");
2683 error (
"munlock: invalid use outside a function");
2687 warning (
"munlock: unlocking built-in function has no effect");
2699 error (
"mislocked: invalid use outside a function");
2717 std::shared_ptr<stack_frame> frame
2741 std::shared_ptr<stack_frame> frame
2744 frame->clear_objects ();
2749 std::shared_ptr<stack_frame> frame
2752 frame->clear_variable (name);
2757 std::shared_ptr<stack_frame> frame
2760 frame->clear_variable_pattern (pattern);
2765 std::shared_ptr<stack_frame> frame
2768 frame->clear_variable_regexp (pattern);
2773 std::shared_ptr<stack_frame> frame
2776 frame->clear_variables ();
2866 const std::string& class_name)
2874 std::string name = fname;
2878 auto beg = name.begin () + 2;
2879 auto end = name.end () - 1;
2883 std::size_t name_len = name.length ();
2885 if (name_len > 2 && name.substr (name_len-2) ==
".m")
2886 name = name.substr (0, name_len-2);
2894 std::size_t p2 = std::string::npos;
2900 if (p1 == std::string::npos)
2903 std::string dispatch_type = name.substr (1, p1-1);
2905 p2 = name.find (
'>', p1);
2907 std::string method = name.substr (p1+1, p2-1);
2911 else if (! class_name.empty ())
2923 p2 = name.find (
'>');
2925 std::string main_fcn = name.substr (0, p2);
2931 std::string subfuns;
2933 if (p2 != std::string::npos)
2934 subfuns = name.substr (p2+1);
2939 if (! user_code || subfuns.empty ())
2959 return curfcn->
name ();
2975 int line = cmd.
line ();
2991 init_list->
accept (*
this);
3006 error (
"declaration list element not global or persistent");
3026 template <
typename T>
3036 "FOR loop limit is infinite, will stop after %"
3037 OCTAVE_IDX_TYPE_FORMAT
" steps", steps);
3049 loop_body->
accept (*
this);
3059 int line = cmd.
line ();
3167 loop_body->
accept (*
this);
3190 if (rhs.
ndims () > 2)
3193 if (nrows > 0 && steps > 0)
3223 loop_body->
accept (*
this);
3238 error (
"invalid type in for loop expression near line %d, column %d",
3245 int line = cmd.
line ();
3268 error (
"in statement 'for [X, Y] = VAL', VAL must be a structure");
3276 auto p = lhs->
begin ();
3299 std::string key = keys[i];
3311 loop_body->
accept (*
this);
3337 new_scope = scope.
dup ();
3341 = param_list ? param_list->
dup (new_scope) :
nullptr;
3362 std::set<std::string> free_vars = anon_fcn_ctx.
free_variables ();
3366 std::shared_ptr<stack_frame> frame
3369 for (
auto& name : free_vars)
3374 local_vars[name] = val;
3383 bool is_nested =
false;
3432 error (
"invalid use of colon in function argument list");
3439 retval = (*fcn) (args, nargout);
3477 error (
"invalid use of colon in function argument list");
3481 retval =
call_mex (mex_function, args, nargout);
3495 if (args.
length () != 0 || nargout != 0)
3496 error (
"invalid call to script %s", file_name.c_str ());
3507 error (
"max_recursion_depth exceeded");
3518 cmd_list->
accept (*
this);
3549 int nargin = args.
length ();
3555 ret_args = args.
slice (0, 1,
true);
3557 args = args.
slice (1, nargin,
true);
3568 bool takes_varargs =
false;
3574 max_inputs = param_list->
length ();
3577 if (! takes_varargs && nargin > max_inputs)
3582 name =
"@<anonymous>";
3585 "%s: function called with too many inputs",
3595 int max_outputs = ret_list->
length ();
3597 if (nargout > max_outputs)
3602 "%s: function called with too many outputs",
3617 error (
"%s: invalid classdef constructor, no output argument defined",
3627 error (
"max_recursion_depth exceeded");
3665 cmd_list->
accept (*
this);
3685 varargout = varargout_varval.
xcell_value (
"varargout must be a cell array object");
3724 std::string nm =
f->name ();
3754 int line = cmd.
line ();
3789 stmt_lst->
accept (*
this);
3825 int line = cmd.
line ();
3871 int line = cmd.
line ();
3922 int line = stmt.
line ();
3945 bool do_bind_ans =
false;
3958 catch (
const std::bad_alloc&)
3966 "out of memory or dimension too large for Octave's index type");
3968 catch (
const interrupt_exception&)
4013 auto p = lst.
begin ();
4015 if (p != lst.
end ())
4022 error (
"invalid statement found in statement list!");
4034 if (p == lst.
end ())
4074 int line = cmd.
line ();
4087 error (
"missing value in switch command near line %d, column %d",
4103 stmt_lst->
accept (*
this);
4116 int line = cmd.
line ();
4123 bool execution_error =
false;
4141 try_code->
accept (*
this);
4145 execution_error =
true;
4162 if (execution_error)
4178 catch_code->
accept (*
this);
4271 int line = cmd.
line ();
4282 if (unwind_protect_code)
4286 unwind_protect_code->
accept (*
this);
4307 catch (
const interrupt_exception&)
4324 int line = cmd.
line ();
4354 loop_body->
accept (*
this);
4367 int line = cmd.
line ();
4392 loop_body->
accept (*
this);
4419 static std::string ans =
"ans";
4445 feval (
"display", args);
4460 bool is_end_of_fcn_or_script)
4462 bool break_on_this_statement =
false;
4465 break_on_this_statement =
true;
4478 break_on_this_statement =
true;
4495 break_on_this_statement =
true;
4502 break_on_this_statement =
true;
4514 if (is_end_of_fcn_or_script
4519 if (! break_on_this_statement)
4524 if (break_on_this_statement)
4534 const char *warn_for)
4536 bool expr_value =
false;
4545 error (
"%s: undefined value used in conditional expression", warn_for);
4555 "max_recursion_depth", 0);
4590 fcn_names(i) = fcn_fname.first;
4591 file_names(i) = fcn_fname.second;
4598 m.assign (
"function", fcn_names);
4599 m.assign (
"file", file_names);
4622 std::list<std::string> names;
4625 names.push_back (fcn_fname.first);
4630 std::list<std::string>
4633 std::list<std::string> names;
4636 if (nm == fcn_fname.second)
4637 names.push_back (fcn_fname.first);
4643 const std::string& nm)
4651 const std::string& nm)
4667 "whos_line_format");
4674 "silent_functions");
4681 "string_fill_char");
4691 std::string extra_message;
4695 std::string var = expr->
name ();
4707 if (fp && fp->
name () == var)
4709 =
" (note: variable '" + var +
"' shadows function)";
4713 std::string msg = ie.message () + extra_message;
4720 bool return_list,
bool verbose)
4743 std::list<octave_value> arg_vals;
4747 for (
auto elt : *args)
4763 arg_vals.push_back (tmp_ovl(i));
4766 arg_vals.push_back (tmp);
4780 std::list<octave_lvalue>
4783 std::list<octave_lvalue> retval;
4786 retval.push_back (elt->lvalue (*
this));
4896 std::string arg0 = argv[0];
4900 else if (arg0 ==
"off")
4908 error (
"echo: no such file %s", arg0.c_str ());
4935 p->second = ! p->second;
4944 std::string arg0 = argv[0];
4945 std::string arg1 = argv[1];
4947 if (arg1 ==
"on" || arg1 ==
"off")
4948 std::swap (arg0, arg1);
4963 error (
"echo: no such file %s", arg1.c_str ());
4969 else if (arg0 ==
"off")
4982 error (
"echo: no such file %s", arg1.c_str ());
5026 int ndims = dv.
ndims ();
5028 if (num_indices < ndims)
5030 for (
int i = num_indices; i < ndims; i++)
5031 dv(num_indices-1) *= dv(i);
5033 if (num_indices == 1)
5041 ndims = num_indices;
5046 return (index_position < ndims
5053 int nargin = args.
length ();
5055 if (nargin != 0 && nargin != 3)
5061 = args(1).xidx_type_value (
"end: K must be integer value");
5064 error (
"end: K must be greater than zero");
5067 = args(2).xidx_type_value (
"end: N must be integer value");
5070 error (
"end: N must be greater than zero");
5082 error (
"invalid use of 'end': may only be used to index existing value");
5123 error (
"error evaluating partial expression for END");
5133 std::string dispatch_class = expr_result.
class_name ();
5198 std::deque<std::string> lines
5201 for (
auto& elt : lines)
5225 const Matrix& ignored_outputs,
5226 int nargin,
int nargout,
5246 std::string full_name = nm;
5256 if (! fname.empty ())
5261 sys::file_stat fs (fname + nm);
5265 full_name = fname + nm;
5273 "autoload: '%s' is not an absolute filename",
5279 DEFMETHOD (max_recursion_depth, interp, args, nargout,
5314 DEFMETHOD (whos_line_format, interp, args, nargout,
5395 DEFMETHOD (silent_functions, interp, args, nargout,
5429 DEFMETHOD (string_fill_char, interp, args, nargout,
5497 return tw.
PS4 (args, nargout);
5543 return tw.
echo (args, nargout);
F77_RET_T const F77_DBLE const F77_DBLE const F77_INT const F77_DBLE const F77_DBLE const F77_DBLE F77_DBLE F77_DBLE F77_INT F77_INT const F77_INT const F77_INT F77_INT F77_INT F77_DBLE *F77_RET_T const F77_DBLE const F77_INT const F77_DBLE const F77_DBLE F77_DBLE F77_DBLE F77_INT F77_INT const F77_INT const F77_INT F77_INT F77_INT F77_DBLE *F77_RET_T const F77_REAL const F77_REAL const F77_INT const F77_REAL const F77_REAL const F77_REAL F77_REAL F77_REAL F77_INT F77_INT const F77_INT const F77_INT F77_INT F77_INT F77_REAL *F77_RET_T const F77_REAL const F77_INT const F77_REAL const F77_REAL F77_REAL F77_REAL F77_INT F77_INT const F77_INT const F77_INT F77_INT F77_INT F77_REAL *static F77_INT user_function(const double &x, int &, double &result)
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type columns(void) const
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
void add(F &&fcn, Args &&... args)
void discard(std::size_t num)
OCTAVE_API void run(std::size_t num)
static application * app(void)
static bool forced_interactive(void)
void forced_interactive(bool arg)
std::size_t length(void) const
OCTINTERP_API void disallow_command_syntax(void)
OCTINTERP_API void statement_list(std::shared_ptr< tree_statement_list > &lst)
bool at_end_of_input(void) const
OCTINTERP_API void reset(void)
bool debug_on_err(const std::string &id)
bool have_breakpoints(void)
bool debug_on_caught(const std::string &id)
void set_dispatch_class(const std::string &class_name)
octave_value do_who(int argc, const string_vector &argv, bool return_list, bool verbose=false)
octave_value get_top_level_value(const std::string &name) const
octave_value global_varval(const std::string &name) const
std::list< frame_info > backtrace_info(octave_idx_type &curr_user_frame, bool print_subfn=true) const
std::shared_ptr< stack_frame > get_current_stack_frame(void) const
octave_map backtrace(octave_idx_type &curr_user_frame, bool print_subfn=true) const
symbol_scope current_scope(void) const
octave_value & global_varref(const std::string &name)
void set_top_level_value(const std::string &name, const octave_value &value)
void goto_base_frame(void)
octave_value get_auto_fcn_var(stack_frame::auto_var_type avt) const
symbol_info_list top_scope_symbol_info(void) const
std::string get_dispatch_class(void) const
symbol_info_list regexp_symbol_info(const std::string &pattern) const
void make_global(const symbol_record &sym)
octave_user_code * current_user_code(void) const
int current_line(void) const
symbol_info_list get_symbol_info(void)
symbol_info_list glob_symbol_info(const std::string &pattern) const
void restore_frame(std::size_t n)
bool is_class_method_executing(std::string &dispatch_class) const
bool goto_frame(std::size_t n=0, bool verbose=false)
void set_auto_fcn_var(stack_frame::auto_var_type avt, const octave_value &val)
int current_column(void) const
void clear_global_variables(void)
int current_user_code_line(void) const
std::size_t current_frame(void) const
std::list< std::string > variable_names(void) const
std::list< std::shared_ptr< stack_frame > > backtrace_frames(octave_idx_type &curr_user_frame) const
void set_location(int l, int c)
bool is_class_constructor_executing(std::string &dispatch_class) const
octave_function * current_function(bool skip_first=false) const
void clear_global_variable_pattern(const std::string &pattern)
std::shared_ptr< stack_frame > current_user_frame(void) const
void push(const symbol_scope &scope)
octave_user_code * debug_user_code(void) const
std::list< std::string > top_level_variable_names(void) const
void clear_global_variable(const std::string &name)
std::size_t find_current_user_frame(void) const
std::list< std::string > global_variable_names(void) const
int debug_user_code_line(void) const
std::size_t dbupdown(std::size_t start, int n, bool verbose)
bool at_top_level(void) const
std::size_t size(void) const
int debug_user_code_column(void) const
unwind_protect * curr_fcn_unwind_protect_frame(void)
void clear_global_variable_regexp(const std::string &pattern)
void goto_caller_frame(void)
octave_map empty_backtrace(void) const
symbol_scope top_scope(void) const
void make_persistent(const symbol_record &sym)
octave_value max_stack_depth(const octave_value_list &args, int nargout)
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
OCTINTERP_API octave_value find_method(const std::string &class_name, const std::string &name) const
bool is_static(void) const
octave_value get_function(void) const
OCTINTERP_API cdef_class get_class(void) const
static void run_event_hooks(void)
static bool interrupt(bool=true)
static void increment_current_command_number(void)
static bool erase_empty_line(bool flag)
static std::string decode_prompt_string(const std::string &s)
static bool add(const std::string &)
static bool ignoring_entries(void)
static void ignore_entries(bool=true)
void dbquit(bool all=false)
bool quitting_debugger(void) const
interpreter & m_interpreter
execution_mode m_execution_mode
void repl(const std::string &prompt="debug> ")
bool in_debug_repl(void) const
debugger(interpreter &interp, std::size_t level)
Vector representing the dimensions (size) of an Array.
void resize(int n, int fill_value=0)
octave_idx_type ndims(void) const
Number of dimensions.
OCTAVE_API dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
OCTINTERP_API octave_value last_error_id(const octave_value_list &args, int nargout)
OCTINTERP_API octave_value debug_on_warning(const octave_value_list &args, int nargout)
OCTINTERP_API void display_exception(const execution_exception &ee, std::ostream &os) const
void set_debug_on_warning(bool flag)
OCTINTERP_API octave_value debug_on_caught(const octave_value_list &args, int nargout)
OCTINTERP_API void save_exception(const execution_exception &ee)
OCTINTERP_API octave_value debug_on_error(const octave_value_list &args, int nargout)
OCTINTERP_API octave_value last_error_message(const octave_value_list &args, int nargout)
octave_map last_error_stack(void) const
void set_debug_on_error(bool flag)
Provides threadsafe access to octave.
void append_history(const std::string &hist_entry)
void push_event_queue(void)
OCTINTERP_API void set_workspace(void)
void enter_debugger_event(const std::string &fcn_name, const std::string &fcn_file_name, int line)
void pop_event_queue(void)
OCTINTERP_API void post_event(const fcn_callback &fcn)
void execute_in_debugger_event(const std::string &file, int line)
void pre_input_event(void)
void set_var(const std::string &var_arg="")
virtual const char * err_id(void) const =0
event_manager & get_event_manager(void)
bool in_top_level_repl(void) const
bool server_mode(void) const
error_system & get_error_system(void)
tree_evaluator & get_evaluator(void)
void parse_and_execute(const std::string &input, bool &incomplete_parse)
symbol_table & get_symbol_table(void)
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
cdef_manager & get_cdef_manager(void)
bool interactive(void) const
void recover_from_exception(void)
input_system & get_input_system(void)
load_path & get_load_path(void)
std::string find_file(const std::string &file) const
virtual bool is_user_code(void) const
virtual bool is_user_function(void) const
virtual bool is_builtin_function(void) const
octave_value_list(* fcn)(const octave_value_list &, int)
octave_value_list(* meth)(octave::interpreter &, const octave_value_list &, int)
octave::cdef_object get_object(void) const
octave_classdef * classdef_object_value(bool=false)
std::string class_name(void) const
std::string dispatch_class(void) const
virtual std::string fcn_file_name(void) const
bool is_private_function(void) const
std::string dir_name(void) const
bool is_class_method(const std::string &cname="") const
virtual bool is_parent_function(void) const
bool is_class_constructor(const std::string &cname="") const
virtual bool is_subfunction(void) const
virtual std::list< std::string > parent_fcn_names(void) const
bool islocked(void) const
virtual std::string parent_fcn_name(void) const
void stash_dir_name(const std::string &dir)
virtual octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
void stash_dispatch_class(const std::string &nm)
std::string name(void) const
virtual bool is_nested_function(void) const
bool is_undefined(void) const
void assign(octave_value::assign_op, const octave_value &)
void define(const octave_value &v)
string_vector keys(void) const
const Cell & contents(const_iterator p) const
void assign(const std::string &k, const octave_value &val)
void stash_fcn_file_name(const std::string &nm)
std::string fcn_file_name(void) const
std::string get_code_line(std::size_t line)
octave::tree_statement_list * body(void)
std::deque< std::string > get_code_lines(std::size_t line, std::size_t num_lines)
virtual octave_value find_subfunction(const std::string &) const
void mark_as_anonymous_function(void)
void mark_as_nested_function(void)
void make_storable_values(void)
Cell cell_value(void) const
octave_value & xelem(octave_idx_type i)
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
void stash_name_tags(const string_vector &nm)
octave_idx_type length(void) const
string_vector name_tags(void) const
octave_value_list slice(octave_idx_type offset, octave_idx_type len, bool tags=false) const
string_vector make_argv(const std::string &="") const
bool has_magic_colon(void) const
bool is_function(void) const
octave::range< double > range_value(void) const
OCTINTERP_API octave_function * function_value(bool silent=false) const
OCTINTERP_API octave_value_list list_value(void) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
bool is_uint16_type(void) const
bool is_int8_type(void) const
OCTINTERP_API Cell xcell_value(const char *fmt,...) const
bool is_scalar_type(void) const
bool is_cs_list(void) const
bool is_string(void) const
bool is_user_code(void) const
OCTINTERP_API octave_value storable_value(void) const
bool is_defined(void) const
bool is_double_type(void) const
Cell cell_value(void) const
bool is_equal(const octave_value &) const
std::string class_name(void) const
bool is_uint32_type(void) const
OCTINTERP_API octave_user_code * user_code_value(bool silent=false) const
bool is_int64_type(void) const
bool isstruct(void) const
octave_value reshape(const dim_vector &dv) const
bool is_matrix_type(void) const
bool is_int32_type(void) const
bool is_uint64_type(void) const
bool is_int16_type(void) const
bool is_range(void) const
bool is_single_type(void) const
OCTINTERP_API octave_map map_value(void) const
bool isobject(void) const
bool is_undefined(void) const
bool is_uint8_type(void) const
dim_vector dims(void) const
OCTINTERP_API int run(void)
OCTINTERP_API int run(void)
~quit_debug_exception(void)=default
quit_debug_exception(const quit_debug_exception &)=default
quit_debug_exception(bool all=false)
std::map< std::string, octave_value > local_vars_map
octave_idx_type numel(void) const
std::size_t nesting_depth(void) const
void set_parent(const symbol_scope &p)
void cache_fcn_file_name(const std::string &name)
symbol_scope dup(void) const
void set_nesting_depth(std::size_t depth)
void set_primary_parent(const symbol_scope &p)
void cache_dir_name(const std::string &name)
octave_value find_scoped_function(const std::string &name, const symbol_scope &search_scope)
octave_value find_method(const std::string &name, const std::string &dispatch_type)
void clear_function(const std::string &name)
void clear_function_pattern(const std::string &pat)
void clear_functions(bool force=false)
void install_cmdline_function(const std::string &name, const octave_value &fcn)
void clear_dld_function(const std::string &name)
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
octave_value find_user_function(const std::string &name)
void clear_function_regexp(const std::string &pat)
octave_value fcn_table_find(const std::string &name, const octave_value_list &args=ovl(), const symbol_scope &search_scope=symbol_scope())
symbol_scope scope(void) const
tree_expression * expression(void) const
tree_parameter_list * parameter_list(void) const
std::set< std::string > free_variables(void) const
tree_statement_list * body(void)
tree_expression * control_expr(void)
tree_argument_list * left_hand_side(void)
tree_decl_init_list * initializer_list(void)
bool is_global(void) const
tree_identifier * ident(void)
tree_expression * expression(void)
bool is_persistent(void) const
void accept(tree_walker &tw)
octave_value_list eval_string(const std::string &eval_str, bool silent, int &parse_status, int nargout)
bool switch_case_label_matches(tree_switch_case *expr, const octave_value &val)
void reset_debug_state(void)
std::size_t m_debug_frame
octave_value_list execute_user_function(octave_user_function &user_function, int nargout, const octave_value_list &args)
std::stack< debugger * > m_debugger_stack
void visit_break_command(tree_break_command &)
bool is_global(const std::string &name) const
void goto_caller_frame(void)
void visit_octave_user_function(octave_user_function &)
void visit_unwind_protect_command(tree_unwind_protect_command &)
bool mislocked(bool skip_first=false) const
std::list< std::string > autoloaded_functions(void) const
symbol_info_list get_symbol_info(void)
void bind_ans(const octave_value &val, bool print)
void visit_return_command(tree_return_command &)
octave_value_list execute_builtin_function(octave_builtin &builtin_function, int nargout, const octave_value_list &args)
bool statement_printing_enabled(void)
void clear_all(bool force=false)
void visit_statement_list(tree_statement_list &)
octave_value evaluate(tree_decl_elt *)
void visit_anon_fcn_handle(tree_anon_fcn_handle &)
void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true)
void visit_cell(tree_cell &)
void push_echo_state_cleanup(unwind_protect &frame)
int dbstep_flag(void) const
std::list< octave_value_list > m_index_list
octave_value echo(const octave_value_list &args, int nargout)
std::list< frame_info > backtrace_info(void) const
octave_value_list evaluate_end_expression(const octave_value_list &args)
void add_autoload(const std::string &fcn, const std::string &nm)
void visit_constant(tree_constant &)
void keyboard(const std::string &prompt="keyboard> ")
void visit_superclass_ref(tree_superclass_ref &)
void visit_simple_assignment(tree_simple_assignment &)
interpreter & m_interpreter
octave_value & global_varref(const std::string &name)
void do_breakpoint(tree_statement &stmt)
octave_map empty_backtrace(void) const
symbol_scope get_current_scope(void) const
void final_index_error(index_exception &ie, const tree_expression *expr)
symbol_scope get_top_scope(void) const
char string_fill_char(void) const
bool at_top_level(void) const
void visit_args_block_validation_list(tree_args_block_validation_list &)
void debug_where(std::ostream &os) const
void goto_base_frame(void)
octave_user_code * current_user_code(void) const
void clear_global_variable(const std::string &name)
octave_value_list execute_mex_function(octave_mex_function &mex_function, int nargout, const octave_value_list &args)
void set_dispatch_class(const std::string &class_name)
void visit_boolean_expression(tree_boolean_expression &)
bool goto_frame(std::size_t n=0, bool verbose=false)
void visit_switch_case(tree_switch_case &)
stmt_list_type m_statement_context
void munlock(bool skip_first=false) const
octave_user_code * get_user_code(const std::string &fname="", const std::string &class_name="")
void visit_arg_validation(tree_arg_validation &)
void pop_stack_frame(void)
octave_value get_auto_fcn_var(stack_frame::auto_var_type avt) const
void remove_autoload(const std::string &fcn, const std::string &nm)
Matrix ignored_fcn_outputs(void) const
int max_recursion_depth(void) const
bool is_logically_true(tree_expression *expr, const char *warn_for)
void visit_octave_user_function_header(octave_user_function &)
void visit_arg_size_spec(tree_arg_size_spec &)
void visit_multi_assignment(tree_multi_assignment &)
void visit_continue_command(tree_continue_command &)
octave_value find(const std::string &name)
void visit_while_command(tree_while_command &)
void visit_do_until_command(tree_do_until_command &)
std::size_t debug_frame(void) const
void visit_index_expression(tree_index_expression &)
void visit_postfix_expression(tree_postfix_expression &)
std::list< std::shared_ptr< stack_frame > > backtrace_frames() const
std::size_t current_call_stack_frame_number(void) const
void display_call_stack(void) const
void define_parameter_list_from_arg_vector(tree_parameter_list *param_list, const octave_value_list &args)
octave_map get_autoload_map(void) const
bool is_local_variable(const std::string &name) const
void visit_decl_command(tree_decl_command &)
octave_function * caller_function(void) const
void visit_arg_validation_fcns(tree_arg_validation_fcns &)
int debug_user_code_column(void) const
octave_map backtrace(void) const
void visit_function_def(tree_function_def &)
void visit_switch_command(tree_switch_command &)
void clear_symbol_pattern(const std::string &pattern)
void clear_symbol(const std::string &name)
std::list< std::string > top_level_variable_names(void) const
std::map< std::string, std::string > m_autoload_map
void visit_arguments_block(tree_arguments_block &)
void dbquit(bool all=false)
void restore_frame(std::size_t n)
int returning(void) const
void visit_if_command(tree_if_command &)
bool is_class_method_executing(std::string &dispatch_class) const
void visit_spmd_command(tree_spmd_command &)
octave_value_list convert_to_const_vector(tree_argument_list *arg_list)
octave_value m_indexed_object
octave_user_code * debug_user_code(void) const
void visit_try_catch_command(tree_try_catch_command &)
unwind_protect * curr_fcn_unwind_protect_frame(void)
int index_position(void) const
void clear_global_variables(void)
void clear_variables(void)
bool echo_this_file(const std::string &file, int type) const
void visit_colon_expression(tree_colon_expression &)
std::string PS4(void) const
int current_line(void) const
void push_dummy_scope(const std::string &name)
void visit_simple_for_command(tree_simple_for_command &)
octave_value_list make_value_list(tree_argument_list *args, const string_vector &arg_nm)
std::shared_ptr< push_parser > m_parser
int num_indices(void) const
void clear_variable(const std::string &name)
void visit_matrix(tree_matrix &)
bool is_variable(const std::string &name) const
bool is_class_constructor_executing(std::string &dispatch_class) const
void visit_octave_user_script(octave_user_script &)
std::string lookup_autoload(const std::string &nm) const
std::list< std::string > global_variable_names(void) const
void visit_if_clause(tree_if_clause &)
std::list< std::string > reverse_lookup_autoload(const std::string &nm) const
void visit_args_block_attribute_list(tree_args_block_attribute_list &)
bool in_debug_repl(void) const
bool maybe_push_echo_state_cleanup(void)
bool quiet_breakpoint_flag(void) const
octave_value do_who(int argc, const string_vector &argv, bool return_list, bool verbose=false)
void set_parser(const std::shared_ptr< push_parser > &parser)
int debug_user_code_line(void) const
symbol_info_list glob_symbol_info(const std::string &pattern) const
bool in_user_code(void) const
void clear_global_variable_pattern(const std::string &pattern)
bool m_break_on_next_stmt
void visit_argument_list(tree_argument_list &)
void assign(const std::string &name, const octave_value &val=octave_value())
int current_column(void) const
void assignin(const std::string &context, const std::string &name, const octave_value &val=octave_value())
const std::list< octave_lvalue > * m_lvalue_list
void visit_statement(tree_statement &)
void bind_auto_fcn_vars(const string_vector &arg_names, const Matrix &ignored_outputs, int nargin, int nargout, bool takes_varargs, const octave_value_list &va_args)
octave_value top_level_varval(const std::string &name) const
std::string backtrace_message(void) const
void dbupdown(int n, bool verbose=false)
octave_value evaluate_anon_fcn_handle(tree_anon_fcn_handle &afh)
void undefine_parameter_list(tree_parameter_list *param_list)
std::string check_autoload_file(const std::string &nm) const
octave_value max_stack_depth(const octave_value_list &args, int nargout)
void visit_identifier(tree_identifier &)
bool server_mode(void) const
void clear_symbol_regexp(const std::string &pattern)
int m_max_recursion_depth
void visit_octave_user_function_trailer(octave_user_function &)
void push_echo_state(int type, const std::string &file_name, int pos=1)
void visit_fcn_handle(tree_fcn_handle &)
octave_value_list execute_user_script(octave_user_script &user_script, int nargout, const octave_value_list &args)
void uwp_set_echo_state(bool state, const std::string &file_name, int pos)
void eval(std::shared_ptr< tree_statement_list > &stmt_list, bool interactive)
symbol_info_list top_scope_symbol_info(void) const
octave_value_list evalin(const std::string &context, const std::string &try_code, int nargout)
bool is_defined(const tree_expression *expr) const
octave_value global_varval(const std::string &name) const
void top_level_assign(const std::string &name, const octave_value &val=octave_value())
void install_variable(const std::string &name, const octave_value &value, bool global)
void visit_binary_expression(tree_binary_expression &)
void set_echo_state(int type, const std::string &file_name, int pos)
std::string m_echo_file_name
std::list< std::string > variable_names(void) const
symbol_info_list regexp_symbol_info(const std::string &pattern) const
void set_auto_fcn_var(stack_frame::auto_var_type avt, const octave_value &val=octave_value())
void get_line_and_eval(void)
bool eval_decl_elt(tree_decl_elt *elt)
void maybe_set_echo_state(void)
void clear_global_variable_regexp(const std::string &pattern)
void visit_decl_elt(tree_decl_elt &)
void execute_range_loop(const range< T > &rng, int line, octave_lvalue &ult, tree_statement_list *loop_body)
void parse_and_execute(const std::string &input, bool &incomplete_parse)
std::shared_ptr< stack_frame > current_user_frame(void) const
void visit_parameter_list(tree_parameter_list &)
std::list< octave_lvalue > make_lvalue_list(tree_argument_list *)
void enter_debugger(const std::string &prompt="debug> ")
std::string m_whos_line_format
void visit_complex_for_command(tree_complex_for_command &)
std::shared_ptr< push_parser > get_parser(void)
octave_value whos_line_format(const octave_value_list &args, int nargout)
void global_assign(const std::string &name, const octave_value &val=octave_value())
octave_value make_fcn_handle(const std::string &nm)
void mlock(bool skip_first=false) const
void visit_metaclass_query(tree_metaclass_query &)
void visit_compound_binary_expression(tree_compound_binary_expression &)
octave_value_list convert_return_list_to_const_vector(tree_parameter_list *ret_list, int nargout, const Matrix &ignored_outputs, const Cell &varargout)
void do_unwind_protect_cleanup_code(tree_statement_list *list)
octave_value varval(const symbol_record &sym) const
void visit_switch_case_list(tree_switch_case_list &)
octave_value PS4(const octave_value_list &args, int nargout)
void push_stack_frame(const symbol_scope &scope)
std::string mfilename(const std::string &opt="") const
bool silent_functions(void) const
std::string whos_line_format(void) const
void visit_prefix_expression(tree_prefix_expression &)
int continuing(void) const
std::string get_dispatch_class(void) const
void clear_variable_regexp(const std::string &pattern)
void visit_no_op_command(tree_no_op_command &)
octave_function * current_function(bool skip_first=false) const
void clear_variable_pattern(const std::string &pattern)
std::string current_function_name(bool skip_first=false) const
std::map< std::string, bool > m_echo_files
void visit_if_command_list(tree_if_command_list &)
virtual bool is_assignment_expression(void) const
virtual octave_value evaluate(tree_evaluator &tw, int nargout=1)=0
virtual std::string name(void) const
virtual tree_expression * dup(symbol_scope &scope) const =0
tree_expression * set_print_flag(bool print)
bool print_result(void) const
virtual octave_lvalue lvalue(tree_evaluator &)
virtual bool is_identifier(void) const
virtual octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)=0
octave_value function(void)
symbol_record symbol(void) const
virtual bool is_black_hole(void) const
octave_lvalue lvalue(tree_evaluator &tw)
octave_value evaluate(tree_evaluator &tw, int nargout=1)
void accept(tree_walker &tw)
tree_if_command_list * cmd_list(void)
bool is_end_of_fcn_or_script(void) const
tree_parameter_list * dup(symbol_scope &scope) const
bool takes_varargs(void) const
tree_expression * left_hand_side(void)
tree_statement_list * body(void)
tree_expression * control_expr(void)
tree_statement_list * body(void)
void accept(tree_walker &tw)
bool is_active_breakpoint(tree_evaluator &tw) const
bool is_expression(void) const
tree_command * command(void)
bool is_end_of_fcn_or_script(void) const
tree_expression * expression(void)
void accept(tree_walker &tw)
tree_expression * case_label(void)
tree_switch_case_list * case_list(void)
tree_expression * switch_value(void)
tree_statement_list * cleanup(void)
tree_statement_list * body(void)
tree_identifier * identifier(void)
tree_statement_list * body(void)
tree_statement_list * cleanup(void)
tree_expression * condition(void)
tree_statement_list * body(void)
virtual int column(void) const
bool is_active_breakpoint(tree_evaluator &tw) const
virtual int line(void) const
virtual void accept(tree_walker &tw)=0
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
void interpreter_try(unwind_protect &frame)
void error_with_id(const char *id, const char *fmt,...)
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
void err_indexed_cs_list(void)
std::string canonicalize_file_name(const std::string &name)
std::string dir_sep_str(void)
std::string tilde_expand(const std::string &name)
bool iskeyword(const std::string &s)
F77_RET_T const F77_DBLE const F77_DBLE * f
OCTINTERP_API octave_value_list call_mex(octave_mex_function &mex_fcn, const octave_value_list &args, int nargout_arg)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
octave_value parse_fcn_file(interpreter &interp, const std::string &full_file, const std::string &file, const std::string &dir_name, const std::string &dispatch_type, const std::string &package_name, bool require_file, bool force_script, bool autoload, bool relative_lookup)
int release_unreferenced_dynamic_libraries(void)
static int input(yyscan_t yyscanner)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
static std::string get_operator_function_name(const std::string &name)
static octave_value end_value(const octave_value &value, octave_idx_type index_position, octave_idx_type num_indices)
sig_atomic_t octave_interrupt_state
static uint32_t state[624]
static bool absolute_pathname(const std::string &s)
static const char dir_sep_char
static std::string dir_sep_chars
static string_vector make_absolute(const string_vector &sv)
bool valid_identifier(const char *s)
void sleep(double seconds, bool do_graphics_events)
std::string fcn_file_in_path(const std::string &name)
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)