- server_register_commands(cmd_ctx);
- gdb_register_commands(cmd_ctx);
- log_register_commands(cmd_ctx);
- jtag_register_commands(cmd_ctx);
- xsvf_register_commands(cmd_ctx);
- svf_register_commands(cmd_ctx);
- target_register_commands(cmd_ctx);
- flash_register_commands(cmd_ctx);
- nand_register_commands(cmd_ctx);
- pld_register_commands(cmd_ctx);
- mflash_register_commands(cmd_ctx);
-
+ typedef int (*command_registrant_t)(struct command_context *cmd_ctx_value);
+ static const command_registrant_t command_registrants[] = {
+ &openocd_register_commands,
+ &server_register_commands,
+ &gdb_register_commands,
+ &log_register_commands,
+ &transport_register_commands,
+ &interface_register_commands,
+ &target_register_commands,
+ &flash_register_commands,
+ &nand_register_commands,
+ &pld_register_commands,
+ &mflash_register_commands,
+ NULL
+ };
+ for (unsigned i = 0; NULL != command_registrants[i]; i++) {
+ int retval = (*command_registrants[i])(cmd_ctx);
+ if (ERROR_OK != retval) {
+ command_done(cmd_ctx);
+ return NULL;
+ }
+ }