summaryrefslogtreecommitdiff
path: root/doc/manual/primer
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-17 05:38:17 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-17 11:40:21 -0800
commit789d47c18097abb5ee6cc8544e0ba030000fd418 (patch)
tree349442e6ce2f224b87a1b91e3c1b8b0185bc0515 /doc/manual/primer
parentcfaf7bdd0aedb23a4837078db808be450e5efc30 (diff)
downloadopenocd_libswd-789d47c18097abb5ee6cc8544e0ba030000fd418.tar.gz
openocd_libswd-789d47c18097abb5ee6cc8544e0ba030000fd418.tar.bz2
openocd_libswd-789d47c18097abb5ee6cc8544e0ba030000fd418.tar.xz
openocd_libswd-789d47c18097abb5ee6cc8544e0ba030000fd418.zip
update command_handler documentation
Improve the developer manual and primer sections which talk about writing command handlers. Notably, it documents the new CMD_* macros.
Diffstat (limited to 'doc/manual/primer')
-rw-r--r--doc/manual/primer/commands.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/manual/primer/commands.txt b/doc/manual/primer/commands.txt
index 9efcca2e..b15f6697 100644
--- a/doc/manual/primer/commands.txt
+++ b/doc/manual/primer/commands.txt
@@ -16,7 +16,7 @@ COMMAND_HANDLER(handle_hello_command)
const char *sep, *name;
int retval = CALL_COMMAND_HANDLER(handle_hello_args);
if (ERROR_OK == retval)
- command_print(cmd_ctx, "Greetings%s%s!", sep, name);
+ command_print(CMD_CTX, "Greetings%s%s!", sep, name);
return retval;
}
@endcode
@@ -39,13 +39,13 @@ static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name)
{
if (argc > 1)
{
- LOG_ERROR("%s: too many arguments", COMMAND_NAME);
+ LOG_ERROR("%s: too many arguments", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
- if (1 == argc)
+ if (1 == CMD_ARGC)
{
*sep = ", ";
- *name = args[0];
+ *name = CMD_ARGV[0];
}
else
*sep = *name = "";
@@ -96,4 +96,9 @@ Greetings, John Doe!
Error: ocd_hello: too many arguments
@endcode
+This difference between the registered and displayed command name comes from
+the fact that the TCL scripts are provided with a stub that calls the munged
+name. This stub wraps the internal <code>ocd_</code>-prefixed routine,
+providing a measure of high-level error handling.
+
*/