26 #if defined (HAVE_CONFIG_H)
32 #include <condition_variable>
80 class quit_debug_exception
84 quit_debug_exception (
bool all =
false) : m_all (all) { }
86 quit_debug_exception (
const quit_debug_exception&) =
default;
88 quit_debug_exception& operator = (
const quit_debug_exception&) =
default;
90 ~quit_debug_exception () =
default;
92 bool all ()
const {
return m_all; }
112 : m_interpreter (interp), m_level (level),
113 m_execution_mode (EX_NORMAL), m_in_debug_repl (false)
118 void repl (
const std::string& prompt =
"debug> ");
120 bool in_debug_repl ()
const {
return m_in_debug_repl; }
122 void dbcont () { m_execution_mode = EX_CONTINUE; }
124 void dbquit (
bool all =
false)
127 m_execution_mode = EX_QUIT_ALL;
129 m_execution_mode = EX_QUIT;
132 bool quitting_debugger ()
const;
139 execution_mode m_execution_mode;
140 bool m_in_debug_repl;
148 debugger::server_loop ()
162 if (m_execution_mode == EX_CONTINUE || tw.
dbstep_flag ())
165 if (quitting_debugger ())
198 catch (
const interrupt_exception&)
201 m_interpreter.recover_from_exception ();
204 if (m_interpreter.interactive ())
209 m_interpreter.recover_from_exception ();
211 std::cerr <<
"error: unhandled index exception: "
212 << e.message () <<
" -- trying to return to prompt"
222 if (m_interpreter.interactive ())
224 m_interpreter.recover_from_exception ();
233 catch (
const quit_debug_exception& qde)
240 catch (
const std::bad_alloc&)
242 m_interpreter.recover_from_exception ();
244 std::cerr <<
"error: out of memory -- trying to return to prompt"
248 while (exit_status == 0);
250 if (exit_status == EOF)
252 if (m_interpreter.interactive ())
262 debugger::repl (
const std::string& prompt_arg)
269 m_in_debug_repl =
true;
281 std::string fcn_file_nm, fcn_nm;
286 fcn_nm = fcn_file_nm.empty () ? caller->
name () : fcn_file_nm;
291 std::ostringstream buf;
293 input_system& input_sys = m_interpreter.get_input_system ();
297 if (! fcn_nm.empty ())
301 static char ctrl_z =
'Z' & 0x1f;
303 buf << ctrl_z << ctrl_z << fcn_nm <<
':' << curr_debug_line;
315 frm->display_stopped_in_message (buf);
323 fcn_nm, curr_debug_line);
327 std::string line_buf;
332 if (! line_buf.empty ())
333 buf << curr_debug_line <<
": " << line_buf;
341 std::string stopped_in_msg = buf.str ();
343 if (m_interpreter.server_mode ())
345 if (! stopped_in_msg.empty ())
354 std::shared_ptr<push_parser>
363 if (! stopped_in_msg.empty ())
364 std::cerr << stopped_in_msg << std::endl;
366 std::string tmp_prompt = prompt_arg;
368 tmp_prompt =
"[" + std::to_string (m_level) +
"]" + prompt_arg;
371 m_interpreter.PS1 (tmp_prompt);
373 if (! m_interpreter.interactive ())
377 frame.
add (interactive_fptr, &m_interpreter,
378 m_interpreter.interactive ());
380 m_interpreter.interactive (
true);
389 void (
application::*forced_interactive_fptr) (bool)
391 frame.
add (forced_interactive_fptr, app,
398 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
406 parser debug_parser (m_interpreter);
412 while (m_in_debug_repl)
414 if (m_execution_mode == EX_CONTINUE || tw.
dbstep_flag ())
417 if (quitting_debugger ())
422 debug_parser.reset ();
424 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
434 std::string input_line = reader.get_input (prompt, eof);
442 retval = debug_parser.run (input_line,
false);
450 int retval = debug_parser.run ();
457 quitting_debugger ();
465 std::shared_ptr<tree_statement_list> stmt_list
466 = debug_parser.statement_list ();
469 stmt_list->accept (tw);
495 m_interpreter.recover_from_exception ();
497 catch (
const quit_debug_exception& qde)
509 debugger::quitting_debugger ()
const
511 if (m_execution_mode == EX_QUIT)
516 if (m_level > 0 || m_interpreter.server_mode ()
517 || m_interpreter.in_top_level_repl ())
518 throw quit_debug_exception ();
523 if (m_execution_mode == EX_QUIT_ALL)
528 if (m_interpreter.server_mode () || m_interpreter.in_top_level_repl ())
529 throw quit_debug_exception (
true);
555 fname = fcn->
name ();
558 if (opt ==
"fullpathext")
562 std::size_t epos = fname.rfind (
'.');
565 epos = std::string::npos;
567 if (epos != std::string::npos)
568 fname = fname.substr (0, epos);
570 if (opt ==
"fullpath")
573 if (dpos != std::string::npos)
574 fname = fname.substr (dpos+1);
581 bool& incomplete_parse)
583 incomplete_parse =
false;
611 m_exit_status = m_parser->run (input, eof);
613 if (m_exit_status == 0)
615 std::shared_ptr<tree_statement_list>
616 stmt_list = m_parser->statement_list ();
626 else if (m_parser->at_end_of_input ())
630 incomplete_parse =
true;
636 if (m_exit_status == -1)
648 std::unique_lock<std::mutex> lock (mtx);
649 std::condition_variable cv;
650 bool incomplete_parse =
false;
651 bool evaluation_pending =
false;
652 bool exiting =
false;
663 = incomplete_parse ? m_interpreter.
PS2 () : m_interpreter.
PS1 ();
668 std::getline (std::cin, input);
673 incomplete_parse =
false;
674 evaluation_pending =
true;
682 std::lock_guard<std::mutex> local_lock (mtx);
688 catch (
const exit_exception&)
690 evaluation_pending =
false;
706 evaluation_pending =
false;
711 evaluation_pending =
false;
713 throw exit_exception (1);
718 evaluation_pending =
false;
723 evaluation_pending =
false;
730 cv.wait (lock, [&] {
return ! evaluation_pending; });
751 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
752 static bool use_command_line_push_parser =
true;
754 static bool use_command_line_push_parser =
false;
762 std::shared_ptr<base_parser> repl_parser;
766 if (use_command_line_push_parser)
772 repl_parser = std::shared_ptr<base_parser> (pp);
777 repl_parser = std::shared_ptr<base_parser> (pp);
783 repl_parser = std::shared_ptr<base_parser> (pp);
792 repl_parser->reset ();
800 exit_status = repl_parser->run ();
802 if (exit_status == 0)
804 std::shared_ptr<tree_statement_list>
805 stmt_list = repl_parser->statement_list ();
813 else if (repl_parser->at_end_of_input ())
820 catch (
const interrupt_exception&)
832 std::cerr <<
"error: unhandled index exception: "
833 << ie.message () <<
" -- trying to return to prompt"
852 catch (
const quit_debug_exception&)
858 catch (
const std::bad_alloc&)
862 std::cerr <<
"error: out of memory -- trying to return to prompt"
866 while (exit_status == 0);
868 if (exit_status == EOF)
917 catch (
const interrupt_exception&)
932 std::cerr <<
"error: unhandled index exception: "
933 << e.message () <<
" -- trying to return to prompt"
955 catch (
const quit_debug_exception&)
961 catch (
const exit_exception& xe)
963 m_exit_status = xe.exit_status ();
966 catch (
const std::bad_alloc&)
971 std::cerr <<
"error: out of memory -- trying to return to prompt"
975 while (m_exit_status == 0);
977 if (m_exit_status == EOF)
985 return m_exit_status;
994 stmt_list->accept (*
this);
1000 bool quit = (m_returning || m_breaking);
1015 catch (
const quit_debug_exception&)
1023 int& parse_status,
int nargout)
1027 parser eval_parser (eval_str, m_interpreter);
1031 eval_parser.
reset ();
1042 parse_status = eval_parser.
run ();
1044 if (parse_status == 0)
1046 std::shared_ptr<tree_statement_list> stmt_list
1053 if (stmt_list->length () == 1
1054 && (stmt = stmt_list->front ())
1064 bool do_bind_ans =
false;
1071 if (do_bind_ans && ! retval.
empty ())
1077 else if (nargout == 0)
1078 stmt_list->accept (*
this);
1080 error (
"eval: invalid use of statement list");
1089 while (parse_status == 0);
1096 bool silent,
int& parse_status)
1110 bool silent,
int& parse_status,
1113 std::string s = arg.
xstring_value (
"eval: expecting string argument");
1115 return eval_string (s, silent, parse_status, nargout);
1122 int parse_status = 0;
1124 return eval_string (try_code, nargout > 0, parse_status, nargout);
1129 const std::string& catch_code,
1136 int parse_status = 0;
1138 bool execution_error =
false;
1144 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1151 execution_error =
true;
1154 if (parse_status != 0 || execution_error)
1156 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1168 if (execution_error)
1177 const std::string& try_code,
1185 if (context ==
"caller")
1187 else if (context ==
"base")
1190 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1192 int parse_status = 0;
1194 return eval_string (try_code, nargout > 0, parse_status, nargout);
1199 const std::string& try_code,
1200 const std::string& catch_code,
1210 if (context ==
"caller")
1212 else if (context ==
"base")
1215 error (R
"(evalin: CONTEXT must be "caller" or "base")");
1219 int parse_status = 0;
1221 bool execution_error =
false;
1227 tmp =
eval_string (try_code, nargout > 0, parse_status, nargout);
1234 execution_error =
true;
1237 if (parse_status != 0 || execution_error)
1239 tmp =
eval_string (catch_code, nargout > 0, parse_status, nargout);
1251 if (execution_error)
1273 warning (
"function arguments validation blocks are not supported; INCORRECT RESULTS ARE POSSIBLE");
1333 m_echo_file_pos =
line + 1;
1339 if (m_in_loop_command)
1342 error (
"break must appear in a loop in the same file as loop command");
1360 m_echo_file_pos =
line + 1;
1366 if (m_in_loop_command)
1373 return ! (m_silent_functions && (m_statement_context ==
SC_FUNCTION
1381 || m_dbstep_flag != 0
1382 || m_break_on_next_stmt
1389 m_debug_mode = mode;
1420 m_debug_frame = m_call_stack.
dbupdown (0);
1428 debugger *dbgr =
new debugger (m_interpreter, m_debugger_stack.size ());
1430 m_debugger_stack.push (dbgr);
1434 delete m_debugger_stack.top ();
1435 m_debugger_stack.pop ();
1439 dbgr->repl (prompt);
1451 m_debug_frame = m_call_stack.
dbupdown (
n, verbose);
1459 const std::list<octave_lvalue> *lvalues = m_lvalue_list;
1466 for (
const auto& lval : *lvalues)
1467 nbh += lval.is_black_hole ();
1476 for (
const auto& lval : *lvalues)
1478 if (lval.is_black_hole ())
1492 get_operator_function_name (
const std::string& name)
1501 std::size_t
len = name.length ();
1528 else if (name[1] ==
'=')
1559 return "ctranspose";
1612 std::string fcn_name = get_operator_function_name (name);
1619 bool name_is_operator = fcn_name != name;
1621 std::size_t pos = fcn_name.find (
'.');
1623 if (pos != std::string::npos)
1642 std::string meth_nm = fcn_name.substr (pos+1);
1644 if (meth_nm.find (
'.') == std::string::npos)
1646 std::string obj_nm = fcn_name.substr (0, pos);
1653 if (
object.
is_defined () &&
object.is_classdef_object ())
1676 fcn_name = class_nm +
'.' + meth_nm;
1725 bool skip_first = name_is_operator;
1734 if (! name_is_operator)
1739 std::shared_ptr<stack_frame> frame
1755 && (fcn_name == curr_fcn->
name ()
1757 frame = frame->access_link ();
1862 std::shared_ptr<stack_frame> frame
1865 return frame->is_variable (name);
1871 std::shared_ptr<stack_frame> frame
1874 return frame->is_local_variable (name);
1911 std::shared_ptr<stack_frame> frame
1914 return frame->is_variable (sym);
1920 std::shared_ptr<stack_frame> frame
1923 return frame->is_defined (sym);
1929 std::shared_ptr<stack_frame> frame
1932 return frame->is_global (name);
1938 std::shared_ptr<stack_frame> frame
1941 return frame->varval (sym);
1947 std::shared_ptr<stack_frame> frame
1950 return frame->varval (name);
1958 std::shared_ptr<stack_frame> frame
1961 return frame->install_variable (name, value, global);
1999 std::shared_ptr<stack_frame> frame
2002 frame->assign (name, val);
2018 if (context ==
"caller")
2020 else if (context ==
"base")
2023 error (R
"(assignin: CONTEXT must be "caller" or "base")");
2032 error (
"assignin: invalid assignment to keyword '%s'",
2038 error (
"assignin: invalid variable name '%s'", name.c_str ());
2043 const std::string& context,
2044 bool verbose,
bool require_file)
2079 static std::map<std::string, int> source_call_depth;
2081 std::string file_full_name
2087 std::string dir_name = file_full_name.substr (0, pos);
2089 file_full_name = sys::env::make_absolute (file_full_name);
2093 if (source_call_depth.find (file_full_name) == source_call_depth.end ())
2094 source_call_depth[file_full_name] = -1;
2096 frame.
protect_var (source_call_depth[file_full_name]);
2098 source_call_depth[file_full_name]++;
2101 error (
"max_recursion_depth exceeded");
2103 if (! context.empty ())
2108 if (context ==
"caller")
2110 else if (context ==
"base")
2113 error (R
"(source: CONTEXT must be "caller" or "base")");
2119 dir_end = (dir_end == std::string::npos) ? 0 : dir_end + 1;
2121 std::size_t extension = file_name.find_last_of (
'.');
2122 if (extension == std::string::npos)
2123 extension = file_name.length ();
2125 std::string symbol = file_name.substr (dir_end, extension - dir_end);
2161 file_name, dir_name,
"",
"",
2162 require_file,
true,
false,
false);
2166 error (ee,
"source: error sourcing file '%s'",
2167 file_full_name.c_str ());
2177 error (
"source: %s is not a script", full_name.c_str ());
2181 octave_stdout <<
"executing commands from " << full_name <<
" ... ";
2235 if (args(i).
is_defined () && args(i).is_magic_colon ())
2238 error (
"no default value for argument %d", i+1);
2330 std::list<octave_value> arg_vals;
2332 for (
auto elt : *args)
2347 arg_vals.push_back (tmp_ovl(i));
2350 arg_vals.push_back (tmp);
2372 int nout = nargout > 0 ? nargout : 1;
2377 if (nargout == 0 && !
is_defined (elt->ident ()))
2404 retval(i++) = varargout(j);
2414 bool retval =
false;
2443 if (label_value.
iscell ())
2451 bool match = val.
is_equal (cell(i,j));
2468 m_call_stack.
push (scope);
2473 const std::shared_ptr<stack_frame>& closure_frames)
2475 m_call_stack.
push (fcn, closure_frames);
2481 const std::shared_ptr<stack_frame>& closure_frames)
2483 m_call_stack.
push (fcn, local_vars, closure_frames);
2489 m_call_stack.
push (script);
2495 m_call_stack.
push (fcn);
2501 m_call_stack.
pop ();
2504 std::shared_ptr<stack_frame>
2539 frm->display_stopped_in_message (os);
2620 std::list<std::shared_ptr<stack_frame>>
2626 std::list<std::shared_ptr<stack_frame>>
2632 std::list<frame_info>
2634 bool print_subfn)
const
2636 return m_call_stack.
backtrace_info (curr_user_frame, print_subfn);
2639 std::list<frame_info>
2647 bool print_subfn)
const
2649 return m_call_stack.
backtrace (curr_user_frame, print_subfn);
2669 std::ostringstream buf;
2671 for (
const auto& frm : frames)
2673 buf <<
" " << frm.fcn_name ();
2679 buf <<
" at line " <<
line;
2681 int column = frm.column ();
2684 buf <<
" column " << column;
2698 m_call_stack.
push (dummy_scope);
2704 m_call_stack.
pop ();
2725 error (
"mlock: invalid use outside a function");
2729 warning (
"mlock: locking built-in function has no effect");
2742 error (
"munlock: invalid use outside a function");
2746 warning (
"munlock: unlocking built-in function has no effect");
2759 error (
"mislocked: invalid use outside a function");
2779 std::shared_ptr<stack_frame> frame
2804 std::shared_ptr<stack_frame> frame
2807 frame->clear_objects ();
2813 std::shared_ptr<stack_frame> frame
2816 frame->clear_variable (name);
2822 std::shared_ptr<stack_frame> frame
2825 frame->clear_variable_pattern (pattern);
2831 std::shared_ptr<stack_frame> frame
2834 frame->clear_variable_regexp (pattern);
2840 std::shared_ptr<stack_frame> frame
2843 frame->clear_variables ();
2919 std::list<std::string>
2925 std::list<std::string>
2931 std::list<std::string>
2950 std::string name = fname;
2954 auto beg = name.begin () + 2;
2955 auto end = name.end () - 1;
2959 std::size_t name_len = name.length ();
2961 if (name_len > 2 && name.substr (name_len-2) ==
".m")
2962 name = name.substr (0, name_len-2);
2970 std::size_t p2 = std::string::npos;
2976 if (p1 == std::string::npos)
2979 std::string dispatch_type = name.substr (1, p1-1);
2981 p2 = name.find (
'>', p1);
2983 std::string method = name.substr (p1+1, p2-1);
2991 if (cls.
ok () && cls.
get_name () == dispatch_type)
3000 p2 = name.find (
'>');
3002 std::string main_fcn = name.substr (0, p2);
3008 std::string subfuns;
3010 if (p2 != std::string::npos)
3011 subfuns = name.substr (p2+1);
3016 if (! user_code || subfuns.empty ())
3036 return curfcn->
name ();
3056 m_echo_file_pos =
line + 1;
3068 init_list->
accept (*
this);
3083 error (
"declaration list element not global or persistent");
3103 template <
typename T>
3105 tree_evaluator::execute_range_loop (
const range<T>& rng,
int line,
3113 "FOR loop limit is infinite, will stop after %"
3114 OCTAVE_IDX_TYPE_FORMAT
" steps", steps);
3119 m_echo_file_pos =
line;
3126 loop_body->
accept (*
this);
3128 if (quit_loop_now ())
3183 m_echo_file_pos =
line;
3188 loop_body->
accept (*
this);
3211 if (rhs.
ndims () > 2)
3214 if (nrows > 0 && steps > 0)
3235 m_echo_file_pos =
line;
3244 loop_body->
accept (*
this);
3246 if (quit_loop_now ())
3259 error (
"invalid type in for loop expression near line %d, column %d",
3289 error (
"in statement 'for [X, Y] = VAL', VAL must be a structure");
3297 auto p = lhs->
begin ();
3318 m_echo_file_pos =
line;
3320 std::string key = keys[i];
3332 loop_body->
accept (*
this);
3334 if (quit_loop_now ())
3361 = param_list ? param_list->
dup (new_scope) :
nullptr;
3382 std::set<std::string> free_vars = anon_fcn_ctx.
free_variables ();
3386 std::shared_ptr<stack_frame> frame
3389 for (
auto& name : free_vars)
3394 local_vars[name] = val;
3403 bool is_nested =
false;
3452 error (
"invalid use of colon in function argument list");
3464 retval = (*fcn) (args, nargout);
3469 retval = (*meth) (m_interpreter, args, nargout);
3502 error (
"invalid use of colon in function argument list");
3511 retval =
call_mex (mex_function, args, nargout);
3525 if (args.
length () != 0 || nargout != 0)
3526 error (
"invalid call to script %s", file_name.c_str ());
3536 if (m_call_stack.
size () >=
static_cast<std::size_t
> (m_max_recursion_depth))
3537 error (
"max_recursion_depth exceeded");
3548 cmd_list->
accept (*
this);
3586 m_lvalue_list =
nullptr;
3591 int nargin = args.
length ();
3602 ret_args = args.
slice (0, 1,
true);
3604 args = args.
slice (1, nargin,
true);
3612 bool takes_varargs =
false;
3618 max_inputs = param_list->
length ();
3621 if (! takes_varargs && nargin > max_inputs)
3623 std::string name = user_function.
name ();
3626 name =
"@<anonymous>";
3629 "%s: function called with too many inputs",
3639 int max_outputs = ret_list->
length ();
3641 if (nargout > max_outputs)
3643 std::string name = user_function.
name ();
3646 "%s: function called with too many outputs",
3651 bind_auto_fcn_vars (xargs.
name_tags (), ignored_outputs, nargin,
3661 error (
"%s: invalid classdef constructor, no output argument defined",
3670 if (m_call_stack.
size () >=
static_cast<std::size_t
> (m_max_recursion_depth))
3671 error (
"max_recursion_depth exceeded");
3686 block (m_profiler, user_function);
3708 if (nargout <= 1 && retval.
length () == 1 && retval(0).is_cs_list ())
3709 retval = retval(0).list_value ();
3713 cmd_list->
accept (*
this);
3733 varargout = varargout_varval.
xcell_value (
"varargout must be a cell array object");
3770 std::string nm =
f->name ();
3804 m_echo_file_pos =
line + 1;
3825 m_call_stack.
set_location (tic->line (), tic->column ());
3827 if (m_debug_mode && ! tic->is_else_clause ())
3828 do_breakpoint (tic->is_active_breakpoint (*
this));
3830 if (tic->is_else_clause () || is_logically_true (expr,
"if"))
3835 stmt_lst->
accept (*
this);
3875 m_echo_file_pos =
line + 1;
3921 m_echo_file_pos =
line + 1;
3933 || m_in_loop_command)
3960 upv (m_lvalue_list,
nullptr);
3972 m_echo_file_pos =
line + 1;
3991 bool do_bind_ans =
false;
4004 catch (
const std::bad_alloc&)
4012 "out of memory or dimension too large for Octave's index type");
4014 catch (
const interrupt_exception&)
4045 throw quit_debug_exception (
true);
4059 auto p = lst.
begin ();
4061 if (p != lst.
end ())
4068 error (
"invalid statement found in statement list!");
4074 if (m_breaking || m_continuing)
4080 if (p == lst.
end ())
4124 m_echo_file_pos =
line + 1;
4133 error (
"missing value in switch command near line %d, column %d",
4149 stmt_lst->
accept (*
this);
4166 m_echo_file_pos =
line + 1;
4169 bool execution_error =
false;
4187 try_code->
accept (*
this);
4191 execution_error =
true;
4208 if (execution_error)
4224 catch_code->
accept (*
this);
4269 if (m_breaking || m_returning)
4306 if (m_breaking || m_returning)
4321 m_echo_file_pos =
line + 1;
4328 if (unwind_protect_code)
4332 unwind_protect_code->
accept (*
this);
4353 catch (
const interrupt_exception&)
4390 m_echo_file_pos =
line;
4395 if (is_logically_true (expr,
"while"))
4400 loop_body->
accept (*
this);
4402 if (quit_loop_now ())
4433 m_echo_file_pos =
line;
4438 loop_body->
accept (*
this);
4440 if (quit_loop_now ())
4446 if (is_logically_true (expr,
"do-until"))
4466 static std::string ans =
"ans";
4492 m_interpreter.
feval (
"display", args);
4506 tree_evaluator::do_breakpoint (
bool is_breakpoint,
4507 bool is_end_of_fcn_or_script)
4509 bool break_on_this_statement =
false;
4512 break_on_this_statement =
true;
4513 else if (m_dbstep_flag > 0)
4517 if (m_dbstep_flag == 1 || is_end_of_fcn_or_script)
4525 break_on_this_statement =
true;
4535 else if (m_dbstep_flag == 1
4542 break_on_this_statement =
true;
4545 else if (m_dbstep_flag == -1)
4549 break_on_this_statement =
true;
4553 else if (m_dbstep_flag == -2)
4561 if (is_end_of_fcn_or_script
4566 if (! break_on_this_statement)
4567 break_on_this_statement = m_break_on_next_stmt;
4569 m_break_on_next_stmt =
false;
4571 if (break_on_this_statement)
4581 const char *warn_for)
4583 bool expr_value =
false;
4592 error (
"%s: undefined value used in conditional expression", warn_for);
4602 "max_recursion_depth", 0);
4636 for (
const auto& fcn_fname : m_autoload_map)
4638 fcn_names(i) = fcn_fname.first;
4639 file_names(i) = fcn_fname.second;
4646 m.assign (
"function", fcn_names);
4647 m.assign (
"file", file_names);
4657 auto p = m_autoload_map.find (nm);
4659 if (p != m_autoload_map.end ())
4669 std::list<std::string>
4672 std::list<std::string> names;
4674 for (
const auto& fcn_fname : m_autoload_map)
4675 names.push_back (fcn_fname.first);
4680 std::list<std::string>
4683 std::list<std::string> names;
4685 for (
const auto& fcn_fname : m_autoload_map)
4686 if (nm == fcn_fname.second)
4687 names.push_back (fcn_fname.first);
4694 const std::string& nm)
4696 m_autoload_map[fcn] = check_autoload_file (nm);
4701 const std::string& nm)
4703 check_autoload_file (nm);
4710 m_autoload_map.erase (fcn);
4717 "whos_line_format");
4724 "silent_functions");
4731 "string_fill_char");
4742 std::string extra_message;
4746 std::string var = expr->
name ();
4758 if (fp && fp->
name () == var)
4760 =
" (note: variable '" + var +
"' shadows function)";
4764 std::string msg = ie.message () + extra_message;
4771 bool return_list,
bool verbose)
4773 return m_call_stack.
do_who (argc, argv, return_list, verbose);
4785 upv (m_lvalue_list,
nullptr);
4792 m_num_indices =
len;
4794 std::list<octave_value> arg_vals;
4798 for (
auto elt : *args)
4805 m_index_position = k++;
4814 arg_vals.push_back (tmp_ovl(i));
4817 arg_vals.push_back (tmp);
4831 std::list<octave_lvalue>
4834 std::list<octave_lvalue> retval;
4837 retval.push_back (elt->lvalue (*
this));
4850 push_echo_state_cleanup (*frame);
4852 set_echo_state (type, file_name, pos);
4857 tree_evaluator::set_echo_state (
int type,
const std::string& file_name,
4860 m_echo_state = echo_this_file (file_name, type);
4862 m_echo_file_name = file_name;
4863 m_echo_file_pos = pos;
4867 tree_evaluator::uwp_set_echo_state (
bool state,
const std::string& file_name,
4870 m_echo_state = state;
4872 m_echo_file_name = file_name;
4873 m_echo_file_pos = pos;
4877 tree_evaluator::maybe_set_echo_state ()
4898 set_echo_state (type, file_name, pos);
4905 frame.
add (&tree_evaluator::uwp_set_echo_state,
this,
4906 m_echo_state, m_echo_file_name, m_echo_file_pos);
4910 tree_evaluator::maybe_push_echo_state_cleanup ()
4921 push_echo_state_cleanup (*frame);
4932 bool cleanup_pushed = maybe_push_echo_state_cleanup ();
4942 m_echo_files.clear ();
4950 std::string arg0 = argv[0];
4954 else if (arg0 ==
"off")
4959 file = sys::env::make_absolute (file);
4962 error (
"echo: no such file %s", arg0.c_str ());
4969 m_echo_files[file] =
false;
4975 auto p = m_echo_files.find (file);
4977 if (p == m_echo_files.end ())
4982 m_echo_files[file] =
true;
4989 p->second = ! p->second;
4998 std::string arg0 = argv[0];
4999 std::string arg1 = argv[1];
5001 if (arg1 ==
"on" || arg1 ==
"off")
5002 std::swap (arg0, arg1);
5009 m_echo_files.clear ();
5014 file = sys::env::make_absolute (file);
5017 error (
"echo: no such file %s", arg1.c_str ());
5020 m_echo_files[file] =
true;
5023 else if (arg0 ==
"off")
5028 m_echo_files.clear ();
5033 file = sys::env::make_absolute (file);
5036 error (
"echo: no such file %s", arg1.c_str ());
5038 m_echo_files[file] =
false;
5052 maybe_set_echo_state ();
5060 return (m_debugger_stack.empty ()
5061 ?
false : m_debugger_stack.top()->in_debug_repl ());
5067 if (! m_debugger_stack.empty ())
5068 m_debugger_stack.top()->dbcont ();
5074 if (! m_debugger_stack.empty ())
5075 m_debugger_stack.top()->dbquit (all);
5081 int nargin = args.
length ();
5083 if (nargin != 0 && nargin != 3)
5089 = args(1).xidx_type_value (
"end: K must be integer value");
5092 error (
"end: K must be greater than zero");
5095 = args(2).xidx_type_value (
"end: N must be integer value");
5098 error (
"end: N must be greater than zero");
5110 error (
"invalid use of 'end': may only be used to index existing value");
5114 if (m_index_list.empty ())
5115 expr_result = m_indexed_object;
5142 = m_indexed_object.
subsref (m_index_type, m_index_list, 1);
5151 error (
"error evaluating partial expression for END");
5161 std::string dispatch_class = expr_result.
class_name ();
5168 return m_interpreter.
feval
5169 (meth,
ovl (expr_result, m_index_position+1, m_num_indices), 1);
5182 tree_evaluator::echo_this_file (
const std::string& file,
int type)
const
5195 auto p = m_echo_files.find (file);
5202 return (p == m_echo_files.end () || p->second);
5208 return p != m_echo_files.end () && p->second;
5216 tree_evaluator::echo_code (
int line)
5226 int num_lines =
line - m_echo_file_pos + 1;
5228 std::deque<std::string> lines
5231 for (
auto& elt : lines)
5238 tree_evaluator::quit_loop_now ()
5247 bool quit = (m_returning || m_breaking || m_continuing);
5256 tree_evaluator::bind_auto_fcn_vars (
const string_vector& arg_names,
5257 const Matrix& ignored_outputs,
5258 int nargin,
int nargout,
5273 tree_evaluator::check_autoload_file (
const std::string& nm)
const
5275 if (sys::env::absolute_pathname (nm))
5278 std::string full_name = nm;
5288 if (! fname.empty ())
5290 fname = sys::env::make_absolute (fname);
5293 sys::file_stat fs (fname + nm);
5297 full_name = fname + nm;
5305 "autoload: '%s' is not an absolute filename",
5311 DEFMETHOD (max_recursion_depth, interp, args, nargout,
5346 DEFMETHOD (whos_line_format, interp, args, nargout,
5427 DEFMETHOD (silent_functions, interp, args, nargout,
5461 DEFMETHOD (string_fill_char, interp, args, nargout,
5527 return interp.PS4 (args, nargout);
5573 return tw.
echo (args, nargout);
5586 OCTAVE_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 bool forced_interactive()
static application * app()
std::size_t length() const
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)
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::shared_ptr< stack_frame > get_current_stack_frame() const
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_class find_class(const std::string &name, bool error_if_not_found=true, bool load_if_not_found=true)
octave_value get_function() const
cdef_class get_class() 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)
virtual const char * err_id() const =0
void set_var(const std::string &var_arg="")
cdef_manager & get_cdef_manager()
event_manager & get_event_manager()
symbol_table & get_symbol_table()
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)
load_path & get_load_path()
error_system & get_error_system()
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)
line(const graphics_handle &mh, const graphics_handle &p)
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::cdef_object get_object() const
std::string class_name() const
octave_classdef * classdef_object_value(bool=false)
virtual std::list< std::string > parent_fcn_names() 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())
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 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()
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 * parameter_list()
bool is_anonymous_function() const
void restore_warning_states()
octave::tree_parameter_list * return_list()
void mark_as_anonymous_function()
void mark_as_nested_function()
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)
bool has_magic_colon() const
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()
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_value index_op(const octave_value_list &idx, bool resize_ok=false)
bool is_scalar_type() const
octave::range< double > range_value() const
octave_idx_type end_index(octave_idx_type index_position, octave_idx_type num_indices) const
octave_user_code * user_code_value(bool silent=false) const
bool is_equal(const octave_value &) const
octave_value storable_value() const
octave_function * function_value(bool silent=false) const
octave_value reshape(const dim_vector &dv) const
octave_map map_value() const
bool is_matrix_type() const
bool is_double_type() const
bool is_user_code() const
std::string xstring_value(const char *fmt,...) 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)
symbol_scope scope() const
tree_parameter_list * parameter_list() const
tree_expression * expression() const
std::set< std::string > free_variables() const
tree_statement_list * body()
tree_argument_list * left_hand_side()
tree_expression * control_expr()
tree_decl_init_list * initializer_list()
tree_identifier * ident()
bool is_persistent() const
tree_expression * expression()
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)
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 keyboard(const std::string &prompt="keyboard> ")
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)
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)
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 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)
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 &)
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)
std::shared_ptr< push_parser > get_parser()
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 &)
std::shared_ptr< stack_frame > current_user_frame() const
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)
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
virtual tree_expression * dup(symbol_scope &scope) const =0
tree_expression * set_print_flag(bool print)
virtual std::string name() const
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
bool is_expression() const
tree_expression * expression()
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_statement_list * cleanup()
tree_identifier * identifier()
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 void accept(tree_walker &tw)=0
virtual int column() const
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 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 interpreter_try(octave::unwind_protect &)
#define panic_impossible()
void err_indexed_cs_list()
std::string dir_sep_str()
std::string dir_sep_chars()
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)
std::string tilde_expand(const std::string &name)
std::string canonicalize_file_name(const std::string &name)
bool valid_identifier(const char *s)
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
int release_unreferenced_dynamic_libraries()
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.
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)
std::atomic< sig_atomic_t > octave_interrupt_state
std::string fcn_file_in_path(const std::string &)
void sleep(double seconds, bool do_graphics_events=false)