This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9781
-- gerrit commit 964280bab3e4190d8f26b1a72f478f5525f5151e Author: Antonio Borneo <[email protected]> Date: Fri May 9 17:54:23 2025 +0200 helper: add tcl-common Add a new helper file to start moving there the code specific to Jim Tcl. Coding with Jim Tcl require knowledge and dedicated review effort to properly handle its garbage collection. Having such specific helper will let us focus in a single place: - the knowledge of Jim Tcl garbage collection; - the use of Jim Tcl error codes JIM_OK and JIM_ERR; - the use of CamelCase symbols of Jim Tcl. Confining Jim Tcl code in a single file could also make easier the switch to a different Tcl library, in the remote case we need to address it. Change-Id: Idd89adb57e5a782f141f02d9ccdd1911f3aa9bee Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am index 1a61f78719..fab10c29ec 100644 --- a/src/helper/Makefile.am +++ b/src/helper/Makefile.am @@ -18,6 +18,7 @@ noinst_LTLIBRARIES += %D%/libhelper.la %D%/jep106.c \ %D%/jim-nvp.c \ %D%/nvp.c \ + %D%/tcl-libjim.c \ %D%/align.h \ %D%/base64.h \ %D%/binarybuffer.h \ @@ -39,6 +40,7 @@ noinst_LTLIBRARIES += %D%/libhelper.la %D%/jep106.inc \ %D%/jim-nvp.h \ %D%/nvp.h \ + %D%/tcl-common.h \ %D%/compiler.h STARTUP_TCL_SRCS += %D%/startup.tcl diff --git a/src/helper/tcl-common.h b/src/helper/tcl-common.h new file mode 100644 index 0000000000..959c39972a --- /dev/null +++ b/src/helper/tcl-common.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef OPENOCD_HELPER_TCL_COMMON_H +#define OPENOCD_HELPER_TCL_COMMON_H + +#include <jim.h> + +#endif /* OPENOCD_HELPER_TCL_COMMON_H */ diff --git a/src/helper/tcl-libjim.c b/src/helper/tcl-libjim.c new file mode 100644 index 0000000000..fb2183c23f --- /dev/null +++ b/src/helper/tcl-libjim.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +/* + * This file collects all the functions to interact with Jim Tcl library. + * + * The purposes are: + * - to decouple the jimtcl error codes (JIM_OK, JIM_ERR, ...) from the error + * codes of OpenOCD; + * - to decouple the internal Jim_Obj and its garbage collection; + * - to concentrate the Jim Tcl CamelCase symbols, now spread in OpenOCD code. + * + * The Jim Tcl CamelCase symbols used in this files should be reported in the + * file 'tools/scripts/camelcase.txt' to prevent errors from checkpatch. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <helper/tcl-common.h> --
