From fcb552a060dd886a2bc705c9817fa3f211ee8865 Mon Sep 17 00:00:00 2001 From: das Date: Mon, 3 Sep 2007 01:36:54 +0000 Subject: * generic/tclObj.c (TclInitObjSubsystem): restore registration of the "wideInt" Tcl_ObjType for compatibility with 8.4 extensions that access the tclWideIntType Tcl_ObjType; add setFromAnyProc for tclWideIntType. --- ChangeLog | 6 ++++++ generic/tclObj.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 72c64d8..8b9a8a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-03 Daniel Steffen + + * generic/tclObj.c (TclInitObjSubsystem): restore registration of the + "wideInt" Tcl_ObjType for compatibility with 8.4 extensions that access + the tclWideIntType Tcl_ObjType; add setFromAnyProc for tclWideIntType. + 2007-09-02 Donal K. Fellows * doc/lsearch.n: Added note that order of results with the -all option diff --git a/generic/tclObj.c b/generic/tclObj.c index c94228a..12ea2b8 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,7 +12,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.132 2007/08/12 14:40:01 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.133 2007/09/03 01:36:54 das Exp $ */ #include "tclInt.h" @@ -175,6 +175,7 @@ static void UpdateStringOfDouble(Tcl_Obj *objPtr); static void UpdateStringOfInt(Tcl_Obj *objPtr); #ifndef NO_WIDE_TYPE static void UpdateStringOfWideInt(Tcl_Obj *objPtr); +static int SetWideIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); #endif static void FreeBignum(Tcl_Obj *objPtr); static void DupBignum(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); @@ -241,7 +242,7 @@ Tcl_ObjType tclWideIntType = { NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ UpdateStringOfWideInt, /* updateStringProc */ - NULL /* setFromAnyProc */ + SetWideIntFromAny /* setFromAnyProc */ }; #endif Tcl_ObjType tclBignumType = { @@ -366,6 +367,9 @@ TclInitObjSubsystem(void) /* For backward compatibility only ... */ Tcl_RegisterObjType(&oldBooleanType); +#ifndef NO_WIDE_TYPE + Tcl_RegisterObjType(&tclWideIntType); +#endif #ifdef TCL_COMPILE_STATS Tcl_MutexLock(&tclObjMutex); @@ -2532,6 +2536,33 @@ Tcl_GetWideIntFromObj( TCL_PARSE_INTEGER_ONLY)==TCL_OK); return TCL_ERROR; } +#ifndef NO_WIDE_TYPE + +/* + *---------------------------------------------------------------------- + * + * SetWideIntFromAny -- + * + * Attempts to force the internal representation for a Tcl object to + * tclWideIntType, specifically. + * + * Results: + * The return value is a standard object Tcl result. If an error occurs + * during conversion, an error message is left in the interpreter's + * result unless "interp" is NULL. + * + *---------------------------------------------------------------------- + */ + +static int +SetWideIntFromAny( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *objPtr) /* Pointer to the object to convert */ +{ + Tcl_WideInt w; + return Tcl_GetWideIntFromObj(interp, objPtr, &w); +} +#endif /* !NO_WIDE_TYPE */ /* *---------------------------------------------------------------------- @@ -2607,6 +2638,8 @@ DupBignum( * * The object's existing string representation is NOT freed; memory will leak * if the string rep is still valid at the time this function is called. + * + *---------------------------------------------------------------------- */ static void -- cgit v0.12