command: drop Jim Command handler, at last

With all OpenOCD commands converted to COMMAND_HANDLER, we can
drop the management of jim_handler commands.
Drop also from documentation the subsection on Jim Command
Registration.

Change-Id: I4d13abc7e384e64ecb155cb40bbbd52bb79ec672
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8901
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2023-12-16 17:39:12 +01:00
parent e9c78512b3
commit 6cec67251d
4 changed files with 4 additions and 22 deletions

View File

@@ -130,13 +130,13 @@ static struct command *command_new(struct command_context *cmd_ctx,
assert(cr->name);
/*
* If it is a non-jim command with no .usage specified,
* If it is a command with no .usage specified,
* log an error.
*
* strlen(.usage) == 0 means that the command takes no
* arguments.
*/
if (!cr->jim_handler && !cr->usage)
if (!cr->usage)
LOG_ERROR("BUG: command '%s' does not have the "
"'.usage' field filled out",
full_name);
@@ -152,7 +152,6 @@ static struct command *command_new(struct command_context *cmd_ctx,
}
c->handler = cr->handler;
c->jim_handler = cr->jim_handler;
c->mode = cr->mode;
if (cr->help || cr->usage)
@@ -425,9 +424,6 @@ static bool command_can_run(struct command_context *cmd_ctx, struct command *c,
static int exec_command(Jim_Interp *interp, struct command_context *context,
struct command *c, int argc, Jim_Obj * const *argv)
{
if (c->jim_handler)
return c->jim_handler(interp, argc, argv);
/* use c->handler */
const char **words = malloc(argc * sizeof(char *));
if (!words) {
@@ -841,7 +837,7 @@ static int jim_command_dispatch(Jim_Interp *interp, int argc, Jim_Obj * const *a
script_debug(interp, argc, argv);
struct command *c = jim_to_command(interp);
if (!c->jim_handler && !c->handler) {
if (!c->handler) {
Jim_EvalObjPrefix(interp, Jim_NewStringObj(interp, "usage", -1), 1, argv);
return JIM_ERR;
}