summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2000-11-24 15:29:51 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2000-11-24 15:29:51 (GMT)
commitfc5ae1303256736570c487af3878721224de2afc (patch)
tree4fc9bfe9d0af05ee99a1fbf3dcf4e0704debc7fa
parent4cf6a38e55fbdf502fcbb4d15c8ad94e4f891e6d (diff)
downloadtcl-fc5ae1303256736570c487af3878721224de2afc.zip
tcl-fc5ae1303256736570c487af3878721224de2afc.tar.gz
tcl-fc5ae1303256736570c487af3878721224de2afc.tar.bz2
Logical negation "!" can now handle string booleans, provided those
values are placed in variables. Resolves bug #119153 as most people will experience it.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclExecute.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 69595c6..da6496c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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")));