summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
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 a5e34e6..4f5d784 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.44 2003/04/07 10:12:10 dkf Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.45 2003/04/16 23:33:44 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 /* TCL_WIDE_INT_IS_LONG */
+ SetWideIntFromAny /* setFromAnyProc */
};
/*
@@ -2137,12 +2136,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;
@@ -2228,10 +2227,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
/*
*----------------------------------------------------------------------
@@ -2318,9 +2321,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);
@@ -2329,7 +2329,6 @@ Tcl_NewWideIntObj(wideValue)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
return objPtr;
-#endif /* TCL_WIDE_INT_IS_LONG */
}
#endif /* if TCL_MEM_DEBUG */
@@ -2379,9 +2378,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);
@@ -2390,7 +2386,6 @@ Tcl_DbNewWideIntObj(wideValue, file, line)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
return objPtr;
-#endif
}
#else /* if not TCL_MEM_DEBUG */
@@ -2433,9 +2428,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)) {
@@ -2449,7 +2441,6 @@ Tcl_SetWideIntObj(objPtr, wideValue)
objPtr->internalRep.wideValue = wideValue;
objPtr->typePtr = &tclWideIntType;
Tcl_InvalidateStringRep(objPtr);
-#endif
}
/*
@@ -2479,12 +2470,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) {
@@ -2496,7 +2481,6 @@ Tcl_GetWideIntFromObj(interp, objPtr, wideIntPtr)
*wideIntPtr = objPtr->internalRep.wideValue;
}
return result;
-#endif
}
/*