diff options
32 files changed, 522 insertions, 223 deletions
diff --git a/compat/zlib/contrib/minizip/ioapi.c b/compat/zlib/contrib/minizip/ioapi.c index 7f5c191..8274a3d 100644 --- a/compat/zlib/contrib/minizip/ioapi.c +++ b/compat/zlib/contrib/minizip/ioapi.c @@ -14,7 +14,11 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#if defined(__APPLE__) || defined(IOAPI_NO_64) +#if defined(_WIN32) +#define FOPEN_FUNC(filename, mode) fopen(filename, mode) +#define FTELLO_FUNC(stream) _ftelli64(stream) +#define FSEEKO_FUNC(stream, offset, origin) _fseeki64(stream, offset, origin) +#elif defined(__APPLE__) || defined(IOAPI_NO_64) // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) diff --git a/compat/zlib/contrib/minizip/minizip.c b/compat/zlib/contrib/minizip/minizip.c index 8a31582..7ce0b97 100644 --- a/compat/zlib/contrib/minizip/minizip.c +++ b/compat/zlib/contrib/minizip/minizip.c @@ -27,7 +27,11 @@ #endif #endif -#if defined(__APPLE__) || defined(IOAPI_NO_64) +#if defined(_WIN32) +#define FOPEN_FUNC(filename, mode) fopen(filename, mode) +#define FTELLO_FUNC(stream) _ftelli64(stream) +#define FSEEKO_FUNC(stream, offset, origin) _fseeki64(stream, offset, origin) +#elif defined(__APPLE__) || defined(IOAPI_NO_64) // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) diff --git a/doc/InitSubSyst.3 b/doc/InitSubSyst.3 index eef801f..3c138a4 100644 --- a/doc/InitSubSyst.3 +++ b/doc/InitSubSyst.3 @@ -3,7 +3,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .so man.macros .TH Tcl_InitSubsystems 3 8.7 Tcl "Tcl Library Procedures" .BS diff --git a/generic/tcl.h b/generic/tcl.h index c44a31a..5822d86 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2204,8 +2204,6 @@ typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData); typedef struct mp_int mp_int; #define MP_INT_DECLARED -typedef unsigned int mp_digit; -#define MP_DIGIT_DECLARED /* *---------------------------------------------------------------------------- diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8bfda85..d4ba888 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7657,7 +7657,7 @@ ExprIsqrtFunc( if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) { return TCL_ERROR; } - if (big.sign != MP_ZPOS) { + if (mp_isneg(&big)) { mp_clear(&big); goto negarg; } @@ -7933,7 +7933,7 @@ ExprAbsFunc( } if (type == TCL_NUMBER_BIG) { - if (((const mp_int *) ptr)->sign != MP_ZPOS) { + if (mp_isneg((const mp_int *) ptr)) { Tcl_GetBignumFromObj(NULL, objv[1], &big); tooLarge: mp_neg(&big, &big); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 28a1fd2..9f3b443 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8072,7 +8072,7 @@ ExecuteExtendedBinaryMathOp( Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); /* TODO: internals intrusion */ - if ((w1 > ((Tcl_WideInt) 0)) ^ (big2.sign == MP_ZPOS)) { + if ((w1 > ((Tcl_WideInt) 0)) ^ !mp_isneg(&big2)) { /* * Arguments are opposite sign; remainder is sum. */ @@ -8121,7 +8121,7 @@ ExecuteExtendedBinaryMathOp( break; case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); - invalid = big2.sign != MP_ZPOS; + invalid = mp_isneg(&big2); mp_clear(&big2); break; default: @@ -8200,7 +8200,7 @@ ExecuteExtendedBinaryMathOp( break; case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); - zero = (big1.sign == MP_ZPOS); + zero = !mp_isneg(&big1); mp_clear(&big1); break; default: @@ -8324,7 +8324,7 @@ ExecuteExtendedBinaryMathOp( oddExponent = (int) (w2 & (Tcl_WideInt)1); } else { Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); - negativeExponent = big2.sign != MP_ZPOS; + negativeExponent = mp_isneg(&big2); mp_mod_2d(&big2, 1, &big2); oddExponent = big2.used != 0; mp_clear(&big2); @@ -8799,7 +8799,7 @@ TclCompareTwoNumbers( goto wideCompare; case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); - if (big2.sign != MP_ZPOS) { + if (mp_isneg(&big2)) { compare = MP_GT; } else { compare = MP_LT; @@ -8836,7 +8836,7 @@ TclCompareTwoNumbers( } Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); if ((d1 < (double)WIDE_MAX) && (d1 > (double)WIDE_MIN)) { - if (big2.sign != MP_ZPOS) { + if (mp_isneg(&big2)) { compare = MP_GT; } else { compare = MP_LT; diff --git a/generic/tclInt.h b/generic/tclInt.h index 2740953..4f013bf 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2875,18 +2875,14 @@ struct Tcl_LoadHandle_ { /* Flags for conversion of doubles to digit strings */ -#define TCL_DD_SHORTEST 0x4 - /* Use the shortest possible string */ #define TCL_DD_E_FORMAT 0x2 /* Use a fixed-length string of digits, * suitable for E format*/ #define TCL_DD_F_FORMAT 0x3 /* Use a fixed number of digits after the * decimal point, suitable for F format */ - -#define TCL_DD_SHORTEN_FLAG 0x4 - /* Allow return of a shorter digit string - * if it converts losslessly */ +#define TCL_DD_SHORTEST 0x4 + /* Use the shortest possible string */ #define TCL_DD_NO_QUICK 0x8 /* Debug flag: forbid quick FP conversion */ @@ -4193,8 +4189,6 @@ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr, int before, int after, int *indexPtr); MODULE_SCOPE int TclIndexDecode(int encoded, int endValue); -MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len); - /* Constants used in index value encoding routines. */ #define TCL_INDEX_END (-2) #define TCL_INDEX_START (0) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 41fb0c6..63c6558 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -2055,6 +2055,7 @@ Tcl_FSGetInternalRep( nativePathPtr = (char *)proc(pathPtr); srcFsPathPtr = PATHOBJ(pathPtr); srcFsPathPtr->nativePathPtr = nativePathPtr; + srcFsPathPtr->filesystemEpoch = TclFSEpoch(); } return srcFsPathPtr->nativePathPtr; diff --git a/generic/tclScan.c b/generic/tclScan.c index 78fd3be..67138e6 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -945,7 +945,7 @@ Tcl_ScanObjCmd( int code = Tcl_GetBignumFromObj(interp, objPtr, &big); if (code == TCL_OK) { - if (big.sign != MP_ZPOS) { + if (mp_isneg(&big)) { code = TCL_ERROR; } mp_clear(&big); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index d542da0..9fee06e 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -2724,7 +2724,7 @@ QuickConversion( int k, /* floor(log10(d)), approximately. */ int k_check, /* 0 if k is exact, 1 if it may be too high */ int flags, /* Flags passed to dtoa: - * TCL_DD_SHORTEN_FLAG */ + * TCL_DD_SHORTEST */ int len, /* Length of the return value. */ int ilim, /* Number of digits to store. */ int ilim1, /* Number of digits to store if we misguessed @@ -2795,7 +2795,7 @@ QuickConversion( * Format the digit string. */ - if (flags & TCL_DD_SHORTEN_FLAG) { + if (flags & TCL_DD_SHORTEST) { end = ShorteningQuickFormat(d, k, ilim, eps.d, retval, decpt); } else { end = StrictQuickFormat(d, k, ilim, eps.d, retval, decpt); @@ -4011,7 +4011,7 @@ StrictBignumConversion( * choosing the one that is closest to the given number (and * resolving ties with 'round to even'). It is allowed to return * fewer than 'ndigits' if the number converts exactly; if the - * TCL_DD_E_FORMAT|TCL_DD_SHORTEN_FLAG is supplied instead, it + * TCL_DD_E_FORMAT|TCL_DD_SHORTEST is supplied instead, it * also returns fewer digits if the shorter string will still * reconvert without loss to the given input number. In any case, * strings of trailing zeroes are suppressed. @@ -4022,7 +4022,7 @@ StrictBignumConversion( * string if the number is sufficiently small. Again, it is * permissible for TCL_DD_F_FORMAT to return fewer digits for a * number that converts exactly, and changing the argument to - * TCL_DD_F_FORMAT|TCL_DD_SHORTEN_FLAG will allow the routine + * TCL_DD_F_FORMAT|TCL_DD_SHORTEST will allow the routine * also to return fewer digits if the shorter string will still * reconvert without loss to the given input number. Strings of * trailing zeroes are suppressed. @@ -4159,7 +4159,7 @@ TclDoubleDigits( * denominator. */ - if (flags & TCL_DD_SHORTEN_FLAG) { + if (flags & TCL_DD_SHORTEST) { int m2minus = b2; int m2plus; int m5 = b5; @@ -4548,10 +4548,10 @@ TclBignumToDouble( bits = mp_count_bits(a); if (bits > DBL_MAX_EXP*log2FLT_RADIX) { errno = ERANGE; - if (a->sign == MP_ZPOS) { - return HUGE_VAL; - } else { + if (mp_isneg(a)) { return -HUGE_VAL; + } else { + return HUGE_VAL; } } shift = mantBits - bits; @@ -4581,10 +4581,10 @@ TclBignumToDouble( mp_div_2d(a, -shift, &b, NULL); if (mp_isodd(&b)) { - if (b.sign == MP_ZPOS) { - mp_add_d(&b, 1, &b); - } else { + if (mp_isneg(&b)) { mp_sub_d(&b, 1, &b); + } else { + mp_add_d(&b, 1, &b); } } } else { @@ -4594,10 +4594,10 @@ TclBignumToDouble( */ mp_div_2d(a, -1-shift, &b, NULL); - if (b.sign == MP_ZPOS) { - mp_add_d(&b, 1, &b); - } else { + if (mp_isneg(&b)) { mp_sub_d(&b, 1, &b); + } else { + mp_add_d(&b, 1, &b); } mp_div_2d(&b, 1, &b, NULL); } @@ -4623,10 +4623,10 @@ TclBignumToDouble( * Return the result with the appropriate sign. */ - if (a->sign == MP_ZPOS) { - return r; - } else { + if (mp_isneg(a)) { return -r; + } else { + return r; } } @@ -4652,7 +4652,7 @@ TclCeil( mp_int b; mp_init(&b); - if (a->sign != MP_ZPOS) { + if (mp_isneg(a)) { mp_neg(a, &b); r = -TclFloor(&b); } else { @@ -4709,7 +4709,7 @@ TclFloor( mp_int b; mp_init(&b); - if (a->sign != MP_ZPOS) { + if (mp_isneg(a)) { mp_neg(a, &b); r = -TclCeil(&b); } else { @@ -4799,7 +4799,7 @@ BignumToBiasedFrExp( */ *machexp = bits - mantBits + 2; - return ((a->sign == MP_ZPOS) ? r : -r); + return (mp_isneg(a) ? -r : r); } /* diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 76f0230..da99ee8 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -99,6 +99,48 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) #define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))TclBN_mp_set_long +mp_err MP_WUR TclBN_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c) { + return TclBN_s_mp_expt_u32(a, b, c); +} + +mp_err TclBN_mp_add_d(const mp_int *a, unsigned int b, mp_int *c) { + return TclBN_s_mp_add_d(a, b, c); +} +mp_err TclBN_mp_cmp_d(const mp_int *a, unsigned int b) { + return TclBN_s_mp_cmp_d(a, b); +} +mp_err TclBN_mp_sub_d(const mp_int *a, unsigned int b, mp_int *c) { + return TclBN_s_mp_sub_d(a, b, c); +} + +mp_err TclBN_mp_div_d(const mp_int *a, unsigned int b, mp_int *c, unsigned int *d) { + mp_digit d2; + mp_err result = TclBN_s_mp_div_d(a, b, c, (d ? &d2 : NULL)); + if (d) { + *d = d2; + } + return result; +} +mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) { + mp_digit d2; + mp_err result = TclBN_s_mp_div_3(a, c, &d2); + if (d) { + *d = d2; + } + return result; +} +mp_err TclBN_mp_init_set(mp_int *a, unsigned int b) { + return TclBN_s_mp_init_set(a, b); +} +mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) { + return TclBN_s_mp_mul_d(a, b, c); +} +void TclBN_mp_set(mp_int *a, unsigned int b) { + TclBN_s_mp_set(a, b); +} + + + #if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 # define TclBN_mp_expt_d_ex 0 # define TclBN_mp_to_unsigned_bin 0 @@ -136,7 +178,7 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) # define Tcl_BackgroundError 0 #else -int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) +int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast) { (void)fast; return mp_expt_u32(a, b, c); @@ -1011,7 +1053,7 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_get_mag_ull, /* 69 */ 0, /* 70 */ TclBN_mp_get_mag_ul, /* 71 */ - TclBN_mp_isodd, /* 72 */ + 0, /* 72 */ TclBN_mp_tc_and, /* 73 */ TclBN_mp_tc_or, /* 74 */ TclBN_mp_tc_xor, /* 75 */ diff --git a/generic/tclTest.c b/generic/tclTest.c index 91ceaa6..898ccab 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1846,7 +1846,7 @@ TestdoubledigitsObjCmd(void *dummy, Tcl_SetObjResult(interp, Tcl_NewStringObj("bad flag", -1)); return TCL_ERROR; } - type |= TCL_DD_SHORTEN_FLAG; + type |= TCL_DD_SHORTEST; } str = TclDoubleDigits(d, ndigits, type, &decpt, &signum, &endPtr); strObj = Tcl_NewStringObj(str, endPtr-str); diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 89751bd..f95371e 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -33,7 +33,7 @@ declare 2 { mp_err MP_WUR TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { - mp_err MP_WUR TclBN_mp_add_d(const mp_int *a, mp_digit b, mp_int *c) + mp_err MP_WUR TclBN_mp_add_d(const mp_int *a, unsigned int b, mp_int *c) } declare 4 { mp_err MP_WUR TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) @@ -51,7 +51,7 @@ declare 8 { mp_ord MP_WUR TclBN_mp_cmp(const mp_int *a, const mp_int *b) } declare 9 { - mp_ord MP_WUR TclBN_mp_cmp_d(const mp_int *a, mp_digit b) + mp_ord MP_WUR TclBN_mp_cmp_d(const mp_int *a, unsigned int b) } declare 10 { mp_ord MP_WUR TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b) @@ -66,7 +66,7 @@ declare 13 { mp_err MP_WUR TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) } declare 14 { - mp_err MP_WUR TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r) + mp_err MP_WUR TclBN_mp_div_d(const mp_int *a, unsigned int b, mp_int *q, unsigned int *r) } declare 15 { mp_err MP_WUR TclBN_mp_div_2(const mp_int *a, mp_int *q) @@ -75,7 +75,7 @@ declare 16 { mp_err MP_WUR TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) } declare 17 { - mp_err MP_WUR TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r) + mp_err MP_WUR TclBN_mp_div_3(const mp_int *a, mp_int *q, unsigned int *r) } declare 18 { void TclBN_mp_exch(mp_int *a, mp_int *b) @@ -96,7 +96,7 @@ declare 23 { mp_err MP_WUR TclBN_mp_init_multi(mp_int *a, ...) } declare 24 { - mp_err MP_WUR TclBN_mp_init_set(mp_int *a, mp_digit b) + mp_err MP_WUR TclBN_mp_init_set(mp_int *a, unsigned int b) } declare 25 { mp_err MP_WUR TclBN_mp_init_size(mp_int *a, int size) @@ -114,7 +114,7 @@ declare 29 { mp_err MP_WUR TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p) } declare 30 { - mp_err MP_WUR TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p) + mp_err MP_WUR TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *p) } declare 31 { mp_err MP_WUR TclBN_mp_mul_2(const mp_int *a, mp_int *p) @@ -141,7 +141,7 @@ declare 38 { mp_err MP_WUR TclBN_mp_shrink(mp_int *a) } declare 39 { - void TclBN_mp_set(mp_int *a, mp_digit b) + void TclBN_mp_set(mp_int *a, unsigned int b) } declare 40 { mp_err MP_WUR TclBN_mp_sqr(const mp_int *a, mp_int *b) @@ -153,7 +153,7 @@ declare 42 { mp_err MP_WUR TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { - mp_err MP_WUR TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) + mp_err MP_WUR TclBN_mp_sub_d(const mp_int *a, unsigned int b, mp_int *c) } declare 44 {deprecated {Use mp_to_ubin}} { mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b) @@ -235,7 +235,7 @@ declare 66 {deprecated {Use mp_init() + mp_set_ull()}} { # Added in libtommath 1.0 declare 67 {deprecated {Use mp_expt_u32}} { - mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) + mp_err TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast) } # Added in libtommath 1.0.1 declare 68 { @@ -245,10 +245,7 @@ declare 69 { Tcl_WideUInt MP_WUR TclBN_mp_get_mag_ull(const mp_int *a) } declare 71 { - unsigned long TclBN_mp_get_mag_ul(const mp_int *a) -} -declare 72 { - mp_bool MP_WUR TclBN_mp_isodd(const mp_int *a) + unsigned long MP_WUR TclBN_mp_get_mag_ul(const mp_int *a) } # Added in libtommath 1.1.0 diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 618e555..557eff1 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -7,24 +7,48 @@ #ifndef MP_NO_STDINT # include <stdint.h> #endif +#include <stddef.h> +#include <limits.h> #ifndef MODULE_SCOPE #define MODULE_SCOPE extern #endif +#ifdef LTM_NO_FILE +# warning LTM_NO_FILE has been deprecated, use MP_NO_FILE. +# define MP_NO_FILE +#endif + +#ifndef MP_NO_FILE +# include <stdio.h> +#endif + +#ifdef MP_8BIT +# ifdef _MSC_VER +# pragma message("8-bit (MP_8BIT) support is deprecated and will be dropped completely in the next version.") +# else +# warning "8-bit (MP_8BIT) support is deprecated and will be dropped completely in the next version." +# endif +#endif + #ifdef __cplusplus extern "C" { #endif /* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */ -#if (defined(_WIN32) || defined(__LLP64__) || defined(__e2k__) || defined(__LCC__)) && !defined(MP_64BIT) +#if (defined(_WIN32) || defined(__LLP64__) || defined(__e2k__) || defined(__LCC__)) && !defined(MP_32BIT) && !defined(MP_64BIT) # define MP_32BIT #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) -# if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) -# if defined(__GNUC__) +#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ + defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ + defined(__s390x__) || defined(__arch64__) || defined(__aarch64__) || \ + defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ + defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \ + defined(__LP64__) || defined(_LP64) || defined(__64BIT__) +# if !(defined(MP_64BIT) || defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) +# if defined(__GNUC__) && !defined(__hppa) /* we support 128bit integers only via: __attribute__((mode(TI))) */ # define MP_64BIT # else @@ -47,39 +71,17 @@ extern "C" { */ #ifdef MP_8BIT -#ifndef MP_DIGIT_DECLARED typedef unsigned char mp_digit; -#define MP_DIGIT_DECLARED -#endif -# define MP_SIZEOF_MP_DIGIT 1 -# ifdef MP_DIGIT_BIT -# error You must not define MP_DIGIT_BIT when using MP_8BIT -# endif +# define MP_DIGIT_BIT 7 #elif defined(MP_16BIT) -#ifndef MP_DIGIT_DECLARED typedef unsigned short mp_digit; -#define MP_DIGIT_DECLARED -#endif -# define MP_SIZEOF_MP_DIGIT 2 -# ifdef MP_DIGIT_BIT -# error You must not define MP_DIGIT_BIT when using MP_16BIT -# endif +# define MP_DIGIT_BIT 15 #elif defined(MP_64BIT) /* for GCC only on supported platforms */ -#ifndef MP_DIGIT_DECLARED typedef unsigned long long mp_digit; -#define MP_DIGIT_DECLARED -#endif # define MP_DIGIT_BIT 60 #else -/* this is the default case, 28-bit digits */ - -/* this is to make porting into LibTomCrypt easier :-) */ -#ifndef MP_DIGIT_DECLARED typedef unsigned int mp_digit; -#define MP_DIGIT_DECLARED -#endif - # ifdef MP_31BIT /* * This is an extension that uses 31-bit digits. @@ -108,10 +110,6 @@ typedef unsigned int mp_digit; #define MP_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */ #define MP_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */ -#define LTM_PRIME_BBS (MP_DEPRECATED_PRAGMA("LTM_PRIME_BBS has been deprecated, use MP_PRIME_BBS") MP_PRIME_BBS) -#define LTM_PRIME_SAFE (MP_DEPRECATED_PRAGMA("LTM_PRIME_SAFE has been deprecated, use MP_PRIME_SAFE") MP_PRIME_SAFE) -#define LTM_PRIME_2MSB_ON (MP_DEPRECATED_PRAGMA("LTM_PRIME_2MSB_ON has been deprecated, use MP_PRIME_2MSB_ON") MP_PRIME_2MSB_ON) - #ifdef MP_USE_ENUMS typedef enum { MP_ZPOS = 0, /* positive */ @@ -236,10 +234,10 @@ TOOM_SQR_CUTOFF; # define MP_DEPRECATED_PRAGMA(s) #endif -#define DIGIT_BIT MP_DIGIT_BIT -#define USED(m) ((m)->used) -#define DIGIT(m,k) ((m)->dp[(k)]) -#define SIGN(m) ((m)->sign) +#define DIGIT_BIT (MP_DEPRECATED_PRAGMA("DIGIT_BIT macro is deprecated, MP_DIGIT_BIT instead") MP_DIGIT_BIT) +#define USED(m) (MP_DEPRECATED_PRAGMA("USED macro is deprecated, use z->used instead") (m)->used) +#define DIGIT(m, k) (MP_DEPRECATED_PRAGMA("DIGIT macro is deprecated, use z->dp instead") (m)->dp[(k)]) +#define SIGN(m) (MP_DEPRECATED_PRAGMA("SIGN macro is deprecated, use z->sign instead") (m)->sign) /* the infamous mp_int structure */ #ifndef MP_INT_DECLARED @@ -300,12 +298,8 @@ mp_err mp_init_size(mp_int *a, int size) MP_WUR; /* ---> Basic Manipulations <--- */ #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) -/* -mp_bool mp_iseven(const mp_int *a) MP_WUR; -*/ -/* -mp_bool mp_isodd(const mp_int *a) MP_WUR; -*/ +#define mp_isodd(a) (((a)->used != 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) +#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) #define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO) /* set to zero */ @@ -463,6 +457,7 @@ mp_err mp_init_copy(mp_int *a, const mp_int *b) MP_WUR; void mp_clamp(mp_int *a); */ + /* export binary data */ /* MP_DEPRECATED(mp_pack) mp_err mp_export(void *rop, size_t *countp, int order, size_t size, @@ -559,6 +554,7 @@ void mp_rand_source(mp_err(*source)(void *out, size_t size)); */ #ifdef MP_PRNG_ENABLE_LTM_RNG +# warning MP_PRNG_ENABLE_LTM_RNG has been deprecated, use mp_rand_source instead. /* A last resort to provide random data on systems without any of the other * implemented ways to gather entropy. * It is compatible with `rng_get_bytes()` from libtomcrypt so you could diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 811727d..c3032b1 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -48,17 +48,27 @@ #define MP_FREE(mem, size) TclBNFree(mem) +MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len); +MODULE_SCOPE mp_err TclBN_s_mp_add_d(const mp_int *a, mp_digit b, mp_int *c); +MODULE_SCOPE mp_ord TclBN_s_mp_cmp_d(const mp_int *a, mp_digit b); +MODULE_SCOPE mp_err TclBN_s_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); +MODULE_SCOPE mp_err TclBN_s_mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +MODULE_SCOPE mp_err TclBN_s_mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); +MODULE_SCOPE mp_err TclBN_s_mp_init_set(mp_int *a, mp_digit b); +MODULE_SCOPE mp_err TclBN_s_mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); +MODULE_SCOPE void TclBN_s_mp_set(mp_int *a, mp_digit b); +MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c); + + /* Rename the global symbols in libtommath to avoid linkage conflicts */ #define bn_reverse TclBN_reverse #define mp_add TclBN_mp_add -#define mp_add_d TclBN_mp_add_d #define mp_and TclBN_mp_and #define mp_clamp TclBN_mp_clamp #define mp_clear TclBN_mp_clear #define mp_clear_multi TclBN_mp_clear_multi #define mp_cmp TclBN_mp_cmp -#define mp_cmp_d TclBN_mp_cmp_d #define mp_cmp_mag TclBN_mp_cmp_mag #define mp_cnt_lsb TclBN_mp_cnt_lsb #define mp_copy TclBN_mp_copy @@ -66,12 +76,9 @@ #define mp_div TclBN_mp_div #define mp_div_2 TclBN_mp_div_2 #define mp_div_2d TclBN_mp_div_2d -#define mp_div_3 TclBN_mp_div_3 -#define mp_div_d TclBN_mp_div_d #define mp_exch TclBN_mp_exch #define mp_expt_d TclBN_mp_expt_u32 #define mp_expt_d_ex TclBN_mp_expt_d_ex -#define mp_expt_u32 TclBN_mp_expt_u32 #define mp_get_bit TclBN_mp_get_bit #define mp_get_mag_ul TclBN_mp_get_mag_ul #define mp_get_mag_ull TclBN_mp_get_mag_ull @@ -79,24 +86,20 @@ #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy #define mp_init_multi TclBN_mp_init_multi -#define mp_init_set TclBN_mp_init_set #define mp_init_set_int(a,i) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_ul(a,(unsigned int)(i))) #define mp_init_size TclBN_mp_init_size #define mp_init_ul TclBN_mp_init_ul -#define mp_isodd TclBN_mp_isodd #define mp_lshd TclBN_mp_lshd #define mp_mod TclBN_mp_mod #define mp_mod_2d TclBN_mp_mod_2d #define mp_mul TclBN_mp_mul #define mp_mul_2 TclBN_mp_mul_2 #define mp_mul_2d TclBN_mp_mul_2d -#define mp_mul_d TclBN_mp_mul_d #define mp_neg TclBN_mp_neg #define mp_or TclBN_mp_or #define mp_radix_size TclBN_mp_radix_size #define mp_read_radix TclBN_mp_read_radix #define mp_rshd TclBN_mp_rshd -#define mp_set TclBN_mp_set #define mp_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),((unsigned int)(b))),MP_OKAY)) #define mp_set_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_ul((a),(b)),MP_OKAY)) #define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ull") (TclBN_mp_set_ull((a),(b)),MP_OKAY)) @@ -106,7 +109,6 @@ #define mp_sqr TclBN_mp_sqr #define mp_sqrt TclBN_mp_sqrt #define mp_sub TclBN_mp_sub -#define mp_sub_d TclBN_mp_sub_d #define mp_signed_rsh TclBN_mp_signed_rsh #define mp_tc_and TclBN_mp_and #define mp_tc_div_2d TclBN_mp_signed_rsh @@ -170,7 +172,7 @@ EXTERN int TclBN_revision(void) MP_WUR; EXTERN mp_err TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 3 */ -EXTERN mp_err TclBN_mp_add_d(const mp_int *a, mp_digit b, +EXTERN mp_err TclBN_mp_add_d(const mp_int *a, unsigned int b, mp_int *c) MP_WUR; /* 4 */ EXTERN mp_err TclBN_mp_and(const mp_int *a, const mp_int *b, @@ -184,7 +186,7 @@ EXTERN void TclBN_mp_clear_multi(mp_int *a, ...); /* 8 */ EXTERN mp_ord TclBN_mp_cmp(const mp_int *a, const mp_int *b) MP_WUR; /* 9 */ -EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, mp_digit b) MP_WUR; +EXTERN mp_ord TclBN_mp_cmp_d(const mp_int *a, unsigned int b) MP_WUR; /* 10 */ EXTERN mp_ord TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b) MP_WUR; /* 11 */ @@ -195,8 +197,8 @@ EXTERN int TclBN_mp_count_bits(const mp_int *a) MP_WUR; EXTERN mp_err TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) MP_WUR; /* 14 */ -EXTERN mp_err TclBN_mp_div_d(const mp_int *a, mp_digit b, - mp_int *q, mp_digit *r) MP_WUR; +EXTERN mp_err TclBN_mp_div_d(const mp_int *a, unsigned int b, + mp_int *q, unsigned int *r) MP_WUR; /* 15 */ EXTERN mp_err TclBN_mp_div_2(const mp_int *a, mp_int *q) MP_WUR; /* 16 */ @@ -204,7 +206,7 @@ EXTERN mp_err TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) MP_WUR; /* 17 */ EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q, - mp_digit *r) MP_WUR; + unsigned int *r) MP_WUR; /* 18 */ EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b); /* 19 */ @@ -219,7 +221,7 @@ EXTERN mp_err TclBN_mp_init_copy(mp_int *a, const mp_int *b) MP_WUR; /* 23 */ EXTERN mp_err TclBN_mp_init_multi(mp_int *a, ...) MP_WUR; /* 24 */ -EXTERN mp_err TclBN_mp_init_set(mp_int *a, mp_digit b) MP_WUR; +EXTERN mp_err TclBN_mp_init_set(mp_int *a, unsigned int b) MP_WUR; /* 25 */ EXTERN mp_err TclBN_mp_init_size(mp_int *a, int size) MP_WUR; /* 26 */ @@ -233,7 +235,7 @@ EXTERN mp_err TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r) MP_WUR; EXTERN mp_err TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p) MP_WUR; /* 30 */ -EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, mp_digit b, +EXTERN mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *p) MP_WUR; /* 31 */ EXTERN mp_err TclBN_mp_mul_2(const mp_int *a, mp_int *p) MP_WUR; @@ -255,7 +257,7 @@ EXTERN void TclBN_mp_rshd(mp_int *a, int shift); /* 38 */ EXTERN mp_err TclBN_mp_shrink(mp_int *a) MP_WUR; /* 39 */ -EXTERN void TclBN_mp_set(mp_int *a, mp_digit b); +EXTERN void TclBN_mp_set(mp_int *a, unsigned int b); /* 40 */ EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b) MP_WUR; /* 41 */ @@ -264,7 +266,7 @@ EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b) MP_WUR; EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 43 */ -EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b, +EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, unsigned int b, mp_int *c) MP_WUR; /* 44 */ TCL_DEPRECATED("Use mp_to_ubin") @@ -343,7 +345,7 @@ void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ TCL_DEPRECATED("Use mp_expt_u32") -mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, +mp_err TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast); /* 68 */ EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i); @@ -351,9 +353,8 @@ EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i); EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a) MP_WUR; /* Slot 70 is reserved */ /* 71 */ -EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a); -/* 72 */ -EXTERN mp_bool TclBN_mp_isodd(const mp_int *a) MP_WUR; +EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a) MP_WUR; +/* Slot 72 is reserved */ /* 73 */ EXTERN mp_err TclBN_mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; @@ -384,34 +385,34 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void) MP_WUR; /* 0 */ int (*tclBN_revision) (void) MP_WUR; /* 1 */ mp_err (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 2 */ - mp_err (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c) MP_WUR; /* 3 */ + mp_err (*tclBN_mp_add_d) (const mp_int *a, unsigned int b, mp_int *c) MP_WUR; /* 3 */ mp_err (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */ mp_ord (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b) MP_WUR; /* 8 */ - mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b) MP_WUR; /* 9 */ + mp_ord (*tclBN_mp_cmp_d) (const mp_int *a, unsigned int b) MP_WUR; /* 9 */ mp_ord (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b) MP_WUR; /* 10 */ mp_err (*tclBN_mp_copy) (const mp_int *a, mp_int *b) MP_WUR; /* 11 */ int (*tclBN_mp_count_bits) (const mp_int *a) MP_WUR; /* 12 */ mp_err (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) MP_WUR; /* 13 */ - mp_err (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r) MP_WUR; /* 14 */ + mp_err (*tclBN_mp_div_d) (const mp_int *a, unsigned int b, mp_int *q, unsigned int *r) MP_WUR; /* 14 */ mp_err (*tclBN_mp_div_2) (const mp_int *a, mp_int *q) MP_WUR; /* 15 */ mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r) MP_WUR; /* 16 */ - mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r) MP_WUR; /* 17 */ + mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, unsigned int *r) MP_WUR; /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ mp_err (*tclBN_mp_expt_u32) (const mp_int *a, unsigned int b, mp_int *c) MP_WUR; /* 19 */ mp_err (*tclBN_mp_grow) (mp_int *a, int size) MP_WUR; /* 20 */ mp_err (*tclBN_mp_init) (mp_int *a) MP_WUR; /* 21 */ mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b) MP_WUR; /* 22 */ mp_err (*tclBN_mp_init_multi) (mp_int *a, ...) MP_WUR; /* 23 */ - mp_err (*tclBN_mp_init_set) (mp_int *a, mp_digit b) MP_WUR; /* 24 */ + mp_err (*tclBN_mp_init_set) (mp_int *a, unsigned int b) MP_WUR; /* 24 */ mp_err (*tclBN_mp_init_size) (mp_int *a, int size) MP_WUR; /* 25 */ mp_err (*tclBN_mp_lshd) (mp_int *a, int shift) MP_WUR; /* 26 */ mp_err (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r) MP_WUR; /* 27 */ mp_err (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r) MP_WUR; /* 28 */ mp_err (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p) MP_WUR; /* 29 */ - mp_err (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p) MP_WUR; /* 30 */ + mp_err (*tclBN_mp_mul_d) (const mp_int *a, unsigned int b, mp_int *p) MP_WUR; /* 30 */ mp_err (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p) MP_WUR; /* 31 */ mp_err (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p) MP_WUR; /* 32 */ mp_err (*tclBN_mp_neg) (const mp_int *a, mp_int *b) MP_WUR; /* 33 */ @@ -420,11 +421,11 @@ typedef struct TclTomMathStubs { mp_err (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix) MP_WUR; /* 36 */ void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */ mp_err (*tclBN_mp_shrink) (mp_int *a) MP_WUR; /* 38 */ - void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */ + void (*tclBN_mp_set) (mp_int *a, unsigned int b); /* 39 */ mp_err (*tclBN_mp_sqr) (const mp_int *a, mp_int *b) MP_WUR; /* 40 */ mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b) MP_WUR; /* 41 */ mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 42 */ - mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c) MP_WUR; /* 43 */ + mp_err (*tclBN_mp_sub_d) (const mp_int *a, unsigned int b, mp_int *c) MP_WUR; /* 43 */ TCL_DEPRECATED_API("Use mp_to_ubin") mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */ TCL_DEPRECATED_API("Use mp_to_ubin") mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ TCL_DEPRECATED_API("Use mp_to_radix") mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */ @@ -448,12 +449,12 @@ typedef struct TclTomMathStubs { TCL_DEPRECATED_API("Use mp_init() + mp_set_l()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_ll()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_ull()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ - TCL_DEPRECATED_API("Use mp_expt_u32") mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + TCL_DEPRECATED_API("Use mp_expt_u32") mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, unsigned int b, mp_int *c, int fast); /* 67 */ void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a) MP_WUR; /* 69 */ void (*reserved70)(void); - unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a); /* 71 */ - mp_bool (*tclBN_mp_isodd) (const mp_int *a) MP_WUR; /* 72 */ + unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a) MP_WUR; /* 71 */ + void (*reserved72)(void); mp_err (*tclBN_mp_tc_and) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 73 */ mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 74 */ mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c) MP_WUR; /* 75 */ @@ -619,8 +620,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; /* Slot 70 is reserved */ #define TclBN_mp_get_mag_ul \ (tclTomMathStubsPtr->tclBN_mp_get_mag_ul) /* 71 */ -#define TclBN_mp_isodd \ - (tclTomMathStubsPtr->tclBN_mp_isodd) /* 72 */ +/* Slot 72 is reserved */ #define TclBN_mp_tc_and \ (tclTomMathStubsPtr->tclBN_mp_tc_and) /* 73 */ #define TclBN_mp_tc_or \ @@ -641,9 +641,27 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; /* !END!: Do not edit above this line. */ -#undef mp_isodd -#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) -#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) +#if defined(USE_TCL_STUBS) +#define mp_add_d TclBN_mp_add_d +#define mp_cmp_d TclBN_mp_cmp_d +#define mp_div_d TclBN_mp_div_d +#define mp_div_3 TclBN_mp_div_3 +#define mp_sub_d TclBN_mp_sub_d +#define mp_init_set TclBN_mp_init_set +#define mp_mul_d TclBN_mp_mul_d +#define mp_set TclBN_mp_set +#define mp_expt_u32 TclBN_mp_expt_u32 +#else +#define mp_add_d TclBN_s_mp_add_d +#define mp_cmp_d TclBN_s_mp_cmp_d +#define mp_div_d TclBN_s_mp_div_d +#define mp_div_3 TclBN_s_mp_div_3 +#define mp_sub_d TclBN_s_mp_sub_d +#define mp_init_set TclBN_s_mp_init_set +#define mp_mul_d TclBN_s_mp_mul_d +#define mp_set TclBN_s_mp_set +#define mp_expt_u32 TclBN_s_mp_expt_u32 +#endif /* !BUILD_tcl */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 5eaea4a..4b58fad 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3345,13 +3345,13 @@ Tcl_PrintDouble( * the first (the recommended zero value for tcl_precision avoids the * problem entirely). * - * Uncomment TCL_DD_SHORTEN_FLAG in the next call to prefer the method + * Uncomment TCL_DD_SHORTEST in the next call to prefer the method * that allows floating point values to be shortened if it can be done * without loss of precision. */ digits = TclDoubleDigits(value, *precisionPtr, - TCL_DD_E_FORMAT /* | TCL_DD_SHORTEN_FLAG */, + TCL_DD_E_FORMAT /* | TCL_DD_SHORTEST */, &exponent, &signum, &end); } if (signum) { @@ -3728,7 +3728,7 @@ GetWideForIndex( /* objPtr holds an integer outside the signed wide range */ /* Truncate to the signed wide range. */ - *widePtr = (((mp_int *)cd)->sign != MP_ZPOS) ? WIDE_MIN : WIDE_MAX; + *widePtr = ((mp_isneg((mp_int *)cd)) ? WIDE_MIN : WIDE_MAX); return TCL_OK; } @@ -3841,7 +3841,7 @@ GetWideForIndex( } else { /* sum holds an integer outside the signed wide range */ /* Truncate to the signed wide range. */ - if (((mp_int *)cd)->sign != MP_ZPOS) { + if (mp_isneg((mp_int *)cd)) { *widePtr = WIDE_MIN; } else { *widePtr = WIDE_MAX; @@ -3988,7 +3988,7 @@ GetEndOffsetFromObj( if (t == TCL_NUMBER_BIG) { /* Truncate to the signed wide range. */ - if (((mp_int *)cd)->sign != MP_ZPOS) { + if (mp_isneg((mp_int *)cd)) { offset = (bytes[3] == '-') ? WIDE_MAX : WIDE_MIN; } else { offset = (bytes[3] == '-') ? WIDE_MIN : WIDE_MAX; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 82330c3..285fc8a 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -32,7 +32,7 @@ extern "C" { #endif /* MS Visual C++ doesn't have a 128bit type for words, so fall back to 32bit MPI's (where words are 64bit) */ -#if (defined(_WIN32) || defined(__LLP64__) || defined(__e2k__) || defined(__LCC__)) && !defined(MP_64BIT) +#if (defined(_MSC_VER) || defined(__LLP64__) || defined(__e2k__) || defined(__LCC__)) && !defined(MP_32BIT) && !defined(MP_64BIT) # define MP_32BIT #endif @@ -74,7 +74,7 @@ typedef unsigned short mp_digit; # define MP_DIGIT_BIT 15 #elif defined(MP_64BIT) /* for GCC only on supported platforms */ -typedef Tcl_WideUInt mp_digit; +typedef unsigned long long mp_digit; # define MP_DIGIT_BIT 60 #else typedef unsigned int mp_digit; @@ -148,6 +148,7 @@ typedef int mp_err; #define MP_ERR -1 /* unknown error */ #define MP_MEM -2 /* out of mem */ #define MP_VAL -3 /* invalid input */ +#define MP_RANGE (MP_DEPRECATED_PRAGMA("MP_RANGE has been deprecated in favor of MP_VAL") MP_VAL) #define MP_ITER -4 /* maximum iterations reached */ #define MP_BUF -5 /* buffer overflow, supplied buffer too small */ typedef int mp_order; diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 61d382d..2e3250c 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -287,7 +287,4 @@ extern MP_PRIVATE const mp_digit s_mp_prime_tab[]; return (a->sign == MP_NEG) ? (type)-res : (type)res; \ } -#undef mp_isodd -#define mp_isodd TclBN_mp_isodd - #endif diff --git a/macosx/README b/macosx/README index 953e689..62b3a99 100644 --- a/macosx/README +++ b/macosx/README @@ -36,8 +36,8 @@ Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2). - Tcl extensions can be installed in any of: - $HOME/Library/Tcl /Library/Tcl /System/Library/Tcl - $HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks + $HOME/Library/Tcl /Library/Tcl + $HOME/Library/Frameworks /Library/Frameworks (searched in that order). Given a potential package directory $pkg, Tcl on OSX checks for the file $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test new file mode 100644 index 0000000..fa67646 --- /dev/null +++ b/tests/fileSystemEncoding.test @@ -0,0 +1,51 @@ +#! /usr/bin/env tclsh + +# Copyright (c) 2019 Poor Yorick + +if {[string equal $::tcl_platform(os) "Windows NT"]} { + return +} + +namespace eval ::tcl::test::fileSystemEncoding { + package require tcltest 2 + namespace import ::tcltest::* + + variable fname1 \u767b\u9e1b\u9d72\u6a13 + + proc autopath {} { + global auto_path + set scriptpath [info script] + set scriptpathnorm [file dirname [file normalize $scriptpath/...]] + set dirnorm [file dirname $scriptpathnorm] + set idx [lsearch -exact $auto_path $dirnorm] + if {$idx >= 0} { + set auto_path [lreplace $auto_path[set auto_path {}] $idx $idx {}] + } + set auto_path [linsert $auto_path[set auto_path {}] 0 0 $dirnorm] + } + autopath + + package require tcltests + + test filesystemEncoding-1.0 { + issue bcd100410465 + } -body { + set dir [tcltests::tempdir] + set saved [encoding system] + encoding system iso8859-1 + set fname1a $dir/$fname1 + set utf8name [encoding convertto utf-8 $fname1a] + makeFile {} $utf8name + set globbed [lindex [glob -directory $dir *] 0] + encoding system utf-8 + lappend res [file exists $globbed] + encoding system iso8859-1 + lappend res [file exists $globbed] + return $res + } -cleanup { + file delete -force $dir + encoding system $saved + } -result {0 1} + + cleanupTests +} diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl index c8759a8..c3c8650 100644 --- a/tests/tcltests.tcl +++ b/tests/tcltests.tcl @@ -2,7 +2,6 @@ package require tcltest 2.2 namespace import ::tcltest::* - testConstraint exec [llength [info commands exec]] testConstraint fcopy [llength [info commands fcopy]] testConstraint fileevent [llength [info commands fileevent]] @@ -10,4 +9,38 @@ testConstraint thread [ expr {0 == [catch {package require Thread 2.7-}]}] testConstraint notValgrind [expr {![testConstraint valgrind]}] -package provide tcltests 0.1
\ No newline at end of file + +namespace eval ::tcltests { + + + proc init {} { + if {[namespace which ::tcl::file::tempdir] eq {}} { + interp alias {} [namespace current]::tempdir {} [ + namespace current]::tempdir_alternate + } else { + interp alias {} [namespace current]::tempdir {} ::tcl::file::tempdir + } + } + + + proc tempdir_alternate {} { + file tempfile tempfile + set tmpdir [file dirname $tempfile] + set execname [info nameofexecutable] + regsub -all {[^[:alpha:][:digit:]]} $execname _ execname + for {set i 0} {$i < 10000} {incr i} { + set time [clock milliseconds] + set name $tmpdir/${execname}_${time}_$i + if {![file exists $name]} { + file mkdir $name + return $name + } + } + error [list {could not create temporary directory}] + } + + init + + package provide tcltests 0.1 +} + diff --git a/unix/Makefile.in b/unix/Makefile.in index 5ec5317..42bb4c0 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -180,6 +180,7 @@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DBUILD_tcl SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ TCL_SHLIB_LD_EXTRAS = @TCL_SHLIB_LD_EXTRAS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ @@ -330,7 +331,7 @@ TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \ bn_s_mp_get_bit.o bn_mp_get_mag_ul.o bn_mp_grow.o bn_mp_init.o \ bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \ bn_mp_init_size.o bn_mp_init_ul.o bn_s_mp_karatsuba_mul.o \ - bn_s_mp_karatsuba_sqr.o bn_s_mp_balance_mul.o bn_mp_isodd.o \ + bn_s_mp_karatsuba_sqr.o bn_s_mp_balance_mul.o \ bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mul.o bn_mp_mul_2.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o \ bn_mp_radix_size.o bn_mp_radix_smap.o \ @@ -519,8 +520,6 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_dr_setup.c \ $(TOMMATH_DIR)/bn_mp_error_to_string.c \ $(TOMMATH_DIR)/bn_mp_exch.c \ - $(TOMMATH_DIR)/bn_mp_expt_d.c \ - $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ $(TOMMATH_DIR)/bn_mp_expt_u32.c \ $(TOMMATH_DIR)/bn_mp_exptmod.c \ $(TOMMATH_DIR)/bn_mp_exteuclid.c \ @@ -991,14 +990,14 @@ install-binaries: binaries @$(INSTALL_DATA) tcl.pc $(LIB_INSTALL_DIR)/pkgconfig/tcl.pc install-libraries-zipfs-shared: libraries - @for i in "$(SCRIPT_INSTALL_DIR)" ; do \ + @for i in "$(SCRIPT_INSTALL_DIR)"; do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ fi; \ done @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/" - @for i in $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@ ; do \ + @for i in $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ done @@ -1008,13 +1007,13 @@ install-libraries-zipfs-static: install-libraries-zipfs-shared MODULE_INSTALL_DIR=$(SCRIPT_INSTALL_DIR)/.. install-libraries: libraries - @for i in "$(SCRIPT_INSTALL_DIR)" ; do \ + @for i in "$(SCRIPT_INSTALL_DIR)"; do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ fi; \ done - @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6 ../tcl8/8.7 ; do \ + @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6 ../tcl8/8.7; do \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ $(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/$$i; \ @@ -1029,7 +1028,7 @@ install-libraries: libraries @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl \ "$(MODULE_INSTALL_DIR)"/tcl8/8.6/http-2.9.0.tm @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/" - @for i in $(TOP_DIR)/library/opt/*.tcl ; do \ + @for i in $(TOP_DIR)/library/opt/*.tcl; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done @echo "Installing package msgcat 1.7.0 as a Tcl Module" @@ -1045,7 +1044,7 @@ install-libraries: libraries @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl \ "$(MODULE_INSTALL_DIR)"/tcl8/8.4/platform/shell-1.1.4.tm @echo "Installing encoding files to $(SCRIPT_INSTALL_DIR)/encoding/" - @for i in $(TOP_DIR)/library/encoding/*.enc ; do \ + @for i in $(TOP_DIR)/library/encoding/*.enc; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/encoding; \ done @if [ -n "$(TCL_MODULE_PATH)" -a -f $(TOP_DIR)/library/tm.tcl ] ; then \ @@ -1055,26 +1054,26 @@ install-libraries: libraries fi install-tzdata: - @for i in tzdata ; do \ + @for i in tzdata; do \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ $(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/$$i; \ fi; \ done @echo "Installing time zone files to $(SCRIPT_INSTALL_DIR)/tzdata/" - @for i in $(TOP_DIR)/library/tzdata/* ; do \ + @for i in $(TOP_DIR)/library/tzdata/*; do \ if [ -d $$i ] ; then \ ii=`basename $$i`; \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/tzdata/$$ii ] ; then \ $(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/tzdata/$$ii; \ fi; \ - for j in $$i/* ; do \ + for j in $$i/*; do \ if [ -d $$j ] ; then \ jj=`basename $$j`; \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/tzdata/$$ii/$$jj ] ; then \ $(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/tzdata/$$ii/$$jj; \ fi; \ - for k in $$j/* ; do \ + for k in $$j/*; do \ $(INSTALL_DATA) $$k "$(SCRIPT_INSTALL_DIR)"/tzdata/$$ii/$$jj; \ done; \ else \ @@ -1087,34 +1086,34 @@ install-tzdata: done install-msgs: - @for i in msgs ; do \ + @for i in msgs; do \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ $(INSTALL_DATA_DIR) "$(SCRIPT_INSTALL_DIR)"/$$i; \ fi; \ done @echo "Installing message catalog files to $(SCRIPT_INSTALL_DIR)/msgs/" - @for i in $(TOP_DIR)/library/msgs/*.msg ; do \ + @for i in $(TOP_DIR)/library/msgs/*.msg; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/msgs; \ done install-doc: doc - @for i in "$(MAN_INSTALL_DIR)" "$(MAN1_INSTALL_DIR)" "$(MAN3_INSTALL_DIR)" "$(MANN_INSTALL_DIR)" ; do \ + @for i in "$(MAN_INSTALL_DIR)" "$(MAN1_INSTALL_DIR)" "$(MAN3_INSTALL_DIR)" "$(MANN_INSTALL_DIR)"; do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ fi; \ done @echo "Installing and cross-linking top-level (.1) docs to $(MAN1_INSTALL_DIR)/" - @for i in $(TOP_DIR)/doc/*.1 ; do \ + @for i in $(TOP_DIR)/doc/*.1; do \ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN1_INSTALL_DIR)"; \ done @echo "Installing and cross-linking C API (.3) docs to $(MAN3_INSTALL_DIR)/" - @for i in $(TOP_DIR)/doc/*.3 ; do \ + @for i in $(TOP_DIR)/doc/*.3; do \ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MAN3_INSTALL_DIR)"; \ done @echo "Installing and cross-linking command (.n) docs to $(MANN_INSTALL_DIR)/"; - @for i in $(TOP_DIR)/doc/*.n ; do \ + @for i in $(TOP_DIR)/doc/*.n; do \ $(SHELL) $(UNIX_DIR)/installManPage $(MAN_FLAGS) $$i "$(MANN_INSTALL_DIR)"; \ done @@ -1132,30 +1131,30 @@ TCL_PRIVATE_HEADERS = $(GENERIC_DIR)/tclInt.h $(GENERIC_DIR)/tclIntDecls.h \ # implementation, and aren't to be installed. install-headers: - @for i in "$(INCLUDE_INSTALL_DIR)" ; do \ + @for i in "$(INCLUDE_INSTALL_DIR)"; do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ fi; \ done @echo "Installing header files to $(INCLUDE_INSTALL_DIR)/"; - @for i in $(TCL_PUBLIC_HEADERS) ; do \ + @for i in $(TCL_PUBLIC_HEADERS); do \ $(INSTALL_DATA) $$i "$(INCLUDE_INSTALL_DIR)"; \ done # Optional target to install private headers install-private-headers: - @for i in "$(PRIVATE_INCLUDE_INSTALL_DIR)" ; do \ + @for i in "$(PRIVATE_INCLUDE_INSTALL_DIR)"; do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ fi; \ done @echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/"; - @for i in $(TCL_PRIVATE_HEADERS) ; do \ + @for i in $(TCL_PRIVATE_HEADERS); do \ $(INSTALL_DATA) $$i "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \ done - @if test -f tclConfig.h ; then \ + @if test -f tclConfig.h; then\ $(INSTALL_DATA) tclConfig.h "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \ fi @@ -1647,9 +1646,6 @@ bn_s_mp_karatsuba_sqr.o: $(TOMMATH_DIR)/bn_s_mp_karatsuba_sqr.c $(MATHHDRS) bn_s_mp_balance_mul.o: $(TOMMATH_DIR)/bn_s_mp_balance_mul.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_balance_mul.c -bn_mp_isodd.o: $(TOMMATH_DIR)/bn_mp_isodd.c $(MATHHDRS) - $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_isodd.c - bn_mp_lshd.o: $(TOMMATH_DIR)/bn_mp_lshd.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_lshd.c @@ -1970,7 +1966,7 @@ PKG_CFG_ARGS = @PKG_CFG_ARGS@ PKG_DIR = ./pkgs configure-packages: - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ if [ -x $$i/configure ] ; then \ pkg=`basename $$i`; \ @@ -1988,7 +1984,7 @@ configure-packages: done packages: configure-packages ${STUB_LIB_FILE} - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -1999,7 +1995,7 @@ packages: configure-packages ${STUB_LIB_FILE} done install-packages: packages - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -2011,7 +2007,7 @@ install-packages: packages done test-packages: ${TCLTEST_EXE} packages - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -2026,7 +2022,7 @@ test-packages: ${TCLTEST_EXE} packages done clean-packages: - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -2036,7 +2032,7 @@ clean-packages: done distclean-packages: - @for i in $(PKGS_DIR)/* ; do \ + @for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -2050,7 +2046,7 @@ distclean-packages: dist-packages: configure-packages @rm -rf $(DISTROOT)/pkgs; \ mkdir -p $(DISTROOT)/pkgs; \ - for i in $(PKGS_DIR)/* ; do \ + for i in $(PKGS_DIR)/*; do \ if [ -d $$i ] ; then \ pkg=`basename $$i`; \ if [ -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ @@ -2136,7 +2132,7 @@ checkstubs: $(TCL_LIB_FILE) | awk '$$2 ~ /^[TDBCS]$$/ { sub("^_", "", $$3); print $$3 }' \ | sort -n` ; do \ match=0; \ - for j in $(TCL_DECLS) ; do \ + for j in $(TCL_DECLS); do \ if [ `grep -c "$$i *(" $$j` -gt 0 ] ; then \ match=1; \ fi; \ @@ -2153,15 +2149,15 @@ checkstubs: $(TCL_LIB_FILE) checkdoc: $(TCL_LIB_FILE) -@for i in `nm -p $(TCL_LIB_FILE) | awk '$$3 ~ /Tcl_/ { print $$3 }' \ - | grep -Fv . | grep -v 'Cmd$$' | sort -n` ; do \ + | grep -Fv . | grep -v 'Cmd$$' | sort -n`; do \ match=0; \ i=`echo $$i | sed 's/^_//'`; \ - for j in $(TOP_DIR)/doc/*.3 ; do \ - if [ `grep '\-' $$j | grep -c $$i` -gt 0 ] ; then \ + for j in $(TOP_DIR)/doc/*.3; do \ + if [ `grep '\-' $$j | grep -c $$i` -gt 0 ]; then \ match=1; \ fi; \ done; \ - if [ $$match -eq 0 ] ; then \ + if [ $$match -eq 0 ]; then \ echo $$i; \ fi; \ done @@ -2251,7 +2247,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tclConfig.h.in $(UNIX_DIR)/tcl.pc.in \ @mkdir $(DISTDIR)/library cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \ $(TOP_DIR)/library/tclIndex $(DISTDIR)/library - @for i in $(BUILTIN_PACKAGE_LIST) ; do \ + @for i in $(BUILTIN_PACKAGE_LIST); do \ mkdir $(DISTDIR)/library/$$i;\ cp -p $(TOP_DIR)/library/$$i/*.tcl $(DISTDIR)/library/$$i; \ done @@ -2322,7 +2318,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tclConfig.h.in $(UNIX_DIR)/tcl.pc.in \ @mkdir $(DISTDIR)/pkgs cp $(TOP_DIR)/pkgs/README $(DISTDIR)/pkgs cp $(TOP_DIR)/pkgs/package.list.txt $(DISTDIR)/pkgs - for i in `ls $(DISTROOT)/pkgs/*.tar.gz 2> /dev/null` ; do \ + for i in `ls $(DISTROOT)/pkgs/*.tar.gz 2> /dev/null`; do \ tar -C $(DISTDIR)/pkgs -xzf "$$i"; \ done diff --git a/unix/configure b/unix/configure index 00a12c6..6b3b930 100755 --- a/unix/configure +++ b/unix/configure @@ -3894,6 +3894,14 @@ $as_echo "#define NO_DLFCN_H 1" >>confdefs.h fi + ac_fn_c_check_header_mongrel "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" +if test "x$ac_cv_header_stdbool_h" = xyes; then : + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). for ac_header in sys/param.h @@ -4857,6 +4865,9 @@ $as_echo "$as_me: WARNING: can't find uname command" >&2;} if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi + if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then + tcl_cv_sys_version=NetBSD-Debian + fi fi fi @@ -6124,13 +6135,13 @@ fi # below. if test "$GCC" = yes; then : - SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else - SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" @@ -6883,6 +6894,9 @@ fi if test "${tcl_cv_type_64bit}" = none ; then +$as_echo "#define MP_32BIT 1" >>confdefs.h + + $as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -9826,6 +9840,9 @@ $as_echo "$as_me: WARNING: can't find uname command" >&2;} if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi + if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then + tcl_cv_sys_version=NetBSD-Debian + fi fi fi @@ -10250,7 +10267,7 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" -TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' +test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -10375,13 +10392,13 @@ VERSION=${TCL_VERSION} if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_PACKAGE_PATH" && \ - TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks" + TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks" test -z "$TCL_MODULE_PATH" && \ - TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /System/Library/Tcl" + TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}" else - TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}" fi #-------------------------------------------------------------------- diff --git a/unix/configure.ac b/unix/configure.ac index 74ee955..6614f5a 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -841,7 +841,7 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" -TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' +test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -930,13 +930,13 @@ VERSION=${TCL_VERSION} if test "$FRAMEWORK_BUILD" = "1" ; then test -z "$TCL_PACKAGE_PATH" && \ - TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks" + TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks" test -z "$TCL_MODULE_PATH" && \ - TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /System/Library/Tcl" + TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl" elif test "$prefix/lib" != "$libdir"; then - TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}" else - TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}" + test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}" fi #-------------------------------------------------------------------- diff --git a/unix/installManPage b/unix/installManPage index 09a31dd..fca08bb 100755 --- a/unix/installManPage +++ b/unix/installManPage @@ -107,12 +107,20 @@ case $ManPage in exit 2 ;; esac +Name=`basename $ManPage .$Section` SrcDir=`dirname $ManPage` ######################################################################## ### Process Page to Create Target Pages ### +Specials="DString Thread Notifier RegExp library packagens pkgMkIndex safesock" +for n in $Specials; do + if [ "$Name" = "$n" ] ; then + Names="$n $Names" + fi +done + First="" for Target in $Names; do Target=$Target.$Section$Suffix diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 30b1851..6ca3e21 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -77,7 +77,6 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ - `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" @@ -94,6 +93,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ + `ls -d /usr/lib/tcl8.7 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \ @@ -210,7 +210,6 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ - `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tk.framework/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`" @@ -227,6 +226,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ + `ls -d /usr/lib/tk8.7 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tk8.7 2>/dev/null` \ @@ -814,6 +814,9 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [ if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi + if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then + tcl_cv_sys_version=NetBSD-Debian + fi fi fi ]) @@ -1585,11 +1588,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # this test works, since "uname -s" was non-standard in 3.2.4 and # below. AS_IF([test "$GCC" = yes], [ - SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" ], [ - SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" ]) SHLIB_LD="ld -G" SHLIB_LD_LIBS="" @@ -1930,7 +1933,7 @@ dnl # preprocessing tests use only CPPFLAGS. # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_SYS_PARAM_H -# +# HAVE_STDBOOL_H # HAVE_STRING_H ? # #-------------------------------------------------------------------- @@ -1981,6 +1984,7 @@ closedir(d); AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])]) AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])]) + AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],) # OS/390 lacks sys/param.h (and doesn't need it, by chance). AC_HAVE_HEADERS(sys/param.h) @@ -2366,6 +2370,7 @@ AC_DEFUN([SC_TCL_EARLY_FLAGS],[ # HAVE_STRUCT_DIRENT64, HAVE_DIR64 # HAVE_STRUCT_STAT64 # HAVE_TYPE_OFF64_T +# MP_32BIT # #-------------------------------------------------------------------- @@ -2383,6 +2388,7 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then + AC_DEFINE(MP_32BIT, 1, [Use 'MP_32BIT' for libtommath]) AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) AC_MSG_RESULT([yes]) else diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index be5cf5e..290596f 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -19,6 +19,9 @@ /* Defined when compiler supports casting to union type. */ #undef HAVE_CAST_TO_UNION +/* Define to 1 if you have the `cfmakeraw' function. */ +#undef HAVE_CFMAKERAW + /* Define to 1 if you have the `chflags' function. */ #undef HAVE_CHFLAGS @@ -42,9 +45,16 @@ you don't. */ #undef HAVE_DECL_GETHOSTBYNAME_R +/* Define to 1 if you have the declaration of `PTHREAD_MUTEX_RECURSIVE', and + to 0 if you don't. */ +#undef HAVE_DECL_PTHREAD_MUTEX_RECURSIVE + /* Is 'DIR64' in <sys/types.h>? */ #undef HAVE_DIR64 +/* Is eventfd(2) supported? */ +#undef HAVE_EVENTFD + /* Define to 1 if you have the `freeaddrinfo' function. */ #undef HAVE_FREEADDRINFO @@ -189,6 +199,9 @@ /* Are characters signed? */ #undef HAVE_SIGNED_CHAR +/* Do we have <stdbool.h>? */ +#undef HAVE_STDBOOL_H + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -228,6 +241,15 @@ /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS +/* Define to 1 if you have the <sys/epoll.h> header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the <sys/eventfd.h> header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the <sys/event.h> header file. */ +#undef HAVE_SYS_EVENT_H + /* Define to 1 if you have the <sys/filio.h> header file. */ #undef HAVE_SYS_FILIO_H @@ -288,6 +310,9 @@ /* No Compiler support for module scope symbols */ #undef MODULE_SCOPE +/* Use 'MP_32BIT' for libtommath */ +#undef MP_32BIT + /* Default libtommath precision. */ #undef MP_PREC @@ -297,6 +322,12 @@ /* Use compat implementation of getaddrinfo() and friends */ #undef NEED_FAKE_RFC2553 +/* Is epoll(7) supported? */ +#undef NOTIFIER_EPOLL + +/* Is kqueue(2) supported? */ +#undef NOTIFIER_KQUEUE + /* Is Darwin CoreFoundation unavailable for 64-bit? */ #undef NO_COREFOUNDATION_64 @@ -408,7 +439,7 @@ /* Does this platform have wide high-resolution clicks? */ #undef TCL_WIDE_CLICKS -/* Do Tcl_WideInt, 'long' and 'long long' all have the same size (64-bit) ? */ +/* Do 'long' and 'long long' have the same size (64-bit)? */ #undef TCL_WIDE_INT_IS_LONG /* What type should be used to define wide integers? */ @@ -429,9 +460,6 @@ /* Should we use FIONBIO? */ #undef USE_FIONBIO -/* Do we want to use the threaded memory allocator? */ -#undef USE_THREAD_ALLOC - /* Should we use vfork() instead of fork()? */ #undef USE_VFORK @@ -447,6 +475,9 @@ # endif #endif +/* Are we building with zipfs enabled? */ +#undef ZIPFS_BUILD + /* Are Darwin SUSv3 extensions available? */ #undef _DARWIN_C_SOURCE diff --git a/win/Makefile.in b/win/Makefile.in index 48932df..8c8ed44 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -388,7 +388,6 @@ TOMMATH_OBJS = \ bn_mp_init_set.${OBJEXT} \ bn_mp_init_size.${OBJEXT} \ bn_mp_init_ul.${OBJEXT} \ - bn_mp_isodd.${OBJEXT} \ bn_mp_lshd.${OBJEXT} \ bn_mp_mod.${OBJEXT} \ bn_mp_mod_2d.${OBJEXT} \ @@ -781,7 +780,7 @@ INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_T install: $(INSTALL_TARGETS) install-binaries: binaries - @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \ + @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)"; \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ @@ -877,7 +876,7 @@ install-libraries: libraries install-tzdata install-msgs @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm; @echo "Installing encodings"; - @for i in $(ROOT_DIR)/library/encoding/*.enc ; do \ + @for i in $(ROOT_DIR)/library/encoding/*.enc; do \ $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \ done; diff --git a/win/configure b/win/configure index d2beded..1c0b265 100755 --- a/win/configure +++ b/win/configure @@ -1697,6 +1697,93 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -4524,6 +4611,15 @@ $as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h fi + ac_fn_c_check_header_mongrel "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" +if test "x$ac_cv_header_stdbool_h" = xyes; then : + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + + + # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. @@ -4564,6 +4660,10 @@ $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi fi + +$as_echo "#define MP_32BIT 1" >>confdefs.h + + # DL_LIBS is empty, but then we match the Unix version diff --git a/win/makefile.vc b/win/makefile.vc index 69346b4..19911fd 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -344,7 +344,6 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_init_set.obj \
$(TMP_DIR)\bn_mp_init_size.obj \
$(TMP_DIR)\bn_mp_init_ul.obj \
- $(TMP_DIR)\bn_mp_isodd.obj \
$(TMP_DIR)\bn_mp_lshd.obj \
$(TMP_DIR)\bn_mp_mod.obj \
$(TMP_DIR)\bn_mp_mod_2d.obj \
@@ -948,6 +948,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ [Defined when cygwin/mingw ignores VOID define in winnt.h]) fi + AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],) + # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. @@ -968,6 +970,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi fi + AC_DEFINE(MP_32BIT, 1, [Use 'MP_32BIT' for libtommath]) + # DL_LIBS is empty, but then we match the Unix version AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 35f183c..1946adb 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -84,6 +84,9 @@ typedef DWORD_PTR * PDWORD_PTR; #include <process.h> #include <signal.h> #include <limits.h> +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif #ifndef __GNUC__ # define strncasecmp _strnicmp |