diff options
author | dgp <dgp@users.sourceforge.net> | 2003-04-16 23:33:43 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-04-16 23:33:43 (GMT) |
commit | 221d64cae9a7781a4b3dd2a2e2e273fd6196c09e (patch) | |
tree | 4156c4da5bb0e708ca942f78b5c01ec34686f8bb /generic/tclObj.c | |
parent | caa2e40c5ef3e6d45edebe3e156b25903fb30eba (diff) | |
download | tcl-221d64cae9a7781a4b3dd2a2e2e273fd6196c09e.zip tcl-221d64cae9a7781a4b3dd2a2e2e273fd6196c09e.tar.gz tcl-221d64cae9a7781a4b3dd2a2e2e273fd6196c09e.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.c | 34 |
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 } /* |