Mercurial > hg > octave-nkf
changeset 19575:5db5619fe54e
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 04 Dec 2014 16:22:26 -0500 |
parents | 9ef286208da1 (current diff) c1ce43276b86 (diff) |
children | af41e41ad28e |
files | libgui/src/main-window.cc libinterp/corefcn/debug.cc libinterp/corefcn/input.cc libinterp/parse-tree/lex.ll libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h liboctave/util/cmd-edit.cc liboctave/util/cmd-edit.h liboctave/util/oct-rl-edit.c liboctave/util/oct-rl-edit.h |
diffstat | 10 files changed, 106 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -2198,13 +2198,22 @@ _dbg_queue_mutex.unlock (); if (debug == "step") - Fdbstep (); + { + Fdb_next_breakpoint_quiet (); + Fdbstep (); + } else if (debug == "cont") - Fdbcont (); + { + Fdb_next_breakpoint_quiet (); + Fdbcont (); + } else if (debug == "quit") Fdbquit (); else - Fdbstep (ovl (debug.toStdString ())); + { + Fdb_next_breakpoint_quiet (); + Fdbstep (ovl (debug.toStdString ())); + } command_editor::interrupt (true); }
--- a/libinterp/corefcn/debug.cc +++ b/libinterp/corefcn/debug.cc @@ -1546,3 +1546,38 @@ return retval; } + +DEFUN (db_next_breakpoint_quiet, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} db_next_breakpoint_quiet ()\n\ +@deftypefnx {Built-in Function} {} db_next_breakpoint_quiet (@var{flag})\n\ +Disable line info printing at the next breakpoint. With a logical\n\ +argument, set the state on or off.\n\ +@end deftypefn") +{ + octave_value retval; + + int nargin = args.length (); + + if (nargin == 0 || nargin == 1) + { + bool state = true; + + if (nargin == 1) + { + state = args(0).bool_value (); + + if (error_state) + { + gripe_wrong_type_arg ("db_next_breakpoint", args(0), true); + return retval; + } + } + + tree_evaluator::quiet_breakpoint_flag = state; + } + else + print_usage (); + + return retval; +}
--- a/libinterp/corefcn/input.cc +++ b/libinterp/corefcn/input.cc @@ -184,10 +184,13 @@ eof = false; std::string retval = command_editor::readline (s, eof); - + if (! eof && retval.empty ()) retval = "\n"; + if (command_editor::interrupt (false)) + retval = ""; + return retval; } @@ -508,6 +511,9 @@ { unwind_protect frame; + bool silent = tree_evaluator::quiet_breakpoint_flag; + tree_evaluator::quiet_breakpoint_flag = false; + octave_user_code *caller = octave_call_stack::caller_user_code (); std::string nm; int curr_debug_line; @@ -544,10 +550,13 @@ // that we are stopped on the no-op command that marks the // end of a function or script. - buf << "stopped in " << nm; + if (! silent) + { + buf << "stopped in " << nm; - if (curr_debug_line > 0) - buf << " at line " << curr_debug_line; + if (curr_debug_line > 0) + buf << " at line " << curr_debug_line; + } if (have_file) { @@ -558,15 +567,21 @@ frame.add_fcn (execute_in_debugger_handler, std::pair<std::string, int> (nm, curr_debug_line)); - std::string line_buf - = get_file_line (nm, curr_debug_line); + if (! silent) + { + std::string line_buf + = get_file_line (nm, curr_debug_line); - if (! line_buf.empty ()) - buf << "\n" << curr_debug_line << ": " << line_buf; + if (! line_buf.empty ()) + buf << "\n" << curr_debug_line << ": " << line_buf; + } } } } + if (silent) + command_editor::erase_empty_line (true); + std::string msg = buf.str (); if (! msg.empty ()) @@ -595,7 +610,7 @@ if (command_editor::interrupt (false)) break; - else + else { if (retval == 0 && curr_parser.stmt_list) { @@ -910,6 +925,7 @@ octave_call_stack::goto_frame_relative (0); tree_evaluator::debug_mode = true; + tree_evaluator::quiet_breakpoint_flag = false; tree_evaluator::current_frame = octave_call_stack::current_frame ();
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -3437,12 +3437,7 @@ if (! input_buf.empty ()) status = input_buf.copy_chunk (buf, max_size); else - { - status = YY_NULL; - - if (! input_buf.at_eof ()) - fatal_error ("octave_base_lexer::fill_flex_buffer failed"); - } + status = YY_NULL; return status; } @@ -3458,12 +3453,7 @@ if (! input_buf.empty ()) status = input_buf.copy_chunk (buf, max_size); else - { - status = YY_NULL; - - if (! input_buf.at_eof ()) - fatal_error ("octave_base_lexer::fill_flex_buffer failed"); - } + status = YY_NULL; return status; }
--- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -57,6 +57,8 @@ bool tree_evaluator::debug_mode = false; +bool tree_evaluator::quiet_breakpoint_flag = false; + tree_evaluator::stmt_list_type tree_evaluator::statement_context = tree_evaluator::other;
--- a/libinterp/parse-tree/pt-eval.h +++ b/libinterp/parse-tree/pt-eval.h @@ -151,6 +151,8 @@ static bool debug_mode; + static bool quiet_breakpoint_flag; + // Possible types of evaluation contexts. enum stmt_list_type {
--- a/liboctave/util/cmd-edit.cc +++ b/liboctave/util/cmd-edit.cc @@ -108,6 +108,8 @@ void do_blink_matching_paren (bool flag); + bool do_erase_empty_line (bool flag); + void do_set_basic_word_break_characters (const std::string& s); void do_set_completer_word_break_characters (const std::string& s); @@ -379,6 +381,12 @@ ::octave_rl_enable_paren_matching (flag ? 1 : 0); } +bool +gnu_readline::do_erase_empty_line (bool flag) +{ + return ::octave_rl_erase_empty_line (flag ? 1 : 0); +} + void gnu_readline::do_set_basic_word_break_characters (const std::string& s) { @@ -1177,6 +1185,12 @@ instance->do_blink_matching_paren (flag); } +bool +command_editor::erase_empty_line (bool flag) +{ + return instance_ok () ? instance->do_erase_empty_line (flag) : false; +} + void command_editor::set_basic_word_break_characters (const std::string& s) {
--- a/liboctave/util/cmd-edit.h +++ b/liboctave/util/cmd-edit.h @@ -91,6 +91,8 @@ static void blink_matching_paren (bool flag); + static bool erase_empty_line (bool flag); + static void set_basic_word_break_characters (const std::string& s); static void set_completer_word_break_characters (const std::string& s); @@ -262,6 +264,8 @@ virtual void do_blink_matching_paren (bool) { } + virtual bool do_erase_empty_line (bool) { return false; } + virtual void do_set_basic_word_break_characters (const std::string&) { } virtual void do_set_completer_word_break_characters (const std::string&) { }
--- a/liboctave/util/oct-rl-edit.c +++ b/liboctave/util/oct-rl-edit.c @@ -74,6 +74,14 @@ rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); } +int +octave_rl_erase_empty_line (int val) +{ + int retval = rl_erase_empty_line; + rl_erase_empty_line = val; + return retval; +} + /* It would be much simpler if we could just call _rl_clear_screen to only clear the screen, but it is not a public function, and on some systems, it is not exported from shared library versions of