diff options
author | antirez <antirez> | 2005-03-05 09:46:12 +0000 |
---|---|---|
committer | antirez <antirez> | 2005-03-05 09:46:12 +0000 |
commit | f461c42d9a83e1e4a18b02793d20d09d041d391e (patch) | |
tree | 0c26edbcb6ea2531b8716c8a3e70e1a255d9c6dd | |
parent | 8d6dca8b69276c77bffc1deaf8fb75d28e8c2e63 (diff) | |
download | jimtcl-f461c42d9a83e1e4a18b02793d20d09d041d391e.zip jimtcl-f461c42d9a83e1e4a18b02793d20d09d041d391e.tar.gz jimtcl-f461c42d9a83e1e4a18b02793d20d09d041d391e.tar.bz2 |
removed strcasecmp() and isascii(). Now the Jim core is fully
ANSI-C excluding the [load] command. I plan to add a JIM_FORCE_ANSIC
ifdef to exclude the load command for compilation.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | jim.c | 19 | ||||
-rw-r--r-- | jim.h | 6 |
3 files changed, 22 insertions, 10 deletions
@@ -1,3 +1,10 @@ +2005-03-05 10:34 antirez + + * AUTHORS, ChangeLog, README, jim.c, jim.h, test.tcl: [switch] + command contributed by Clemens Hintze, modified to avoid problems + with -command and shimmering of the objects passed as [switch] + arguments. + 2005-03-05 00:59 patthoyts * Makefile.vc, jim-win32com.c, jim.c: Added ole32.foreach command, @@ -1,7 +1,7 @@ /* Jim - A small embeddable Tcl interpreter * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org> * - * $Id: jim.c,v 1.61 2005/03/05 09:34:13 antirez Exp $ + * $Id: jim.c,v 1.62 2005/03/05 09:46:12 antirez Exp $ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ static void JimRegisterCoreApi(Jim_Interp *interp); * alphabets and digits are each contiguous. */ #ifdef HAVE_LONG_LONG +#define JimIsAscii(c) (((c) & ~0x7f) == 0) static jim_wide JimStrtoll(const char *nptr, char **endptr, register int base) { register const char *s; @@ -135,7 +136,7 @@ static jim_wide JimStrtoll(const char *nptr, char **endptr, register int base) cutlim = (int)(cutoff % qbase); cutoff /= qbase; for (acc = 0, any = 0;; c = *s++) { - if (!isascii(c)) + if (!JimIsAscii(c)) break; if (isdigit(c)) c -= '0'; @@ -5091,20 +5092,20 @@ static Jim_ObjType returnCodeObjType = { int SetReturnCodeFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { const char *str; - int returnCode; + int strLen, returnCode; /* Get the string representation */ - str = Jim_GetString(objPtr, NULL); + str = Jim_GetString(objPtr, &strLen); /* Try to convert into a jim_wide */ - if (!strcasecmp(str, "ok")) + if (!JimStringCompare(str, strLen, "ok", 2, JIM_NOCASE)) returnCode = JIM_OK; - else if (!strcasecmp(str, "error")) + else if (!JimStringCompare(str, strLen, "error", 5, JIM_NOCASE)) returnCode = JIM_ERR; - else if (!strcasecmp(str, "return")) + else if (!JimStringCompare(str, strLen, "return", 6, JIM_NOCASE)) returnCode = JIM_RETURN; - else if (!strcasecmp(str, "break")) + else if (!JimStringCompare(str, strLen, "break", 5, JIM_NOCASE)) returnCode = JIM_BREAK; - else if (!strcasecmp(str, "continue")) + else if (!JimStringCompare(str, strLen, "continue", 8, JIM_NOCASE)) returnCode = JIM_CONTINUE; else { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); @@ -1,7 +1,7 @@ /* Jim - A small embeddable Tcl interpreter * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org> * - * $Id: jim.h,v 1.33 2005/03/05 09:34:13 antirez Exp $ + * $Id: jim.h,v 1.34 2005/03/05 09:46:12 antirez Exp $ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,6 +126,10 @@ /* Unused arguments generate annoying warnings... */ #define JIM_NOTUSED(V) ((void) V) +/* Flags used by API calls getting a 'nocase' argument. */ +#define JIM_CASESENS 0 /* case sensitive */ +#define JIM_NOCASE 1 /* no case */ + /* ----------------------------------------------------------------------------- * Hash table * ---------------------------------------------------------------------------*/ |