| | @@ -42,10 +42,11 @@ |
| 42 | 42 | #define HAVE_ISATTY |
| 43 | 43 | #define HAVE_SYS_TIME_H |
| 44 | 44 | #define HAVE_DIRENT_H |
| 45 | 45 | #define HAVE_UNISTD_H |
| 46 | 46 | #endif |
| 47 | +#define JIM_VERSION 75 |
| 47 | 48 | #ifndef JIM_WIN32COMPAT_H |
| 48 | 49 | #define JIM_WIN32COMPAT_H |
| 49 | 50 | |
| 50 | 51 | |
| 51 | 52 | |
| | @@ -185,12 +186,10 @@ |
| 185 | 186 | #endif |
| 186 | 187 | |
| 187 | 188 | #define UCHAR(c) ((unsigned char)(c)) |
| 188 | 189 | |
| 189 | 190 | |
| 190 | | -#define JIM_VERSION 74 |
| 191 | | - |
| 192 | 191 | #define JIM_OK 0 |
| 193 | 192 | #define JIM_ERR 1 |
| 194 | 193 | #define JIM_RETURN 2 |
| 195 | 194 | #define JIM_BREAK 3 |
| 196 | 195 | #define JIM_CONTINUE 4 |
| | @@ -832,16 +831,10 @@ |
| 832 | 831 | double *doublePtr); |
| 833 | 832 | JIM_EXPORT void Jim_SetDouble(Jim_Interp *interp, Jim_Obj *objPtr, |
| 834 | 833 | double doubleValue); |
| 835 | 834 | JIM_EXPORT Jim_Obj * Jim_NewDoubleObj(Jim_Interp *interp, double doubleValue); |
| 836 | 835 | |
| 837 | | - |
| 838 | | -JIM_EXPORT const char * Jim_GetSharedString (Jim_Interp *interp, |
| 839 | | - const char *str); |
| 840 | | -JIM_EXPORT void Jim_ReleaseSharedString (Jim_Interp *interp, |
| 841 | | - const char *str); |
| 842 | | - |
| 843 | 836 | |
| 844 | 837 | JIM_EXPORT void Jim_WrongNumArgs (Jim_Interp *interp, int argc, |
| 845 | 838 | Jim_Obj *const *argv, const char *msg); |
| 846 | 839 | JIM_EXPORT int Jim_GetEnum (Jim_Interp *interp, Jim_Obj *objPtr, |
| 847 | 840 | const char * const *tablePtr, int *indexPtr, const char *name, int flags); |
| | @@ -875,11 +868,11 @@ |
| 875 | 868 | JIM_EXPORT void Jim_HistoryShow(void); |
| 876 | 869 | |
| 877 | 870 | |
| 878 | 871 | JIM_EXPORT int Jim_InitStaticExtensions(Jim_Interp *interp); |
| 879 | 872 | JIM_EXPORT int Jim_StringToWide(const char *str, jim_wide *widePtr, int base); |
| 880 | | -JIM_EXPORT int Jim_CheckSignal(Jim_Interp *interp); |
| 873 | +JIM_EXPORT int Jim_IsBigEndian(void); |
| 881 | 874 | #define Jim_CheckSignal(i) ((i)->signal_level && (i)->sigmask) |
| 882 | 875 | |
| 883 | 876 | |
| 884 | 877 | JIM_EXPORT int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName); |
| 885 | 878 | JIM_EXPORT void Jim_FreeLoadHandles(Jim_Interp *interp); |
| | @@ -1775,19 +1768,11 @@ |
| 1775 | 1768 | |
| 1776 | 1769 | Jim_DecrRefCount(interp, af->filename); |
| 1777 | 1770 | |
| 1778 | 1771 | #ifdef jim_ext_eventloop |
| 1779 | 1772 | |
| 1780 | | - if (af->rEvent) { |
| 1781 | | - Jim_DeleteFileHandler(interp, af->fp); |
| 1782 | | - } |
| 1783 | | - if (af->wEvent) { |
| 1784 | | - Jim_DeleteFileHandler(interp, af->fp); |
| 1785 | | - } |
| 1786 | | - if (af->eEvent) { |
| 1787 | | - Jim_DeleteFileHandler(interp, af->fp); |
| 1788 | | - } |
| 1773 | + Jim_DeleteFileHandler(interp, af->fp, JIM_EVENT_READABLE | JIM_EVENT_WRITABLE | JIM_EVENT_EXCEPTION); |
| 1789 | 1774 | #endif |
| 1790 | 1775 | Jim_Free(af); |
| 1791 | 1776 | } |
| 1792 | 1777 | |
| 1793 | 1778 | static int JimCheckStreamError(Jim_Interp *interp, AioFile *af) |
| | @@ -2147,27 +2132,26 @@ |
| 2147 | 2132 | } |
| 2148 | 2133 | |
| 2149 | 2134 | #ifdef jim_ext_eventloop |
| 2150 | 2135 | static void JimAioFileEventFinalizer(Jim_Interp *interp, void *clientData) |
| 2151 | 2136 | { |
| 2152 | | - Jim_Obj *objPtr = clientData; |
| 2137 | + Jim_Obj **objPtrPtr = clientData; |
| 2153 | 2138 | |
| 2154 | | - Jim_DecrRefCount(interp, objPtr); |
| 2139 | + Jim_DecrRefCount(interp, *objPtrPtr); |
| 2140 | + *objPtrPtr = NULL; |
| 2155 | 2141 | } |
| 2156 | 2142 | |
| 2157 | 2143 | static int JimAioFileEventHandler(Jim_Interp *interp, void *clientData, int mask) |
| 2158 | 2144 | { |
| 2159 | | - Jim_Obj *objPtr = clientData; |
| 2145 | + Jim_Obj **objPtrPtr = clientData; |
| 2160 | 2146 | |
| 2161 | | - return Jim_EvalObjBackground(interp, objPtr); |
| 2147 | + return Jim_EvalObjBackground(interp, *objPtrPtr); |
| 2162 | 2148 | } |
| 2163 | 2149 | |
| 2164 | 2150 | static int aio_eventinfo(Jim_Interp *interp, AioFile * af, unsigned mask, Jim_Obj **scriptHandlerObj, |
| 2165 | 2151 | int argc, Jim_Obj * const *argv) |
| 2166 | 2152 | { |
| 2167 | | - int scriptlen = 0; |
| 2168 | | - |
| 2169 | 2153 | if (argc == 0) { |
| 2170 | 2154 | |
| 2171 | 2155 | if (*scriptHandlerObj) { |
| 2172 | 2156 | Jim_SetResult(interp, *scriptHandlerObj); |
| 2173 | 2157 | } |
| | @@ -2174,27 +2158,25 @@ |
| 2174 | 2158 | return JIM_OK; |
| 2175 | 2159 | } |
| 2176 | 2160 | |
| 2177 | 2161 | if (*scriptHandlerObj) { |
| 2178 | 2162 | |
| 2179 | | - Jim_DeleteFileHandler(interp, af->fp); |
| 2180 | | - *scriptHandlerObj = NULL; |
| 2163 | + Jim_DeleteFileHandler(interp, af->fp, mask); |
| 2181 | 2164 | } |
| 2182 | 2165 | |
| 2183 | 2166 | |
| 2184 | | - Jim_GetString(argv[0], &scriptlen); |
| 2185 | | - if (scriptlen == 0) { |
| 2167 | + if (Jim_Length(argv[0]) == 0) { |
| 2186 | 2168 | |
| 2187 | 2169 | return JIM_OK; |
| 2188 | 2170 | } |
| 2189 | 2171 | |
| 2190 | 2172 | |
| 2191 | 2173 | Jim_IncrRefCount(argv[0]); |
| 2192 | 2174 | *scriptHandlerObj = argv[0]; |
| 2193 | 2175 | |
| 2194 | 2176 | Jim_CreateFileHandler(interp, af->fp, mask, |
| 2195 | | - JimAioFileEventHandler, *scriptHandlerObj, JimAioFileEventFinalizer); |
| 2177 | + JimAioFileEventHandler, scriptHandlerObj, JimAioFileEventFinalizer); |
| 2196 | 2178 | |
| 2197 | 2179 | return JIM_OK; |
| 2198 | 2180 | } |
| 2199 | 2181 | |
| 2200 | 2182 | static int aio_cmd_readable(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
| | @@ -4005,11 +3987,11 @@ |
| 4005 | 3987 | static void JimRestoreEnv(char **env); |
| 4006 | 3988 | static int JimCreatePipeline(Jim_Interp *interp, int argc, Jim_Obj *const *argv, |
| 4007 | 3989 | pidtype **pidArrayPtr, fdtype *inPipePtr, fdtype *outPipePtr, fdtype *errFilePtr); |
| 4008 | 3990 | static void JimDetachPids(Jim_Interp *interp, int numPids, const pidtype *pidPtr); |
| 4009 | 3991 | static int JimCleanupChildren(Jim_Interp *interp, int numPids, pidtype *pidPtr, fdtype errorId); |
| 4010 | | -static fdtype JimCreateTemp(Jim_Interp *interp, const char *contents); |
| 3992 | +static fdtype JimCreateTemp(Jim_Interp *interp, const char *contents, int len); |
| 4011 | 3993 | static fdtype JimOpenForWrite(const char *filename, int append); |
| 4012 | 3994 | static int JimRewindFd(fdtype fd); |
| 4013 | 3995 | |
| 4014 | 3996 | static void Jim_SetResultErrno(Jim_Interp *interp, const char *msg) |
| 4015 | 3997 | { |
| | @@ -4347,10 +4329,11 @@ |
| 4347 | 4329 | int cmdCount; /* Count of number of distinct commands |
| 4348 | 4330 | * found in argc/argv. */ |
| 4349 | 4331 | const char *input = NULL; /* Describes input for pipeline, depending |
| 4350 | 4332 | * on "inputFile". NULL means take input |
| 4351 | 4333 | * from stdin/pipe. */ |
| 4334 | + int input_len = 0; |
| 4352 | 4335 | |
| 4353 | 4336 | #define FILE_NAME 0 |
| 4354 | 4337 | #define FILE_APPEND 1 |
| 4355 | 4338 | #define FILE_HANDLE 2 |
| 4356 | 4339 | #define FILE_TEXT 3 |
| | @@ -4412,19 +4395,20 @@ |
| 4412 | 4395 | if (arg[0] == '<') { |
| 4413 | 4396 | inputFile = FILE_NAME; |
| 4414 | 4397 | input = arg + 1; |
| 4415 | 4398 | if (*input == '<') { |
| 4416 | 4399 | inputFile = FILE_TEXT; |
| 4400 | + input_len = Jim_Length(argv[i]) - 2; |
| 4417 | 4401 | input++; |
| 4418 | 4402 | } |
| 4419 | 4403 | else if (*input == '@') { |
| 4420 | 4404 | inputFile = FILE_HANDLE; |
| 4421 | 4405 | input++; |
| 4422 | 4406 | } |
| 4423 | 4407 | |
| 4424 | 4408 | if (!*input && ++i < argc) { |
| 4425 | | - input = Jim_String(argv[i]); |
| 4409 | + input = Jim_GetString(argv[i], &input_len); |
| 4426 | 4410 | } |
| 4427 | 4411 | } |
| 4428 | 4412 | else if (arg[0] == '>') { |
| 4429 | 4413 | int dup_error = 0; |
| 4430 | 4414 | |
| | @@ -4498,11 +4482,11 @@ |
| 4498 | 4482 | |
| 4499 | 4483 | save_environ = JimSaveEnv(JimBuildEnv(interp)); |
| 4500 | 4484 | |
| 4501 | 4485 | if (input != NULL) { |
| 4502 | 4486 | if (inputFile == FILE_TEXT) { |
| 4503 | | - inputId = JimCreateTemp(interp, input); |
| 4487 | + inputId = JimCreateTemp(interp, input, input_len); |
| 4504 | 4488 | if (inputId == JIM_BAD_FD) { |
| 4505 | 4489 | goto error; |
| 4506 | 4490 | } |
| 4507 | 4491 | } |
| 4508 | 4492 | else if (inputFile == FILE_HANDLE) { |
| | @@ -4587,11 +4571,11 @@ |
| 4587 | 4571 | goto error; |
| 4588 | 4572 | } |
| 4589 | 4573 | } |
| 4590 | 4574 | } |
| 4591 | 4575 | else if (errFilePtr != NULL) { |
| 4592 | | - errorId = JimCreateTemp(interp, NULL); |
| 4576 | + errorId = JimCreateTemp(interp, NULL, 0); |
| 4593 | 4577 | if (errorId == JIM_BAD_FD) { |
| 4594 | 4578 | goto error; |
| 4595 | 4579 | } |
| 4596 | 4580 | *errFilePtr = JimDupFd(errorId); |
| 4597 | 4581 | } |
| | @@ -4953,11 +4937,11 @@ |
| 4953 | 4937 | *status = ret; |
| 4954 | 4938 | CloseHandle(pid); |
| 4955 | 4939 | return pid; |
| 4956 | 4940 | } |
| 4957 | 4941 | |
| 4958 | | -static HANDLE JimCreateTemp(Jim_Interp *interp, const char *contents) |
| 4942 | +static HANDLE JimCreateTemp(Jim_Interp *interp, const char *contents, int len) |
| 4959 | 4943 | { |
| 4960 | 4944 | char name[MAX_PATH]; |
| 4961 | 4945 | HANDLE handle; |
| 4962 | 4946 | |
| 4963 | 4947 | if (!GetTempPath(MAX_PATH, name) || !GetTempFileName(name, "JIM", 0, name)) { |
| | @@ -4977,11 +4961,11 @@ |
| 4977 | 4961 | FILE *fh = JimFdOpenForWrite(JimDupFd(handle)); |
| 4978 | 4962 | if (fh == NULL) { |
| 4979 | 4963 | goto error; |
| 4980 | 4964 | } |
| 4981 | 4965 | |
| 4982 | | - if (fwrite(contents, strlen(contents), 1, fh) != 1) { |
| 4966 | + if (fwrite(contents, len, 1, fh) != 1) { |
| 4983 | 4967 | fclose(fh); |
| 4984 | 4968 | goto error; |
| 4985 | 4969 | } |
| 4986 | 4970 | fseek(fh, 0, SEEK_SET); |
| 4987 | 4971 | fclose(fh); |
| | @@ -5196,11 +5180,11 @@ |
| 5196 | 5180 | static int JimRewindFd(int fd) |
| 5197 | 5181 | { |
| 5198 | 5182 | return lseek(fd, 0L, SEEK_SET); |
| 5199 | 5183 | } |
| 5200 | 5184 | |
| 5201 | | -static int JimCreateTemp(Jim_Interp *interp, const char *contents) |
| 5185 | +static int JimCreateTemp(Jim_Interp *interp, const char *contents, int len) |
| 5202 | 5186 | { |
| 5203 | 5187 | char inName[] = "/tmp/tcl.tmp.XXXXXX"; |
| 5204 | 5188 | |
| 5205 | 5189 | int fd = mkstemp(inName); |
| 5206 | 5190 | if (fd == JIM_BAD_FD) { |
| | @@ -5207,12 +5191,11 @@ |
| 5207 | 5191 | Jim_SetResultErrno(interp, "couldn't create temp file"); |
| 5208 | 5192 | return -1; |
| 5209 | 5193 | } |
| 5210 | 5194 | unlink(inName); |
| 5211 | 5195 | if (contents) { |
| 5212 | | - int length = strlen(contents); |
| 5213 | | - if (write(fd, contents, length) != length) { |
| 5196 | + if (write(fd, contents, len) != len) { |
| 5214 | 5197 | Jim_SetResultErrno(interp, "couldn't write temp file"); |
| 5215 | 5198 | close(fd); |
| 5216 | 5199 | return -1; |
| 5217 | 5200 | } |
| 5218 | 5201 | lseek(fd, 0L, SEEK_SET); |
| | @@ -5671,10 +5654,11 @@ |
| 5671 | 5654 | #ifdef JIM_MAINTAINER |
| 5672 | 5655 | #define JIM_DEBUG_COMMAND |
| 5673 | 5656 | #define JIM_DEBUG_PANIC |
| 5674 | 5657 | #endif |
| 5675 | 5658 | |
| 5659 | + |
| 5676 | 5660 | |
| 5677 | 5661 | #define JIM_INTEGER_SPACE 24 |
| 5678 | 5662 | |
| 5679 | 5663 | const char *jim_tt_name(int type); |
| 5680 | 5664 | |
| | @@ -6029,11 +6013,12 @@ |
| 6029 | 6013 | if (str[i] != '-' && str[i] != '+' && !isspace(UCHAR(str[i]))) { |
| 6030 | 6014 | |
| 6031 | 6015 | return i; |
| 6032 | 6016 | } |
| 6033 | 6017 | |
| 6034 | | - return 10; |
| 6018 | + *base = 10; |
| 6019 | + return 0; |
| 6035 | 6020 | } |
| 6036 | 6021 | |
| 6037 | 6022 | static long jim_strtol(const char *str, char **endptr) |
| 6038 | 6023 | { |
| 6039 | 6024 | int sign; |
| | @@ -6109,10 +6094,12 @@ |
| 6109 | 6094 | return len; |
| 6110 | 6095 | } |
| 6111 | 6096 | |
| 6112 | 6097 | if (buf[i] == 'i' || buf[i] == 'I' || buf[i] == 'n' || buf[i] == 'N') { |
| 6113 | 6098 | buf[i] = toupper(UCHAR(buf[i])); |
| 6099 | + if (buf[i] == 'n' || buf[i] == 'N') |
| 6100 | + buf[i+2] = toupper(UCHAR(buf[i+2])); |
| 6114 | 6101 | buf[i + 3] = 0; |
| 6115 | 6102 | return i + 3; |
| 6116 | 6103 | } |
| 6117 | 6104 | } |
| 6118 | 6105 | |
| | @@ -7581,17 +7568,21 @@ |
| 7581 | 7568 | objPtr->prevObjPtr->nextObjPtr = objPtr->nextObjPtr; |
| 7582 | 7569 | if (objPtr->nextObjPtr) |
| 7583 | 7570 | objPtr->nextObjPtr->prevObjPtr = objPtr->prevObjPtr; |
| 7584 | 7571 | if (interp->liveList == objPtr) |
| 7585 | 7572 | interp->liveList = objPtr->nextObjPtr; |
| 7573 | +#ifdef JIM_DISABLE_OBJECT_POOL |
| 7574 | + Jim_Free(objPtr); |
| 7575 | +#else |
| 7586 | 7576 | |
| 7587 | 7577 | objPtr->prevObjPtr = NULL; |
| 7588 | 7578 | objPtr->nextObjPtr = interp->freeList; |
| 7589 | 7579 | if (interp->freeList) |
| 7590 | 7580 | interp->freeList->prevObjPtr = objPtr; |
| 7591 | 7581 | interp->freeList = objPtr; |
| 7592 | 7582 | objPtr->refCount = -1; |
| 7583 | +#endif |
| 7593 | 7584 | } |
| 7594 | 7585 | |
| 7595 | 7586 | |
| 7596 | 7587 | void Jim_InvalidateStringRep(Jim_Obj *objPtr) |
| 7597 | 7588 | { |
| | @@ -8244,10 +8235,19 @@ |
| 8244 | 8235 | } |
| 8245 | 8236 | |
| 8246 | 8237 | return strObjPtr; |
| 8247 | 8238 | } |
| 8248 | 8239 | |
| 8240 | + |
| 8241 | +#ifdef HAVE_ISASCII |
| 8242 | +#define jim_isascii isascii |
| 8243 | +#else |
| 8244 | +static int jim_isascii(int c) |
| 8245 | +{ |
| 8246 | + return !(c & ~0x7f); |
| 8247 | +} |
| 8248 | +#endif |
| 8249 | 8249 | |
| 8250 | 8250 | static int JimStringIs(Jim_Interp *interp, Jim_Obj *strObjPtr, Jim_Obj *strClass, int strict) |
| 8251 | 8251 | { |
| 8252 | 8252 | static const char * const strclassnames[] = { |
| 8253 | 8253 | "integer", "alpha", "alnum", "ascii", "digit", |
| | @@ -8291,11 +8291,11 @@ |
| 8291 | 8291 | return JIM_OK; |
| 8292 | 8292 | } |
| 8293 | 8293 | |
| 8294 | 8294 | case STR_IS_ALPHA: isclassfunc = isalpha; break; |
| 8295 | 8295 | case STR_IS_ALNUM: isclassfunc = isalnum; break; |
| 8296 | | - case STR_IS_ASCII: isclassfunc = isascii; break; |
| 8296 | + case STR_IS_ASCII: isclassfunc = jim_isascii; break; |
| 8297 | 8297 | case STR_IS_DIGIT: isclassfunc = isdigit; break; |
| 8298 | 8298 | case STR_IS_LOWER: isclassfunc = islower; break; |
| 8299 | 8299 | case STR_IS_UPPER: isclassfunc = isupper; break; |
| 8300 | 8300 | case STR_IS_SPACE: isclassfunc = isspace; break; |
| 8301 | 8301 | case STR_IS_XDIGIT: isclassfunc = isxdigit; break; |
| | @@ -10213,11 +10213,11 @@ |
| 10213 | 10213 | Jim_Collect(interp); |
| 10214 | 10214 | } |
| 10215 | 10215 | } |
| 10216 | 10216 | #endif |
| 10217 | 10217 | |
| 10218 | | -static int JimIsBigEndian(void) |
| 10218 | +int Jim_IsBigEndian(void) |
| 10219 | 10219 | { |
| 10220 | 10220 | union { |
| 10221 | 10221 | unsigned short s; |
| 10222 | 10222 | unsigned char c[2]; |
| 10223 | 10223 | } uval = {0x0102}; |
| | @@ -10269,11 +10269,11 @@ |
| 10269 | 10269 | Jim_SetVariableStrWithStr(i, JIM_INTERACTIVE, "0"); |
| 10270 | 10270 | |
| 10271 | 10271 | Jim_SetVariableStrWithStr(i, "tcl_platform(os)", TCL_PLATFORM_OS); |
| 10272 | 10272 | Jim_SetVariableStrWithStr(i, "tcl_platform(platform)", TCL_PLATFORM_PLATFORM); |
| 10273 | 10273 | Jim_SetVariableStrWithStr(i, "tcl_platform(pathSeparator)", TCL_PLATFORM_PATH_SEPARATOR); |
| 10274 | | - Jim_SetVariableStrWithStr(i, "tcl_platform(byteOrder)", JimIsBigEndian() ? "bigEndian" : "littleEndian"); |
| 10274 | + Jim_SetVariableStrWithStr(i, "tcl_platform(byteOrder)", Jim_IsBigEndian() ? "bigEndian" : "littleEndian"); |
| 10275 | 10275 | Jim_SetVariableStrWithStr(i, "tcl_platform(threaded)", "0"); |
| 10276 | 10276 | Jim_SetVariableStr(i, "tcl_platform(pointerSize)", Jim_NewIntObj(i, sizeof(void *))); |
| 10277 | 10277 | Jim_SetVariableStr(i, "tcl_platform(wordSize)", Jim_NewIntObj(i, sizeof(jim_wide))); |
| 10278 | 10278 | |
| 10279 | 10279 | return i; |
| | @@ -10449,17 +10449,11 @@ |
| 10449 | 10449 | interp->stackTrace = stackTraceObj; |
| 10450 | 10450 | interp->errorFlag = 1; |
| 10451 | 10451 | |
| 10452 | 10452 | len = Jim_ListLength(interp, interp->stackTrace); |
| 10453 | 10453 | if (len >= 3) { |
| 10454 | | - Jim_Obj *filenameObj; |
| 10455 | | - |
| 10456 | | - Jim_ListIndex(interp, interp->stackTrace, len - 2, &filenameObj, JIM_NONE); |
| 10457 | | - |
| 10458 | | - Jim_GetString(filenameObj, &len); |
| 10459 | | - |
| 10460 | | - if (!Jim_Length(filenameObj)) { |
| 10454 | + if (Jim_Length(Jim_ListGetIndex(interp, interp->stackTrace, len - 2)) == 0) { |
| 10461 | 10455 | interp->addStackTrace = 1; |
| 10462 | 10456 | } |
| 10463 | 10457 | } |
| 10464 | 10458 | } |
| 10465 | 10459 | |
| | @@ -10485,14 +10479,15 @@ |
| 10485 | 10479 | if (!*procname && Jim_Length(fileNameObj)) { |
| 10486 | 10480 | |
| 10487 | 10481 | int len = Jim_ListLength(interp, interp->stackTrace); |
| 10488 | 10482 | |
| 10489 | 10483 | if (len >= 3) { |
| 10490 | | - Jim_Obj *objPtr; |
| 10491 | | - if (Jim_ListIndex(interp, interp->stackTrace, len - 3, &objPtr, JIM_NONE) == JIM_OK && Jim_Length(objPtr)) { |
| 10484 | + Jim_Obj *objPtr = Jim_ListGetIndex(interp, interp->stackTrace, len - 3); |
| 10485 | + if (Jim_Length(objPtr)) { |
| 10492 | 10486 | |
| 10493 | | - if (Jim_ListIndex(interp, interp->stackTrace, len - 2, &objPtr, JIM_NONE) == JIM_OK && !Jim_Length(objPtr)) { |
| 10487 | + objPtr = Jim_ListGetIndex(interp, interp->stackTrace, len - 2); |
| 10488 | + if (Jim_Length(objPtr) == 0) { |
| 10494 | 10489 | |
| 10495 | 10490 | ListSetIndex(interp, interp->stackTrace, len - 2, fileNameObj, 0); |
| 10496 | 10491 | ListSetIndex(interp, interp->stackTrace, len - 1, Jim_NewIntObj(interp, linenr), 0); |
| 10497 | 10492 | return; |
| 10498 | 10493 | } |
| | @@ -17159,10 +17154,15 @@ |
| 17159 | 17154 | |
| 17160 | 17155 | static int Jim_LocalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
| 17161 | 17156 | { |
| 17162 | 17157 | int retcode; |
| 17163 | 17158 | |
| 17159 | + if (argc < 2) { |
| 17160 | + Jim_WrongNumArgs(interp, 1, argv, "cmd ?args ...?"); |
| 17161 | + return JIM_ERR; |
| 17162 | + } |
| 17163 | + |
| 17164 | 17164 | |
| 17165 | 17165 | interp->local++; |
| 17166 | 17166 | retcode = Jim_EvalObjVector(interp, argc - 1, argv + 1); |
| 17167 | 17167 | interp->local--; |
| 17168 | 17168 | |
| | @@ -19552,11 +19552,11 @@ |
| 19552 | 19552 | char *num_buffer = NULL; |
| 19553 | 19553 | int num_buffer_size = 0; |
| 19554 | 19554 | |
| 19555 | 19555 | span = format = Jim_GetString(fmtObjPtr, &formatLen); |
| 19556 | 19556 | formatEnd = format + formatLen; |
| 19557 | | - resultPtr = Jim_NewStringObj(interp, "", 0); |
| 19557 | + resultPtr = Jim_NewEmptyStringObj(interp); |
| 19558 | 19558 | |
| 19559 | 19559 | while (format != formatEnd) { |
| 19560 | 19560 | char *end; |
| 19561 | 19561 | int gotMinus, sawFlag; |
| 19562 | 19562 | int gotPrecision, useShort; |
| 19563 | 19563 | |