diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-02-01 13:24:19 +0100 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-02-01 13:24:19 +0100 |
commit | 04b756deb6c4d95f6940592dd784382b063ecdf9 (patch) | |
tree | ddfa0499ecc3785ca9d9360df95a3b90ae1907c4 | |
parent | fb76eaf8f1f24a394618d4e757cb2b203055ae17 (diff) | |
download | jimtcl-04b756deb6c4d95f6940592dd784382b063ecdf9.zip jimtcl-04b756deb6c4d95f6940592dd784382b063ecdf9.tar.gz jimtcl-04b756deb6c4d95f6940592dd784382b063ecdf9.tar.bz2 |
ecos: update eCos copy.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
-rw-r--r-- | ecos/language/tcl/jim/current/include/jim.h | 4 | ||||
-rw-r--r-- | ecos/language/tcl/jim/current/src/jim.c | 47 |
2 files changed, 38 insertions, 13 deletions
diff --git a/ecos/language/tcl/jim/current/include/jim.h b/ecos/language/tcl/jim/current/include/jim.h index 089ccc1..8baf34d 100644 --- a/ecos/language/tcl/jim/current/include/jim.h +++ b/ecos/language/tcl/jim/current/include/jim.h @@ -892,8 +892,10 @@ JIM_STATIC int JIM_API(Jim_DeleteAssocData)(Jim_Interp *interp, const char *key) /* API import/export functions */ JIM_STATIC int JIM_API(Jim_GetApi) (Jim_Interp *interp, const char *funcname, void *targetPtrPtr); + +typedef void JimApiFunc(void); JIM_STATIC int JIM_API(Jim_RegisterApi) (Jim_Interp *interp, - const char *funcname, void *funcptr); + const char *funcname, JimApiFunc *funcptr); /* Packages C API */ JIM_STATIC int JIM_API(Jim_PackageProvide) (Jim_Interp *interp, diff --git a/ecos/language/tcl/jim/current/src/jim.c b/ecos/language/tcl/jim/current/src/jim.c index 7f0ecec..ed7ba79 100644 --- a/ecos/language/tcl/jim/current/src/jim.c +++ b/ecos/language/tcl/jim/current/src/jim.c @@ -55,6 +55,7 @@ #include <stdlib.h> typedef CYG_ADDRWORD intptr_t; +typedef CYG_ADDRWORD uintptr_t; #include <string.h> #include <stdarg.h> @@ -63,7 +64,20 @@ typedef CYG_ADDRWORD intptr_t; #include <assert.h> #include <errno.h> #include <time.h> +#else /* __ECOS */ +#include <sys/param.h> + +#include <assert.h> +#include <ctype.h> +#include <errno.h> +#include <stdint.h> +#include <string.h> +#include <strings.h> +#include <unistd.h> + +#define NEED_ENVIRON_EXTERN (1) #endif + #ifndef JIM_ANSIC #define JIM_DYNLIB /* Dynamic library support for UNIX and WIN32 */ #endif /* JIM_ANSIC */ @@ -573,10 +587,11 @@ void Jim_Panic(Jim_Interp *interp, const char *fmt, ...) void *Jim_Alloc(int size) { + void *p; /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ if (size == 0) size = 1; - void *p = malloc(size); + p = malloc(size); if (p == NULL) Jim_Panic(NULL,"malloc: Out of memory"); return p; @@ -588,10 +603,11 @@ void Jim_Free(void *ptr) { void *Jim_Realloc(void *ptr, int size) { + void *p; /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ if (size == 0) size = 1; - void *p = realloc(ptr, size); + p = realloc(ptr, size); if (p == NULL) Jim_Panic(NULL,"realloc: Out of memory"); return p; @@ -2217,7 +2233,7 @@ static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr) memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1); for (i = 0; i < strObjPtr->length; i++) - buf[i] = tolower(buf[i]); + buf[i] = tolower((int)buf[i]); return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length); } @@ -2233,7 +2249,7 @@ static Jim_Obj *JimStringToUpper(Jim_Interp *interp, Jim_Obj *strObjPtr) memcpy(buf, strObjPtr->bytes, strObjPtr->length + 1); for (i = 0; i < strObjPtr->length; i++) - buf[i] = toupper(buf[i]); + buf[i] = toupper((int)buf[i]); return Jim_NewStringObjNoAlloc(interp, buf, strObjPtr->length); } @@ -2347,7 +2363,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr, case '8': case '9': accum = 0; - while (isdigit(*fmt) && (fmtLen > 0)) { + while (isdigit((int)*fmt) && (fmtLen > 0)) { accum = (accum * 10) + (*fmt - '0'); fmt++; fmtLen--; } @@ -3347,7 +3363,7 @@ int Jim_RenameCommand(Jim_Interp *interp, const char *oldName, /* In order to avoid that a procedure will get arglist/body/statics * freed by the hash table methods, fake a C-coded command * setting cmdPtr->cmdProc as not NULL */ - cmdPtr->cmdProc = (void*)1; + cmdPtr->cmdProc = (Jim_CmdProc)1; /* Also make sure delProc is NULL. */ cmdPtr->delProc = NULL; /* Destroy the old command, and make sure the new is freed @@ -7972,7 +7988,8 @@ int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName) continue; goto err; } - if ((onload = dlsym(handle, "Jim_OnLoad")) == NULL) { + onload = (int(*)(Jim_Interp *))(uintptr_t)dlsym(handle, "Jim_OnLoad"); + if (onload == NULL) { Jim_SetResultString(interp, "No Jim_OnLoad symbol found on extension", -1); goto err; @@ -9246,13 +9263,13 @@ int Jim_GetApi(Jim_Interp *interp, const char *funcname, void *targetPtrPtr) return JIM_OK; } -int Jim_RegisterApi(Jim_Interp *interp, const char *funcname, void *funcptr) +int Jim_RegisterApi(Jim_Interp *interp, const char *funcname, JimApiFunc *funcptr) { - return Jim_AddHashEntry(&interp->stub, funcname, funcptr); + return Jim_AddHashEntry(&interp->stub, funcname, (void *)(uintptr_t)funcptr); } #define JIM_REGISTER_API(name) \ - Jim_RegisterApi(interp, "Jim_" #name, (void *)Jim_ ## name) + Jim_RegisterApi(interp, "Jim_" #name, (JimApiFunc *)(Jim_ ## name)) void JimRegisterCoreApi(Jim_Interp *interp) { @@ -9526,7 +9543,7 @@ static int Jim_PutsCoreCommand(Jim_Interp *interp, int argc, { Jim_SetResultString(interp, "The second argument must " "be -nonewline", -1); - return JIM_OK; + return JIM_ERR; } else { nonewline = 1; argv++; @@ -10749,7 +10766,7 @@ static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, const char *type = objPtr->typePtr ? objPtr->typePtr->name : ""; subListObjPtr = Jim_NewListObj(interp, NULL, 0); - sprintf(buf, "%p", objPtr); + sprintf(buf, "%p", (void *)objPtr); Jim_ListAppendElement(interp, subListObjPtr, Jim_NewStringObj(interp, buf, -1)); Jim_ListAppendElement(interp, subListObjPtr, @@ -12507,6 +12524,8 @@ Jim_Nvp_name2value(Jim_Interp *interp, { const Jim_Nvp *p; + (void)interp; + p = Jim_Nvp_name2value_simple(_p, name); /* result */ @@ -12533,6 +12552,8 @@ Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *nam { const Jim_Nvp *p; + (void)interp; + p = Jim_Nvp_name2value_nocase_simple(_p, name); if (puthere) { @@ -12579,6 +12600,8 @@ Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **r { const Jim_Nvp *p; + (void)interp; + p = Jim_Nvp_value2name_simple(_p, value); if (result) { |