/* The corresponding gdb command objects.
These are NULL if the parameter has not been registered yet, or
is no longer registered. */
- struct cmd_list_element *set_command;
- struct cmd_list_element *show_command;
+ set_show_commands commands;
/* The value of the parameter. */
union pascm_variable value;
static int
pascm_is_valid (param_smob *p_smob)
{
- return p_smob->set_command != NULL;
+ return p_smob->commands.set != nullptr;
}
\f
/* A helper function which return the default documentation string for
/* A helper function that dispatches to the appropriate add_setshow
function. */
-static void
+static set_show_commands
add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
char *cmd_name, param_smob *self,
char *set_doc, char *show_doc, char *help_doc,
cmd_const_sfunc_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
- struct cmd_list_element **show_list,
- struct cmd_list_element **set_cmd,
- struct cmd_list_element **show_cmd)
+ struct cmd_list_element **show_list)
{
- struct cmd_list_element *param = NULL;
- const char *tmp_name = NULL;
+ set_show_commands commands;
switch (param_type)
{
case var_boolean:
- add_setshow_boolean_cmd (cmd_name, cmd_class,
- &self->value.boolval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
-
+ commands = add_setshow_boolean_cmd (cmd_name, cmd_class,
+ &self->value.boolval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_auto_boolean:
- add_setshow_auto_boolean_cmd (cmd_name, cmd_class,
- &self->value.autoboolval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_auto_boolean_cmd (cmd_name, cmd_class,
+ &self->value.autoboolval,
+ set_doc, show_doc, help_doc,
+ set_func, show_func, set_list,
+ show_list);
break;
case var_uinteger:
- add_setshow_uinteger_cmd (cmd_name, cmd_class,
- &self->value.uintval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_uinteger_cmd (cmd_name, cmd_class,
+ &self->value.uintval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_zinteger:
- add_setshow_zinteger_cmd (cmd_name, cmd_class,
- &self->value.intval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_zinteger_cmd (cmd_name, cmd_class,
+ &self->value.intval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_zuinteger:
- add_setshow_zuinteger_cmd (cmd_name, cmd_class,
- &self->value.uintval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_zuinteger_cmd (cmd_name, cmd_class,
+ &self->value.uintval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_zuinteger_unlimited:
- add_setshow_zuinteger_unlimited_cmd (cmd_name, cmd_class,
- &self->value.intval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_zuinteger_unlimited_cmd (cmd_name, cmd_class,
+ &self->value.intval,
+ set_doc, show_doc,
+ help_doc, set_func,
+ show_func, set_list,
+ show_list);
break;
case var_string:
- add_setshow_string_cmd (cmd_name, cmd_class,
- &self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_string_cmd (cmd_name, cmd_class,
+ &self->value.stringval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_string_noescape:
- add_setshow_string_noescape_cmd (cmd_name, cmd_class,
- &self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_string_noescape_cmd (cmd_name, cmd_class,
+ &self->value.stringval,
+ set_doc, show_doc, help_doc,
+ set_func, show_func, set_list,
+ show_list);
break;
case var_optional_filename:
- add_setshow_optional_filename_cmd (cmd_name, cmd_class,
- &self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_optional_filename_cmd (cmd_name, cmd_class,
+ &self->value.stringval,
+ set_doc, show_doc, help_doc,
+ set_func, show_func,
+ set_list, show_list);
break;
case var_filename:
- add_setshow_filename_cmd (cmd_name, cmd_class,
- &self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_filename_cmd (cmd_name, cmd_class,
+ &self->value.stringval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_enum:
- add_setshow_enum_cmd (cmd_name, cmd_class,
- self->enumeration,
- &self->value.cstringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands = add_setshow_enum_cmd (cmd_name, cmd_class, self->enumeration,
+ &self->value.cstringval, set_doc,
+ show_doc, help_doc, set_func, show_func,
+ set_list, show_list);
/* Initialize the value, just in case. */
self->value.cstringval = self->enumeration[0];
break;
gdb_assert_not_reached ("bad param_type value");
}
- /* Lookup created parameter, and register Scheme object against the
- parameter context. Perform this task against both lists. */
- tmp_name = cmd_name;
- param = lookup_cmd (&tmp_name, *show_list, "", NULL, 0, 1);
- gdb_assert (param != NULL);
- param->set_context (self);
- *set_cmd = param;
-
- tmp_name = cmd_name;
- param = lookup_cmd (&tmp_name, *set_list, "", NULL, 0, 1);
- gdb_assert (param != NULL);
- param->set_context (self);
- *show_cmd = param;
+ /* Register Scheme object against the commandsparameter context. Perform this
+ task against both lists. */
+ commands.set->set_context (self);
+ commands.show->set_context (self);
+
+ return commands;
}
/* Return an array of strings corresponding to the enum values for
gdbscm_gdb_exception exc {};
try
{
- add_setshow_generic (p_smob->type, p_smob->cmd_class,
- p_smob->cmd_name, p_smob,
- p_smob->set_doc, p_smob->show_doc, p_smob->doc,
- (gdbscm_is_procedure (p_smob->set_func)
- ? pascm_set_func : NULL),
- (gdbscm_is_procedure (p_smob->show_func)
- ? pascm_show_func : NULL),
- set_list, show_list,
- &p_smob->set_command, &p_smob->show_command);
+ p_smob->commands = add_setshow_generic
+ (p_smob->type, p_smob->cmd_class, p_smob->cmd_name, p_smob,
+ p_smob->set_doc, p_smob->show_doc, p_smob->doc,
+ (gdbscm_is_procedure (p_smob->set_func) ? pascm_set_func : NULL),
+ (gdbscm_is_procedure (p_smob->show_func) ? pascm_show_func : NULL),
+ set_list, show_list);
}
catch (const gdb_exception &except)
{