aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-06-26 20:58:17 +0000
committerTom Tromey <tromey@redhat.com>2002-06-26 20:58:17 +0000
commit9f064c95194a51d61bfcff02b4fabbd183fd4aae (patch)
treea7e1a8e6e12a3367f63eb1ff52169e40248a97b7 /gdb/cli
parent7655ea92770345b6d557295cdde8ed6bc7f53dd9 (diff)
downloadgdb-9f064c95194a51d61bfcff02b4fabbd183fd4aae.zip
gdb-9f064c95194a51d61bfcff02b4fabbd183fd4aae.tar.gz
gdb-9f064c95194a51d61bfcff02b4fabbd183fd4aae.tar.bz2
* 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.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c66
1 files changed, 47 insertions, 19 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 3efee97..098c13a 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -329,16 +329,20 @@ add_set_or_show_cmd (char *name,
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. */
+ non-NULL). SET_DOC and SHOW_DOC are the documentation strings.
+ SET_RESULT and SHOW_RESULT, if not NULL, are set to the resulting
+ command structures. */
-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 +354,31 @@ add_setshow_cmd (char *name,
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 +431,10 @@ add_setshow_auto_boolean_cmd (char *name,
{
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 +453,11 @@ add_setshow_boolean_cmd (char *name,
{
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;
}