summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-06-27 21:33:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-06-27 21:33:05 (GMT)
commitdcee7a8510ae0c460b59cc78bd47d47344fc368e (patch)
treeacc1aea37daf06a130f4bfc08d1d29e23715fe66 /generic/tclExecute.c
parent00a84e3e9482271c8f74d33197f29e3fb803e7b4 (diff)
downloadtcl-dcee7a8510ae0c460b59cc78bd47d47344fc368e.zip
tcl-dcee7a8510ae0c460b59cc78bd47d47344fc368e.tar.gz
tcl-dcee7a8510ae0c460b59cc78bd47d47344fc368e.tar.bz2
Modified expression of tests and added comments for easier understanding
by future maintainers.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 8e5714f..06cd7fa 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.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: tclExecute.c,v 1.103 2003/06/10 19:52:58 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.104 2003/06/27 21:33:05 dgp Exp $
*/
#include "tclInt.h"
@@ -3395,8 +3395,19 @@ TclExecuteByteCode(interp, codePtr)
valuePtr = stackPtr[stackTop];
tPtr = valuePtr->typePtr;
- if (!IS_INTEGER_TYPE(tPtr) && ((tPtr != &tclDoubleType)
- || (valuePtr->bytes != NULL))) {
+ if (IS_INTEGER_TYPE(tPtr)
+ || ((tPtr == &tclDoubleType) && (valuePtr->bytes == NULL))) {
+ /*
+ * We already have a numeric internal rep, either some kind
+ * of integer, or a "pure" double. (Need "pure" so that we
+ * know the string rep of the double would not prefer to be
+ * interpreted as an integer.)
+ */
+ } else {
+ /*
+ * Otherwise, we need to generate a numeric internal rep.
+ * from the string rep.
+ */
char *s = Tcl_GetStringFromObj(valuePtr, &length);
if (TclLooksLikeInt(s, length)) {
GET_WIDE_OR_INT(result, valuePtr, i, w);
@@ -3459,8 +3470,19 @@ TclExecuteByteCode(interp, codePtr)
valuePtr = stackPtr[stackTop];
tPtr = valuePtr->typePtr;
- if (!IS_INTEGER_TYPE(tPtr) && ((tPtr != &tclDoubleType)
- || (valuePtr->bytes != NULL))) {
+ if (IS_INTEGER_TYPE(tPtr)
+ || ((tPtr == &tclDoubleType) && (valuePtr->bytes == NULL))) {
+ /*
+ * We already have a numeric internal rep, either some kind
+ * of integer, or a "pure" double. (Need "pure" so that we
+ * know the string rep of the double would not prefer to be
+ * interpreted as an integer.)
+ */
+ } else {
+ /*
+ * Otherwise, we need to generate a numeric internal rep.
+ * from the string rep.
+ */
if ((tPtr == &tclBooleanType) && (valuePtr->bytes == NULL)) {
valuePtr->typePtr = &tclIntType;
} else {
@@ -3671,8 +3693,19 @@ TclExecuteByteCode(interp, codePtr)
valuePtr = stackPtr[stackTop];
tPtr = valuePtr->typePtr;
converted = 0;
- if (!IS_INTEGER_TYPE(tPtr) && ((tPtr != &tclDoubleType)
- || (valuePtr->bytes != NULL))) {
+ if (IS_INTEGER_TYPE(tPtr)
+ || ((tPtr == &tclDoubleType) && (valuePtr->bytes == NULL))) {
+ /*
+ * We already have a numeric internal rep, either some kind
+ * of integer, or a "pure" double. (Need "pure" so that we
+ * know the string rep of the double would not prefer to be
+ * interpreted as an integer.)
+ */
+ } else {
+ /*
+ * Otherwise, we need to generate a numeric internal rep.
+ * from the string rep.
+ */
if ((tPtr == &tclBooleanType) && (valuePtr->bytes == NULL)) {
valuePtr->typePtr = &tclIntType;
converted = 1;