diff options
author | dgp <dgp@noemail.net> | 2006-12-08 16:14:16 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2006-12-08 16:14:16 (GMT) |
commit | acbab363031860d4e5d1d18eaf05a7512904ac91 (patch) | |
tree | 1abc67af24d394346125a19bcecd987fc4698765 /generic/tclMathOp.c | |
parent | 53394c63b24c7afa9835e2667b95240d4c2f052c (diff) | |
download | tcl-acbab363031860d4e5d1d18eaf05a7512904ac91.zip tcl-acbab363031860d4e5d1d18eaf05a7512904ac91.tar.gz tcl-acbab363031860d4e5d1d18eaf05a7512904ac91.tar.bz2 |
* generic/tclMathOp.c: More revisions to make tests pass.
* tests/mathop.test:
FossilOrigin-Name: d2478055f09e8a05c7fd13946e82107f7373aec4
Diffstat (limited to 'generic/tclMathOp.c')
-rw-r--r-- | generic/tclMathOp.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/tclMathOp.c b/generic/tclMathOp.c index ed28123..f4a5b53 100644 --- a/generic/tclMathOp.c +++ b/generic/tclMathOp.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: tclMathOp.c,v 1.4 2006/12/07 23:35:30 dgp Exp $ + * RCS: @(#) $Id: tclMathOp.c,v 1.5 2006/12/08 16:14:17 dgp Exp $ */ #include "tclInt.h" @@ -1062,7 +1062,9 @@ TclInvertOpCmd( Tcl_WrongNumArgs(interp, 1, objv, "number"); return TCL_ERROR; } - if (TclGetNumberFromObj(interp, objv[1], &val, &type) != TCL_OK) { + if (TclGetNumberFromObj(NULL, objv[1], &val, &type) != TCL_OK) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "can't use non-numeric string as operand of \"~\"", -1)); return TCL_ERROR; } switch (type) { @@ -1137,7 +1139,16 @@ TclNotOpCmd( Tcl_WrongNumArgs(interp, 1, objv, "boolean"); return TCL_ERROR; } - if (Tcl_GetBooleanFromObj(interp, objv[1], &b) != TCL_OK) { + if (Tcl_GetBooleanFromObj(NULL, objv[1], &b) != TCL_OK) { + int type; + ClientData val; + if (TclGetNumberFromObj(NULL, objv[1], &val, &type) == TCL_OK) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "can't use non-numeric floating-point value as operand of \"!\"", -1)); + } else { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "can't use non-numeric string as operand of \"!\"", -1)); + } return TCL_ERROR; } Tcl_SetBooleanObj(Tcl_GetObjResult(interp), !b); |