*
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
* Copyright 2005 Clemens Hintze <c.hintze@gmx.net>
- * Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
- * Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
+ * Copyright 2005 patthoyts - Pat Thoyts <patthoyts@users.sf.net>
+ * Copyright 2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com
* Copyright 2008 Andrew Lunn <andrew@lunn.ch>
* Copyright 2008 Duane Ellis <openocd@duaneellis.com>
* Copyright 2008 Uwe Klein <uklein@klein-messgeraete.de>
- *
+ *
* The FreeBSD license
- *
+ *
* 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of the Jim Tcl Project.
*
- *--- Inline Header File Documentation ---
+ *--- Inline Header File Documentation ---
* [By Duane Ellis, openocd@duaneellis.com, 8/18/8]
*
* Belief is "Jim" would greatly benifit if Jim Internals where
#endif /* _MSC_VER */
/* Long Long type and related issues */
-#ifdef HAVE_LONG_LONG_INT
+#if !defined(__ECOS) && defined(HAVE_LONG_LONG_INT)
# ifdef _MSC_VER /* MSC compiler */
# define jim_wide _int64
# ifndef LLONG_MAX
* LIBC specific fixes
* ---------------------------------------------------------------------------*/
-#ifdef HAVE_LONG_LONG_INT
-# if defined(_MSC_VER) || defined(__MSVCRT__)
+#if !defined(__ECOS) && defined(HAVE_LONG_LONG_INT)
+# if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__MINGW32__)
# define JIM_WIDE_MODIFIER "I64d"
# else
# define JIM_WIDE_MODIFIER "lld"
typedef void (Jim_DupInternalRepProc)(struct Jim_Interp *interp,
struct Jim_Obj *srcPtr, Jim_Obj *dupPtr);
typedef void (Jim_UpdateStringProc)(struct Jim_Obj *objPtr);
-
+
typedef struct Jim_ObjType {
const char *name; /* The name of the type. */
Jim_FreeInternalRepProc *freeIntRepProc;
Jim_Obj *objPtr;
struct Jim_CallFrame *linkFramePtr;
} Jim_Var;
-
+
/* The cmd structure. */
typedef int (*Jim_CmdProc)(struct Jim_Interp *interp, int argc,
Jim_Obj *const *argv);
* };
*
* Jim_Nvp *result
- * e = Jim_Nvp_name2value(interp, yn, "y", &result);
+ * e = Jim_Nvp_name2value(interp, yn, "y", &result);
* returns &yn[0];
* e = Jim_Nvp_name2value(interp, yn, "n", &result);
* returns &yn[1];
const char *name;
int value;
} Jim_Nvp;
-
+
/* -----------------------------------------------------------------------------
* Exported API prototypes.
#define Jim_FreeHashTableIterator(iter) Jim_Free(iter)
#ifdef DOXYGEN
-#define JIM_STATIC
+#define JIM_STATIC
#define JIM_API(X) X
#else
#ifndef __JIM_CORE__
/* commands */
JIM_STATIC void JIM_API(Jim_RegisterCoreCommands) (Jim_Interp *interp);
-JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp,
+JIM_STATIC int JIM_API(Jim_CreateCommand) (Jim_Interp *interp,
const char *cmdName, Jim_CmdProc cmdProc, void *privData,
Jim_DelCmdProc delProc);
-JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp,
+JIM_STATIC int JIM_API(Jim_CreateProcedure) (Jim_Interp *interp,
const char *cmdName, Jim_Obj *argListObjPtr, Jim_Obj *staticsListObjPtr,
Jim_Obj *bodyObjPtr, int arityMin, int arityMax);
JIM_STATIC int JIM_API(Jim_DeleteCommand) (Jim_Interp *interp,
const char *cmdName);
-JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp,
+JIM_STATIC int JIM_API(Jim_RenameCommand) (Jim_Interp *interp,
const char *oldName, const char *newName);
JIM_STATIC Jim_Cmd * JIM_API(Jim_GetCommand) (Jim_Interp *interp,
Jim_Obj *objPtr, int flags);
JIM_STATIC Jim_Obj * JIM_API(Jim_NewDoubleObj)(Jim_Interp *interp, double doubleValue);
/* shared strings */
-JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp,
+JIM_STATIC const char * JIM_API(Jim_GetSharedString) (Jim_Interp *interp,
const char *str);
JIM_STATIC void JIM_API(Jim_ReleaseSharedString) (Jim_Interp *interp,
const char *str);
Jim_Obj *const *argv, const char *msg);
JIM_STATIC int JIM_API(Jim_GetEnum) (Jim_Interp *interp, Jim_Obj *objPtr,
const char * const *tablePtr, int *indexPtr, const char *name, int flags);
-JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp,
+JIM_STATIC int JIM_API(Jim_GetNvp) (Jim_Interp *interp,
Jim_Obj *objPtr,
- const Jim_Nvp *nvp_table,
+ const Jim_Nvp *nvp_table,
const Jim_Nvp **result);
JIM_STATIC int JIM_API(Jim_ScriptIsComplete) (const char *s, int len,
char *stateCharPtr);
/* API import/export functions */
JIM_STATIC int JIM_API(Jim_GetApi) (Jim_Interp *interp, const char *funcname,
void *targetPtrPtr);
-JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp,
+JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp,
const char *funcname, void *funcptr);
/* Packages C API */
JIM_STATIC int JIM_API(Jim_Nvp_value2name_obj)(Jim_Interp *interp, const Jim_Nvp *nvp_table, Jim_Obj *value_obj, Jim_Nvp **result);
/** prints a nice 'unknown' parameter error message to the 'result' */
-JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp,
+JIM_STATIC void JIM_API(Jim_SetResult_NvpUnknown)(Jim_Interp *interp,
Jim_Obj *param_name,
Jim_Obj *param_value,
const Jim_Nvp *nvp_table);
/** Debug: convert argc/argv into a printable string for printf() debug
- *
+ *
* \param interp - the interpeter
* \param argc - arg count
* \param argv - the objects
*
* \returns string pointer holding the text.
- *
+ *
* Note, next call to this function will free the old (last) string.
*
* For example might want do this:
JIM_STATIC const char *JIM_API(Jim_Debug_ArgvString)(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-/** A TCL -ish GetOpt like code.
+/** A TCL -ish GetOpt like code.
*
* Some TCL objects have various "configuration" values.
* For example - in Tcl/Tk the "buttons" have many options.
- *
+ *
* Usefull when dealing with command options.
* that may come in any order...
*
typedef struct jim_getopt {
Jim_Interp *interp;
- int argc;
+ int argc;
Jim_Obj * const * argv;
int isconfigure; /* non-zero if configure */
} Jim_GetOptInfo;
*
* Example (short and incomplete):
* \code
- * Jim_GetOptInfo goi;
+ * Jim_GetOptInfo goi;
*
* Jim_GetOpt_Setup(&goi, interp, argc, argv);
*
- * while (goi.argc){
+ * while (goi.argc) {
* e = Jim_GetOpt_Nvp(&goi, nvp_options, &n);
- * if (e != JIM_OK){
+ * if (e != JIM_OK) {
* Jim_GetOpt_NvpUnknown(&goi, nvp_options, 0);
* return e;
* }
*
- * switch (n->value){
+ * switch (n->value) {
* case ALIVE:
* printf("Option ALIVE specified\n");
* break;
* case FIRST:
- * if (goi.argc < 1){
+ * if (goi.argc < 1) {
* .. not enough args error ..
* }
* Jim_GetOpt_String(&goi, &cp, NULL);
* break;
* case POLITICS:
* e = Jim_GetOpt_Nvp(&goi, nvp_politics, &n);
- * if (e != JIM_OK){
+ * if (e != JIM_OK) {
* Jim_GetOpt_NvpUnknown(&goi, nvp_politics, 1);
* return e;
* }
* }
*
* \endcode
- *
+ *
*/
-/** Setup GETOPT
+/** Setup GETOPT
*
* \param goi - get opt info to be initialized
* \param interp - jim interp
*
* \code
* Jim_GetOptInfo goi;
- *
+ *
* Jim_GetOptSetup(&goi, interp, argc, argv);
* \endcode
*/
-JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi,
- Jim_Interp *interp,
- int argc,
+JIM_STATIC int JIM_API(Jim_GetOpt_Setup)(Jim_GetOptInfo *goi,
+ Jim_Interp *interp,
+ int argc,
Jim_Obj * const * argv);
*
* \param goi - get opt info
* \param puthere - where param is put
- *
+ *
*/
JIM_STATIC int JIM_API(Jim_GetOpt_Obj)(Jim_GetOptInfo *goi, Jim_Obj **puthere);
* Example:
* \code
*
- * while (goi.argc){
- * // Get the next option
+ * while (goi.argc) {
+ * // Get the next option
* e = Jim_GetOpt_Nvp(&goi, cmd_options, &n);
- * if (e != JIM_OK){
+ * if (e != JIM_OK) {
* // option was not recognized
* // pass 'hadprefix = 0' because there is no prefix
* Jim_GetOpt_NvpUnknown(&goi, cmd_options, 0);
* return e;
* }
*
- * switch (n->value){
+ * switch (n->value) {
* case OPT_SEX:
* // handle: --sex male | female | lots | needmore
* e = Jim_GetOpt_Nvp(&goi, &nvp_sex, &n);
- * if (e != JIM_OK){
+ * if (e != JIM_OK) {
* Jim_GetOpt_NvpUnknown(&ogi, nvp_sex, 1);
* return e;
* }
JIM_GET_API(Nvp_name2value);
JIM_GET_API(Nvp_name2value_nocase);
JIM_GET_API(Nvp_name2value_simple);
-
+
JIM_GET_API(Nvp_value2name);
JIM_GET_API(Nvp_value2name_simple);