helper/jim-nvp: comply with coding style [2/2]

With the API fixed to comply with OpenOCD coding style, fix all
the references in the code.

Patch generated automatically with the script below.
The list is in reverse order to replace a common prefix after the
replacement of the symbols with the same prefix.

%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---
(cat << EOF
Jim_SetResult_NvpUnknown         jim_set_result_nvp_unknown
Jim_Nvp_value2name_simple        jim_nvp_value2name_simple
Jim_Nvp_value2name_obj           jim_nvp_value2name_obj
Jim_Nvp_value2name               jim_nvp_value2name
Jim_Nvp_name2value_simple        jim_nvp_name2value_simple
Jim_Nvp_name2value_obj_nocase    jim_nvp_name2value_obj_nocase
Jim_Nvp_name2value_obj           jim_nvp_name2value_obj
Jim_Nvp_name2value_nocase_simple jim_nvp_name2value_nocase_simple
Jim_Nvp_name2value_nocase        jim_nvp_name2value_nocase
Jim_Nvp_name2value               jim_nvp_name2value
Jim_Nvp                        struct jim_nvp
Jim_GetOpt_Wide                  jim_getopt_wide
Jim_GetOpt_String                jim_getopt_string
Jim_GetOpt_Setup                 jim_getopt_setup
Jim_GetOpt_Obj                   jim_getopt_obj
Jim_GetOpt_NvpUnknown            jim_getopt_nvp_unknown
Jim_GetOpt_Nvp                   jim_getopt_nvp
Jim_GetOpt_Enum                  jim_getopt_enum
Jim_GetOpt_Double                jim_getopt_double
Jim_GetOpt_Debug                 jim_getopt_debug
Jim_GetOptInfo                 struct jim_getopt_info
Jim_GetNvp                       jim_get_nvp
Jim_Debug_ArgvString             jim_debug_argv_string
EOF
) | while read a b; do
    sed -i "s/$a/$b/g" $(find src -type f ! -name jim-nvp.\? )
done
%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---

Change-Id: I10a12bd64bb8b17575fd9150482c989c92b298a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6184
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-04-25 00:48:14 +02:00
parent b8e18d292e
commit 9e7b31479b
21 changed files with 316 additions and 316 deletions

View File

@@ -49,7 +49,7 @@
* Holds support for accessing JTAG-specific mechanisms from TCl scripts.
*/
static const Jim_Nvp nvp_jtag_tap_event[] = {
static const struct jim_nvp nvp_jtag_tap_event[] = {
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
@@ -310,24 +310,24 @@ enum jtag_tap_cfg_param {
JCFG_IDCODE,
};
static Jim_Nvp nvp_config_opts[] = {
static struct jim_nvp nvp_config_opts[] = {
{ .name = "-event", .value = JCFG_EVENT },
{ .name = "-idcode", .value = JCFG_IDCODE },
{ .name = NULL, .value = -1 }
};
static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap *tap)
{
if (goi->argc == 0) {
Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
return JIM_ERR;
}
Jim_Nvp *n;
int e = Jim_GetOpt_Nvp(goi, nvp_jtag_tap_event, &n);
struct jim_nvp *n;
int e = jim_getopt_nvp(goi, nvp_jtag_tap_event, &n);
if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1);
jim_getopt_nvp_unknown(goi, nvp_jtag_tap_event, 1);
return e;
}
@@ -369,7 +369,7 @@ static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
jteap->event = n->value;
Jim_Obj *o;
Jim_GetOpt_Obj(goi, &o);
jim_getopt_obj(goi, &o);
jteap->body = Jim_DuplicateObj(goi->interp, o);
Jim_IncrRefCount(jteap->body);
@@ -386,16 +386,16 @@ static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
return JIM_OK;
}
static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap *tap)
static int jtag_tap_configure_cmd(struct jim_getopt_info *goi, struct jtag_tap *tap)
{
/* parse config or cget options */
while (goi->argc > 0) {
Jim_SetEmptyResult(goi->interp);
Jim_Nvp *n;
int e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n);
struct jim_nvp *n;
int e = jim_getopt_nvp(goi, nvp_config_opts, &n);
if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0);
jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
return e;
}
@@ -439,11 +439,11 @@ static int is_bad_irval(int ir_length, jim_wide w)
return (w & v) != 0;
}
static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap)
{
jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w);
int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
return e;
@@ -470,11 +470,11 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
#define NTAP_OPT_EXPECTED_ID 5
#define NTAP_OPT_VERSION 6
static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
struct jtag_tap *pTap)
{
jim_wide w;
int e = Jim_GetOpt_Wide(goi, &w);
int e = jim_getopt_wide(goi, &w);
if (e != JIM_OK) {
Jim_SetResultFormatted(goi->interp,
"option: %s bad parameter", n->name);
@@ -516,14 +516,14 @@ static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
return JIM_OK;
}
static int jim_newtap_cmd(Jim_GetOptInfo *goi)
static int jim_newtap_cmd(struct jim_getopt_info *goi)
{
struct jtag_tap *pTap;
int x;
int e;
Jim_Nvp *n;
struct jim_nvp *n;
char *cp;
const Jim_Nvp opts[] = {
const struct jim_nvp opts[] = {
{ .name = "-irlen", .value = NTAP_OPT_IRLEN },
{ .name = "-irmask", .value = NTAP_OPT_IRMASK },
{ .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
@@ -550,10 +550,10 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
}
const char *tmp;
Jim_GetOpt_String(goi, &tmp, NULL);
jim_getopt_string(goi, &tmp, NULL);
pTap->chip = strdup(tmp);
Jim_GetOpt_String(goi, &tmp, NULL);
jim_getopt_string(goi, &tmp, NULL);
pTap->tapname = strdup(tmp);
/* name + dot + name + null */
@@ -580,9 +580,9 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
pTap->ir_capture_value = 0x01;
while (goi->argc) {
e = Jim_GetOpt_Nvp(goi, opts, &n);
e = jim_getopt_nvp(goi, opts, &n);
if (e != JIM_OK) {
Jim_GetOpt_NvpUnknown(goi, opts, 0);
jim_getopt_nvp_unknown(goi, opts, 0);
free(cp);
free(pTap);
return e;
@@ -644,7 +644,7 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
if (jteap->event != e)
continue;
Jim_Nvp *nvp = Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e);
struct jim_nvp *nvp = jim_nvp_value2name_simple(nvp_jtag_tap_event, e);
LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
tap->dotted_name, e, nvp->name,
Jim_GetString(jteap->body, NULL));
@@ -678,8 +678,8 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR;
@@ -697,8 +697,8 @@ static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int e = ERROR_OK;
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR;
@@ -719,8 +719,8 @@ static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const
int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
return jim_newtap_cmd(&goi);
}
@@ -759,8 +759,8 @@ int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
struct command *c = jim_to_command(interp);
const char *cmd_name = c->name;
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 1) {
Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
return JIM_ERR;
@@ -797,8 +797,8 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
struct command *c = jim_to_command(interp);
const char *cmd_name = c->name;
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
goi.isconfigure = !strcmp(cmd_name, "configure");
if (goi.argc < 2 + goi.isconfigure) {
Jim_WrongNumArgs(goi.interp, 0, NULL,
@@ -809,7 +809,7 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
struct jtag_tap *t;
Jim_Obj *o;
Jim_GetOpt_Obj(&goi, &o);
jim_getopt_obj(&goi, &o);
t = jtag_tap_by_jim_obj(goi.interp, o);
if (t == NULL)
return JIM_ERR;
@@ -819,8 +819,8 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
struct jim_getopt_info goi;
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) {
Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
return JIM_ERR;