From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10938 invoked by alias); 18 Mar 2002 17:06:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10781 invoked from network); 18 Mar 2002 17:06:26 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 18 Mar 2002 17:06:26 -0000 Received: from redhat.com (rtl.cygnus.com [205.180.230.21]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id JAA18313; Mon, 18 Mar 2002 09:06:24 -0800 (PST) Message-ID: <3C961E27.34088BD7@redhat.com> Date: Mon, 18 Mar 2002 09:06:00 -0000 From: Fernando Nasser Organization: Red Hat Canada X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.9-21 i686) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Cagney CC: gdb-patches@sources.redhat.com Subject: Re: [rfa:cli] Add {set,get}_cmd_context() or set_cmd_ccfunc() References: <3C797A8F.7040108@cygnus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00313.txt.bz2 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