2002-02-24 Andrew Cagney * command.h (struct cmd_list_element): Add field context. (set_cmd_context, get_cmd_context): Declare. * cli/cli-decode.h: Ditto. * cli/cli-decode.c (get_cmd_context): New function. (set_cmd_context): New function. (add_cmd): Initialize context. Index: command.h =================================================================== RCS file: /cvs/src/src/gdb/command.h,v retrieving revision 1.24 diff -u -r1.24 command.h --- command.h 2002/02/23 21:30:23 1.24 +++ command.h 2002/02/24 23:27:24 @@ -145,6 +145,9 @@ } function; + /* Local state (context) for this command. This can be anything. */ + void *context; + /* Documentation of this command (or help topic). First line is brief documentation; remaining lines form, with it, the full documentation. First line should end with a period. @@ -296,6 +299,10 @@ around in cmd objects to test the value of the commands sfunc(). */ extern int cmd_cfunc_eq (struct cmd_list_element *cmd, void (*cfunc) (char *args, int from_tty)); + +/* Access to the command's local context. */ +extern void set_cmd_context (struct cmd_list_element *cmd, void *context); +extern void *get_cmd_context (struct cmd_list_element *cmd); extern struct cmd_list_element *lookup_cmd (char **, struct cmd_list_element *, char *, Index: cli/cli-decode.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v retrieving revision 1.14 diff -u -r1.14 cli-decode.c --- cli-decode.c 2002/02/23 20:12:13 1.14 +++ cli-decode.c 2002/02/24 23:27:32 @@ -86,6 +86,18 @@ return cmd->func == do_cfunc && cmd->function.cfunc == cfunc; } +void +set_cmd_context (struct cmd_list_element *cmd, void *context) +{ + cmd->context = context; +} + +void * +get_cmd_context (struct cmd_list_element *cmd) +{ + return cmd->context; +} + /* Add element named NAME. CLASS is the top level category into which commands are broken down @@ -133,6 +145,7 @@ c->name = name; c->class = class; set_cmd_cfunc (c, fun); + set_cmd_context (c, NULL); c->doc = doc; c->flags = 0; c->replacement = NULL; Index: cli/cli-decode.h =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v retrieving revision 1.8 diff -u -r1.8 cli-decode.h --- cli-decode.h 2002/02/23 20:12:13 1.8 +++ cli-decode.h 2002/02/24 23:27:33 @@ -139,6 +139,9 @@ } function; + /* Local state (context) for this command. This can be anything. */ + void *context; + /* Documentation of this command (or help topic). First line is brief documentation; remaining lines form, with it, the full documentation. First line should end with a period. @@ -290,6 +293,10 @@ around in cmd objects to test the value of the commands sfunc(). */ extern int cmd_cfunc_eq (struct cmd_list_element *cmd, void (*cfunc) (char *args, int from_tty)); + +/* Access to the command's local context. */ +extern void set_cmd_context (struct cmd_list_element *cmd, void *context); +extern void *get_cmd_context (struct cmd_list_element *cmd); extern struct cmd_list_element *lookup_cmd (char **, struct cmd_list_element *, char *,