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 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
}
/*