logo       

RFA: add_setshow_cmd_full: msg#00518

Subject: RFA: add_setshow_cmd_full
In some situations we need to get both the set and show command
structure back when creating a set/show pair.  I propose a new
add_setshow_cmd_full function that returns both.

This patch includes my previous patch to make add_setshow_cmd public.

Ok?  Or is there another way you'd prefer I approach this problem?

I've converted all the add_show_from_set calls to use add_setshow_cmd.
This patch or something like it has to go in before I can completely
finish that patch.  At this point I'm going to stop working on
gettextization until the patch backlog clears up a bit.  It gets hard
to manage the patches when many files have already been touched.

Tom

2002-06-25  Tom Tromey  <tromey@xxxxxxxxxx>

        * cli/cli-decode.c (add_setshow_cmd_full): New function.
        (add_setshow_cmd): Use it.
        * command.h (add_setshow_cmd_full): Declare.

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 25 Jun 2002 20:37:04 -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,35 @@
                              show_doc, show_list);
   if (show_func != NULL)
     set_cmd_sfunc (show, show_func);
+
+  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.  */
+
+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)
+{
+  cmd_list_element *result;
   /* The caller often wants to modify set to include info like an
      enumeration.  */
-  return set;
+  add_setshow_cmd_full (name, class, var_type, var, set_doc, show_doc,
+                       set_func, show_func, set_list, show_list,
+                       &result, NULL);
+  return result;
 }
 
 struct cmd_list_element *
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 25 Jun 2002 20:37:04 -0000
@@ -210,6 +210,28 @@
 extern void help_cmd_list (struct cmd_list_element *, enum command_class,
                           char *, int, struct ui_file *);
 
+extern 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);
+
+extern struct cmd_list_element *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,



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe