diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclExecute.c | 8 |
2 files changed, 12 insertions, 2 deletions
@@ -1,7 +1,11 @@ 2000-11-24 Donal K. Fellows <fellowsd@cs.man.ac.uk> + * generic/tclExecute.c (TclExecuteByteCode): Logical negation "!" + can now handle string booleans, provided those values are placed + in variables. + * tests/expr.test (expr-13.17): Check that [expr {!$var}] can - negate the string-versions of booleans "yes", "false", etc. + negate the string-versions of booleans "yes", "false", etc. * library/tcltest/tcltest.tcl (getMatchingFiles, getMatchingDirectories): diff --git a/generic/tclExecute.c b/generic/tclExecute.c index e9e3ebb..cdc0724 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.15 2000/09/06 16:59:27 hobbs Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.16 2000/11/24 15:29:51 dkf Exp $ */ #include "tclInt.h" @@ -2512,6 +2512,7 @@ TclExecuteByteCode(interp, codePtr) */ double d; + int boolvar; Tcl_ObjType *tPtr; valuePtr = POP_OBJECT(); @@ -2530,6 +2531,11 @@ TclExecuteByteCode(interp, codePtr) result = Tcl_GetDoubleFromObj((Tcl_Interp *) NULL, valuePtr, &d); } + if (result == TCL_ERROR && *pc == INST_LNOT) { + result = Tcl_GetBooleanFromObj((Tcl_Interp *)NULL, + valuePtr, &boolvar); + i = (long)boolvar; /* i is long, not int! */ + } if (result != TCL_OK) { TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n", s, (tPtr? tPtr->name : "null"))); |