diff options
author | hobbs <hobbs@noemail.net> | 1999-09-22 04:12:36 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 1999-09-22 04:12:36 (GMT) |
commit | 99805efcbcdd9c098cc437c81ad6365070396026 (patch) | |
tree | f176f693578997d3b6760b85ac5339c92d61d5ed | |
parent | 8506e13306bbd90d4989990079c0ea4a9d3c3ff5 (diff) | |
download | tcl-99805efcbcdd9c098cc437c81ad6365070396026.zip tcl-99805efcbcdd9c098cc437c81ad6365070396026.tar.gz tcl-99805efcbcdd9c098cc437c81ad6365070396026.tar.bz2 |
1999-09-21 Jeff Hobbs <hobbs@scriptics.com>
* tests/env.test:
* unix/Makefile.in: added support for AIX LIBPATH env var [Bug: 2793]
removed second definition of INCLUDE_INSTALL_DIR (the one that
referenced @includedir@) [Bug: 2805]
* unix/dltest/Makefile.in: added -lc to LIBS [Bug: 2794]
* tests/timer.test: changed after delay in timer test 6.29 from
1 to 10. [Bug: 2796]
* tests/pkg.test:
* generic/tclPkg.c: fixed package version check to disallow 1.2..3
[Bug: 2539]
* unix/Makefile.in: fixed gendate target - this never worked
since RCS was intro'd.
* generic/tclGetDate.y: updated to reflect previous changes
to tclDate.c (leap year calc) and added CEST and UCT time zone
recognition. Fixed 4 missing UCHAR() casts. [Bug: 2717, 954,
1245, 1249]
* generic/tclCkalloc.c: changed Tcl_DumpActiveMemory to really
dump to stderr and close it [Bug: 725] and changed Tcl_Ckrealloc
and Tcl_Ckfree to not bomb when NULL was passed in [Bug: 1719]
and changed Tcl_Alloc, et al to not panic when a alloc request
for zero came through and NULL was returned (valid on AIX, Tru64)
[Bug: 2795, etc]
* generic/tclIOCmd.c: fixed potential core dump in conjunction
with stacked channels with result obj manipulation in
Tcl_ReadChars [Bug: 2623]
* tests/format.test:
* generic/tclCmdAH.c: fixed translation of %0#s in format [Bug: 2605]
* tests/set-old.test:
* generic/tclVar.c: Added fix in TclArraySet
to check when trying to set in a non-existent namespace. [Bug: 2613]
* tests/linsert.test:
* generic/tclCmdIL.c: fixed end-int interpretation of linsert
to correctly calculate value for end, added test and docs [Bug: 2693]
* doc/switch.n: added proper use of comments to example.
* generic/tclCmdMZ.c: changed switch to complain when an error
occurs that seems to be due to a misplaced comment.
* generic/tclCmdMZ.c: fixed illegal ref for \[0-9] substitutions
in regsub [Bug: 2723]
* generic/tclCmdMZ.c: changed [string equal] to return an Int
type object (was a Boolean)
* generic/tclParseExpr.c: changed '"' to '\"' to make FreeBSD
happy [Bug: 2625]
* generic/tclProc.c: moved static buf to better location and
changed static msg that would overflow in ProcessProcResultCode
[Bug: 2483] and added Tcl_DStringFree to Tcl_ProcObjCmd.
Also reworked size of static buffers.
* tests/stringObj.test: added test 9.11
* generic/tclStringObj.c: changed Tcl_AppendObjToObj to
properly handle the 1-byte dest and mixed src case where
both had had Unicode string len checks made on them. [Bug: 2678]
* unix/aclocal.m4:
* unix/tcl.m4: added -bnoentry to the AIX-* case [Bug: 1909]
added fix for FreeBSD-[1-2] recognition
[Bug: 2070] and fix for IRIX SHLIB_LB_LIBS. [Bug: 2610]
* generic/tclPosixStr.c: fixed typo [Bug: 2592]
* win/README.binary: fixed version info and some typos [Bug: 2561]
* generic/tclIO.c: changed Tcl_GetChannelNames* to use style guide
headers (pleases HP cc)
* tests/expr.test:
* generic/tclCompile.c: add TCL_TOKEN_VARIABLE to the part types
that cause differed compilation for exprs, to correct the expr
double-evaluation problem for vars. Added test cases.
Related to [Bug: 732]
FossilOrigin-Name: ab656050a918c62d00ec76ee8f577dfb0f1f10e7
-rw-r--r-- | ChangeLog | 89 | ||||
-rw-r--r-- | doc/switch.n | 7 | ||||
-rw-r--r-- | generic/tclCkalloc.c | 66 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 23 | ||||
-rw-r--r-- | generic/tclCmdIL.c | 10 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 43 | ||||
-rw-r--r-- | generic/tclCompile.c | 5 | ||||
-rw-r--r-- | generic/tclDate.c | 78 | ||||
-rw-r--r-- | generic/tclGetDate.y | 24 | ||||
-rw-r--r-- | generic/tclIO.c | 6 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 8 | ||||
-rw-r--r-- | generic/tclParseExpr.c | 4 | ||||
-rw-r--r-- | generic/tclPkg.c | 11 | ||||
-rw-r--r-- | generic/tclPosixStr.c | 4 | ||||
-rw-r--r-- | generic/tclProc.c | 27 | ||||
-rw-r--r-- | generic/tclStringObj.c | 11 | ||||
-rw-r--r-- | generic/tclVar.c | 15 | ||||
-rw-r--r-- | tests/env.test | 6 | ||||
-rw-r--r-- | tests/event.test | 6 | ||||
-rw-r--r-- | tests/expr.test | 10 | ||||
-rw-r--r-- | tests/format.test | 15 | ||||
-rw-r--r-- | tests/linsert.test | 5 | ||||
-rw-r--r-- | tests/pkg.test | 5 | ||||
-rw-r--r-- | tests/set-old.test | 11 | ||||
-rw-r--r-- | tests/stringObj.test | 19 | ||||
-rw-r--r-- | tests/timer.test | 4 | ||||
-rw-r--r-- | unix/Makefile.in | 10 | ||||
-rw-r--r-- | unix/aclocal.m4 | 6 | ||||
-rw-r--r-- | unix/dltest/Makefile.in | 4 | ||||
-rw-r--r-- | unix/tcl.m4 | 6 | ||||
-rw-r--r-- | win/README.binary | 8 |
31 files changed, 390 insertions, 156 deletions
@@ -1,7 +1,92 @@ +1999-09-21 Jeff Hobbs <hobbs@scriptics.com> + + * tests/env.test: + * unix/Makefile.in: added support for AIX LIBPATH env var [Bug: 2793] + removed second definition of INCLUDE_INSTALL_DIR (the one that + referenced @includedir@) [Bug: 2805] + * unix/dltest/Makefile.in: added -lc to LIBS [Bug: 2794] + + * tests/timer.test: changed after delay in timer test 6.29 from + 1 to 10. [Bug: 2796] + + * tests/pkg.test: + * generic/tclPkg.c: fixed package version check to disallow 1.2..3 + [Bug: 2539] + + * unix/Makefile.in: fixed gendate target - this never worked + since RCS was intro'd. + * generic/tclGetDate.y: updated to reflect previous changes + to tclDate.c (leap year calc) and added CEST and UCT time zone + recognition. Fixed 4 missing UCHAR() casts. [Bug: 2717, 954, + 1245, 1249] + + * generic/tclCkalloc.c: changed Tcl_DumpActiveMemory to really + dump to stderr and close it [Bug: 725] and changed Tcl_Ckrealloc + and Tcl_Ckfree to not bomb when NULL was passed in [Bug: 1719] + and changed Tcl_Alloc, et al to not panic when a alloc request + for zero came through and NULL was returned (valid on AIX, Tru64) + [Bug: 2795, etc] + + * generic/tclIOCmd.c: fixed potential core dump in conjunction + with stacked channels with result obj manipulation in + Tcl_ReadChars [Bug: 2623] + + * tests/format.test: + * generic/tclCmdAH.c: fixed translation of %0#s in format [Bug: 2605] + + * tests/set-old.test: + * generic/tclVar.c: Added fix in TclArraySet + to check when trying to set in a non-existent namespace. [Bug: 2613] + + * tests/linsert.test: + * generic/tclCmdIL.c: fixed end-int interpretation of linsert + to correctly calculate value for end, added test and docs [Bug: 2693] + + * doc/switch.n: added proper use of comments to example. + * generic/tclCmdMZ.c: changed switch to complain when an error + occurs that seems to be due to a misplaced comment. + + * generic/tclCmdMZ.c: fixed illegal ref for \[0-9] substitutions + in regsub [Bug: 2723] + + * generic/tclCmdMZ.c: changed [string equal] to return an Int + type object (was a Boolean) + + * generic/tclParseExpr.c: changed '"' to '\"' to make FreeBSD + happy [Bug: 2625] + + * generic/tclProc.c: moved static buf to better location and + changed static msg that would overflow in ProcessProcResultCode + [Bug: 2483] and added Tcl_DStringFree to Tcl_ProcObjCmd. + Also reworked size of static buffers. + + * tests/stringObj.test: added test 9.11 + * generic/tclStringObj.c: changed Tcl_AppendObjToObj to + properly handle the 1-byte dest and mixed src case where + both had had Unicode string len checks made on them. [Bug: 2678] + + * unix/aclocal.m4: + * unix/tcl.m4: added -bnoentry to the AIX-* case [Bug: 1909] + added fix for FreeBSD-[1-2] recognition + [Bug: 2070] and fix for IRIX SHLIB_LB_LIBS. [Bug: 2610] + + * generic/tclPosixStr.c: fixed typo [Bug: 2592] + + * win/README.binary: fixed version info and some typos [Bug: 2561] + + * generic/tclIO.c: changed Tcl_GetChannelNames* to use style guide + headers (pleases HP cc) + + * tests/expr.test: + * generic/tclCompile.c: add TCL_TOKEN_VARIABLE to the part types + that cause differed compilation for exprs, to correct the expr + double-evaluation problem for vars. Added test cases. + Related to [Bug: 732] + 1999-08-05 Jim Ingham <jingham@cygnus.com> - * mac/tclMacProjects.sea.hqx: Rearrange the projects so that the build - directory is separate from the sources. Much more convenient! + * mac/tclMacProjects.sea.hqx: Rearrange the projects so that the build + directory is separate from the sources. Much more convenient! 1999-08-12 Scott Stanton <stanton@scriptics.com> diff --git a/doc/switch.n b/doc/switch.n index fb7ac60..950e1c6 100644 --- a/doc/switch.n +++ b/doc/switch.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: switch.n,v 1.3 1999/06/24 21:15:14 jpeek Exp $ +'\" RCS: @(#) $Id: switch.n,v 1.3.4.1 1999/09/22 04:12:42 hobbs Exp $ '\" .so man.macros .TH switch n 7.0 Tcl "Tcl Built-In Commands" @@ -94,7 +94,10 @@ will return \fB1\fR, and a \- b - {format 1} + { + # Correct Comment Placement (in switch body) + format 1 + } a* {format 2} default diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 61e744c..070ca37 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -13,7 +13,7 @@ * * This code contributed by Karl Lehenbauer and Mark Diekhans * - * RCS: @(#) $Id: tclCkalloc.c,v 1.5 1999/08/10 02:42:12 welch Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.5.4.1 1999/09/22 04:12:45 hobbs Exp $ */ #include "tclInt.h" @@ -294,7 +294,7 @@ Tcl_DumpActiveMemory (fileName) char *address; if (fileName == NULL) { - fileP = stdout; + fileP = stderr; } else { fileP = fopen(fileName, "w"); if (fileP == NULL) { @@ -445,10 +445,16 @@ Tcl_DbCkalloc(size, file, line) int Tcl_DbCkfree(ptr, file, line) - char * ptr; - char *file; - int line; + char *ptr; + char *file; + int line; { + struct mem_header *memp; + + if (ptr == NULL) { + return; + } + /* * The following cast is *very* tricky. Must convert the pointer * to an integer before doing arithmetic on it, because otherwise @@ -457,8 +463,7 @@ Tcl_DbCkfree(ptr, file, line) * even though BODY_OFFSET is in words on these machines). */ - struct mem_header *memp = (struct mem_header *) - (((unsigned long) ptr) - BODY_OFFSET); + memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET); if (alloc_tracing) fprintf(stderr, "ckfree %lx %ld %s %d\n", @@ -520,14 +525,18 @@ Tcl_DbCkrealloc(ptr, size, file, line) { char *new; unsigned int copySize; + struct mem_header *memp; + + if (ptr == NULL) { + return Tcl_DbCkalloc(size, file, line); + } /* * See comment from Tcl_DbCkfree before you change the following * line. */ - struct mem_header *memp = (struct mem_header *) - (((unsigned long) ptr) - BODY_OFFSET); + memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET); copySize = size; if (copySize > (unsigned int) memp->length) { @@ -796,12 +805,22 @@ char * Tcl_Alloc (size) unsigned int size; { - char *result; + char *result; - result = TclpAlloc(size); - if (result == NULL) - panic("unable to alloc %d bytes", size); - return result; + result = TclpAlloc(size); + /* + * Most systems will not alloc(0), instead bumping it to one so + * that NULL isn't returned. Some systems (AIX, Tru64) will alloc(0) + * by returning NULL, so we have to check that the NULL we get is + * not in response to alloc(0). + * + * The ANSI spec actually says that systems either return NULL *or* + * a special pointer on failure, but we only check for NULL + */ + if ((result == NULL) && size) { + panic("unable to alloc %d bytes", size); + } + return result; } char * @@ -814,7 +833,7 @@ Tcl_DbCkalloc(size, file, line) result = (char *) TclpAlloc(size); - if (result == NULL) { + if ((result == NULL) && size) { fflush(stdout); panic("unable to alloc %d bytes, %s line %d", size, file, line); @@ -841,8 +860,10 @@ Tcl_Realloc(ptr, size) char *result; result = TclpRealloc(ptr, size); - if (result == NULL) + + if ((result == NULL) && size) { panic("unable to realloc %d bytes", size); + } return result; } @@ -857,10 +878,9 @@ Tcl_DbCkrealloc(ptr, size, file, line) result = (char *) TclpRealloc(ptr, size); - if (result == NULL) { + if ((result == NULL) && size) { fflush(stdout); - panic("unable to realloc %d bytes, %s line %d", size, file, - line); + panic("unable to realloc %d bytes, %s line %d", size, file, line); } return result; } @@ -880,14 +900,14 @@ void Tcl_Free (ptr) char *ptr; { - TclpFree(ptr); + TclpFree(ptr); } int Tcl_DbCkfree(ptr, file, line) - char * ptr; - char *file; - int line; + char *ptr; + char *file; + int line; { TclpFree(ptr); return 0; diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 8dc8c54..4874a7a 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.7 1999/07/01 23:21:06 redman Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.7.4.1 1999/09/22 04:12:45 hobbs Exp $ */ #include "tclInt.h" @@ -1907,6 +1907,8 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) * been seen in the current field. */ int gotPrecision; /* Non-zero indicates that a precision has * been set for the current field. */ + int gotZero; /* Non-zero indicates that a zero flag has + * been seen in the current field. */ /* * This procedure is a bit nasty. The goal is to use sprintf to @@ -1935,7 +1937,7 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) register char *newPtr = newFormat; width = precision = noPercent = useShort = 0; - gotMinus = gotPrecision = 0; + gotZero = gotMinus = gotPrecision = 0; whichValue = PTR_VALUE; /* @@ -2004,6 +2006,13 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) if (*format == '-') { gotMinus = 1; } + if (*format == '0') { + /* + * This will be handled by sprintf for numbers, but we + * need to do the char/string ones ourselves + */ + gotZero = 1; + } *newPtr = *format; newPtr++; format++; @@ -2191,21 +2200,23 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) } case CHAR_VALUE: { char *ptr; + char padChar = (gotZero ? '0' : ' '); ptr = dst; if (!gotMinus) { for ( ; --width > 0; ptr++) { - *ptr = ' '; + *ptr = padChar; } } ptr += Tcl_UniCharToUtf(intValue, ptr); for ( ; --width > 0; ptr++) { - *ptr = ' '; + *ptr = padChar; } *ptr = '\0'; break; } case STRING_VALUE: { char *ptr; + char padChar = (gotZero ? '0' : ' '); int pad; ptr = dst; @@ -2217,7 +2228,7 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) if (!gotMinus) { while (pad > 0) { - *ptr++ = ' '; + *ptr++ = padChar; pad--; } } @@ -2228,7 +2239,7 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) ptr += size; } while (pad > 0) { - *ptr++ = ' '; + *ptr++ = padChar; pad--; } *ptr = '\0'; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index aff66e2..cf30bdf 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.15 1999/08/10 17:35:18 redman Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.15.4.1 1999/09/22 04:12:46 hobbs Exp $ */ #include "tclInt.h" @@ -1954,8 +1954,12 @@ Tcl_LinsertObjCmd(dummy, interp, objc, objv) * will invalidate the list's internal representation. */ - result = TclGetIntForIndex(interp, objv[2], /*endValue*/ INT_MAX, - &index); + result = Tcl_ListObjLength(interp, objv[1], &len); + if (result != TCL_OK) { + return result; + } + + result = TclGetIntForIndex(interp, objv[2], /*endValue*/ len, &index); if (result != TCL_OK) { return result; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 585ffa7..87b48f2 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.19 1999/07/22 21:50:54 redman Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.19.4.1 1999/09/22 04:12:46 hobbs Exp $ */ #include "tclInt.h" @@ -485,11 +485,13 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) if (firstChar != src) { Tcl_AppendToObj(resultPtr, firstChar, src - firstChar); } - subStart = info.matches[index].start; - subEnd = info.matches[index].end; - if ((subStart >= 0) && (subEnd >= 0)) { - Tcl_AppendUnicodeToObj(resultPtr, wstring + offset + subStart, - subEnd - subStart); + if (index <= info.nsubs) { + subStart = info.matches[index].start; + subEnd = info.matches[index].end; + if ((subStart >= 0) && (subEnd >= 0)) { + Tcl_AppendUnicodeToObj(resultPtr, + wstring + offset + subStart, subEnd - subStart); + } } if (*src == '\\') { src++; @@ -949,7 +951,7 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) } if ((enum options) index == STR_EQUAL) { - Tcl_SetBooleanObj(resultPtr, (match) ? 0 : 1); + Tcl_SetIntObj(resultPtr, (match) ? 0 : 1); } else { Tcl_SetIntObj(resultPtr, ((match > 0) ? 1 : (match < 0) ? -1 : 0)); @@ -2136,7 +2138,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - int i, j, index, mode, matched, result; + int i, j, index, mode, matched, result, splitObjs, seenComment; char *string, *pattern; Tcl_Obj *stringObj; static char *options[] = { @@ -2179,6 +2181,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) * argument, split them out again. */ + splitObjs = 0; if (objc == 1) { Tcl_Obj **listv; @@ -2186,13 +2189,26 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } objv = listv; + splitObjs = 1; } + seenComment = 0; for (i = 0; i < objc; i += 2) { if (i == objc - 1) { Tcl_ResetResult(interp); Tcl_AppendToObj(Tcl_GetObjResult(interp), "extra switch pattern with no body", -1); + + /* + * Check if this can be due to a badly placed comment + * in the switch block + */ + + if (splitObjs && seenComment) { + Tcl_AppendToObj(Tcl_GetObjResult(interp), + ", this may be due to a comment incorrectly placed outside of a switch body - see the \"switch\" documentation", -1); + } + return TCL_ERROR; } @@ -2201,6 +2217,17 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) */ pattern = Tcl_GetString(objv[i]); + + /* + * The following is an heuristic to detect the infamous + * "comment in switch" error: just check if a pattern + * begins with '#'. + */ + + if (splitObjs && *pattern == '#') { + seenComment = 1; + } + matched = 0; if ((i == objc - 2) && (*pattern == 'd') diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 25803a0..037eec5 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.15 1999/04/22 22:57:06 stanton Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.15.6.1 1999/09/22 04:12:46 hobbs Exp $ */ #include "tclInt.h" @@ -1393,7 +1393,8 @@ TclCompileExprWords(interp, tokenPtr, numWords, envPtr) for (j = 0, partPtr = wordPtr+1; j < wordPtr->numComponents; j++, partPtr++) { if ((partPtr->type == TCL_TOKEN_BS) - || (partPtr->type == TCL_TOKEN_COMMAND)) { + || (partPtr->type == TCL_TOKEN_COMMAND) + || (partPtr->type == TCL_TOKEN_VARIABLE)) { doExprInline = 0; break; } diff --git a/generic/tclDate.c b/generic/tclDate.c index 3544737..ac6a943 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDate.c,v 1.5 1999/05/14 18:29:50 stanton Exp $ + * RCS: @(#) $Id: tclDate.c,v 1.5.4.1 1999/09/22 04:12:47 hobbs Exp $ */ #include "tclInt.h" @@ -135,22 +135,27 @@ typedef union -#ifdef __cplusplus +#if defined(__cplusplus) || defined(__STDC__) + +#if defined(__cplusplus) && defined(__EXTERN_C__) +extern "C" { +#endif #ifndef TclDateerror +#if defined(__cplusplus) void TclDateerror(const char *); #endif - +#endif #ifndef TclDatelex -#ifdef __EXTERN_C__ - extern "C" { int TclDatelex(void); } -#else int TclDatelex(void); #endif -#endif int TclDateparse(void); +#if defined(__cplusplus) && defined(__EXTERN_C__) +} +#endif #endif + #define TclDateclearin TclDatechar = -1 #define TclDateerrok TclDateerrflag = 0 extern int TclDatechar; @@ -258,7 +263,8 @@ static TABLE TimezoneTable[] = { { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ { "utc", tZONE, HOUR( 0) }, - { "wet", tZONE, HOUR( 0) } , /* Western European */ + { "uct", tZONE, HOUR( 0) }, /* Universal Coordinated Time */ + { "wet", tZONE, HOUR( 0) }, /* Western European */ { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */ { "wat", tZONE, HOUR( 1) }, /* West Africa */ { "at", tZONE, HOUR( 2) }, /* Azores */ @@ -290,6 +296,7 @@ static TABLE TimezoneTable[] = { { "nt", tZONE, HOUR(11) }, /* Nome */ { "idlw", tZONE, HOUR(12) }, /* International Date Line West */ { "cet", tZONE, -HOUR( 1) }, /* Central European */ + { "cest", tDAYZONE, -HOUR( 1) }, /* Central European Summer */ { "met", tZONE, -HOUR( 1) }, /* Middle European */ { "mewt", tZONE, -HOUR( 1) }, /* Middle European Winter */ { "mest", tDAYZONE, -HOUR( 1) }, /* Middle European Summer */ @@ -430,12 +437,10 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode, TimePtr) Julian += DaysInMonth[i]; if (Year >= EPOCH) { for (i = EPOCH; i < Year; i++) - Julian += 365 + (((i % 4) == 0) && - (((i % 100) != 0) || ((i % 400) == 0))); + Julian += 365 + (i % 4 == 0); } else { for (i = Year; i < EPOCH; i++) - Julian -= 365 + (((i % 4) == 0) && - (((i % 100) != 0) || ((i % 400) == 0))); + Julian -= 365 + (i % 4 == 0); } Julian *= SECSPERDAY; Julian += TclDateTimezone * 60L; @@ -660,10 +665,10 @@ TclDatelex() TclDateInput++; } - if (isdigit(c = *TclDateInput) || c == '-' || c == '+') { /* INTL: digit */ + if (isdigit(UCHAR(c = *TclDateInput)) || c == '-' || c == '+') { /* INTL: digit */ if (c == '-' || c == '+') { sign = c == '-' ? -1 : 1; - if (!isdigit(*++TclDateInput)) { /* INTL: digit */ + if (!isdigit(UCHAR(*++TclDateInput))) { /* INTL: digit */ /* * skip the '-' sign */ @@ -673,7 +678,7 @@ TclDatelex() sign = 0; } for (TclDatelval.Number = 0; - isdigit(c = *TclDateInput++); ) { /* INTL: digit */ + isdigit(UCHAR(c = *TclDateInput++)); ) { /* INTL: digit */ TclDatelval.Number = 10 * TclDatelval.Number + c - '0'; } TclDateInput--; @@ -683,7 +688,7 @@ TclDatelex() return sign ? tSNUMBER : tUNUMBER; } if (!(c & 0x80) && isalpha(UCHAR(c))) { /* INTL: ISO only. */ - for (p = buff; isalpha(c = *TclDateInput++) /* INTL: ISO only. */ + for (p = buff; isalpha(UCHAR(c = *TclDateInput++)) /* INTL: ISO only. */ || c == '.'; ) { if (p < &buff[sizeof buff - 1]) { *p++ = c; @@ -803,14 +808,14 @@ TclGetDate(p, now, zone, timePtr) *timePtr = Start; return 0; } -TclDatetabelem TclDateexca[] ={ +static const TclDatetabelem TclDateexca[] ={ -1, 1, 0, -1, -2, 0, }; # define YYNPROD 41 # define YYLAST 227 -TclDatetabelem TclDateact[]={ +static const TclDatetabelem TclDateact[]={ 14, 11, 23, 28, 17, 12, 19, 18, 16, 9, 10, 13, 42, 21, 46, 45, 44, 48, 41, 37, @@ -835,39 +840,39 @@ TclDatetabelem TclDateact[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 20, 25, 24, 27, 26, 42, 0, 0, 0, 0, 40 }; -TclDatetabelem TclDatepact[]={ +static const TclDatetabelem TclDatepact[]={ -10000000, -258,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -45, -267,-10000000, -244,-10000000, -14, -231, -240,-10000000,-10000000,-10000000, -10000000, -246,-10000000, -247, -248,-10000000,-10000000,-10000000,-10000000, -15, -10000000,-10000000,-10000000,-10000000,-10000000, -40, -20,-10000000, -251,-10000000, -10000000, -252,-10000000, -253,-10000000, -249,-10000000,-10000000,-10000000 }; -TclDatetabelem TclDatepgo[]={ +static const TclDatetabelem TclDatepgo[]={ 0, 28, 39, 38, 37, 36, 35, 34, 33, 32, 31 }; -TclDatetabelem TclDater1[]={ +static const TclDatetabelem TclDater1[]={ 0, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 1, 1 }; -TclDatetabelem TclDater2[]={ +static const TclDatetabelem TclDater2[]={ 0, 0, 4, 3, 3, 3, 3, 3, 2, 5, 9, 9, 13, 13, 5, 3, 3, 3, 5, 5, 7, 11, 5, 9, 5, 3, 7, 5, 2, 5, 5, 3, 5, 5, 3, 5, 5, 3, 3, 1, 3 }; -TclDatetabelem TclDatechk[]={ +static const TclDatetabelem TclDatechk[]={ -10000000, -2, -3, -4, -5, -6, -7, -8, -9, 267, 268, 259, 263, 269, 258, -10, 266, 262, 265, 264, 261, 58, 258, 47, 263, 262, 265, 264, 270, 267, 44, 257, 262, 265, 264, 267, 267, 267, 44, -1, 266, 58, 261, 47, 267, 267, 267, -1, 266 }; -TclDatetabelem TclDatedef[]={ +static const TclDatetabelem TclDatedef[]={ 1, -2, 2, 3, 4, 5, 6, 7, 8, 38, 15, 16, 0, 25, 17, 28, 0, 31, 34, 37, @@ -979,7 +984,7 @@ char * TclDatereds[] = #define YYRECOVERING() (!!TclDateerrflag) #define YYNEW(type) malloc(sizeof(type) * TclDatenewmax) #define YYCOPY(to, from, type) \ - (type *) memcpy(to, (char *) from, TclDatenewmax * sizeof(type)) + (type *) memcpy(to, (char *) from, TclDatemaxdepth * sizeof (type)) #define YYENLARGE( from, type) \ (type *) realloc((char *) from, TclDatenewmax * sizeof(type)) #ifndef YYDEBUG @@ -1063,12 +1068,12 @@ int TclDateparse(void) int TclDateparse() #endif { - register YYSTYPE *TclDatepvt; /* top of value stack for $vars */ + register YYSTYPE *TclDatepvt = 0; /* top of value stack for $vars */ #if defined(__cplusplus) || defined(lint) /* - hacks to please C++ and lint - goto's inside switch should never be - executed; TclDatepvt is set to 0 to avoid "used before set" warning. + hacks to please C++ and lint - goto's inside + switch should never be executed */ static int __yaccpar_lint_hack__ = 0; switch (__yaccpar_lint_hack__) @@ -1076,7 +1081,6 @@ int TclDateparse() case 1: goto TclDateerrlab; case 2: goto TclDatenewstate; } - TclDatepvt = 0; #endif /* @@ -1167,9 +1171,9 @@ int TclDateparse() ** reallocate and recover. Note that pointers ** have to be reset, or bad things will happen */ - int TclDateps_index = (TclDate_ps - TclDates); - int TclDatepv_index = (TclDate_pv - TclDatev); - int TclDatepvt_index = (TclDatepvt - TclDatev); + long TclDateps_index = (TclDate_ps - TclDates); + long TclDatepv_index = (TclDate_pv - TclDatev); + long TclDatepvt_index = (TclDatepvt - TclDatev); int TclDatenewmax; #ifdef YYEXPAND TclDatenewmax = YYEXPAND(TclDatemaxdepth); @@ -1295,7 +1299,7 @@ int TclDateparse() ** look through exception table */ { - register int *TclDatexi = TclDateexca; + register const int *TclDatexi = TclDateexca; while ( ( *TclDatexi != -1 ) || ( TclDatexi[1] != TclDate_state ) ) @@ -1572,10 +1576,10 @@ case 24:{ TclDateDay = TclDatepvt[-1].Number; } break; case 25:{ - TclDateMonth = 1; - TclDateDay = 1; - TclDateYear = EPOCH; - } break; + TclDateMonth = 1; + TclDateDay = 1; + TclDateYear = EPOCH; + } break; case 26:{ TclDateMonth = TclDatepvt[-1].Number; TclDateDay = TclDatepvt[-2].Number; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 2f519dce..4f2b24c 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclGetDate.y,v 1.4 1999/04/16 00:46:46 stanton Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.4.6.1 1999/09/22 04:12:47 hobbs Exp $ */ %{ @@ -250,11 +250,11 @@ date : tUNUMBER '/' tUNUMBER { yyMonth = $2; yyDay = $1; } - | tEPOCH { - yyMonth = 1; - yyDay = 1; - yyYear = EPOCH; - } + | tEPOCH { + yyMonth = 1; + yyDay = 1; + yyYear = EPOCH; + } | tUNUMBER tMONTH tUNUMBER { yyMonth = $2; yyDay = $1; @@ -413,7 +413,8 @@ static TABLE TimezoneTable[] = { { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ { "utc", tZONE, HOUR( 0) }, - { "wet", tZONE, HOUR( 0) } , /* Western European */ + { "uct", tZONE, HOUR( 0) }, /* Universal Coordinated Time */ + { "wet", tZONE, HOUR( 0) }, /* Western European */ { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */ { "wat", tZONE, HOUR( 1) }, /* West Africa */ { "at", tZONE, HOUR( 2) }, /* Azores */ @@ -445,6 +446,7 @@ static TABLE TimezoneTable[] = { { "nt", tZONE, HOUR(11) }, /* Nome */ { "idlw", tZONE, HOUR(12) }, /* International Date Line West */ { "cet", tZONE, -HOUR( 1) }, /* Central European */ + { "cest", tDAYZONE, -HOUR( 1) }, /* Central European Summer */ { "met", tZONE, -HOUR( 1) }, /* Middle European */ { "mewt", tZONE, -HOUR( 1) }, /* Middle European Winter */ { "mest", tDAYZONE, -HOUR( 1) }, /* Middle European Summer */ @@ -813,10 +815,10 @@ yylex() yyInput++; } - if (isdigit(c = *yyInput) || c == '-' || c == '+') { /* INTL: digit */ + if (isdigit(UCHAR(c = *yyInput)) || c == '-' || c == '+') { /* INTL: digit */ if (c == '-' || c == '+') { sign = c == '-' ? -1 : 1; - if (!isdigit(*++yyInput)) { /* INTL: digit */ + if (!isdigit(UCHAR(*++yyInput))) { /* INTL: digit */ /* * skip the '-' sign */ @@ -826,7 +828,7 @@ yylex() sign = 0; } for (yylval.Number = 0; - isdigit(c = *yyInput++); ) { /* INTL: digit */ + isdigit(UCHAR(c = *yyInput++)); ) { /* INTL: digit */ yylval.Number = 10 * yylval.Number + c - '0'; } yyInput--; @@ -836,7 +838,7 @@ yylex() return sign ? tSNUMBER : tUNUMBER; } if (!(c & 0x80) && isalpha(UCHAR(c))) { /* INTL: ISO only. */ - for (p = buff; isalpha(c = *yyInput++) /* INTL: ISO only. */ + for (p = buff; isalpha(UCHAR(c = *yyInput++)) /* INTL: ISO only. */ || c == '.'; ) { if (p < &buff[sizeof buff - 1]) { *p++ = c; diff --git a/generic/tclIO.c b/generic/tclIO.c index c35147d..84b75b4 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.14 1999/08/10 17:35:18 redman Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.14.4.1 1999/09/22 04:12:48 hobbs Exp $ */ #include "tclInt.h" @@ -8157,7 +8157,6 @@ SetBlockMode(interp, chanPtr, mode) } return TCL_OK; } - /* *---------------------------------------------------------------------- @@ -8176,7 +8175,8 @@ SetBlockMode(interp, chanPtr, mode) */ int -Tcl_GetChannelNames(Tcl_Interp *interp) +Tcl_GetChannelNames(interp) + Tcl_Interp *interp; /* Interp for error reporting. */ { Channel *chanPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index bbb4e4e..ca394f3 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.6 1999/05/05 01:19:43 stanton Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.6.6.1 1999/09/22 04:12:49 hobbs Exp $ */ #include "tclInt.h" @@ -350,12 +350,14 @@ Tcl_ReadObjCmd(dummy, interp, objc, objv) } } - resultPtr = Tcl_GetObjResult(interp); + resultPtr = Tcl_NewObj(); + Tcl_IncrRefCount(resultPtr); charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0); if (charactersRead < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "error reading \"", name, "\": ", Tcl_PosixError(interp), (char *) NULL); + Tcl_DecrRefCount(resultPtr); return TCL_ERROR; } @@ -372,6 +374,8 @@ Tcl_ReadObjCmd(dummy, interp, objc, objv) Tcl_SetObjLength(resultPtr, length - 1); } } + Tcl_SetObjResult(interp, resultPtr); + Tcl_DecrRefCount(resultPtr); return TCL_OK; } diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c index 819628c..d96e24b 100644 --- a/generic/tclParseExpr.c +++ b/generic/tclParseExpr.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParseExpr.c,v 1.4 1999/04/21 21:50:28 rjohnson Exp $ + * RCS: @(#) $Id: tclParseExpr.c,v 1.4.6.1 1999/09/22 04:12:49 hobbs Exp $ */ #include "tclInt.h" @@ -1589,7 +1589,7 @@ GetLexeme(infoPtr) infoPtr->lexeme = DOLLAR; return TCL_OK; - case '"': + case '\"': infoPtr->lexeme = QUOTE; return TCL_OK; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 5cb1818..13eded0 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPkg.c,v 1.4 1999/04/16 00:46:51 stanton Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.4.6.1 1999/09/22 04:12:49 hobbs Exp $ */ #include "tclInt.h" @@ -871,16 +871,19 @@ CheckVersion(interp, string) * by dots. */ { char *p = string; + char prevChar; if (!isdigit(UCHAR(*p))) { /* INTL: digit */ goto error; } - for (p++; *p != 0; p++) { - if (!isdigit(UCHAR(*p)) && (*p != '.')) { /* INTL: digit */ + for (prevChar = *p, p++; *p != 0; p++) { + if (!isdigit(UCHAR(*p)) && + ((*p != '.') || (prevChar == '.'))) { /* INTL: digit */ goto error; } + prevChar = *p; } - if (p[-1] != '.') { + if (prevChar != '.') { return TCL_OK; } diff --git a/generic/tclPosixStr.c b/generic/tclPosixStr.c index 7e61d20..edecfd8 100644 --- a/generic/tclPosixStr.c +++ b/generic/tclPosixStr.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPosixStr.c,v 1.4 1999/04/16 00:46:52 stanton Exp $ + * RCS: @(#) $Id: tclPosixStr.c,v 1.4.6.1 1999/09/22 04:12:49 hobbs Exp $ */ #include "tclInt.h" @@ -736,7 +736,7 @@ Tcl_ErrnoMsg(err) case ENOPKG: return "package not installed"; #endif #ifdef ENOPROTOOPT - case ENOPROTOOPT: return "bad proocol option"; + case ENOPROTOOPT: return "bad protocol option"; #endif #ifdef ENOSPC case ENOSPC: return "no space left on device"; diff --git a/generic/tclProc.c b/generic/tclProc.c index 3609d16..2ef55d1 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.19 1999/04/16 00:46:52 stanton Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.19.6.1 1999/09/22 04:12:50 hobbs Exp $ */ #include "tclInt.h" @@ -135,6 +135,7 @@ Tcl_ProcObjCmd(dummy, interp, objc, objv) cmd = Tcl_CreateObjCommand(interp, Tcl_DStringValue(&ds), TclObjInterpProc, (ClientData) procPtr, TclProcDeleteProc); + Tcl_DStringFree(&ds); /* * Now initialize the new procedure's cmdPtr field. This will be used * later when the procedure is called to determine what namespace the @@ -265,7 +266,7 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) if (precompiled) { if (numArgs > procPtr->numArgs) { - char buf[128]; + char buf[64 + TCL_INTEGER_SPACE + TCL_INTEGER_SPACE]; sprintf(buf, "\": arg list contains %d entries, precompiled header expects %d", numArgs, procPtr->numArgs); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), @@ -351,7 +352,7 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) && (fieldCount == 2)) || ((localPtr->defValuePtr != NULL) && (fieldCount != 2))) { - char buf[128]; + char buf[80 + TCL_INTEGER_SPACE]; sprintf(buf, "\": formal parameter %d is inconsistent with precompiled body", i); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), @@ -1087,7 +1088,6 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) } } if (bodyPtr->typePtr != &tclByteCodeType) { - char buf[100]; int numChars; char *ellipsis; @@ -1133,7 +1133,9 @@ TclProcCompileProc(interp, procPtr, bodyPtr, nsPtr, description, procName) if (result != TCL_OK) { if (result == TCL_ERROR) { - numChars = strlen(procName); + char buf[100 + TCL_INTEGER_SPACE]; + + numChars = strlen(procName); ellipsis = ""; if (numChars > 50) { numChars = 50; @@ -1201,13 +1203,20 @@ ProcessProcResultCode(interp, procName, nameLen, returnCode) int returnCode; /* The unexpected result code. */ { Interp *iPtr = (Interp *) interp; - char msg[100 + TCL_INTEGER_SPACE]; - + if (returnCode == TCL_RETURN) { returnCode = TclUpdateReturnInfo(iPtr); } else if (returnCode == TCL_ERROR) { - sprintf(msg, "\n (procedure \"%.*s\" line %d)", - nameLen, procName, iPtr->errorLine); + char msg[100 + TCL_INTEGER_SPACE]; + char *ellipsis = ""; + int numChars = nameLen; + + if (numChars > 60) { + numChars = 60; + ellipsis = "..."; + } + sprintf(msg, "\n (procedure \"%.*s%s\" line %d)", + numChars, procName, ellipsis, iPtr->errorLine); Tcl_AddObjErrorInfo(interp, msg, -1); } else if (returnCode == TCL_BREAK) { Tcl_ResetResult(interp); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 95e83dc..c37487f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.12 1999/06/16 00:47:56 hershey Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.12.4.1 1999/09/22 04:12:50 hobbs Exp $ */ #include "tclInt.h" @@ -334,7 +334,7 @@ Tcl_GetCharLength(objPtr) if (stringPtr->numChars == objPtr->length) { /* - * Since we've just calucalated the number of chars, and all + * Since we've just calculated the number of chars, and all * UTF chars are 1-byte long, we don't need to store the * unicode string. */ @@ -916,17 +916,18 @@ Tcl_AppendObjToObj(objPtr, appendObjPtr) * number of characters in the final (appended-to) object. */ + bytes = Tcl_GetStringFromObj(appendObjPtr, &length); + allOneByteChars = 0; numChars = stringPtr->numChars; if ((numChars >= 0) && (appendObjPtr->typePtr == &tclStringType)) { stringPtr = GET_STRING(appendObjPtr); - if (stringPtr->numChars >= 0) { + if ((stringPtr->numChars >= 0) && (stringPtr->numChars == length)) { numChars += stringPtr->numChars; allOneByteChars = 1; } } - - bytes = Tcl_GetStringFromObj(appendObjPtr, &length); + AppendUtfToUtfRep(objPtr, bytes, length); if (allOneByteChars) { diff --git a/generic/tclVar.c b/generic/tclVar.c index 67a5cab..d5102a1 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.12 1999/08/10 02:42:14 welch Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.12.4.1 1999/09/22 04:12:50 hobbs Exp $ */ #include "tclInt.h" @@ -3255,8 +3255,7 @@ TclArraySet(interp, arrayNameObj, arrayElemObj) return TCL_OK; } - if (TclIsVarArrayElement(varPtr) || - !TclIsVarUndefined(varPtr)) { + if (TclIsVarArrayElement(varPtr) || !TclIsVarUndefined(varPtr)) { /* * Either an array element, or a scalar: lose! */ @@ -3269,9 +3268,17 @@ TclArraySet(interp, arrayNameObj, arrayElemObj) * Create variable for new array. */ - varPtr = TclLookupVar(interp, varName, (char *) NULL, 0, 0, + varPtr = TclLookupVar(interp, varName, (char *) NULL, + TCL_LEAVE_ERR_MSG, "set", /*createPart1*/ 1, /*createPart2*/ 0, &arrayPtr); + /* + * Still couldn't do it - this can occur if a non-existent + * namespace was specified + */ + if (varPtr == NULL) { + return TCL_ERROR; + } } TclSetVarArray(varPtr); TclClearVarUndefined(varPtr); diff --git a/tests/env.test b/tests/env.test index 44fc6aa..67b8ab7 100644 --- a/tests/env.test +++ b/tests/env.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: env.test,v 1.9 1999/07/08 19:44:43 rjohnson Exp $ +# RCS: @(#) $Id: env.test,v 1.9.4.1 1999/09/22 04:12:56 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -78,7 +78,7 @@ puts $f { lrem names ComSpec lrem names "" } - foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH PURE_PROG_NAME DISPLAY SHLIB_PATH } { + foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH PURE_PROG_NAME DISPLAY SHLIB_PATH } { lrem names $name } foreach p $names { @@ -106,7 +106,7 @@ foreach name [array names env] { # Added the following lines so that child tcltest can actually find its # library if the initial tcltest is run from a non-standard place. # ('saved' env vars) -foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH DISPLAY SHLIB_PATH} { +foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH} { if {[info exists env2($name)]} { set env($name) $env2($name); } diff --git a/tests/event.test b/tests/event.test index 073d96d..bfe3e6d 100644 --- a/tests/event.test +++ b/tests/event.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: event.test,v 1.8 1999/07/01 17:36:17 jenn Exp $ +# RCS: @(#) $Id: event.test,v 1.8.4.1 1999/09/22 04:12:56 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -394,9 +394,9 @@ test event-11.5 {Tcl_VwaitCmd procedure: round robin scheduling, 2 sources} {soc puts $s foobar close $s } - set s1 [socket -server accept 5001] + catch {set s1 [socket -server accept 5001]} after 1000 - set s2 [socket 127.0.0.1 5001] + catch {set s2 [socket 127.0.0.1 5001]} close $s1 set x 0 set y 0 diff --git a/tests/expr.test b/tests/expr.test index 17a4222..9d59a1c 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.5 1999/06/30 00:17:06 jenn Exp $ +# RCS: @(#) $Id: expr.test,v 1.5.4.1 1999/09/22 04:12:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -703,6 +703,14 @@ test expr-20.3 {broken substitution of integer digits} { # fails with 8.0.x, but not 8.1b2 list [set a 000; expr 0x1$a] [set a 1; expr ${a}000] } {4096 1000} +test expr-20.4 {proper double evaluation compilation, error case} { + catch {unset a}; # make sure $a doesn't exist + list [catch {expr 1?{$a}:0} msg] $msg +} {1 {can't read "a": no such variable}} +test expr-20.5 {proper double evaluation compilation, working case} { + set a yellow + expr 1?{$a}:0 +} yellow # cleanup if {[info exists a]} { diff --git a/tests/format.test b/tests/format.test index 9e4a412..493ede3 100644 --- a/tests/format.test +++ b/tests/format.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: format.test,v 1.5 1999/06/26 03:54:14 jenn Exp $ +# RCS: @(#) $Id: format.test,v 1.5.4.1 1999/09/22 04:12:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -467,6 +467,19 @@ test format-14.2 {testing MAX_FLOAT_SIZE for 0 and 1} { format {%s} "a" } {a} +test format-15.1 {testing %0..s 0 padding for chars/strings} { + format %05s a +} {0000a} +test format-15.2 {testing %0..s 0 padding for chars/strings} { + format "% 5s" a +} { a} +test format-15.3 {testing %0..s 0 padding for chars/strings} { + format %5s a +} { a} +test format-15.4 {testing %0..s 0 padding for chars/strings} { + format %05c 61 +} {0000=} + set a "0123456789" set b "" for {set i 0} {$i < 290} {incr i} { diff --git a/tests/linsert.test b/tests/linsert.test index c1e42a6..eee9ede 100644 --- a/tests/linsert.test +++ b/tests/linsert.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: linsert.test,v 1.6 1999/06/26 03:54:16 jenn Exp $ +# RCS: @(#) $Id: linsert.test,v 1.6.4.1 1999/09/22 04:12:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -78,6 +78,9 @@ test linsert-1.18 {linsert command} { test linsert-1.19 {linsert command} { linsert {} end q r } {q r} +test linsert-1.20 {linsert command, use of end-int index} { + linsert {a b c d} end-2 e f +} {a b e f c d} test linsert-2.1 {linsert errors} { list [catch linsert msg] $msg diff --git a/tests/pkg.test b/tests/pkg.test index 82cc7a5..2f701cb 100644 --- a/tests/pkg.test +++ b/tests/pkg.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: pkg.test,v 1.6 1999/06/26 20:55:09 rjohnson Exp $ +# RCS: @(#) $Id: pkg.test,v 1.6.4.1 1999/09/22 04:12:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -529,6 +529,9 @@ test pkg-5.3 {CheckVersion procedure} { test pkg-5.4 {CheckVersion procedure} { list [catch {package vcompare 1.2.3. 2.1} msg] $msg } {1 {expected version number but got "1.2.3."}} +test pkg-5.5 {CheckVersion procedure} { + list [catch {package vcompare 1.2..3 2.1} msg] $msg +} {1 {expected version number but got "1.2..3"}} test pkg-6.1 {ComparePkgVersions procedure} { package vcompare 1.23 1.22 diff --git a/tests/set-old.test b/tests/set-old.test index 7fec23e..b180ebb 100644 --- a/tests/set-old.test +++ b/tests/set-old.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: set-old.test,v 1.6 1999/06/26 20:55:12 rjohnson Exp $ +# RCS: @(#) $Id: set-old.test,v 1.6.4.1 1999/09/22 04:12:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -501,6 +501,15 @@ test set-old-8.37.4 {array command, empty set with populated array} { array set aVaRnAmE [list e3 v3] list [lsort [array names aVaRnAmE]] [catch {set aVaRnAmE(e2)} msg] $msg } {{e1 e2 e3} 0 v2} +test set-old-8.37.5 {array command, set with non-existent namespace} { + list [catch {array set bogusnamespace::var {}} msg] $msg +} {1 {can't set "bogusnamespace::var": parent namespace doesn't exist}} +test set-old-8.37.6 {array command, set with non-existent namespace} { + list [catch {array set bogusnamespace::var {a b}} msg] $msg +} {1 {can't set "bogusnamespace::var(a)": parent namespace doesn't exist}} +test set-old-8.37.7 {array command, set with non-existent namespace} { + list [catch {array set bogusnamespace::var(0) {a b}} msg] $msg +} {1 {can't set "bogusnamespace::var(0)": variable isn't array}} test set-old-8.38 {array command, size option} { catch {unset a} array size a diff --git a/tests/stringObj.test b/tests/stringObj.test index 257aa9a..b83e480 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: stringObj.test,v 1.8 1999/06/26 20:55:14 rjohnson Exp $ +# RCS: @(#) $Id: stringObj.test,v 1.8.4.1 1999/09/22 04:12:58 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -299,6 +299,23 @@ test stringObj-9.10 {TclAppendObjToObj, integer src & mixed dest} { list [testobj objtype $x] [testobj objtype $y] [append x $y] \ [set y] [testobj objtype $x] [testobj objtype $y] } {string int abcï¿®ghi9 9 string int} +test stringObj-9.11 {TclAppendObjToObj, mixed src & 1-byte dest index check} { + # bug 2678, in <=8.2.0, the second obj (the one to append) in + # Tcl_AppendObjToObj was not correctly checked to see if it was + # all one byte chars, so a unicode string would be added as one + # byte chars. + set x abcdef + set len [string length $x] + set y aübåcï + set len [string length $y] + append x $y + string length $x + set q {} + for {set i 0} {$i < 12} {incr i} { + lappend q [string index $x $i] + } + set q +} {a b c d e f a ü b å c ï} test stringObj-10.1 {Tcl_GetRange with all byte-size chars} { set x "abcdef" diff --git a/tests/timer.test b/tests/timer.test index 4a85cda..2c818f0 100644 --- a/tests/timer.test +++ b/tests/timer.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: timer.test,v 1.5 1999/06/26 20:55:15 rjohnson Exp $ +# RCS: @(#) $Id: timer.test,v 1.5.4.1 1999/09/22 04:12:58 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -412,7 +412,7 @@ test timer-6.29 {Tcl_AfterCmd procedure, info option, script with NULL} { } set x "hello world" set id junk - set id [after 1 set x ab\0cd] + set id [after 10 set x ab\0cd] update set y [string length [lindex [lindex [after info $id] 0] 2]] foreach i [after info] { diff --git a/unix/Makefile.in b/unix/Makefile.in index df0cc5e..b317546 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.44 1999/08/11 20:51:54 redman Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.44.2.1 1999/09/22 04:13:02 hobbs Exp $ VERSION = @TCL_VERSION@ @@ -64,9 +64,6 @@ MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 # Tcl commands: MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann -# Directory in which to install the include file tcl.h: -INCLUDE_INSTALL_DIR = @includedir@ - # Package search path. TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ @@ -431,6 +428,7 @@ tcltest: ${TCLTEST_OBJS} ${TCL_LIB_FILE} ${BUILD_DLTEST} test: tcltest LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH; \ + LIBPATH=`pwd`:${LIBPATH}; export LIBPATH; \ SHLIB_PATH=`pwd`:${SHLIB_PATH}; export SHLIB_PATH; \ TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \ ./tcltest $(TOP_DIR)/tests/all.tcl @@ -438,6 +436,7 @@ test: tcltest # Useful target to launch a built tcltest with the proper path,... runtest: tcltest LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}; export LD_LIBRARY_PATH; \ + LIBPATH=`pwd`:${LIBPATH}; export LIBPATH; \ SHLIB_PATH=`pwd`:${SHLIB_PATH}; export SHLIB_PATH; \ TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \ ./tcltest @@ -461,9 +460,10 @@ topDirName: gendate: yacc -l $(GENERIC_DIR)/tclGetDate.y sed -e 's/yy/TclDate/g' -e '/^#include <values.h>/d' \ - -e "s/SCCSID/RCS: @(#) \$Id\$" + -e 's/SCCSID/RCS: @(#) $$Id: Makefile.in,v 1.44.2.1 1999/09/22 04:13:02 hobbs Exp $$/' \ -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \ -e '/TclDatenewstate:/d' -e '/#pragma/d' \ + -e '/#include <inttypes.h>/d' \ <y.tab.c >$(GENERIC_DIR)/tclDate.c rm y.tab.c diff --git a/unix/aclocal.m4 b/unix/aclocal.m4 index d8f4be9..40cb6eb 100644 --- a/unix/aclocal.m4 +++ b/unix/aclocal.m4 @@ -578,7 +578,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ ;; AIX-*) SHLIB_CFLAGS="" - SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512" + SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -646,7 +646,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ IRIX-5.*|IRIX-6.*|IRIX64-6.5*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" - SHLIB_LD_LIBS="" + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -726,7 +726,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ LDFLAGS="-Wl,-Bexport" LD_SEARCH_FLAGS="" ;; - NetBSD-*|FreeBSD-[[12]].*|OpenBSD-*) + NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*) # Not available on all versions: check for include file. AC_CHECK_HEADER(dlfcn.h, [ SHLIB_CFLAGS="-fpic" diff --git a/unix/dltest/Makefile.in b/unix/dltest/Makefile.in index 96b7cc0..54ad585 100644 --- a/unix/dltest/Makefile.in +++ b/unix/dltest/Makefile.in @@ -1,11 +1,11 @@ # This Makefile is used to create several test cases for Tcl's load # command. It also illustrates how to take advantage of configuration # exported by Tcl to set up Makefiles for shared libraries. -# RCS: @(#) $Id: Makefile.in,v 1.5 1999/04/16 00:48:06 stanton Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.5.6.1 1999/09/22 04:13:07 hobbs Exp $ TCL_DBGX = @TCL_DBGX@ CC = @CC@ -LIBS = @TCL_BUILD_STUB_LIB_SPEC@ @TCL_LIBS@ +LIBS = @TCL_BUILD_STUB_LIB_SPEC@ @TCL_LIBS@ -lc AC_FLAGS = @EXTRA_CFLAGS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_LD = @SHLIB_LD@ diff --git a/unix/tcl.m4 b/unix/tcl.m4 index d8f4be9..40cb6eb 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -578,7 +578,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ ;; AIX-*) SHLIB_CFLAGS="" - SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512" + SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -646,7 +646,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ IRIX-5.*|IRIX-6.*|IRIX64-6.5*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" - SHLIB_LD_LIBS="" + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -726,7 +726,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ LDFLAGS="-Wl,-Bexport" LD_SEARCH_FLAGS="" ;; - NetBSD-*|FreeBSD-[[12]].*|OpenBSD-*) + NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*) # Not available on all versions: check for include file. AC_CHECK_HEADER(dlfcn.h, [ SHLIB_CFLAGS="-fpic" diff --git a/win/README.binary b/win/README.binary index 0b70bb8..702ee4b 100644 --- a/win/README.binary +++ b/win/README.binary @@ -1,11 +1,11 @@ -Tcl/Tk 8.2b2 for Windows, Binary Distribution +Tcl/Tk 8.2 for Windows, Binary Distribution -RCS: @(#) $Id: README.binary,v 1.10 1999/08/10 23:16:27 redman Exp $ +RCS: @(#) $Id: README.binary,v 1.10.2.1 1999/09/22 04:13:10 hobbs Exp $ 1. Introduction --------------- -This directory contains the binary distribution of Tcl/Tk 8.2.0 for +This directory contains the binary distribution of Tcl/Tk 8.2.1 for Windows. It was compiled with Microsoft Visual C++ 5.0 using Win32 API, so that it will run under Windows NT, Windows 95, and Windows 98. @@ -32,7 +32,7 @@ Information about new features in Tcl/Tk 8.2 can be found at http://www.scriptics.com/software/whatsnew82.html Detailed release notes can be found at - http://www.scriptics.com/software/relnotes/tcl8.2.0 + http://www.scriptics.com/software/relnotes/tcl8.2.1 Information about Tcl itself can be found at http://www.scriptics.com/scripting/ |