octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New class method for tree_evaluator.


From: John W. Eaton
Subject: New class method for tree_evaluator.
Date: Thu, 28 Jan 2010 01:11:39 -0500

On 27-Jan-2010, Ryan Rusaw wrote:

| This is a simple patch which lets subclasses of tree_evaluator override the
| standard keyboard handler (do_keyboard) for breakpoints. In my use case I
| control the debug flow (ie dbstep, dbcont etc) via control messages from a
| network socket.

| diff --git a/src/pt-eval.h b/src/pt-eval.h
| --- a/src/pt-eval.h
| +++ b/src/pt-eval.h
| @@ -163,6 +163,9 @@
|    void do_breakpoint (bool is_breakpoint,
|                     bool is_end_of_fcn_or_script = false) const;
|  
| +  virtual octave_value do_keyboard_impl (
| +               const octave_value_list& args = octave_value_list ()) const;
| +
|    // No copying!
|  
|    tree_evaluator (const tree_evaluator&);

| diff --git a/src/pt-eval.cc b/src/pt-eval.cc
| --- a/src/pt-eval.cc
| +++ b/src/pt-eval.cc
| @@ -1154,7 +1154,14 @@
|      }
|  
|    if (break_on_this_statement)
| -    do_keyboard ();
| +    do_keyboard_impl ();
| +
| +}
| +
| +octave_value
| +tree_evaluator::do_keyboard_impl (const octave_value_list& args) const
| +{
| +     return do_keyboard(args);
|  }

How does your derived class work?  Unless you are also providing a
replacement for do_breakpoint, then how is args anything bug an empty
list, in which case it seems better to just omit the argument.

If you are overriding the tree_evaluator::do_breakpoint function, then
why do you need the do_keyboard_impl function?

If you do need the do_keyboard_impl function, then I'd prefer to just
call it "do_keyboard", and to call the external non-class-member
function using "::do_keyboard".

If you are using Mercurial, then please submit hg changesets produced
with hg export so that we don't have to manually insert commit log
messages and your user id when applying your changes.

When a declaration is too long for a single line as the one for
do_keyboard_impl above, please write something like

  virtual octave_value
  do_keyboard_impl (const octave_value_list& args = octave_value_list ()) const;

instad of splitting the line after the (.

Also, please try to keep ChangeLog entries less than 80 characters
wide.

Thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]