26#if defined (HAVE_CONFIG_H)
32#include <condition_variable>
78OCTAVE_NORETURN
static void
79error_unexpected (
const char *name)
81 error (
"unexpected call to %s - please report this bug", name);
86class quit_debug_exception
90 quit_debug_exception (
bool all =
false) : m_all (all) { }
92 quit_debug_exception (
const quit_debug_exception&) =
default;
94 quit_debug_exception& operator = (
const quit_debug_exception&) =
default;
96 ~quit_debug_exception () =
default;
98 bool all ()
const {
return m_all; }
118 : m_interpreter (interp), m_level (level),
119 m_execution_mode (EX_NORMAL), m_in_debug_repl (false)
124 void repl (
const std::string& prompt =
"debug> ");
126 bool in_debug_repl ()
const {
return m_in_debug_repl; }
128 void dbcont () { m_execution_mode = EX_CONTINUE; }
130 void dbquit (
bool all =
false)
133 m_execution_mode = EX_QUIT_ALL;
135 m_execution_mode = EX_QUIT;
138 bool quitting_debugger ()
const;
145 execution_mode m_execution_mode;
146 bool m_in_debug_repl;
154debugger::server_loop ()
168 if (m_execution_mode == EX_CONTINUE || tw.
dbstep_flag ())
171 if (quitting_debugger ())
204 catch (
const interrupt_exception&)
207 m_interpreter.recover_from_exception ();
210 if (m_interpreter.interactive ())
215 m_interpreter.recover_from_exception ();
217 std::cerr <<
"error: unhandled index exception: "
218 << e.message () <<
" -- trying to return to prompt"
228 if (m_interpreter.interactive ())
230 m_interpreter.recover_from_exception ();
239 catch (
const quit_debug_exception& qde)
246 catch (
const std::bad_alloc&)
248 m_interpreter.recover_from_exception ();
250 std::cerr <<
"error: out of memory -- trying to return to prompt"
254 while (exit_status == 0);
256 if (exit_status == EOF)
258 if (m_interpreter.interactive ())
268debugger::repl (
const std::string& prompt_arg)
275 m_in_debug_repl =
true;
287 std::string fcn_file_nm, fcn_nm;
292 fcn_nm = fcn_file_nm.empty () ? caller->
name () : fcn_file_nm;
297 std::ostringstream buf;
299 input_system& input_sys = m_interpreter.get_input_system ();
303 if (! fcn_nm.empty ())
307 static char ctrl_z =
'Z' & 0x1f;
309 buf << ctrl_z << ctrl_z << fcn_nm <<
':' << curr_debug_line;
321 frm->display_stopped_in_message (buf);
329 fcn_nm, curr_debug_line);
333 std::string line_buf;
338 if (! line_buf.empty ())
339 buf << curr_debug_line <<
": " << line_buf;
347 std::string stopped_in_msg = buf.str ();
349 if (m_interpreter.server_mode ())
351 if (! stopped_in_msg.empty ())
360 std::shared_ptr<push_parser>
369 if (! stopped_in_msg.empty ())
370 std::cerr << stopped_in_msg << std::endl;
372 std::string tmp_prompt = prompt_arg;
374 tmp_prompt =
"[" + std::to_string (m_level) +
"]" + prompt_arg;
377 m_interpreter.PS1 (tmp_prompt);
379 if (! m_interpreter.interactive ())
383 frame.
add (interactive_fptr, &m_interpreter,
384 m_interpreter.interactive ());
386 m_interpreter.interactive (
true);
397 frame.
add (forced_interactive_fptr, app,
404#if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
412 parser debug_parser (m_interpreter);
418 while (m_in_debug_repl)
420 if (m_execution_mode == EX_CONTINUE || tw.
dbstep_flag ())
423 if (quitting_debugger ())
428 debug_parser.reset ();
430#if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
440 std::string input_line = reader.get_input (prompt, eof);
448 retval = debug_parser.run (input_line,
false);
456 int retval = debug_parser.run ();
463 quitting_debugger ();
471 std::shared_ptr<tree_statement_list> stmt_list
472 = debug_parser.statement_list ();
475 stmt_list->accept (tw);
501 m_interpreter.recover_from_exception ();
503 catch (
const quit_debug_exception& qde)
515debugger::quitting_debugger ()
const
517 if (m_execution_mode == EX_QUIT)
522 if (m_level > 0 || m_interpreter.server_mode ()
523 || m_interpreter.in_top_level_repl ())
524 throw quit_debug_exception ();
529 if (m_execution_mode == EX_QUIT_ALL)
534 if (m_interpreter.server_mode () || m_interpreter.in_top_level_repl ())
535 throw quit_debug_exception (
true);
561 fname = fcn->
name ();
564 if (opt ==
"fullpathext")
567 std::size_t dpos = fname.rfind (sys::file_ops::dir_sep_char ());
568 std::size_t epos = fname.rfind (
'.');
571 epos = std::string::npos;
573 if (epos != std::string::npos)
574 fname = fname.substr (0, epos);
576 if (opt ==
"fullpath")
579 if (dpos != std::string::npos)
580 fname = fname.substr (dpos+1);
587 bool& incomplete_parse)
589 incomplete_parse =
false;
617 m_exit_status = m_parser->run (input, eof);
619 if (m_exit_status == 0)
621 std::shared_ptr<tree_statement_list>
622 stmt_list = m_parser->statement_list ();
632 else if (m_parser->at_end_of_input ())
636 incomplete_parse =
true;
642 if (m_exit_status == -1)
654 std::unique_lock<std::mutex> lock (mtx);
655 std::condition_variable cv;
656 bool incomplete_parse =
false;
657 bool evaluation_pending =
false;
658 bool exiting =
false;
669 = incomplete_parse ? m_interpreter.
PS2 () : m_interpreter.
PS1 ();
674 std::getline (std::cin, input);
679 incomplete_parse =
false;
680 evaluation_pending =
true;
684 ([
this, input, &mtx, &incomplete_parse, &evaluation_pending, &cv, &exiting] (
interpreter& interp)
688 std::lock_guard<std::mutex> local_lock (mtx);
694 catch (
const exit_exception&)
696 evaluation_pending =
false;
712 evaluation_pending =
false;
717 evaluation_pending =
false;
719 throw exit_exception (1);
724 evaluation_pending =
false;
729 evaluation_pending =
false;
736 cv.wait (lock, [&evaluation_pending] {
return ! evaluation_pending; });
757#if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
758 static bool use_command_line_push_parser =
true;
760 static bool use_command_line_push_parser =
false;
768 std::shared_ptr<base_parser> repl_parser;
772 if (use_command_line_push_parser)
778 repl_parser = std::shared_ptr<base_parser> (pp);
783 repl_parser = std::shared_ptr<base_parser> (pp);
789 repl_parser = std::shared_ptr<base_parser> (pp);
798 repl_parser->reset ();
806 exit_status = repl_parser->run ();
808 if (exit_status == 0)
810 std::shared_ptr<tree_statement_list>
811 stmt_list = repl_parser->statement_list ();
819 else if (repl_parser->at_end_of_input ())
826 catch (
const interrupt_exception&)
838 std::cerr <<
"error: unhandled index exception: "
839 << ie.message () <<
" -- trying to return to prompt"
858 catch (
const quit_debug_exception&)
864 catch (
const std::bad_alloc&)
868 std::cerr <<
"error: out of memory -- trying to return to prompt"
872 while (exit_status == 0);
874 if (exit_status == EOF)
923 catch (
const interrupt_exception&)
938 std::cerr <<
"error: unhandled index exception: "
939 << e.message () <<
" -- trying to return to prompt"
961 catch (
const quit_debug_exception&)
967 catch (
const exit_exception& xe)
969 m_exit_status = xe.exit_status ();
972 catch (
const std::bad_alloc&)
977 std::cerr <<
"error: out of memory -- trying to return to prompt"
981 while (m_exit_status == 0);
983 if (m_exit_status == EOF)
991 return m_exit_status;
1000 stmt_list->accept (*
this);
1006 bool quit = (m_returning || m_breaking);
1021 catch (
const quit_debug_exception&)
1029 int& parse_status,
int nargout)
1033 parser eval_parser (eval_str, m_interpreter);
1037 eval_parser.
reset ();
1048 parse_status = eval_parser.
run ();
1050 if (parse_status == 0)
1052 std::shared_ptr<tree_statement_list> stmt_list
1059 if (stmt_list->size () == 1
1060 && (stmt = stmt_list->front ())
1070 bool do_bind_ans =
false;
1077 if (do_bind_ans && ! retval.
empty ())
1083 else if (nargout == 0)
1084 stmt_list->accept (*
this);
1086 error (
"eval: invalid use of statement list");
1095 while (parse_status == 0);
1102 bool silent,
int& parse_status)
1116 bool silent,
int& parse_status,
1119 std::string s = arg.
xstring_value (
"eval: expecting string argument");
1121 return eval_string (s, silent, parse_status, nargout);
1128 int parse_status = 0;
1130 return eval_string (try_code, nargout > 0, parse_status, nargout);
1135 const std::string& catch_code,
1142 int parse_status = 0;
1144 bool execution_error =
false;
1150 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1157 execution_error =
true;
1160 if (parse_status != 0 || execution_error)
1162 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1174 if (execution_error)
1183 const std::string& try_code,
1191 if (context ==
"caller")
1193 else if (context ==
"base")
1196 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1198 int parse_status = 0;
1200 return eval_string (try_code, nargout > 0, parse_status, nargout);
1205 const std::string& try_code,
1206 const std::string& catch_code,
1216 if (context ==
"caller")
1218 else if (context ==
"base")
1221 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1225 int parse_status = 0;
1227 bool execution_error =
false;
1233 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1240 execution_error =
true;
1243 if (parse_status != 0 || execution_error)
1245 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1257 if (execution_error)
1267 error_unexpected (
"tree_evaluator::visit_anon_fcn_handle");
1273 error_unexpected (
"tree_evaluator::visit_argument_list");
1279 warning (
"function arguments validation blocks are not supported; INCORRECT RESULTS ARE POSSIBLE");
1285 error_unexpected (
"tree_evaluator::visit_args_block_attribute_list");
1291 error_unexpected (
"tree_evaluator::visit_args_block_validation_list");
1297 error_unexpected (
"tree_evaluator::visit_arg_validation");
1303 error_unexpected (
"tree_evaluator::visit_arg_size_spec");
1309 error_unexpected (
"tree_evaluator::visit_arg_validation_fcns");
1315 error_unexpected (
"tree_evaluator::visit_binary_expression");
1321 error_unexpected (
"tree_evaluator::visit_boolean_expression");
1327 error_unexpected (
"tree_evaluator::visit_compound_binary_expression");
1335 int line = cmd.
line ();
1339 m_echo_file_pos = line + 1;
1345 if (m_in_loop_command)
1348 error (
"break must appear in a loop in the same file as loop command");
1354 error_unexpected (
"tree_evaluator::visit_colon_expression");
1362 int line = cmd.
line ();
1366 m_echo_file_pos = line + 1;
1372 if (m_in_loop_command)
1379 return ! (m_silent_functions && (m_statement_context ==
SC_FUNCTION
1387 || m_dbstep_flag != 0
1388 || m_break_on_next_stmt
1395 m_debug_mode = mode;
1428 frame.
add ([&tw, saved_frame = m_debug_frame] ()
1434 m_debug_frame = m_call_stack.
dbupdown (0);
1442 debugger *dbgr =
new debugger (m_interpreter, m_debugger_stack.size ());
1444 m_debugger_stack.push (dbgr);
1446 frame.
add ([
this] ()
1448 delete m_debugger_stack.top ();
1449 m_debugger_stack.pop ();
1453 dbgr->repl (prompt);
1465 m_debug_frame = m_call_stack.
dbupdown (n, verbose);
1472 return frame->inputname (n, ids_only);
1480 const std::list<octave_lvalue> *lvalues = m_lvalue_list;
1487 for (
const auto& lval : *lvalues)
1488 nbh += lval.is_black_hole ();
1497 for (
const auto& lval : *lvalues)
1499 if (lval.is_black_hole ())
1513get_operator_function_name (
const std::string& name)
1522 std::size_t
len = name.length ();
1549 else if (name[1] ==
'=')
1580 return "ctranspose";
1633 std::string fcn_name = get_operator_function_name (name);
1640 bool name_is_operator = fcn_name != name;
1642 std::size_t pos = fcn_name.find (
'.');
1644 if (pos != std::string::npos)
1663 std::string meth_nm = fcn_name.substr (pos+1);
1665 if (meth_nm.find (
'.') == std::string::npos)
1667 std::string obj_nm = fcn_name.substr (0, pos);
1674 if (
object.
is_defined () &&
object.is_classdef_object ())
1697 fcn_name = class_nm +
'.' + meth_nm;
1746 bool skip_first = name_is_operator;
1755 if (! name_is_operator)
1760 std::shared_ptr<stack_frame> frame
1776 && (fcn_name == curr_fcn->
name ()
1778 frame = frame->access_link ();
1883 std::shared_ptr<stack_frame> frame
1886 return frame->is_variable (name);
1892 std::shared_ptr<stack_frame> frame
1895 return frame->is_local_variable (name);
1932 std::shared_ptr<stack_frame> frame
1935 return frame->is_variable (sym);
1941 std::shared_ptr<stack_frame> frame
1944 return frame->is_defined (sym);
1950 std::shared_ptr<stack_frame> frame
1953 return frame->is_global (name);
1959 std::shared_ptr<stack_frame> frame
1962 return frame->varval (sym);
1968 std::shared_ptr<stack_frame> frame
1971 return frame->varval (name);
1979 std::shared_ptr<stack_frame> frame
1982 return frame->install_variable (name, value, global);
2020 std::shared_ptr<stack_frame> frame
2023 frame->assign (name, val);
2039 if (context ==
"caller")
2041 else if (context ==
"base")
2044 error (R
"(assignin: CONTEXT must be "caller" or "base")");
2053 error (
"assignin: invalid assignment to keyword '%s'",
2059 error (
"assignin: invalid variable name '%s'", name.c_str ());
2064 const std::string& context,
2065 bool verbose,
bool require_file)
2100 static std::map<std::string, int> source_call_depth;
2102 std::string file_full_name
2103 = sys::file_ops::tilde_expand (file_name);
2106 = file_full_name.find_last_of (sys::file_ops::dir_sep_str ());
2108 std::string dir_name = file_full_name.substr (0, pos);
2110 file_full_name = sys::env::make_absolute (file_full_name);
2114 if (source_call_depth.find (file_full_name) == source_call_depth.end ())
2115 source_call_depth[file_full_name] = -1;
2117 frame.
protect_var (source_call_depth[file_full_name]);
2119 source_call_depth[file_full_name]++;
2122 error (
"max_recursion_depth exceeded");
2124 if (! context.empty ())
2129 if (context ==
"caller")
2131 else if (context ==
"base")
2134 error (R
"(source: CONTEXT must be "caller" or "base")");
2139 = file_name.find_last_of (sys::file_ops::dir_sep_chars ());
2140 dir_end = (dir_end == std::string::npos) ? 0 : dir_end + 1;
2142 std::size_t extension = file_name.find_last_of (
'.');
2143 if (extension == std::string::npos)
2144 extension = file_name.length ();
2146 std::string symbol = file_name.substr (dir_end, extension - dir_end);
2147 std::string full_name = sys::canonicalize_file_name (file_name);
2182 file_name, dir_name,
"",
"",
2183 require_file,
true,
false,
false);
2187 std::string error_message = ee.message ();
2188 if (error_message.empty ())
2189 error (ee,
"source: error sourcing file '%s'",
2190 file_full_name.c_str ());
2192 error (ee,
"%s", error_message.c_str ());
2202 error (
"source: %s is not a script", full_name.c_str ());
2206 octave_stdout <<
"executing commands from " << full_name <<
" ... ";
2263 if (args(i).is_defined () && args(i).is_magic_colon ())
2266 error (
"no default value for argument %d", i+1);
2360 std::list<octave_value> arg_vals;
2362 for (
auto elt : *args)
2377 arg_vals.push_back (tmp_ovl(i));
2380 arg_vals.push_back (tmp);
2391 int len = ret_list->size ();
2402 int nout = nargout > 0 ? nargout : 1;
2407 if (nargout == 0 && !
is_defined (elt->ident ()))
2434 retval(i++) = varargout(j);
2444 bool retval =
false;
2473 if (label_value.
iscell ())
2481 bool match = val.
is_equal (cell(i,j));
2498 m_call_stack.
push (scope);
2503 const std::shared_ptr<stack_frame>& closure_frames)
2505 m_call_stack.
push (fcn, closure_frames);
2511 const std::shared_ptr<stack_frame>& closure_frames)
2513 m_call_stack.
push (fcn, local_vars, closure_frames);
2519 m_call_stack.
push (script);
2525 m_call_stack.
push (fcn);
2531 m_call_stack.
pop ();
2534std::shared_ptr<stack_frame>
2569 frm->display_stopped_in_message (os);
2577 if (! (frm->is_user_script_frame () || frm->is_user_fcn_frame ()))
2578 error (
"dblist: must be inside a user function or script to use dblist\n");
2580 frm->debug_list (os, num_lines);
2588 if (! (frm->is_user_script_frame () || frm->is_user_fcn_frame ()))
2589 error (
"dbtype: must be inside a user function or script to use dbtype\n");
2591 frm->debug_type (os, start_line, end_line);
2672std::list<std::shared_ptr<stack_frame>>
2678std::list<std::shared_ptr<stack_frame>>
2684std::list<frame_info>
2686 bool print_subfn)
const
2688 return m_call_stack.
backtrace_info (curr_user_frame, print_subfn);
2691std::list<frame_info>
2699 bool print_subfn)
const
2701 return m_call_stack.
backtrace (curr_user_frame, print_subfn);
2721 std::ostringstream buf;
2723 for (
const auto& frm : frames)
2725 buf <<
" " << frm.fcn_name ();
2727 int line = frm.line ();
2731 buf <<
" at line " << line;
2733 int column = frm.column ();
2736 buf <<
" column " << column;
2750 m_call_stack.
push (dummy_scope);
2756 m_call_stack.
pop ();
2777 error (
"mlock: invalid use outside a function");
2781 warning (
"mlock: locking built-in function has no effect");
2794 error (
"munlock: invalid use outside a function");
2798 warning (
"munlock: unlocking built-in function has no effect");
2811 error (
"mislocked: invalid use outside a function");
2831 std::shared_ptr<stack_frame> frame
2856 std::shared_ptr<stack_frame> frame
2859 frame->clear_objects ();
2865 std::shared_ptr<stack_frame> frame
2868 frame->clear_variable (name);
2874 std::shared_ptr<stack_frame> frame
2877 frame->clear_variable_pattern (pattern);
2883 std::shared_ptr<stack_frame> frame
2886 frame->clear_variable_regexp (pattern);
2892 std::shared_ptr<stack_frame> frame
2895 frame->clear_variables ();
2971std::list<std::string>
2977std::list<std::string>
2983std::list<std::string>
3002 std::string name = fname;
3004 if (sys::file_ops::dir_sep_char () !=
'/' && name[0] ==
'@')
3006 auto beg = name.begin () + 2;
3007 auto end = name.end () - 1;
3008 std::replace (beg, end,
'/', sys::file_ops::dir_sep_char ());
3011 std::size_t name_len = name.length ();
3013 if (name_len > 2 && name.substr (name_len-2) ==
".m")
3014 name = name.substr (0, name_len-2);
3022 std::size_t p2 = std::string::npos;
3026 std::size_t p1 = name.find (sys::file_ops::dir_sep_char (), 1);
3028 if (p1 == std::string::npos)
3031 std::string dispatch_type = name.substr (1, p1-1);
3033 p2 = name.find (
'>', p1);
3035 std::string method = name.substr (p1+1, p2-1);
3043 if (cls.
ok () && cls.
get_name () == dispatch_type)
3045 if (! method.compare (0, 4,
"get."))
3048 std::string prop_name = method.substr (4);
3050 if (prop.
ok () && prop.
get_name () == prop_name)
3059 else if (! method.compare (0, 4,
"set."))
3062 std::string prop_name = method.substr (4);
3064 if (prop.
ok () && prop.
get_name () == prop_name)
3076 if (meth.
ok () && meth.
get_name () == method)
3089 p2 = name.find (
'>');
3091 std::string main_fcn = name.substr (0, p2);
3097 std::string subfuns;
3099 if (p2 != std::string::npos)
3100 subfuns = name.substr (p2+1);
3105 if (! user_code || subfuns.empty ())
3125 return curfcn->
name ();
3141 int line = cmd.
line ();
3145 m_echo_file_pos = line + 1;
3157 init_list->
accept (*
this);
3172 error (
"declaration list element not global or persistent");
3192template <
typename T>
3194tree_evaluator::execute_range_loop (
const range<T>& rng,
int line,
3200 if (math::isinf (rng.limit ()) || math::isinf (rng.base ()))
3202 "FOR loop limit is infinite, will stop after %"
3203 OCTAVE_IDX_TYPE_FORMAT
" steps", steps);
3208 m_echo_file_pos = line;
3215 loop_body->
accept (*
this);
3217 if (quit_loop_now ())
3225 int line = cmd.
line ();
3262 execute_range_loop (rhs.
range_value (), line, ult, loop_body);
3272 m_echo_file_pos = line;
3277 loop_body->
accept (*
this);
3300 if (rhs.
ndims () > 2)
3324 m_echo_file_pos = line;
3333 loop_body->
accept (*
this);
3335 if (quit_loop_now ())
3348 error (
"invalid type in for loop expression near line %d, column %d",
3355 int line = cmd.
line ();
3378 error (
"in statement 'for [X, Y] = VAL', VAL must be a structure");
3386 auto p = lhs->begin ();
3407 m_echo_file_pos = line;
3409 std::string key = keys[i];
3421 loop_body->
accept (*
this);
3423 if (quit_loop_now ())
3450 = param_list ? param_list->
dup (new_scope) :
nullptr;
3471 std::set<std::string> free_vars = anon_fcn_ctx.
free_variables ();
3475 std::shared_ptr<stack_frame> frame
3478 for (
auto& name : free_vars)
3483 local_vars[name] = val;
3490 bool is_nested =
false;
3539 error (
"invalid use of colon in function argument list");
3551 retval = (*fcn) (args, nargout);
3556 retval = (*meth) (m_interpreter, args, nargout);
3589 error (
"invalid use of colon in function argument list");
3598 retval =
call_mex (mex_function, args, nargout);
3612 if (args.
length () != 0 || nargout != 0)
3613 error (
"invalid call to script %s", file_name.c_str ());
3623 if (m_call_stack.
size () >=
static_cast<std::size_t
> (m_max_recursion_depth))
3624 error (
"max_recursion_depth exceeded");
3635 cmd_list->
accept (*
this);
3650 error_unexpected (
"tree_evaluator::visit_octave_user_script");
3673 m_lvalue_list =
nullptr;
3678 int nargin = args.
length ();
3689 ret_args = args.
slice (0, 1,
true);
3691 args = args.
slice (1, nargin,
true);
3694 error (
"invalid call to classdef constructor in tree_evaluator::execute_user_function - please report this bug");
3699 bool takes_varargs =
false;
3705 max_inputs = param_list->size ();
3708 if (! takes_varargs && nargin > max_inputs)
3710 std::string name = user_function.
name ();
3713 name =
"@<anonymous>";
3716 "%s: function called with too many inputs",
3726 int max_outputs = ret_list->size ();
3728 if (nargout > max_outputs)
3730 std::string name = user_function.
name ();
3733 "%s: function called with too many outputs",
3738 bind_auto_fcn_vars (xargs.
name_tags (), ignored_outputs, nargin,
3748 error (
"%s: invalid classdef constructor, no output argument defined",
3757 if (m_call_stack.
size () >=
static_cast<std::size_t
> (m_max_recursion_depth))
3758 error (
"max_recursion_depth exceeded");
3773 block (m_profiler, user_function);
3795 if (nargout <= 1 && retval.
length () == 1 && retval(0).is_cs_list ())
3796 retval = retval(0).list_value ();
3800 cmd_list->
accept (*
this);
3820 varargout = varargout_varval.
xcell_value (
"varargout must be a cell array object");
3833 error_unexpected (
"tree_evaluator::visit_octave_user_function");
3839 error_unexpected (
"tree_evaluator::visit_octave_user_function_header");
3845 error_unexpected (
"tree_evaluator::visit_octave_user_function_trailer");
3857 std::string nm =
f->
name ();
3873 error_unexpected (
"tree_evaluator::visit_identifier");
3879 error_unexpected (
"tree_evaluator::visit_if_clause");
3887 int line = cmd.
line ();
3891 m_echo_file_pos = line + 1;
3912 m_call_stack.
set_location (tic->line (), tic->column ());
3914 if (m_debug_mode && ! tic->is_else_clause ())
3915 do_breakpoint (tic->is_active_breakpoint (*
this));
3917 if (tic->is_else_clause () || is_logically_true (expr,
"if"))
3922 stmt_lst->
accept (*
this);
3932 error_unexpected (
"tree_evaluator::visit_index_expression");
3938 error_unexpected (
"tree_evaluator::visit_matrix");
3944 error_unexpected (
"tree_evaluator::visit_cell");
3950 error_unexpected (
"tree_evaluator::visit_multi_assignment");
3958 int line = cmd.
line ();
3962 m_echo_file_pos = line + 1;
3972 error_unexpected (
"tree_evaluator::visit_constant");
3978 error_unexpected (
"tree_evaluator::visit_fcn_handle");
3984 error_unexpected (
"tree_evaluator::visit_parameter_list");
3990 error_unexpected (
"tree_evaluator::visit_postfix_expression");
3996 error_unexpected (
"tree_evaluator::visit_prefix_expression");
4004 int line = cmd.
line ();
4008 m_echo_file_pos = line + 1;
4020 || m_in_loop_command)
4027 error_unexpected (
"tree_evaluator::visit_simple_assignment");
4047 upv (m_lvalue_list,
nullptr);
4055 int line = stmt.
line ();
4059 m_echo_file_pos = line + 1;
4078 bool do_bind_ans =
false;
4091 catch (
const std::bad_alloc&)
4099 "out of memory or dimension too large for Octave's index type");
4101 catch (
const interrupt_exception&)
4132 throw quit_debug_exception (
true);
4146 auto p = lst.begin ();
4148 if (p != lst.end ())
4155 error (
"invalid statement found in statement list!");
4161 if (m_breaking || m_continuing)
4167 if (p == lst.end ())
4193 error_unexpected (
"tree_evaluator::visit_switch_case");
4199 error_unexpected (
"tree_evaluator::visit_switch_case_list");
4207 int line = cmd.
line ();
4211 m_echo_file_pos = line + 1;
4220 error (
"missing value in switch command near line %d, column %d",
4236 stmt_lst->
accept (*
this);
4249 int line = cmd.
line ();
4253 m_echo_file_pos = line + 1;
4256 bool execution_error =
false;
4274 try_code->
accept (*
this);
4278 execution_error =
true;
4295 if (execution_error)
4311 catch_code->
accept (*
this);
4356 if (m_breaking || m_returning)
4393 if (m_breaking || m_returning)
4404 int line = cmd.
line ();
4408 m_echo_file_pos = line + 1;
4415 if (unwind_protect_code)
4419 unwind_protect_code->
accept (*
this);
4440 catch (
const interrupt_exception&)
4457 int line = cmd.
line ();
4472 error (
"unexpected: while condition is nullptr - please report this bug");
4477 m_echo_file_pos = line;
4482 if (is_logically_true (expr,
"while"))
4487 loop_body->
accept (*
this);
4489 if (quit_loop_now ())
4500 int line = cmd.
line ();
4515 error (
"unexpected: do-until condition is nullptr - please report this bug");
4520 m_echo_file_pos = line;
4525 loop_body->
accept (*
this);
4527 if (quit_loop_now ())
4533 if (is_logically_true (expr,
"do-until"))
4541 error_unexpected (
"tree_evaluator::visit_superclass_ref");
4547 error_unexpected (
"tree_evaluator::visit_metaclass_query");
4553 static std::string ans =
"ans";
4579 m_interpreter.
feval (
"display", args);
4593tree_evaluator::do_breakpoint (
bool is_breakpoint,
4594 bool is_end_of_fcn_or_script)
4596 bool break_on_this_statement =
false;
4599 break_on_this_statement =
true;
4600 else if (m_dbstep_flag > 0)
4604 if (m_dbstep_flag == 1 || is_end_of_fcn_or_script)
4612 break_on_this_statement =
true;
4622 else if (m_dbstep_flag == 1
4629 break_on_this_statement =
true;
4632 else if (m_dbstep_flag == -1)
4636 break_on_this_statement =
true;
4640 else if (m_dbstep_flag == -2)
4648 if (is_end_of_fcn_or_script
4653 if (! break_on_this_statement)
4654 break_on_this_statement = m_break_on_next_stmt;
4656 m_break_on_next_stmt =
false;
4658 if (break_on_this_statement)
4668 const char *warn_for)
4670 bool expr_value =
false;
4679 error (
"%s: undefined value used in conditional expression", warn_for);
4689 "max_recursion_depth", 0);
4723 for (
const auto& fcn_fname : m_autoload_map)
4725 fcn_names(i) = fcn_fname.first;
4726 file_names(i) = fcn_fname.second;
4733 m.
assign (
"function", fcn_names);
4734 m.
assign (
"file", file_names);
4744 auto p = m_autoload_map.find (nm);
4746 if (p != m_autoload_map.end ())
4756std::list<std::string>
4759 std::list<std::string> names;
4761 for (
const auto& fcn_fname : m_autoload_map)
4762 names.push_back (fcn_fname.first);
4767std::list<std::string>
4770 std::list<std::string> names;
4772 for (
const auto& fcn_fname : m_autoload_map)
4773 if (nm == fcn_fname.second)
4774 names.push_back (fcn_fname.first);
4781 const std::string& nm)
4783 m_autoload_map[fcn] = check_autoload_file (nm);
4788 const std::string& nm)
4790 check_autoload_file (nm);
4797 m_autoload_map.erase (fcn);
4804 "whos_line_format");
4811 "silent_functions");
4818 "string_fill_char");
4829 std::string extra_message;
4833 std::string var = expr->
name ();
4845 if (fp && fp->
name () == var)
4847 =
" (note: variable '" + var +
"' shadows function)";
4851 std::string msg = ie.message () + extra_message;
4858 bool return_list,
bool verbose)
4860 return m_call_stack.
do_who (argc, argv, return_list, verbose);
4872 upv (m_lvalue_list,
nullptr);
4874 int len = args->size ();
4879 m_num_indices =
len;
4881 std::list<octave_value> arg_vals;
4885 for (
auto elt : *args)
4892 m_index_position = k++;
4901 arg_vals.push_back (tmp_ovl(i));
4904 arg_vals.push_back (tmp);
4918std::list<octave_lvalue>
4921 std::list<octave_lvalue> retval;
4924 retval.push_back (elt->lvalue (*
this));
4937 push_echo_state_cleanup (*frame);
4939 set_echo_state (type, file_name, pos);
4944tree_evaluator::set_echo_state (
int type,
const std::string& file_name,
4947 m_echo_state = echo_this_file (file_name, type);
4949 m_echo_file_name = file_name;
4950 m_echo_file_pos = pos;
4954tree_evaluator::uwp_set_echo_state (
bool state,
const std::string& file_name,
4957 m_echo_state = state;
4959 m_echo_file_name = file_name;
4960 m_echo_file_pos = pos;
4964tree_evaluator::maybe_set_echo_state ()
4985 set_echo_state (type, file_name, pos);
4992 frame.
add (&tree_evaluator::uwp_set_echo_state,
this,
4993 m_echo_state, m_echo_file_name, m_echo_file_pos);
4997tree_evaluator::maybe_push_echo_state_cleanup ()
5008 push_echo_state_cleanup (*frame);
5019 bool cleanup_pushed = maybe_push_echo_state_cleanup ();
5029 m_echo_files.clear ();
5037 std::string arg0 = argv[0];
5041 else if (arg0 ==
"off")
5046 file = sys::env::make_absolute (file);
5049 error (
"echo: no such file %s", arg0.c_str ());
5056 m_echo_files[file] =
false;
5062 auto p = m_echo_files.find (file);
5064 if (p == m_echo_files.end ())
5069 m_echo_files[file] =
true;
5076 p->second = ! p->second;
5085 std::string arg0 = argv[0];
5086 std::string arg1 = argv[1];
5088 if (arg1 ==
"on" || arg1 ==
"off")
5089 std::swap (arg0, arg1);
5096 m_echo_files.clear ();
5101 file = sys::env::make_absolute (file);
5104 error (
"echo: no such file %s", arg1.c_str ());
5107 m_echo_files[file] =
true;
5110 else if (arg0 ==
"off")
5115 m_echo_files.clear ();
5120 file = sys::env::make_absolute (file);
5123 error (
"echo: no such file %s", arg1.c_str ());
5125 m_echo_files[file] =
false;
5139 maybe_set_echo_state ();
5147 return (m_debugger_stack.empty ()
5148 ?
false : m_debugger_stack.top()->in_debug_repl ());
5154 if (! m_debugger_stack.empty ())
5155 m_debugger_stack.top()->dbcont ();
5161 if (! m_debugger_stack.empty ())
5162 m_debugger_stack.top()->dbquit (all);
5168 int nargin = args.
length ();
5170 if (nargin != 0 && nargin != 3)
5176 = args(1).strict_idx_type_value (
"end: K must be integer value");
5179 error (
"end: K must be greater than zero");
5182 = args(2).strict_idx_type_value (
"end: N must be integer value");
5185 error (
"end: N must be greater than zero");
5197 error (
"invalid use of 'end': may only be used to index existing value");
5201 if (m_index_list.empty ())
5202 expr_result = m_indexed_object;
5229 = m_indexed_object.
subsref (m_index_type, m_index_list, 1);
5238 error (
"error evaluating partial expression for END");
5248 std::string dispatch_class = expr_result.
class_name ();
5255 return m_interpreter.
feval
5256 (meth,
ovl (expr_result, m_index_position+1, m_num_indices), 1);
5269tree_evaluator::echo_this_file (
const std::string& file,
int type)
const
5282 auto p = m_echo_files.find (file);
5289 return (p == m_echo_files.end () || p->second);
5295 return p != m_echo_files.end () && p->second;
5303tree_evaluator::echo_code (
int line)
5313 int num_lines = line - m_echo_file_pos + 1;
5315 std::deque<std::string> lines
5318 for (
auto& elt : lines)
5325tree_evaluator::quit_loop_now ()
5334 bool quit = (m_returning || m_breaking || m_continuing);
5343tree_evaluator::bind_auto_fcn_vars (
const string_vector& arg_names,
5344 const Matrix& ignored_outputs,
5345 int nargin,
int nargout,
5360tree_evaluator::check_autoload_file (
const std::string& nm)
const
5362 if (sys::env::absolute_pathname (nm))
5365 std::string full_name = nm;
5375 if (! fname.empty ())
5377 fname = sys::env::make_absolute (fname);
5378 fname = fname.substr (0, fname.find_last_of (sys::file_ops::dir_sep_str ()) + 1);
5380 sys::file_stat fs (fname + nm);
5384 full_name = fname + nm;
5392 "autoload: '%s' is not an absolute filename",
5398DEFMETHOD (max_recursion_depth, interp, args, nargout,
5433DEFMETHOD (whos_line_format, interp, args, nargout,
5514DEFMETHOD (silent_functions, interp, args, nargout,
5548DEFMETHOD (string_fill_char, interp, args, nargout,
5614 return interp.PS4 (args, nargout);
5660 return tw.
echo (args, nargout);
5708 int nargin = args.length ();
5715 error (
"inputname: N must be a scalar index");
5717 int n = args(0).strict_int_value (
"inputname: N must be a scalar index");
5720 error (
"inputname: N must be a scalar index");
5722 bool ids_only =
true;
5725 ids_only = args(1).strict_bool_value (
"inputname: IDS_ONLY must be a logical value");
5728 return ovl (interp.inputname (n-1, ids_only));
5785OCTAVE_END_NAMESPACE(octave)
octave_idx_type rows() const
octave_idx_type columns() const
octave_idx_type numel() const
Number of elements in the array.
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)
void run(std::size_t num)
void forced_interactive(bool arg)
static application * app()
static bool forced_interactive()
void statement_list(std::shared_ptr< tree_statement_list > &lst)
void disallow_command_syntax()
bool at_end_of_input() const
bool debug_on_err(const std::string &id)
bool debug_on_caught(const std::string &id)
void set_dispatch_class(const std::string &class_name)
std::shared_ptr< stack_frame > get_current_stack_frame() const
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::size_t find_current_user_frame() const
std::list< frame_info > backtrace_info(octave_idx_type &curr_user_frame, bool print_subfn=true) const
octave_map backtrace(octave_idx_type &curr_user_frame, bool print_subfn=true) const
octave_value & global_varref(const std::string &name)
void set_top_level_value(const std::string &name, const octave_value &value)
octave_value get_auto_fcn_var(stack_frame::auto_var_type avt) const
std::list< std::string > variable_names() const
symbol_info_list regexp_symbol_info(const std::string &pattern) const
void make_global(const symbol_record &sym)
std::shared_ptr< stack_frame > current_user_frame() const
std::shared_ptr< stack_frame > pop_return()
void clear_global_variables()
symbol_info_list glob_symbol_info(const std::string &pattern) const
void restore_frame(std::size_t n)
bool at_top_level() const
bool is_class_method_executing(std::string &dispatch_class) const
bool goto_frame(std::size_t n=0, bool verbose=false)
int debug_user_code_column() const
std::size_t current_frame() const
void set_auto_fcn_var(stack_frame::auto_var_type avt, const octave_value &val)
symbol_info_list get_symbol_info()
symbol_info_list top_scope_symbol_info() const
std::list< std::string > global_variable_names() 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
symbol_scope current_scope() const
octave_map empty_backtrace() const
octave_function * current_function(bool skip_first=false) const
void clear_global_variable_pattern(const std::string &pattern)
unwind_protect * curr_fcn_unwind_protect_frame()
int debug_user_code_line() const
octave_user_code * debug_user_code() const
void push(const symbol_scope &scope)
std::list< std::string > top_level_variable_names() const
void set_nargin(int nargin)
void clear_global_variable(const std::string &name)
octave_user_code * current_user_code() const
symbol_scope top_scope() const
void set_nargout(int nargout)
int current_user_code_line() const
std::size_t dbupdown(std::size_t start, int n, bool verbose)
int current_column() const
std::string get_dispatch_class() const
void clear_global_variable_regexp(const std::string &pattern)
void make_persistent(const symbol_record &sym)
octave_value max_stack_depth(const octave_value_list &args, int nargout)
cdef_method find_method(const std::string &nm, bool local=false)
std::string get_name() const
cdef_property find_property(const std::string &nm)
cdef_class find_class(const std::string &name, bool error_if_not_found=true, bool load_if_not_found=true)
octave_value get_function() const
std::string get_name() const
cdef_class get_class() const
octave_value get(const std::string &pname) const
std::string get_name() const
static void run_event_hooks()
static void increment_current_command_number()
static bool interrupt(bool=true)
static bool erase_empty_line(bool flag)
static std::string decode_prompt_string(const std::string &s)
static bool ignoring_entries()
static bool add(const std::string &)
static void ignore_entries(bool=true)
Vector representing the dimensions (size) of an Array.
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
octave_value last_error_id(const octave_value_list &args, int nargout)
octave_map last_error_stack() const
octave_value debug_on_warning(const octave_value_list &args, int nargout)
void set_debug_on_warning(bool flag)
octave_value debug_on_caught(const octave_value_list &args, int nargout)
void save_exception(const execution_exception &ee)
octave_value debug_on_error(const octave_value_list &args, int nargout)
octave_value last_error_message(const octave_value_list &args, int nargout)
void display_exception(const execution_exception &ee) const
void set_debug_on_error(bool flag)
Provides threadsafe access to octave.
void append_history(const std::string &hist_entry)
void enter_debugger_event(const std::string &fcn_name, const std::string &fcn_file_name, int line)
void post_event(const fcn_callback &fcn)
void execute_in_debugger_event(const std::string &file, int line)
void set_var(const std::string &var_arg="")
virtual const char * err_id() const =0
cdef_manager & get_cdef_manager()
error_system & get_error_system()
load_path & get_load_path()
void set_PS1(const std::string &s)
octave_value PS1(const octave_value_list &args, int nargout)
void parse_and_execute(const std::string &input, bool &incomplete_parse)
tree_evaluator & get_evaluator()
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.
void recover_from_exception()
octave_value PS2(const octave_value_list &args, int nargout)
event_manager & get_event_manager()
symbol_table & get_symbol_table()
std::string find_file(const std::string &file) const
virtual bool is_user_code() const
virtual bool is_user_function() const
virtual bool is_builtin_function() const
octave_value_list(* fcn)(const octave_value_list &, int)
octave_value_list(* meth)(octave::interpreter &, const octave_value_list &, int)
octave_classdef * classdef_object_value(bool=false)
octave::cdef_object get_object() const
std::string class_name() const
virtual bool is_nested_function() const
virtual bool is_subfunction() const
std::string dispatch_class() const
bool is_class_method(const std::string &cname="") const
bool is_class_constructor(const std::string &cname="") const
bool is_private_function() const
virtual std::string parent_fcn_name() const
void stash_dir_name(const std::string &dir)
virtual bool is_parent_function() const
virtual octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
virtual std::list< std::string > parent_fcn_names() const
void stash_dispatch_class(const std::string &nm)
virtual std::string fcn_file_name() const
std::string dir_name() const
bool is_undefined() const
void assign(octave_value::assign_op, const octave_value &)
void define(const octave_value &v)
string_vector keys() const
const Cell & contents(const_iterator p) const
void assign(const std::string &k, const Cell &val)
void assign(const std::string &k, const octave_value &val)
void stash_fcn_file_name(const std::string &nm)
std::string get_code_line(std::size_t line)
std::string fcn_file_name() const
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
octave::tree_statement_list * body()
octave_user_code * user_code_value(bool=false)
octave::tree_parameter_list * parameter_list()
bool takes_varargs() const
bool is_special_expr() const
octave_value_list all_va_args(const octave_value_list &args)
bool is_classdef_constructor(const std::string &cname="") const
octave::tree_parameter_list * return_list()
bool is_anonymous_function() const
void restore_warning_states()
void mark_as_anonymous_function()
void mark_as_nested_function()
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
void stash_name_tags(const string_vector &nm)
bool has_magic_colon() const
octave_value & xelem(octave_idx_type i)
string_vector name_tags() 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
octave_idx_type length() const
void make_storable_values()
bool is_function_handle() const
octave_value_list list_value() const
bool is_undefined() const
Cell xcell_value(const char *fmt,...) const
std::string class_name() const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_function * function_value(bool silent=false) const
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
bool is_scalar_type() const
octave_idx_type end_index(octave_idx_type index_position, octave_idx_type num_indices) const
bool is_equal(const octave_value &) const
octave_value storable_value() const
octave_value reshape(const dim_vector &dv) const
octave_map map_value() const
bool is_matrix_type() const
bool is_double_type() const
octave_user_function * user_function_value(bool silent=false) const
bool is_user_code() const
std::string xstring_value(const char *fmt,...) const
octave_user_code * user_code_value(bool silent=false) const
octave::range< double > range_value() const
std::map< std::string, octave_value > local_vars_map
octave_idx_type numel() const
static symbol_scope invalid()
void set_parent(const symbol_scope &p)
void cache_fcn_file_name(const std::string &name)
void set_nesting_depth(std::size_t depth)
void set_primary_parent(const symbol_scope &p)
void cache_dir_name(const std::string &name)
std::size_t nesting_depth() const
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)
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope::invalid())
void clear_dld_function(const std::string &name)
octave_value fcn_table_find(const std::string &name, const octave_value_list &args=ovl(), const symbol_scope &search_scope=symbol_scope::invalid())
octave_value find_user_function(const std::string &name)
void clear_function_regexp(const std::string &pat)
tree_parameter_list * parameter_list() const
symbol_scope scope() const
tree_expression * expression() const
std::set< std::string > free_variables() const
tree_argument_list * left_hand_side()
tree_statement_list * body()
tree_expression * control_expr()
tree_decl_init_list * initializer_list()
tree_expression * expression()
tree_identifier * ident()
bool is_persistent() const
void accept(tree_walker &tw)
tree_expression * condition()
tree_statement_list * body()
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)
octave_value_list execute_user_function(octave_user_function &user_function, int nargout, const octave_value_list &args)
void visit_break_command(tree_break_command &)
bool is_global(const std::string &name) const
void visit_octave_user_function(octave_user_function &)
void visit_unwind_protect_command(tree_unwind_protect_command &)
bool mislocked(bool skip_first=false) const
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)
void clear_all(bool force=false)
int max_recursion_depth() const
void visit_statement_list(tree_statement_list &)
octave_value evaluate(tree_decl_elt *)
void visit_anon_fcn_handle(tree_anon_fcn_handle &)
octave_user_code * current_user_code() const
void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true)
symbol_scope get_current_scope() const
void visit_cell(tree_cell &)
octave_value echo(const octave_value_list &args, int nargout)
octave_value_list evaluate_end_expression(const octave_value_list &args)
void add_autoload(const std::string &fcn, const std::string &nm)
std::list< frame_info > backtrace_info() const
void visit_constant(tree_constant &)
void display_call_stack() const
octave_map empty_backtrace() const
void visit_superclass_ref(tree_superclass_ref &)
void visit_simple_assignment(tree_simple_assignment &)
octave_value & global_varref(const std::string &name)
octave_map backtrace() const
void final_index_error(index_exception &ie, const tree_expression *expr)
void visit_args_block_validation_list(tree_args_block_validation_list &)
Matrix ignored_fcn_outputs() const
void debug_where(std::ostream &os) const
void clear_global_variables()
void clear_global_variable(const std::string &name)
std::string get_dispatch_class() const
octave_value_list execute_mex_function(octave_mex_function &mex_function, int nargout, const octave_value_list &args)
std::string inputname(int n, bool ids_only=true) const
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 &)
void munlock(bool skip_first=false) const
void visit_arg_validation(tree_arg_validation &)
octave_value get_auto_fcn_var(stack_frame::auto_var_type avt) const
void remove_autoload(const std::string &fcn, const std::string &nm)
void debug_list(std::ostream &os, int num_lines) const
bool at_top_level() const
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)
symbol_info_list top_scope_symbol_info() const
void visit_while_command(tree_while_command &)
void visit_do_until_command(tree_do_until_command &)
octave_map get_autoload_map() 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::list< std::string > variable_names() const
void define_parameter_list_from_arg_vector(tree_parameter_list *param_list, const octave_value_list &args)
bool is_local_variable(const std::string &name) const
void visit_decl_command(tree_decl_command &)
bool in_debug_repl() const
void visit_arg_validation_fcns(tree_arg_validation_fcns &)
void visit_function_def(tree_function_def &)
symbol_scope get_top_scope() const
void visit_switch_command(tree_switch_command &)
int index_position() const
void clear_symbol_pattern(const std::string &pattern)
void clear_symbol(const std::string &name)
bool in_user_code() const
void visit_arguments_block(tree_arguments_block &)
void dbquit(bool all=false)
void keyboard(const std::string &prompt="debug> ")
void restore_frame(std::size_t n)
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)
void debug_type(std::ostream &os, int start_line, int end_line) const
unwind_protect * curr_fcn_unwind_protect_frame()
std::shared_ptr< stack_frame > pop_return_stack_frame()
void visit_try_catch_command(tree_try_catch_command &)
void visit_colon_expression(tree_colon_expression &)
int debug_user_code_line() const
void push_dummy_scope(const std::string &name)
void visit_simple_for_command(tree_simple_for_command &)
std::shared_ptr< push_parser > get_parser()
octave_value_list make_value_list(tree_argument_list *args, const string_vector &arg_nm)
std::string backtrace_message() 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
void visit_if_clause(tree_if_clause &)
std::list< std::string > reverse_lookup_autoload(const std::string &nm) const
std::size_t current_call_stack_frame_number() const
void visit_args_block_attribute_list(tree_args_block_attribute_list &)
std::size_t debug_frame() const
octave_function * caller_function() const
std::list< std::string > global_variable_names() 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)
symbol_info_list get_symbol_info()
symbol_info_list glob_symbol_info(const std::string &pattern) const
bool silent_functions() const
void clear_global_variable_pattern(const std::string &pattern)
void visit_argument_list(tree_argument_list &)
octave_value_list convert_return_list_to_const_vector(tree_parameter_list *ret_list, int nargout, const Cell &varargout)
void assign(const std::string &name, const octave_value &val=octave_value())
void assignin(const std::string &context, const std::string &name, const octave_value &val=octave_value())
void visit_statement(tree_statement &)
char string_fill_char() const
octave_value top_level_varval(const std::string &name) const
void dbupdown(int n, bool verbose=false)
std::shared_ptr< stack_frame > current_user_frame() const
octave_value evaluate_anon_fcn_handle(tree_anon_fcn_handle &afh)
void undefine_parameter_list(tree_parameter_list *param_list)
octave_value max_stack_depth(const octave_value_list &args, int nargout)
void visit_identifier(tree_identifier &)
void clear_symbol_regexp(const std::string &pattern)
std::list< std::string > autoloaded_functions() const
void visit_octave_user_function_trailer(octave_user_function &)
int debug_user_code_column() const
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 eval(std::shared_ptr< tree_statement_list > &stmt_list, bool interactive)
std::string whos_line_format() 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 &)
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())
octave_user_code * debug_user_code() const
bool eval_decl_elt(tree_decl_elt *elt)
bool quiet_breakpoint_flag() const
void clear_global_variable_regexp(const std::string &pattern)
void visit_decl_elt(tree_decl_elt &)
void parse_and_execute(const std::string &input, bool &incomplete_parse)
void visit_parameter_list(tree_parameter_list &)
std::list< std::string > top_level_variable_names() const
std::list< octave_lvalue > make_lvalue_list(tree_argument_list *)
int current_column() const
void enter_debugger(const std::string &prompt="debug> ")
void visit_complex_for_command(tree_complex_for_command &)
octave_value whos_line_format(const octave_value_list &args, int nargout)
octave_user_code * get_user_code(const std::string &fname="")
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 &)
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 &)
void push_stack_frame(const symbol_scope &scope)
std::string mfilename(const std::string &opt="") const
void visit_prefix_expression(tree_prefix_expression &)
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
bool statement_printing_enabled()
void set_nargin(int nargin)
void clear_variable_pattern(const std::string &pattern)
std::string current_function_name(bool skip_first=false) const
void set_nargout(int nargout)
void visit_if_command_list(tree_if_command_list &)
virtual octave_value evaluate(tree_evaluator &tw, int nargout=1)=0
virtual bool is_identifier() const
bool print_result() const
tree_expression * set_print_flag(bool print)
virtual std::string name() const
virtual tree_expression * dup(symbol_scope &scope) const =0
virtual bool is_assignment_expression() const
virtual octave_lvalue lvalue(tree_evaluator &)
virtual octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)=0
virtual bool is_black_hole() const
symbol_record symbol() 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()
bool is_end_of_fcn_or_script() const
bool takes_varargs() const
tree_parameter_list * dup(symbol_scope &scope) const
tree_expression * left_hand_side()
tree_expression * control_expr()
tree_statement_list * body()
tree_statement_list * body()
void accept(tree_walker &tw)
bool is_active_breakpoint(tree_evaluator &tw) const
tree_expression * expression()
bool is_expression() const
void accept(tree_walker &tw)
bool is_end_of_fcn_or_script() const
tree_expression * case_label()
tree_switch_case_list * case_list()
tree_expression * switch_value()
tree_identifier * identifier()
tree_statement_list * cleanup()
tree_statement_list * body()
tree_statement_list * cleanup()
tree_statement_list * body()
tree_statement_list * body()
tree_expression * condition()
bool is_active_breakpoint(tree_evaluator &tw) const
virtual int column() const
virtual void accept(tree_walker &tw)=0
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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,...)
void err_indexed_cs_list()
bool iskeyword(const std::string &s)
F77_RET_T const F77_DBLE const F77_DBLE * f
octave_value_list call_mex(octave_mex_function &mex_fcn, const octave_value_list &args, int nargout_arg)
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()
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
std::atomic< sig_atomic_t > octave_interrupt_state
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)