From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21351 invoked by alias); 26 Jun 2002 17:56:21 -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 21311 invoked from network); 26 Jun 2002 17:56:19 -0000 Received: from unknown (HELO gash2.peakpeak.com) (207.174.178.17) by sources.redhat.com with SMTP; 26 Jun 2002 17:56:19 -0000 Received: from fleche.redhat.com (ta0196.peakpeak.com [204.144.244.196]) by gash2.peakpeak.com (8.9.3/8.9.3) with ESMTP id LAA08361 for ; Wed, 26 Jun 2002 11:56:14 -0600 Received: by fleche.redhat.com (Postfix, from userid 1000) id 71F0F4F80AA; Wed, 26 Jun 2002 12:09:03 -0600 (MDT) To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: add_setshow_cmd_full References: <878z53dqr9.fsf@fleche.redhat.com> <3D192849.3080904@cygnus.com> <873cvahaqt.fsf@fleche.redhat.com> <3D19D248.7040102@cygnus.com> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom X-Zippy: If I have enough money to buy 5,000 CANS of NOODLE-RONI, can I get a VAT of MARSHMALLOW FLUFF free?? Date: Wed, 26 Jun 2002 10:56:00 -0000 In-Reply-To: <3D19D248.7040102@cygnus.com> Message-ID: <87ptydewu8.fsf@fleche.redhat.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-06/txt/msg00541.txt.bz2 >>>>> "Andrew" == Andrew Cagney writes: Andrew> If I understand right, with the above applied, a new Andrew> add_setshow_cmd(..), that returns void, can be implemented using Andrew> add_setshow_cmd_full(). Yes. I went ahead and made that change. The new patch is appended. It subsumes the last two add_setshow_cmd() patches. This time built with -Werror :-). Ok to commit? After this I'll submit my jumbo "use add_setshow_cmd instead of add_show_from_set" patch. Tom 2002-06-26 Tom Tromey * command.h (add_setshow_cmd): Declare. (add_setshow_cmd_full): Declare. * cli/cli-decode.c (add_setshow_cmd): No longer static. Now returns void. Use add_setshow_cmd_full. (add_setshow_cmd_full): New function. (add_setshow_auto_boolean_cmd): Use add_setshow_cmd_full. (add_setshow_boolean_cmd): Likewise. Index: command.h =================================================================== RCS file: /cvs/src/src/gdb/command.h,v retrieving revision 1.33 diff -u -r1.33 command.h --- command.h 15 Jun 2002 22:05:32 -0000 1.33 +++ command.h 26 Jun 2002 17:54:08 -0000 @@ -210,6 +210,26 @@ extern void help_cmd_list (struct cmd_list_element *, enum command_class, char *, int, struct ui_file *); +extern void add_setshow_cmd (char *name, + enum command_class class, + var_types var_type, void *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, + cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list); + +extern void add_setshow_cmd_full (char *name, + enum command_class class, + var_types var_type, void *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, + cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list, + struct cmd_list_element **set_result, + struct cmd_list_element **show_result); + extern struct cmd_list_element *add_set_cmd (char *name, enum command_class class, var_types var_type, void *var, Index: cli/cli-decode.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v retrieving revision 1.25 diff -u -r1.25 cli-decode.c --- cli/cli-decode.c 25 Jun 2002 05:39:18 -0000 1.25 +++ cli/cli-decode.c 26 Jun 2002 17:54:11 -0000 @@ -331,14 +331,16 @@ command. SET_FUNC and SHOW_FUNC are the callback functions (if non-NULL). SET_DOC and SHOW_DOC are the documentation strings. */ -static struct cmd_list_element * -add_setshow_cmd (char *name, - enum command_class class, - var_types var_type, void *var, - char *set_doc, char *show_doc, - cmd_sfunc_ftype *set_func, cmd_sfunc_ftype *show_func, - struct cmd_list_element **set_list, - struct cmd_list_element **show_list) +void +add_setshow_cmd_full (char *name, + enum command_class class, + var_types var_type, void *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list, + struct cmd_list_element **set_result, + struct cmd_list_element **show_result) { struct cmd_list_element *set; struct cmd_list_element *show; @@ -350,9 +352,31 @@ show_doc, show_list); if (show_func != NULL) set_cmd_sfunc (show, show_func); - /* The caller often wants to modify set to include info like an - enumeration. */ - return set; + + if (set_result != NULL) + *set_result = set; + if (show_result != NULL) + *show_result = show; +} + +/* Add element named NAME to both the command SET_LIST and SHOW_LIST. + CLASS is as in add_cmd. VAR_TYPE is the kind of thing we are + setting. VAR is address of the variable being controlled by this + command. SET_FUNC and SHOW_FUNC are the callback functions (if + non-NULL). SET_DOC and SHOW_DOC are the documentation strings. */ + +void +add_setshow_cmd (char *name, + enum command_class class, + var_types var_type, void *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list) +{ + add_setshow_cmd_full (name, class, var_type, var, set_doc, show_doc, + set_func, show_func, set_list, show_list, + NULL, NULL); } struct cmd_list_element * @@ -405,9 +429,10 @@ { static const char *auto_boolean_enums[] = { "on", "off", "auto", NULL }; struct cmd_list_element *c; - c = add_setshow_cmd (name, class, var_auto_boolean, var, - set_doc, show_doc, set_func, show_func, - set_list, show_list); + add_setshow_cmd_full (name, class, var_auto_boolean, var, + set_doc, show_doc, set_func, show_func, + set_list, show_list, + &c, NULL); c->enums = auto_boolean_enums; } @@ -426,10 +451,11 @@ { static const char *boolean_enums[] = { "on", "off", NULL }; struct cmd_list_element *c; - c = add_setshow_cmd (name, class, var_boolean, var, - set_doc, show_doc, - set_func, show_func, - set_list, show_list); + add_setshow_cmd_full (name, class, var_boolean, var, + set_doc, show_doc, + set_func, show_func, + set_list, show_list, + &c, NULL); c->enums = boolean_enums; }