summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-04-16 23:31:33 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-04-16 23:31:33 (GMT)
commit98546bb8b6be883f790f5d6ba1ef37151165116a (patch)
tree467609e01abca9216802d76c8cfaa88a2d166c0c /generic/tclObj.c
parentb97ca5b2bb3826e20a13ff1583baf7df0d8754f6 (diff)
downloadtcl-98546bb8b6be883f790f5d6ba1ef37151165116a.zip
tcl-98546bb8b6be883f790f5d6ba1ef37151165116a.tar.gz
tcl-98546bb8b6be883f790f5d6ba1ef37151165116a.tar.bz2
* generic/tcl.h Made changes so that the "wideInt" Tcl_ObjType
* generic/tclObj.c is defined on all platforms, even those where * generic/tclPort.h TCL_WIDE_INT_IS_LONG is defined. Also made the Tcl_Value struct have a wideValue field on all platforms. This is a ***POTENTIAL INCOMPATIBILITY*** for TCL_WIDE_INT_IS_LONG platforms because that struct changes size. This is the same TIP 72 incompatibility that was seen on other platforms at the 8.4.0 release, when this change should have happened as well. [Bug 713562] * generic/tclInt.h: New internal macros TclGetWide() and TclGetLongFromWide() to deal with both forms of the "wideInt" Tcl_ObjType, so that conditional TCL_WIDE_INT_IS_LONG code is confined to the header file. * generic/tclCmdAH.c: Replaced most coding that was conditional * generic/tclCmdIL.c: on TCL_WIDE_INT_IS_LONG with code that * generic/tclExecute.c: works across platforms, sometimes using * generic/tclTest.c: the new macros above to do it. * generic/tclUtil.c: * generic/tclVar.c:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 6320060..050dfb6 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.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: tclObj.c,v 1.42.2.1 2003/04/07 12:27:30 dkf Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.42.2.2 2003/04/16 23:31:45 dgp Exp $
*/
#include "tclInt.h"
@@ -63,9 +63,9 @@ static int SetIntFromAny _ANSI_ARGS_((Tcl_Interp *interp,
static void UpdateStringOfBoolean _ANSI_ARGS_((Tcl_Obj *objPtr));
static void UpdateStringOfDouble _ANSI_ARGS_((Tcl_Obj *objPtr));
static void UpdateStringOfInt _ANSI_ARGS_((Tcl_Obj *objPtr));
-#ifndef TCL_WIDE_INT_IS_LONG
static int SetWideIntFromAny _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *objPtr));
+#ifndef TCL_WIDE_INT_IS_LONG
static void UpdateStringOfWideInt _ANSI_ARGS_((Tcl_Obj *objPtr));
#endif
@@ -132,11 +132,10 @@ Tcl_ObjType tclWideIntType = {
(Tcl_DupInternalRepProc *) NULL, /* dupIntRepProc */
#ifdef TCL_WIDE_INT_IS_LONG
UpdateStringOfInt, /* updateStringProc */
- SetIntFromAny /* setFromAnyProc */
#else /* !TCL_WIDE_INT_IS_LONG */
UpdateStringOfWideInt, /* updateStringProc */
- SetWideIntFromAny /* setFromAnyProc */
#endif
+ SetWideIntFromAny /* setFromAnyProc */
};
/*
@@ -2136,12 +2135,12 @@ Tcl_GetLongFromObj(interp, objPtr, longPtr)
*----------------------------------------------------------------------
*/
-#ifndef TCL_WIDE_INT_IS_LONG
static int
SetWideIntFromAny(interp, objPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
+#ifndef TCL_WIDE_INT_IS_LONG
Tcl_ObjType *oldTypePtr = objPtr->typePtr;
char *string, *end;
int length;
@@ -2227,10 +2226,14 @@ SetWideIntFromAny(interp, objPtr)
}
objPtr->internalRep.wideValue = newWide;
+#else
+ if (TCL_ERROR == SetIntFromAny(interp, objPtr)) {
+ return TCL_ERROR;
+ }
+#endif
objPtr->typePtr = &tclWideIntType;
return TCL_OK;
}
-#endif
/*
*----------------------------------------------------------------------
@@ -2317,9 +2320,6 @@ Tcl_NewWideIntObj(wideValue)
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the new object. */
{
-#ifdef TCL_WIDE_INT_IS_LONG
- return Tcl_NewLongObj(wideValue);
-#else
register Tcl_Obj *objPtr;
TclNewObj(objPtr);
@@ -2328,7 +2328,6 @@ Tcl_NewWideIntObj(wideValue)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
return objPtr;
-#endif /* TCL_WIDE_INT_IS_LONG */
}
#endif /* if TCL_MEM_DEBUG */
@@ -2378,9 +2377,6 @@ Tcl_DbNewWideIntObj(wideValue, file, line)
int line; /* Line number in the source file;
* used for debugging. */
{
-#ifdef TCL_WIDE_INT_IS_LONG
- return Tcl_DbNewLongObj(wideValue, file, line);
-#else
register Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
@@ -2389,7 +2385,6 @@ Tcl_DbNewWideIntObj(wideValue, file, line)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
return objPtr;
-#endif
}
#else /* if not TCL_MEM_DEBUG */
@@ -2432,9 +2427,6 @@ Tcl_SetWideIntObj(objPtr, wideValue)
register Tcl_WideInt wideValue; /* Wide integer used to initialize
* the object's value. */
{
-#ifdef TCL_WIDE_INT_IS_LONG
- Tcl_SetLongObj(objPtr, wideValue);
-#else
register Tcl_ObjType *oldTypePtr = objPtr->typePtr;
if (Tcl_IsShared(objPtr)) {
@@ -2448,7 +2440,6 @@ Tcl_SetWideIntObj(objPtr, wideValue)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
Tcl_InvalidateStringRep(objPtr);
-#endif
}
/*
@@ -2478,12 +2469,6 @@ Tcl_GetWideIntFromObj(interp, objPtr, wideIntPtr)
register Tcl_Obj *objPtr; /* Object from which to get a wide int. */
register Tcl_WideInt *wideIntPtr; /* Place to store resulting long. */
{
-#ifdef TCL_WIDE_INT_IS_LONG
- /*
- * Next line is type-safe because we only do this when long = Tcl_WideInt
- */
- return Tcl_GetLongFromObj(interp, objPtr, wideIntPtr);
-#else
register int result;
if (objPtr->typePtr == &tclWideIntType) {
@@ -2495,7 +2480,6 @@ Tcl_GetWideIntFromObj(interp, objPtr, wideIntPtr)
*wideIntPtr = objPtr->internalRep.wideValue;
}
return result;
-#endif
}
/*