int
is_complete_command (struct cmd_list_element *c)
{
- return cmd_cfunc_eq (c, complete_command);
+ return cmd_simple_func_eq (c, complete_command);
}
static void
\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 cfunc / sfunc is NULL that is). */
+ bounce function (unless simple_func / sfunc is NULL that is). */
static void
-do_const_cfunc (struct cmd_list_element *c, const char *args, int from_tty)
+do_simple_func (struct cmd_list_element *c, const char *args, int from_tty)
{
- c->function.const_cfunc (args, from_tty);
+ c->function.simple_func (args, from_tty);
}
static void
-set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+set_cmd_simple_func (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple_func)
{
- if (cfunc == NULL)
+ if (simple_func == NULL)
cmd->func = NULL;
else
- cmd->func = do_const_cfunc;
- cmd->function.const_cfunc = cfunc;
+ cmd->func = do_simple_func;
+
+ cmd->function.simple_func = simple_func;
}
static void
}
int
-cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+cmd_simple_func_eq (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple_func)
{
- return cmd->func == do_const_cfunc && cmd->function.const_cfunc == cfunc;
+ return (cmd->func == do_simple_func
+ && cmd->function.simple_func == simple_func);
}
void
{
cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
result->func = NULL;
- result->function.const_cfunc = NULL;
+ result->function.simple_func = NULL;
return result;
}
struct cmd_list_element *
add_cmd (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *doc, struct cmd_list_element **list)
{
cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
- set_cmd_cfunc (result, fun);
+ set_cmd_simple_func (result, fun);
return result;
}
struct cmd_list_element *
add_cmd_suppress_notification (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun, const char *doc,
+ cmd_simple_func_ftype *fun, const char *doc,
struct cmd_list_element **list,
int *suppress_notification)
{
struct cmd_list_element *
add_prefix_cmd (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *doc, struct cmd_list_element **subcommands,
int allow_unknown, struct cmd_list_element **list)
{
struct cmd_list_element *
add_prefix_cmd_suppress_notification
(const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *doc, struct cmd_list_element **subcommands,
int allow_unknown, struct cmd_list_element **list,
int *suppress_notification)
struct cmd_list_element *
add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun, const char *doc,
+ cmd_simple_func_ftype *fun, const char *doc,
struct cmd_list_element **subcommands,
int allow_unknown, struct cmd_list_element **list)
{
return c;
}
-/* This is an empty "cfunc". */
+/* This is an empty "simple func". */
void
not_just_help_class_command (const char *args, int from_tty)
{
/* Add an element to the list of info subcommands. */
struct cmd_list_element *
-add_info (const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
+add_info (const char *name, cmd_simple_func_ftype *fun, const char *doc)
{
return add_cmd (name, class_info, fun, doc, &infolist);
}
struct cmd_list_element *
add_com (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *doc)
{
return add_cmd (name, theclass, fun, doc, &cmdlist);
struct cmd_list_element *
add_com_suppress_notification (const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun, const char *doc,
+ cmd_simple_func_ftype *fun, const char *doc,
int *suppress_notification)
{
return add_cmd_suppress_notification (name, theclass, fun, doc,
cli_user_command_p (struct cmd_list_element *cmd)
{
return (cmd->theclass == class_user
- && (cmd->func == do_const_cfunc || cmd->func == do_sfunc));
+ && (cmd->func == do_simple_func || cmd->func == do_sfunc));
}
to one of the below. */
union
{
- /* If type is not_set_cmd, call it like this: */
- cmd_const_cfunc_ftype *const_cfunc;
+ /* Most commands don't need the cmd_list_element parameter passed to FUNC.
+ They therefore register a command of this type, which doesn't have the
+ 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;
/* This structure records one command'd definition. */
struct cmd_list_element;
-typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
+/* The "simple" signature of command callbacks, which doesn't include a
+ cmd_list_element parameter. */
+
+typedef void cmd_simple_func_ftype (const char *args, int from_tty);
/* This structure specifies notifications to be suppressed by a cli
command interpreter. */
/* Const-correct variant of the above. */
extern struct cmd_list_element *add_cmd (const char *, enum command_class,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *,
struct cmd_list_element **);
extern struct cmd_list_element *add_cmd_suppress_notification
(const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun, const char *doc,
+ cmd_simple_func_ftype *fun, const char *doc,
struct cmd_list_element **list,
int *suppress_notification);
extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *,
struct cmd_list_element **,
int,
extern struct cmd_list_element *add_prefix_cmd_suppress_notification
(const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *doc, struct cmd_list_element **subcommands,
int allow_unknown,
struct cmd_list_element **list,
extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
enum command_class,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *,
struct cmd_list_element
**, int,
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
around in cmd objects to test the value of the commands sfunc(). */
-extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
- cmd_const_cfunc_ftype *cfun);
+extern int cmd_simple_func_eq (struct cmd_list_element *cmd,
+ cmd_simple_func_ftype *cfun);
/* Execute CMD's pre/post hook. Throw an error if the command fails.
If already executing this pre/post hook, or there is no pre/post
struct cmd_list_element **cmd);
extern struct cmd_list_element *add_com (const char *, enum command_class,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *);
extern cmd_list_element *add_com_alias (const char *name,
extern struct cmd_list_element *add_com_suppress_notification
(const char *name, enum command_class theclass,
- cmd_const_cfunc_ftype *fun, const char *doc,
+ cmd_simple_func_ftype *fun, const char *doc,
int *supress_notification);
extern struct cmd_list_element *add_info (const char *,
- cmd_const_cfunc_ftype *fun,
+ cmd_simple_func_ftype *fun,
const char *);
extern cmd_list_element *add_info_alias (const char *name,
if (c == 0)
error (_("`%s' is not a tracepoint action, or is ambiguous."), p);
- if (cmd_cfunc_eq (c, collect_pseudocommand))
+ if (cmd_simple_func_eq (c, collect_pseudocommand))
{
int trace_string = 0;
while (p && *p++ == ',');
}
- else if (cmd_cfunc_eq (c, teval_pseudocommand))
+ else if (cmd_simple_func_eq (c, teval_pseudocommand))
{
do
{ /* Repeat over a comma-separated list. */
while (p && *p++ == ',');
}
- else if (cmd_cfunc_eq (c, while_stepping_pseudocommand))
+ else if (cmd_simple_func_eq (c, while_stepping_pseudocommand))
{
char *endp;
p = endp;
}
- else if (cmd_cfunc_eq (c, end_actions_pseudocommand))
+ else if (cmd_simple_func_eq (c, end_actions_pseudocommand))
;
else
if (cmd == 0)
error (_("Bad action list item: %s"), action_exp);
- if (cmd_cfunc_eq (cmd, collect_pseudocommand))
+ if (cmd_simple_func_eq (cmd, collect_pseudocommand))
{
int trace_string = 0;
}
while (action_exp && *action_exp++ == ',');
} /* if */
- else if (cmd_cfunc_eq (cmd, teval_pseudocommand))
+ else if (cmd_simple_func_eq (cmd, teval_pseudocommand))
{
do
{ /* Repeat over a comma-separated list. */
}
while (action_exp && *action_exp++ == ',');
} /* if */
- else if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand))
+ else if (cmd_simple_func_eq (cmd, while_stepping_pseudocommand))
{
/* We check against nested while-stepping when setting
breakpoint action, so no way to run into nested
if (cmd == 0)
error (_("Bad action list item: %s"), action_exp);
- if (cmd_cfunc_eq (cmd, while_stepping_pseudocommand))
+ if (cmd_simple_func_eq (cmd, while_stepping_pseudocommand))
{
gdb_assert (action->body_list_1 == nullptr);
trace_dump_actions (action->body_list_0.get (),
1, stepping_frame, from_tty);
}
- else if (cmd_cfunc_eq (cmd, collect_pseudocommand))
+ else if (cmd_simple_func_eq (cmd, collect_pseudocommand))
{
/* Display the collected data.
For the trap frame, display only what was collected at