From 872e88fa4a341e40d152513ef5eca12fc1796fc4 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 27 Dec 2005 20:14:08 +0000 Subject: Export Tcl_InitBignumFromDouble --- ChangeLog | 15 ++++++++++++--- generic/tcl.decls | 9 ++++++++- generic/tclBasic.c | 8 ++++---- generic/tclDecls.h | 14 +++++++++++++- generic/tclExecute.c | 6 +++--- generic/tclInt.h | 4 +--- generic/tclStrToD.c | 10 +++++----- generic/tclStubInit.c | 3 ++- 8 files changed, 48 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc736ac..e95347b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,28 +1,37 @@ 2005-12-27 Kevin B. Kenny - * generic/tcl.decls: Destubbed TclTomMathInitializeStubs - it is in - * generic/tcl.h: the stub library, notthe main shared - library. + * generic/tcl.decls: Destubbed TclTomMathInitializeStubs - it is in + * generic/tcl.h: the stub library, notthe main shared + * generic/tclBasic.c: library. Exported Tcl_InitBignumFromDouble. + * generic/tclExecute.c: + * generic/tclInt.h: + * generic/tclStrToD.c: + * generic/tclDecls.h: * generic/tclStubLib.c: * generic/tclStubInit.c: Regenerated. + * generic/clock.tcl: Reverted to using the time zone abbreviation and not its name to "stop the bleeding" on Bug 1386377. This is *not* a good long-term solution, but there may not be one. + * libtommath/bn_mp_sqrt.c: Improved the initial approximation to the square root, roughly doubling the speed of the routine. (This is a local change that needs to be communicated to Tom.) + * win/Makefile.in: Corrected a bug where tommath_class.h and tommath_superclass.h were not installed, making it impossible for client code to compile against the tommath stubs. + * library/tzdata: Updated to Olson's tzdata2005r. (Latest changes to Daylight Saving Time in Canada, plus redefinition of the Posix-style zones [e.g., EST5EDT] to be locale-independent.) + * libtommath: Updated to Tom St.Denis's release 0.37. 2005-12-20 Donal K. Fellows diff --git a/generic/tcl.decls b/generic/tcl.decls index 3549ccc..410538d 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -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: tcl.decls,v 1.117 2005/12/27 17:39:01 kennykb Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.118 2005/12/27 20:14:08 kennykb Exp $ library tcl @@ -2030,6 +2030,13 @@ declare 564 generic { declare 565 generic { void Tcl_GetChannelError (Tcl_Channel chan, Tcl_Obj** msg) } + +# Additional conversion functions for bignum support + +declare 566 generic { + int Tcl_InitBignumFromDouble(Tcl_Interp* interp, double initval, + mp_int *toInit) +} ############################################################################## diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c219502..19acbf5 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.185 2005/12/14 02:09:19 das Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.186 2005/12/27 20:14:08 kennykb Exp $ */ #include "tclInt.h" @@ -4316,7 +4316,7 @@ Tcl_ExprLongObj( d = *((CONST double *)internalPtr); Tcl_DecrRefCount(resultPtr); - if (TclInitBignumFromDouble(interp, d, &big) != TCL_OK) { + if (Tcl_InitBignumFromDouble(interp, d, &big) != TCL_OK) { return TCL_ERROR; } resultPtr = Tcl_NewBignumObj(&big); @@ -5347,7 +5347,7 @@ ExprEntierFunc( if ((d >= (double)LONG_MAX) || (d <= (double)LONG_MIN)) { mp_int big; - if (TclInitBignumFromDouble(interp, d, &big) != TCL_OK) { + if (Tcl_InitBignumFromDouble(interp, d, &big) != TCL_OK) { /* Infinity */ return TCL_ERROR; } @@ -5651,7 +5651,7 @@ ExprRoundFunc( if ((intPart >= (double)max) || (intPart <= (double)min)) { mp_int big; - if (TclInitBignumFromDouble(interp, intPart, &big) != TCL_OK) { + if (Tcl_InitBignumFromDouble(interp, intPart, &big) != TCL_OK) { /* Infinity */ return TCL_ERROR; } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index a4a8ec6..8802438 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.119 2005/12/27 17:39:01 kennykb Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.120 2005/12/27 20:14:08 kennykb Exp $ */ #ifndef _TCLDECLS @@ -3527,6 +3527,13 @@ EXTERN void Tcl_SetChannelError _ANSI_ARGS_((Tcl_Channel chan, EXTERN void Tcl_GetChannelError _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj** msg)); #endif +#ifndef Tcl_InitBignumFromDouble_TCL_DECLARED +#define Tcl_InitBignumFromDouble_TCL_DECLARED +/* 566 */ +EXTERN int Tcl_InitBignumFromDouble _ANSI_ARGS_(( + Tcl_Interp* interp, double initval, + mp_int * toInit)); +#endif typedef struct TclStubHooks { struct TclPlatStubs *tclPlatStubs; @@ -4134,6 +4141,7 @@ typedef struct TclStubs { void (*tcl_GetChannelErrorInterp) _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj** msg)); /* 563 */ void (*tcl_SetChannelError) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj* msg)); /* 564 */ void (*tcl_GetChannelError) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj** msg)); /* 565 */ + int (*tcl_InitBignumFromDouble) _ANSI_ARGS_((Tcl_Interp* interp, double initval, mp_int * toInit)); /* 566 */ } TclStubs; #ifdef __cplusplus @@ -6438,6 +6446,10 @@ extern TclStubs *tclStubsPtr; #define Tcl_GetChannelError \ (tclStubsPtr->tcl_GetChannelError) /* 565 */ #endif +#ifndef Tcl_InitBignumFromDouble +#define Tcl_InitBignumFromDouble \ + (tclStubsPtr->tcl_InitBignumFromDouble) /* 566 */ +#endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f4cc090..6fb49ec 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.224 2005/12/18 22:41:19 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.225 2005/12/27 20:14:08 kennykb Exp $ */ #include "tclInt.h" @@ -3643,7 +3643,7 @@ TclExecuteByteCode( mp_clear(&big2); goto doubleCompare; } - TclInitBignumFromDouble(NULL, d1, &big1); + Tcl_InitBignumFromDouble(NULL, d1, &big1); goto bigCompare; } break; @@ -3680,7 +3680,7 @@ TclExecuteByteCode( mp_clear(&big1); goto doubleCompare; } - TclInitBignumFromDouble(NULL, d2, &big2); + Tcl_InitBignumFromDouble(NULL, d2, &big2); goto bigCompare; case TCL_NUMBER_BIG: if (Tcl_IsShared(value2Ptr)) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 4a0590a..895eafd 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -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: tclInt.h,v 1.263 2005/12/19 19:03:17 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.264 2005/12/27 20:14:09 kennykb Exp $ */ #ifndef _TCLINT @@ -2082,8 +2082,6 @@ MODULE_SCOPE int TclIncrObj(Tcl_Interp *interp, Tcl_Obj *valuePtr, MODULE_SCOPE Tcl_Obj * TclIncrObjVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, int flags); MODULE_SCOPE void TclInitAlloc(void); -MODULE_SCOPE int TclInitBignumFromDouble(Tcl_Interp *interp, double d, - mp_int *b); MODULE_SCOPE void TclInitDbCkalloc(void); MODULE_SCOPE void TclInitDoubleConversion(void); MODULE_SCOPE void TclInitEmbeddedConfigurationInformation( diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 9fe25d0..7122d33 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.18 2005/12/19 19:03:17 dgp Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.19 2005/12/27 20:14:09 kennykb Exp $ * *---------------------------------------------------------------------- */ @@ -2214,7 +2214,7 @@ TclFinalizeDoubleConversion() /* *---------------------------------------------------------------------- * - * TclInitBignumFromDouble -- + * Tcl_InitBignumFromDouble -- * * Extracts the integer part of a double and converts it to an arbitrary * precision integer. @@ -2223,14 +2223,14 @@ TclFinalizeDoubleConversion() * None. * * Side effects: - * Initializes the bignum supplied, and stores the converted number * in - * it. + * Initializes the bignum supplied, and stores the converted number + * in it. * *---------------------------------------------------------------------- */ int -TclInitBignumFromDouble( +Tcl_InitBignumFromDouble( Tcl_Interp *interp, /* For error message */ double d, /* Number to convert */ mp_int *b) /* Place to store the result */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 8274d1a..88f59e0 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStubInit.c,v 1.126 2005/12/27 17:39:02 kennykb Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.127 2005/12/27 20:14:09 kennykb Exp $ */ #include "tclInt.h" @@ -1062,6 +1062,7 @@ TclStubs tclStubs = { Tcl_GetChannelErrorInterp, /* 563 */ Tcl_SetChannelError, /* 564 */ Tcl_GetChannelError, /* 565 */ + Tcl_InitBignumFromDouble, /* 566 */ }; /* !END!: Do not edit above this line. */ -- cgit v0.12