diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-15 04:18:51 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-17 11:38:06 -0800 |
commit | 5b9899d6ea1e0cf763465c64c700f20eddd893f9 (patch) | |
tree | 5f8c9861457841b7fba78e4615e1608ff4570f04 /src | |
parent | f4788652e45662d1e43933dc0620561bc4cddae0 (diff) | |
download | openocd_libswd-5b9899d6ea1e0cf763465c64c700f20eddd893f9.tar.gz openocd_libswd-5b9899d6ea1e0cf763465c64c700f20eddd893f9.tar.bz2 openocd_libswd-5b9899d6ea1e0cf763465c64c700f20eddd893f9.tar.xz openocd_libswd-5b9899d6ea1e0cf763465c64c700f20eddd893f9.zip |
add more command_handler conversion macros
Add additional macros to allow command handling to be migrated easily:
CMD_CTX, CMD_ARGC, and CMD_ARGV. Updates CMD_NAME to use CMD_ARGV.
In addition to making the remaining patches of this series cleaner,
this introduces easily sed-able symbols that could allow us to retire
these once the command handler infrastructure matures (i.e. pre-1.0).
Diffstat (limited to 'src')
-rw-r--r-- | src/helper/command.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/helper/command.h b/src/helper/command.h index 79e57f5a..3e366275 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -122,10 +122,25 @@ struct command_context #define COMMAND_HELPER(name, extra...) __COMMAND_HANDLER(name, extra) /** + * Use this macro to access the context of the command being handled, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD_CTX cmd_ctx +/** + * Use this macro to access the number of arguments for the command being + * handled, rather than accessing the variable directly. It may be moved. + */ +#define CMD_ARGC argc +/** + * Use this macro to access the arguments for the command being handled, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD_ARGV args +/** * Use this macro to access the name of the command being handled, * rather than accessing the variable directly. It may be moved. */ -#define CMD_NAME args[-1] +#define CMD_NAME CMD_ARGV[-1] /// The type signature for commands' handler functions. |