[rfa:cli] Add {set,get}_cmd_context() or set_cmd_ccfunc()

Fernando Nasser fnasser@redhat.com
Mon Mar 18 09:06:00 GMT 2002


Andrew Cagney wrote:
> 
> Hello,
> 
> The current command mechanism doesn't provide a way for a call-back
> function (cfunc or sfunc) to bind a local state/context to a command.
> Consequently, it isn't possible to use a single callback function as a
> generic handler for a number of similar commands.
> 
> For instance the ``set/show remote ...'' (remote.c) each require an
> individual wrapper function.  By adding a context/state, it becomes
> possible for a common function to handle all cases.
> 
> I can think of two ways of implementing this.  Using:
> 
> set_cmd_context() / get_cmd_context()
> 
> as with this patch; or add a new callback function that takes an
> additional context parameter vis:
> 
> set_cmd_ccfunc(cmd, void (*ccfunc) (c, cmd, tty, context), context);
> 
> The choice, I think is pretty arbitrary and I'm happy to change it to
> either.
> 
> Preference?  Ok?
> 

I prefer the first one (your patch), which I think is OK for check-in.

As nobody has objected or stated another preference so far I would
say you go ahead and commit your patch.

Thanks.
Fernando

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9



More information about the Gdb-patches mailing list