void
add_catch_command (const char *name, const char *docstring,
- cmd_const_sfunc_ftype *sfunc,
+ cmd_func_ftype *func,
completer_ftype *completer,
void *user_data_catch,
void *user_data_tcatch)
command = add_cmd (name, class_breakpoint, docstring,
&catch_cmdlist);
- set_cmd_sfunc (command, sfunc);
+ command->func = func;
command->set_context (user_data_catch);
set_cmd_completer (command, completer);
command = add_cmd (name, class_breakpoint, docstring,
&tcatch_cmdlist);
- set_cmd_sfunc (command, sfunc);
+ command->func = func;
command->set_context (user_data_tcatch);
set_cmd_completer (command, completer);
}
extern void
add_catch_command (const char *name, const char *docstring,
- cmd_const_sfunc_ftype *sfunc,
+ cmd_func_ftype *func,
completer_ftype *completer,
void *user_data_catch,
void *user_data_tcatch);
print_help_for_command (struct cmd_list_element *c,
bool recurse, struct ui_file *stream);
-\f
-/* Set the callback function for the specified command. For each both
- the commands callback and func() are set. The latter set to a
- bounce function (unless simple_func / sfunc is NULL that is). */
-
static void
-do_simple_func (struct cmd_list_element *c, const char *args, int from_tty)
+do_simple_func (const char *args, int from_tty, cmd_list_element *c)
{
c->function.simple_func (args, from_tty);
}
cmd->function.simple_func = simple_func;
}
-static void
-do_sfunc (struct cmd_list_element *c, const char *args, int from_tty)
-{
- c->function.sfunc (args, from_tty, c);
-}
-
-void
-set_cmd_sfunc (struct cmd_list_element *cmd, cmd_const_sfunc_ftype *sfunc)
-{
- if (sfunc == NULL)
- cmd->func = NULL;
- else
- cmd->func = do_sfunc;
- cmd->function.sfunc = sfunc;
-}
-
int
cmd_simple_func_eq (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple_func)
{
struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
doc, subcommands,
allow_unknown, list);
- set_cmd_sfunc (cmd, do_prefix_cmd);
+ cmd->func = do_prefix_cmd;
return cmd;
}
struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
doc, subcommands,
allow_unknown, list);
- set_cmd_sfunc (cmd, do_show_prefix_cmd);
+ cmd->func = do_show_prefix_cmd;
return cmd;
}
{
}
-/* This is an empty "sfunc". */
+/* This is an empty cmd func. */
static void
-empty_sfunc (const char *args, int from_tty, struct cmd_list_element *c)
+empty_func (const char *args, int from_tty, cmd_list_element *c)
{
}
c->var = var;
/* This needs to be something besides NULL so that this isn't
treated as a help class. */
- set_cmd_sfunc (c, empty_sfunc);
+ c->func = empty_func;
return c;
}
var_types var_type, void *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
set->doc_allocated = 1;
if (set_func != NULL)
- set_cmd_sfunc (set, set_func);
+ set->func = set_func;
show = add_set_or_show_cmd (name, show_cmd, theclass, var_type, var,
full_show_doc, show_list);
const char *set_doc,
const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
enum auto_boolean *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
add_setshow_boolean_cmd (const char *name, enum command_class theclass, bool *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
char **var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
char **var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
char **var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
char **var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
int *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
unsigned int *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
int *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
const char *set_doc,
const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
unsigned int *var,
const char *set_doc, const char *show_doc,
const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
if (cmd->suppress_notification != NULL)
restore_suppress.emplace (cmd->suppress_notification, 1);
- (*cmd->func) (cmd, args, from_tty);
+ cmd->func (args, from_tty, cmd);
}
else
error (_("Invalid command"));
int
cli_user_command_p (struct cmd_list_element *cmd)
{
- return (cmd->theclass == class_user
- && (cmd->func == do_simple_func || cmd->func == do_sfunc));
+ return cmd->theclass == class_user && cmd->func == do_simple_func;
}
cagney/2002-02-02: This function signature is evolving. For
the moment suggest sticking with either set_cmd_cfunc() or
set_cmd_sfunc(). */
- void (*func) (struct cmd_list_element *c, const char *args, int from_tty)
- = nullptr;
+ cmd_func_ftype *func;
+
/* The command's real callback. At present func() bounces through
to one of the below. */
union
cmd_list_element parameter. do_simple_func is installed as FUNC, and
acts as a shim between the two. */
cmd_simple_func_ftype *simple_func;
-
- /* If type is set_cmd or show_cmd, first set the variables,
- and then call this: */
- cmd_const_sfunc_ftype *sfunc;
}
function;
};
static void
-call_dump_func (struct cmd_list_element *c, const char *args, int from_tty)
+call_dump_func (const char *args, int from_tty, cmd_list_element *c)
{
struct dump_context *d = (struct dump_context *) c->context ();
default:
error (_("gdb internal error: bad var_type in do_setshow_command"));
}
- c->func (c, NULL, from_tty);
+
+ c->func (NULL, from_tty, c);
if (notify_command_param_changed_p (option_changed, c))
{
deprecated_show_value_hack (gdb_stdout, from_tty, c, val.c_str ());
}
- c->func (c, NULL, from_tty);
+ c->func (NULL, from_tty, c);
}
/* Show all the settings in a list of show commands. */
struct cmd_list_element
**);
-typedef void cmd_const_sfunc_ftype (const char *args, int from_tty,
- struct cmd_list_element *c);
-extern void set_cmd_sfunc (struct cmd_list_element *cmd,
- cmd_const_sfunc_ftype *sfunc);
+typedef void cmd_func_ftype (const char *args, int from_tty,
+ cmd_list_element *c);
/* A completion routine. Add possible completions to tracker.
extern set_show_commands add_setshow_enum_cmd
(const char *name, command_class theclass, const char *const *enumlist,
const char **var, const char *set_doc, const char *show_doc,
- const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_auto_boolean_cmd
(const char *name, command_class theclass, auto_boolean *var,
const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
cmd_list_element **set_list, cmd_list_element **show_list);
extern set_show_commands add_setshow_boolean_cmd
(const char *name, command_class theclass, bool *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_filename_cmd
(const char *name, command_class theclass, char **var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_string_cmd
(const char *name, command_class theclass, char **var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_string_noescape_cmd
(const char *name, command_class theclass, char **var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_optional_filename_cmd
(const char *name, command_class theclass, char **var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_integer_cmd
(const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_uinteger_cmd
(const char *name, command_class theclass, unsigned int *var,
const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
cmd_list_element **set_list, cmd_list_element **show_list);
extern set_show_commands add_setshow_zinteger_cmd
(const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
extern set_show_commands add_setshow_zuinteger_cmd
(const char *name, command_class theclass, unsigned int *var,
const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
cmd_list_element **set_list, cmd_list_element **show_list);
extern set_show_commands add_setshow_zuinteger_unlimited_cmd
(const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list);
/* Called by gdb to invoke the command. */
static void
-cmdscm_function (struct cmd_list_element *command,
- const char *args, int from_tty)
+cmdscm_function (const char *args, int from_tty, cmd_list_element *command)
{
command_smob *c_smob/*obj*/ = (command_smob *) command->context ();
SCM arg_scm, tty_scm, result;
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,
+ cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
/* Called by gdb to invoke the command. */
static void
-cmdpy_function (struct cmd_list_element *command,
- const char *args, int from_tty)
+cmdpy_function (const char *args, int from_tty, cmd_list_element *command)
{
cmdpy_object *obj = (cmdpy_object *) command->context ();
&targetlist, 0, &cmdlist);
c = add_cmd (t.shortname, no_class, t.doc, &targetlist);
c->set_context ((void *) &t);
- set_cmd_sfunc (c, open_target);
+ c->func = open_target;
if (completer != NULL)
set_cmd_completer (c, completer);
}
/* If we use add_alias_cmd, here, we do not get the deprecated warning,
see PR cli/15104. */
c = add_cmd (alias, no_class, tinfo.doc, &targetlist);
- set_cmd_sfunc (c, open_target);
+ c->func = open_target;
c->set_context ((void *) &tinfo);
alt = xstrprintf ("target %s", tinfo.shortname);
deprecate_cmd (c, alt);
/* Function to set the layout. */
static void
-tui_apply_layout (struct cmd_list_element *command,
- const char *args, int from_tty)
+tui_apply_layout (const char *args, int from_tty, cmd_list_element *command)
{
tui_layout_split *layout = (tui_layout_split *) command->context ();