This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa:cli] Add {set,get}_cmd_context() or set_cmd_ccfunc()
- From: Fernando Nasser <fnasser at redhat dot com>
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 18 Mar 2002 12:04:39 -0500
- Subject: Re: [rfa:cli] Add {set,get}_cmd_context() or set_cmd_ccfunc()
- Organization: Red Hat Canada
- References: <3C797A8F.7040108@cygnus.com>
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