diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-15 15:49:46 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-15 15:49:46 (GMT) |
| commit | 7ed7fa90ffa88ab4144d20e91139e6f36abdf133 (patch) | |
| tree | 6233d2b913eba2a00298d1ede66c3d49a321d5c6 /generic/tclStubInit.c | |
| parent | b8c310c91a436e8514cc19a4fe75c124d5444286 (diff) | |
| parent | a72376335b62d075c3d7d92870af01c361da518e (diff) | |
| download | tcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.zip tcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.tar.gz tcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.tar.bz2 | |
Merge trunk. Fix MSVC static build
Diffstat (limited to 'generic/tclStubInit.c')
| -rw-r--r-- | generic/tclStubInit.c | 192 |
1 files changed, 115 insertions, 77 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 6c11147..01434b9 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -11,6 +11,7 @@ #include "tclInt.h" #include "tommath_private.h" +#include "tclTomMath.h" #ifdef __CYGWIN__ # include <wchar.h> @@ -29,8 +30,10 @@ #undef Tcl_Alloc #undef Tcl_Free #undef Tcl_Realloc +#undef Tcl_NewBooleanObj #undef Tcl_NewByteArrayObj #undef Tcl_NewDoubleObj +#undef Tcl_NewIntObj #undef Tcl_NewListObj #undef Tcl_NewLongObj #undef Tcl_DbNewLongObj @@ -39,82 +42,99 @@ #undef Tcl_GetUnicode #undef Tcl_DumpActiveMemory #undef Tcl_ValidateAllMemory +#undef Tcl_FindHashEntry +#undef Tcl_CreateHashEntry +#undef Tcl_Panic +#undef Tcl_FindExecutable #undef Tcl_SetExitProc #undef Tcl_SetPanicProc #undef TclpGetPid +#undef TclSockMinimumBuffers +#undef Tcl_SetIntObj +#undef Tcl_SetLongObj +#undef TclpInetNtoa +#undef TclWinGetServByName +#undef TclWinGetSockOpt +#undef TclWinSetSockOpt +#undef TclWinNToHS #undef TclStaticPackage #undef Tcl_BackgroundError -#undef Tcl_UtfToUniChar -#undef Tcl_UtfToUniCharDString -#undef Tcl_UniCharToUtfDString #define TclStaticPackage Tcl_StaticPackage +#undef Tcl_UniCharToUtfDString +#undef Tcl_UtfToUniCharDString +#undef Tcl_UtfToUniChar -#ifdef TCL_MEM_DEBUG -# define Tcl_Alloc TclpAlloc -# define Tcl_Free TclpFree -# define Tcl_Realloc TclpRealloc -# undef Tcl_AttemptAlloc -# define Tcl_AttemptAlloc TclpAlloc -# undef Tcl_AttemptRealloc -# define Tcl_AttemptRealloc TclpRealloc -#endif - -MP_SET_UNSIGNED(mp_set_ull, Tcl_WideUInt) -MP_SET_SIGNED(mp_set_ll, mp_set_ull, Tcl_WideInt, Tcl_WideUInt) -MP_GET_MAG(mp_get_mag_ull, Tcl_WideUInt) - -mp_err TclBN_mp_set_int(mp_int *a, unsigned long i) -{ - mp_set_ul(a, i); - return MP_OKAY; -} - -static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) -{ - mp_set_ul(a, i); - return MP_OKAY; -} - -#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_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); -} - - +#define TclBN_mp_add mp_add +#define TclBN_mp_add_d mp_add_d +#define TclBN_mp_and mp_and +#define TclBN_mp_clamp mp_clamp +#define TclBN_mp_clear mp_clear +#define TclBN_mp_clear_multi mp_clear_multi +#define TclBN_mp_cmp mp_cmp +#define TclBN_mp_cmp_d mp_cmp_d +#define TclBN_mp_cmp_mag mp_cmp_mag +#define TclBN_mp_cnt_lsb mp_cnt_lsb +#define TclBN_mp_copy mp_copy +#define TclBN_mp_count_bits mp_count_bits +#define TclBN_mp_div mp_div +#define TclBN_mp_div_d mp_div_d +#define TclBN_mp_div_2 mp_div_2 +#define TclBN_mp_div_2d mp_div_2d +#define TclBN_mp_exch mp_exch +#define TclBN_mp_expt_u32 mp_expt_u32 +#define TclBN_mp_get_mag_u64 mp_get_mag_u64 +#define TclBN_mp_grow mp_grow +#define TclBN_mp_init mp_init +#define TclBN_mp_init_copy mp_init_copy +#define TclBN_mp_init_multi mp_init_multi +#define TclBN_mp_init_set mp_init_set +#define TclBN_mp_init_size mp_init_size +#define TclBN_mp_init_i64 mp_init_i64 +#define TclBN_mp_init_u64 mp_init_u64 +#define TclBN_mp_lshd mp_lshd +#define TclBN_mp_mod mp_mod +#define TclBN_mp_mod_2d mp_mod_2d +#define TclBN_mp_mul mp_mul +#define TclBN_mp_mul_d mp_mul_d +#define TclBN_mp_mul_2 mp_mul_2 +#define TclBN_mp_mul_2d mp_mul_2d +#define TclBN_mp_neg mp_neg +#define TclBN_mp_or mp_or +#define TclBN_mp_radix_size mp_radix_size +#define TclBN_mp_reverse mp_reverse +#define TclBN_mp_read_radix mp_read_radix +#define TclBN_mp_rshd mp_rshd +#define TclBN_mp_set_i64 mp_set_i64 +#define TclBN_mp_set_u64 mp_set_u64 +#define TclBN_mp_shrink mp_shrink +#define TclBN_mp_sqr mp_sqr +#define TclBN_mp_sqrt mp_sqrt +#define TclBN_mp_sub mp_sub +#define TclBN_mp_sub_d mp_sub_d +#define TclBN_mp_signed_rsh mp_signed_rsh +#define TclBN_mp_to_radix mp_to_radix +#define TclBN_mp_to_ubin mp_to_ubin +#define TclBN_mp_ubin_size mp_ubin_size +#define TclBN_mp_xor mp_xor +#define TclBN_mp_zero mp_zero +#define TclBN_s_mp_add s_mp_add +#define TclBN_s_mp_balance_mul mp_balance_mul +#define TclBN_mp_karatsuba_mul s_mp_karatsuba_mul +#define TclBN_mp_karatsuba_sqr s_mp_karatsuba_sqr +#define TclBN_s_mp_mul_digs s_mp_mul_digs +#define TclBN_s_mp_mul_digs_fast s_mp_mul_digs_fast +#define TclBN_s_mp_reverse s_mp_reverse +#define TclBN_s_mp_sqr s_mp_sqr +#define TclBN_s_mp_sqr_fast s_mp_sqr_fast +#define TclBN_s_mp_sub s_mp_sub +#define TclBN_mp_toom_mul s_mp_toom_mul +#define TclBN_mp_toom_sqr s_mp_toom_sqr #ifdef _WIN32 # define TclUnixWaitForFile 0 # define TclUnixCopyFile 0 # define TclUnixOpenTemporaryFile 0 +# define TclpReaddir 0 # define TclpIsAtty 0 #elif defined(__CYGWIN__) # define TclpIsAtty TclPlatIsAtty @@ -125,6 +145,7 @@ doNothing(void) } # define TclWinAddProcess (void (*) (void *, size_t)) doNothing # define TclWinFlushDirtyChannels doNothing + static int TclpIsAtty(int fd) { @@ -135,7 +156,7 @@ void *TclWinGetTclInstance() { void *hInstance = NULL; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (const char *)&TclpIsAtty, &hInstance); + (const wchar_t *)&TclpIsAtty, &hInstance); return hInstance; } @@ -197,6 +218,23 @@ static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){ return result; } #define Tcl_ExprLongObj (int(*)(Tcl_Interp*,Tcl_Obj*,long*))exprIntObj +static int uniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ + return Tcl_UniCharNcmp(ucs, uct, (unsigned long)n); +} +#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))(void *)uniCharNcmp +static int utfNcmp(const char *s1, const char *s2, unsigned int n){ + return Tcl_UtfNcmp(s1, s2, (unsigned long)n); +} +#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcmp +static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){ + return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n); +} +#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcasecmp +static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ + return Tcl_UniCharNcasecmp(ucs, uct, (unsigned long)n); +} +#define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))(void *)uniCharNcasecmp + #endif /* TCL_WIDE_INT_IS_LONG */ #endif /* __CYGWIN__ */ @@ -274,7 +312,7 @@ static const TclIntStubs tclIntStubs = { 0, /* 47 */ 0, /* 48 */ 0, /* 49 */ - TclInitCompiledLocals, /* 50 */ + 0, /* 50 */ TclInterpInit, /* 51 */ 0, /* 52 */ TclInvokeObjectCommand, /* 53 */ @@ -640,7 +678,7 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_read_radix, /* 36 */ TclBN_mp_rshd, /* 37 */ TclBN_mp_shrink, /* 38 */ - TclBN_mp_set, /* 39 */ + 0, /* 39 */ 0, /* 40 */ TclBN_mp_sqrt, /* 41 */ TclBN_mp_sub, /* 42 */ @@ -662,18 +700,18 @@ const TclTomMathStubs tclTomMathStubs = { 0, /* 58 */ 0, /* 59 */ 0, /* 60 */ - TclBN_mp_init_ul, /* 61 */ - TclBN_mp_set_ul, /* 62 */ + 0, /* 61 */ + 0, /* 62 */ TclBN_mp_cnt_lsb, /* 63 */ - TclBNInitBignumFromLong, /* 64 */ - TclBNInitBignumFromWideInt, /* 65 */ - TclBNInitBignumFromWideUInt, /* 66 */ + 0, /* 64 */ + TclBN_mp_init_i64, /* 65 */ + TclBN_mp_init_u64, /* 66 */ 0, /* 67 */ - TclBN_mp_set_ull, /* 68 */ - TclBN_mp_get_mag_ull, /* 69 */ - TclBN_mp_set_ll, /* 70 */ - TclBN_mp_get_mag_ul, /* 71 */ - TclBN_mp_set_l, /* 72 */ + TclBN_mp_set_u64, /* 68 */ + TclBN_mp_get_mag_u64, /* 69 */ + TclBN_mp_set_i64, /* 70 */ + 0, /* 71 */ + 0, /* 72 */ 0, /* 73 */ 0, /* 74 */ 0, /* 75 */ |
