octave-maintainers
[Top][All Lists]
Advanced

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

Re: New class method for tree_evaluator.


From: Ryan Rusaw
Subject: Re: New class method for tree_evaluator.
Date: Thu, 28 Jan 2010 00:51:57 -0600



On Thu, Jan 28, 2010 at 12:11 AM, John W. Eaton <address@hidden> wrote:
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.


It just calls a different handler for instead of do_keyboard()
 

octave_value

dbgp_evaluator::do_keyboard_impl (const octave_value_list& args) const

{

return debugger.do_keyboard(args);

}

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


No I just want to override the do_keyboard call at the end of do_breakpoint to call
another function instead.
 
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 that's the preferred form, I'll make the changes and resubmit a fixed patch.
 
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.


Oops,  I thought I had.
 

Thanks,

jwe


Ryan


reply via email to

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