From 89eca7f45bb2f4e17c6f094eed5ada91795fa3f9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 23 Jan 2010 07:45:14 +0000 Subject: [PATCH] unify the list of commands to avoid duplication git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1702 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++ urjtag/src/cmd/cmd.h | 46 +---------------------- urjtag/src/cmd/cmd_cmd.c | 46 +---------------------- urjtag/src/cmd/cmd_list.h | 79 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 88 deletions(-) create mode 100644 urjtag/src/cmd/cmd_list.h diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 5339c76a..e7925d9e 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2010-01-23 Mike Frysinger + + * src/cmd/cmd.h, src/cmd/cmd_list.h, src/cmd/cmd_cmd.c: Unify the list of + commands in one place. + 2010-01-22 Mike Frysinger * src/cmd/cmd_bit.c (cmd_bit_print_params): Fix strncat length handling. diff --git a/urjtag/src/cmd/cmd.h b/urjtag/src/cmd/cmd.h index 79df511d..99fb1d76 100644 --- a/urjtag/src/cmd/cmd.h +++ b/urjtag/src/cmd/cmd.h @@ -48,50 +48,8 @@ typedef struct int (*run) (urj_chain_t *chain, char *params[]); } urj_cmd_t; -extern const urj_cmd_t urj_cmd_quit; -extern const urj_cmd_t urj_cmd_help; -extern const urj_cmd_t urj_cmd_frequency; -extern const urj_cmd_t urj_cmd_cable; -extern const urj_cmd_t urj_cmd_reset; -extern const urj_cmd_t urj_cmd_discovery; -extern const urj_cmd_t urj_cmd_idcode; -extern const urj_cmd_t urj_cmd_detect; -extern const urj_cmd_t urj_cmd_signal; -extern const urj_cmd_t urj_cmd_scan; -extern const urj_cmd_t urj_cmd_salias; -extern const urj_cmd_t urj_cmd_bit; -extern const urj_cmd_t urj_cmd_register; -extern const urj_cmd_t urj_cmd_initbus; -extern const urj_cmd_t urj_cmd_print; -extern const urj_cmd_t urj_cmd_part; -extern const urj_cmd_t urj_cmd_bus; -extern const urj_cmd_t urj_cmd_instruction; -extern const urj_cmd_t urj_cmd_shift; -extern const urj_cmd_t urj_cmd_dr; -extern const urj_cmd_t urj_cmd_get; -extern const urj_cmd_t urj_cmd_test; -extern const urj_cmd_t urj_cmd_shell; -extern const urj_cmd_t urj_cmd_set; -extern const urj_cmd_t urj_cmd_endian; -extern const urj_cmd_t urj_cmd_peek; -extern const urj_cmd_t urj_cmd_poke; -extern const urj_cmd_t urj_cmd_pod; -extern const urj_cmd_t urj_cmd_readmem; -extern const urj_cmd_t urj_cmd_writemem; -extern const urj_cmd_t urj_cmd_detectflash; -extern const urj_cmd_t urj_cmd_flashmem; -extern const urj_cmd_t urj_cmd_eraseflash; -extern const urj_cmd_t urj_cmd_script; -extern const urj_cmd_t urj_cmd_include; -extern const urj_cmd_t urj_cmd_addpart; -extern const urj_cmd_t urj_cmd_usleep; -#ifdef ENABLE_SVF -extern const urj_cmd_t urj_cmd_svf; -#endif -#ifdef ENABLE_BSDL -extern const urj_cmd_t urj_cmd_bsdl; -#endif -extern const urj_cmd_t urj_cmd_debug; +#define _URJ_CMD(cmd) extern const urj_cmd_t urj_cmd_##cmd; +#include "cmd_list.h" extern const urj_cmd_t *urj_cmds[]; diff --git a/urjtag/src/cmd/cmd_cmd.c b/urjtag/src/cmd/cmd_cmd.c index 68452f0a..ae3a37b2 100644 --- a/urjtag/src/cmd/cmd_cmd.c +++ b/urjtag/src/cmd/cmd_cmd.c @@ -35,50 +35,8 @@ #include "cmd.h" const urj_cmd_t *urj_cmds[] = { - &urj_cmd_quit, - &urj_cmd_help, - &urj_cmd_frequency, - &urj_cmd_cable, - &urj_cmd_reset, - &urj_cmd_discovery, - &urj_cmd_idcode, - &urj_cmd_detect, - &urj_cmd_signal, - &urj_cmd_scan, - &urj_cmd_salias, - &urj_cmd_bit, - &urj_cmd_register, - &urj_cmd_initbus, - &urj_cmd_print, - &urj_cmd_part, - &urj_cmd_bus, - &urj_cmd_instruction, - &urj_cmd_shift, - &urj_cmd_dr, - &urj_cmd_get, - &urj_cmd_test, - &urj_cmd_shell, - &urj_cmd_set, - &urj_cmd_endian, - &urj_cmd_peek, - &urj_cmd_poke, - &urj_cmd_pod, - &urj_cmd_readmem, - &urj_cmd_writemem, - &urj_cmd_detectflash, - &urj_cmd_flashmem, - &urj_cmd_eraseflash, - &urj_cmd_script, - &urj_cmd_include, - &urj_cmd_addpart, - &urj_cmd_usleep, -#ifdef ENABLE_SVF - &urj_cmd_svf, -#endif -#ifdef ENABLE_BSDL - &urj_cmd_bsdl, -#endif - &urj_cmd_debug, +#define _URJ_CMD(cmd) &urj_cmd_##cmd, +#include "cmd_list.h" NULL /* last must be NULL */ }; diff --git a/urjtag/src/cmd/cmd_list.h b/urjtag/src/cmd/cmd_list.h new file mode 100644 index 00000000..0d043411 --- /dev/null +++ b/urjtag/src/cmd/cmd_list.h @@ -0,0 +1,79 @@ +/* + * $Id: cmd.h 1637 2009-05-28 14:38:54Z rfhh $ + * + * Copyright (C) 2003 ETC s.r.o. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the ETC s.r.o. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Written by Marcel Telka , 2003. + * + */ + +_URJ_CMD(quit) +_URJ_CMD(help) +_URJ_CMD(frequency) +_URJ_CMD(cable) +_URJ_CMD(reset) +_URJ_CMD(discovery) +_URJ_CMD(idcode) +_URJ_CMD(detect) +_URJ_CMD(signal) +_URJ_CMD(scan) +_URJ_CMD(salias) +_URJ_CMD(bit) +_URJ_CMD(register) +_URJ_CMD(initbus) +_URJ_CMD(print) +_URJ_CMD(part) +_URJ_CMD(bus) +_URJ_CMD(instruction) +_URJ_CMD(shift) +_URJ_CMD(dr) +_URJ_CMD(get) +_URJ_CMD(test) +_URJ_CMD(shell) +_URJ_CMD(set) +_URJ_CMD(endian) +_URJ_CMD(peek) +_URJ_CMD(poke) +_URJ_CMD(pod) +_URJ_CMD(readmem) +_URJ_CMD(writemem) +_URJ_CMD(detectflash) +_URJ_CMD(flashmem) +_URJ_CMD(eraseflash) +_URJ_CMD(script) +_URJ_CMD(include) +_URJ_CMD(addpart) +_URJ_CMD(usleep) +#ifdef ENABLE_SVF +_URJ_CMD(svf) +#endif +#ifdef ENABLE_BSDL +_URJ_CMD(bsdl) +#endif +_URJ_CMD(debug) + +#undef _URJ_CMD