diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/Makefile.in | 2 | ||||
-rw-r--r-- | win/cat.c | 2 | ||||
-rwxr-xr-x | win/configure | 116 | ||||
-rw-r--r-- | win/configure.in | 23 | ||||
-rw-r--r-- | win/makefile.vc | 2 | ||||
-rw-r--r-- | win/rules.vc | 2 | ||||
-rw-r--r-- | win/tcl.m4 | 42 | ||||
-rw-r--r-- | win/tclAppInit.c | 2 | ||||
-rw-r--r-- | win/tclWin32Dll.c | 58 | ||||
-rw-r--r-- | win/tclWinChan.c | 6 | ||||
-rw-r--r-- | win/tclWinConsole.c | 4 | ||||
-rw-r--r-- | win/tclWinDde.c | 8 | ||||
-rw-r--r-- | win/tclWinFCmd.c | 2 | ||||
-rw-r--r-- | win/tclWinFile.c | 30 | ||||
-rw-r--r-- | win/tclWinInt.h | 2 | ||||
-rw-r--r-- | win/tclWinPipe.c | 19 | ||||
-rw-r--r-- | win/tclWinPort.h | 2 | ||||
-rw-r--r-- | win/tclWinReg.c | 4 | ||||
-rw-r--r-- | win/tclWinSerial.c | 4 | ||||
-rw-r--r-- | win/tclWinSock.c | 62 | ||||
-rw-r--r-- | win/tclWinTest.c | 2 | ||||
-rw-r--r-- | win/tclWinThrd.c | 4 |
22 files changed, 267 insertions, 131 deletions
diff --git a/win/Makefile.in b/win/Makefile.in index 392bb15..499f06d 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.184.2.3 2010/12/11 18:39:31 kennykb Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.187 2010/12/03 09:19:39 nijtmans Exp $ VERSION = @TCL_VERSION@ @@ -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: cat.c,v 1.5.4.1 2010/12/01 16:42:37 kennykb Exp $ + * RCS: @(#) $Id: cat.c,v 1.6 2010/11/16 14:03:34 nijtmans Exp $ */ #ifdef TCL_BROKEN_MAINARGS diff --git a/win/configure b/win/configure index 32d9310..2e69364 100755 --- a/win/configure +++ b/win/configure @@ -3628,6 +3628,78 @@ _ACEOF fi +# See if the compiler supports intrinsics. + +echo "$as_me:$LINENO: checking for intrinsics support in compiler" >&5 +echo $ECHO_N "checking for intrinsics support in compiler... $ECHO_C" >&6 +if test "${tcl_cv_intrinsics+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN +#include <intrin.h> + +int +main () +{ + + __cpuidex(0,0,0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_intrinsics=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_intrinsics=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $tcl_cv_intrinsics" >&5 +echo "${ECHO_T}$tcl_cv_intrinsics" >&6 +if test "$tcl_cv_intrinsics" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INTRIN_H 1 +_ACEOF + +fi + #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- @@ -3899,6 +3971,10 @@ fi SHLIB_SUFFIX=".dll" + # MACHINE is IX86 for LINK, but this is used by the manifest, + # which requires x86|amd64|ia64. + MACHINE="X86" + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -4179,11 +4255,18 @@ echo "$as_me: error: ${CC} does not support the -shared option. LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" - if test "$do64bit" != "no" ; then - MACHINE="AMD64" - else - MACHINE="X86" - fi + case "$do64bit" in + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 +echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + ;; + ia64) + MACHINE="IA64" + echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 +echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + ;; + esac else if test "${SHARED_BUILD}" = "0" ; then # static @@ -4208,12 +4291,9 @@ echo "${ECHO_T}using shared flags" >&6 LIBSUFFIX="\${DBGX}.lib" LIBFLAGSUFFIX="\${DBGX}" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs - # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. - MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" @@ -4221,14 +4301,14 @@ echo "${ECHO_T}using shared flags" >&6 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in - amd64|x64|yes) - MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" - ;; - ia64) - MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" - ;; + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + PATH64="${MSSDK}/Bin/Win64/x86/AMD64" + ;; + ia64) + MACHINE="IA64" + PATH64="${MSSDK}/Bin/Win64" + ;; esac if test ! -d "${PATH64}" ; then { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 diff --git a/win/configure.in b/win/configure.in index 256f8c7..bd42c49 100644 --- a/win/configure.in +++ b/win/configure.in @@ -3,7 +3,7 @@ # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.123.2.3 2010/12/11 18:39:31 kennykb Exp $ +# RCS: @(#) $Id: configure.in,v 1.131 2011/01/12 10:40:03 nijtmans Exp $ AC_INIT(../generic/tcl.h) AC_PREREQ(2.59) @@ -272,6 +272,27 @@ if test "$tcl_cv_mwmo_alertable" = "no"; then [Defined when MWMO_ALERTABLE is missing from winuser.h]) fi +# See if the compiler supports intrinsics. + +AC_CACHE_CHECK(for intrinsics support in compiler, + tcl_cv_intrinsics, +AC_TRY_LINK([ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN +#include <intrin.h> +], +[ + __cpuidex(0,0,0); +], + tcl_cv_intrinsics=yes, + tcl_cv_intrinsics=no) +) +if test "$tcl_cv_intrinsics" = "yes"; then + AC_DEFINE(HAVE_INTRIN_H, 1, + [Defined when the compilers supports intrinsics]) +fi + #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- diff --git a/win/makefile.vc b/win/makefile.vc index cfa8770..dece300 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -13,7 +13,7 @@ # Copyright (c) 2003-2008 Pat Thoyts. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.214.2.3 2010/12/01 16:42:37 kennykb Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.217 2010/11/28 23:20:11 kennykb Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) diff --git a/win/rules.vc b/win/rules.vc index 4ec990e..ec63ba3 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -11,7 +11,7 @@ # Copyright (c) 2003-2007 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.44.2.1 2010/10/20 01:50:19 kennykb Exp $ +# RCS: @(#) $Id: rules.vc,v 1.45 2010/10/11 21:33:30 nijtmans Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -407,6 +407,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_SUFFIX=".dll" + # MACHINE is IX86 for LINK, but this is used by the manifest, + # which requires x86|amd64|ia64. + MACHINE="X86" + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -575,11 +579,16 @@ file for information about building with Mingw.]) LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" - if test "$do64bit" != "no" ; then - MACHINE="AMD64" - else - MACHINE="X86" - fi + case "$do64bit" in + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + ;; + ia64) + MACHINE="IA64" + AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + ;; + esac else if test "${SHARED_BUILD}" = "0" ; then # static @@ -602,12 +611,9 @@ file for information about building with Mingw.]) LIBSUFFIX="\${DBGX}.lib" LIBFLAGSUFFIX="\${DBGX}" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs - # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. - MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" @@ -615,14 +621,14 @@ file for information about building with Mingw.]) MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in - amd64|x64|yes) - MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" - ;; - ia64) - MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" - ;; + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + PATH64="${MSSDK}/Bin/Win64/x86/AMD64" + ;; + ia64) + MACHINE="IA64" + PATH64="${MSSDK}/Bin/Win64" + ;; esac if test ! -d "${PATH64}" ; then AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode]) diff --git a/win/tclAppInit.c b/win/tclAppInit.c index eb4347b..c24aae0 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.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: tclAppInit.c,v 1.31.2.2 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.37 2010/11/18 15:50:54 nijtmans Exp $ */ #include "tcl.h" diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index eb19cea..47b8b04 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -10,10 +10,13 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWin32Dll.c,v 1.68.2.2 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.74 2011/01/12 07:37:41 nijtmans Exp $ */ #include "tclWinInt.h" +#if defined(HAVE_INTRIN_H) +# include <intrin.h> +#endif /* * The following data structures are used when loading the thunking library @@ -718,12 +721,47 @@ TclWinCPUID( unsigned int index, /* Which CPUID value to retrieve. */ unsigned int *regsPtr) /* Registers after the CPUID. */ { -#if defined(__GNUC__) && !defined(_WIN64) - EXCEPTION_REGISTRATION registration; -#endif int status = TCL_ERROR; -#if defined(__GNUC__) && !defined(_WIN64) +#if defined(HAVE_INTRIN_H) && defined(_WIN64) + + __cpuid(regsPtr, index); + status = TCL_OK; + +#elif defined(__GNUC__) +# if defined(_WIN64) + /* + * Execute the CPUID instruction with the given index, and store results + * off 'regPtr'. + */ + + __asm__ __volatile__( + /* + * Do the CPUID instruction, and save the results in the 'regsPtr' + * area. + */ + + "movl %[rptr], %%edi" "\n\t" + "movl %[index], %%eax" "\n\t" + "cpuid" "\n\t" + "movl %%eax, 0x0(%%edi)" "\n\t" + "movl %%ebx, 0x4(%%edi)" "\n\t" + "movl %%ecx, 0x8(%%edi)" "\n\t" + "movl %%edx, 0xc(%%edi)" "\n\t" + + : + /* No outputs */ + : + [index] "m" (index), + [rptr] "m" (regsPtr) + : + "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); + status = TCL_OK; + +# else + + EXCEPTION_REGISTRATION registration; + /* * Execute the CPUID instruction with the given index, and store results * off 'regPtr'. @@ -805,7 +843,14 @@ TclWinCPUID( "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); status = registration.status; -#elif defined(_MSC_VER) && !defined(_WIN64) +# endif /* !_WIN64 */ +#elif defined(_MSC_VER) +# if defined(_WIN64) + + __cpuid(regsPtr, index); + status = TCL_OK; + +# else /* * Define a structure in the stack frame to hold the registers. */ @@ -852,6 +897,7 @@ TclWinCPUID( /* do nothing */ } +# endif #else /* * Don't know how to do assembly code for this compiler and/or diff --git a/win/tclWinChan.c b/win/tclWinChan.c index caa0c9f..442b5ad 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinChan.c,v 1.59.2.1 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.61 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1225,7 +1225,7 @@ TclpGetDefaultStdChannel( HANDLE handle; int mode = -1; const char *bufMode = NULL; - DWORD handleId = (DWORD)INVALID_HANDLE_VALUE; + DWORD handleId = (DWORD) -1; /* Standard handle to retrieve. */ switch (type) { @@ -1338,7 +1338,7 @@ TclWinOpenFileChannel( infoPtr->flags = appendMode; infoPtr->handle = handle; infoPtr->dirty = 0; - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&fileChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 6ad92f1..8b2e074 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinConsole.c,v 1.25 2010/09/13 14:20:39 nijtmans Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.26 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1362,7 +1362,7 @@ TclWinOpenConsoleChannel( * for instance). */ - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&consoleChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index c8cd8c6..4a045eb 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinDde.c,v 1.44.2.1 2010/10/20 01:50:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.46 2011/01/25 22:33:56 nijtmans Exp $ */ #undef STATIC_BUILD @@ -220,7 +220,7 @@ Initialize(void) if (ddeInstance == 0) { Tcl_MutexLock(&ddeMutex); if (ddeInstance == 0) { - if (DdeInitializeA(&ddeInstance, DdeServerProc, + if (DdeInitializeA(&ddeInstance, (PFNCALLBACK) DdeServerProc, CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS | CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) { ddeInstance = 0; @@ -967,7 +967,7 @@ DdeClientWindowProc( (struct DdeEnumServices *) lpcs->lpCreateParams; #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, (long)es); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)es); #else SetWindowLongA(hwnd, GWL_USERDATA, (long)es); #endif @@ -1042,7 +1042,7 @@ DdeEnumWindowsCallback( HWND hwndTarget, LPARAM lParam) { - DWORD dwResult = 0; + DWORD_PTR dwResult = 0; struct DdeEnumServices *es = (struct DdeEnumServices *) lParam; SendMessageTimeoutA(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 149e135..a32222c 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.67.2.3 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.71 2010/11/19 20:47:09 nijtmans Exp $ */ #include "tclWinInt.h" diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 0334ea6..bdf2b04 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.112.2.4 2010/12/16 01:42:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.121 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -175,6 +175,7 @@ static int WinLink(const TCHAR *LinkSource, const TCHAR *LinkTarget, int linkAction); static int WinSymLinkDirectory(const TCHAR *LinkDirectory, const TCHAR *LinkTarget); +MODULE_SCOPE void tclWinDebugPanic(const char *format, ...); /* *-------------------------------------------------------------------- @@ -786,9 +787,10 @@ NativeWriteReparse( /* *---------------------------------------------------------------------- * - * WishPanic -- + * tclWinDebugPanic -- * - * Display a message. + * Display a message. If a debugger is present, present it directly + * to the debugger, otherwise use a MessageBox. * * Results: * None. @@ -799,8 +801,8 @@ NativeWriteReparse( *---------------------------------------------------------------------- */ -static void -PanicMessageBox( +void +tclWinDebugPanic( const char *format, ...) { #define TCL_MAX_WARN_LEN 1024 @@ -809,7 +811,7 @@ PanicMessageBox( WCHAR msgString[TCL_MAX_WARN_LEN]; va_start(argList, format); - vsnprintf(buf, sizeof(buf), format, argList); + _vsnprintf(buf, sizeof(buf), format, argList); msgString[TCL_MAX_WARN_LEN-1] = L'\0'; MultiByteToWideChar(CP_UTF8, 0, buf, -1, msgString, TCL_MAX_WARN_LEN); @@ -820,19 +822,15 @@ PanicMessageBox( if (msgString[TCL_MAX_WARN_LEN-1] != L'\0') { memcpy(msgString + (TCL_MAX_WARN_LEN - 5), L" ...", 5 * sizeof(WCHAR)); } + if (IsDebuggerPresent()) { + OutputDebugStringW(msgString); + } else { MessageBeep(MB_ICONEXCLAMATION); MessageBoxW(NULL, msgString, L"Fatal Error", MB_ICONSTOP | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); - /* try to trigger the debugger */ -# ifdef __GNUC__ - __builtin_trap(); -# endif -# ifdef _MSC_VER - DebugBreak(); -# endif - ExitProcess(1); + } } - + /* *--------------------------------------------------------------------------- * @@ -862,7 +860,7 @@ TclpFindExecutable( * create this process. Only if it is NULL, install a new panic handler. */ if (argv0 == NULL) { - Tcl_SetPanicProc(PanicMessageBox); + Tcl_SetPanicProc(tclWinDebugPanic); } #ifdef UNICODE diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 0f6b572..f2e40d4 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.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: tclWinInt.h,v 1.37.2.1 2010/10/20 01:50:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.38 2010/10/12 10:21:55 nijtmans Exp $ */ #ifndef _TCLWININT diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d9f56cb..ab00b0f 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.83.2.2 2010/10/20 01:50:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.86 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1574,7 +1574,6 @@ TclpCreateCommandChannel( Tcl_Pid *pidPtr) /* An array of process identifiers. */ { char channelName[16 + TCL_INTEGER_SPACE]; - int channelId; DWORD id; PipeInfo *infoPtr = (PipeInfo *) ckalloc((unsigned) sizeof(PipeInfo)); @@ -1593,20 +1592,6 @@ TclpCreateCommandChannel( infoPtr->writeError = 0; infoPtr->channel = NULL; - /* - * Use one of the fds associated with the channel as the channel id. - */ - - if (readFile) { - channelId = (int) ((WinFile *) readFile)->handle; - } else if (writeFile) { - channelId = (int) ((WinFile *) writeFile)->handle; - } else if (errorFile) { - channelId = (int) ((WinFile *) errorFile)->handle; - } else { - channelId = 0; - } - infoPtr->validMask = 0; infoPtr->threadId = Tcl_GetCurrentThread(); @@ -1647,7 +1632,7 @@ TclpCreateCommandChannel( * unique, in case channels share handles (stdin/stdout). */ - wsprintfA(channelName, "file%lx", infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName, infoPtr, infoPtr->validMask); diff --git a/win/tclWinPort.h b/win/tclWinPort.h index fdede5b..22d523e 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.61.2.2 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.63 2010/11/16 14:57:07 nijtmans Exp $ */ #ifndef _TCLWINPORT diff --git a/win/tclWinReg.c b/win/tclWinReg.c index f59ee23..22a8f72 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinReg.c,v 1.54.2.2 2010/12/01 16:42:38 kennykb Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.57 2011/01/25 22:33:56 nijtmans Exp $ */ #undef STATIC_BUILD @@ -1417,7 +1417,7 @@ BroadcastValue( Tcl_Obj *const objv[]) /* Argument values. */ { LRESULT result; - DWORD sendResult; + DWORD_PTR sendResult; UINT timeout = 3000; int len; const char *str; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 2f8cbd9..986025d 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.44 2010/09/13 14:20:38 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.45 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1503,7 +1503,7 @@ TclWinOpenSerialChannel( * are shared between multiple channels (stdin/stdout). */ - wsprintfA(channelName, "file%lx", (int) infoPtr); + sprintf(channelName, "file%Ix", (size_t) infoPtr); infoPtr->channel = Tcl_CreateChannel(&serialChannelType, channelName, infoPtr, permissions); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ec2c4eb..2e384ee 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.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: tclWinSock.c,v 1.74.2.6 2010/12/16 01:42:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.82 2011/01/25 22:33:56 nijtmans Exp $ * * ----------------------------------------------------------------------- * @@ -1050,18 +1050,18 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. */ - + SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0); - + /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); /* @@ -1103,34 +1103,34 @@ CreateSocket( chosenport = ntohs(sockname.sa4.sin_port); } } - + /* * Set the maximum number of pending connect requests to the max value * allowed on each platform (Win32 and Win32s may be different, and * there may be differences between TCP/IP stacks). */ - + if (listen(sock, SOMAXCONN) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); closesocket(sock); continue; } - + if (infoPtr == NULL) { /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); fds = infoPtr->sockets; - + /* * Set up the select mask for connection request events. */ - + infoPtr->selectEvents = FD_ACCEPT; infoPtr->watchEvents |= FD_ACCEPT; - + } else { newfds = (TcpFdList *) ckalloc((unsigned) sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); @@ -1159,7 +1159,7 @@ CreateSocket( TclWinConvertWSAError((DWORD) WSAGetLastError()); continue; } - + /* * Win-NT has a misfeature that sockets are inherited in child * processes by default. Turn off the inherit bit. @@ -1170,13 +1170,13 @@ CreateSocket( /* * Set kernel space buffering */ - + TclSockMinimumBuffers((ClientData)sock, TCP_BUFFER_SIZE); - + /* * Try to bind to a local port. */ - + if (bind(sock, myaddrPtr->ai_addr, myaddrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); @@ -1197,14 +1197,14 @@ CreateSocket( /* * Attempt to connect to the remote socket. */ - + if (connect(sock, addrPtr->ai_addr, addrPtr->ai_addrlen) == SOCKET_ERROR) { TclWinConvertWSAError((DWORD) WSAGetLastError()); if (Tcl_GetErrno() != EWOULDBLOCK) { goto looperror; } - + /* * The connection is progressing in the background. */ @@ -1227,14 +1227,14 @@ CreateSocket( /* * Add this socket to the global list of sockets. */ - + infoPtr = NewSocketInfo(sock); - + /* * Set up the select mask for read/write events. If the * connect attempt has not completed, include connect events. */ - + infoPtr->selectEvents = FD_READ | FD_WRITE | FD_CLOSE; if (asyncConnect) { infoPtr->flags |= SOCKET_ASYNC_CONNECT; @@ -1252,11 +1252,11 @@ CreateSocket( * Register for interest in events in the select mask. Note that this * automatically places the socket into non-blocking mode. */ - + if (infoPtr != NULL) { ioctlsocket(sock, (long) FIONBIO, &flag); SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - + return infoPtr; } @@ -1455,7 +1455,7 @@ Tcl_OpenTcpClient( return NULL; } - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); @@ -1520,7 +1520,7 @@ Tcl_MakeTcpClientChannel( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) infoPtr); - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, (TCL_READABLE | TCL_WRITABLE)); Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto crlf"); @@ -1573,7 +1573,7 @@ Tcl_OpenTcpServer( infoPtr->acceptProc = acceptProc; infoPtr->acceptProcData = acceptProcData; - wsprintfA(channelName, "sock%d", infoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) infoPtr->sockets->fd); infoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, infoPtr, 0); @@ -1679,7 +1679,7 @@ TcpAccept( SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, (LPARAM) newInfoPtr); - wsprintfA(channelName, "sock%d", newInfoPtr->sockets->fd); + sprintf(channelName, "sock%Id", (size_t) newInfoPtr->sockets->fd); newInfoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, newInfoPtr, (TCL_READABLE | TCL_WRITABLE)); if (Tcl_SetChannelOption(NULL, newInfoPtr->channel, "-translation", @@ -2171,7 +2171,7 @@ TcpGetOptionProc( address sockname; socklen_t size; int found = 0; - + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); @@ -2182,11 +2182,11 @@ TcpGetOptionProc( if (getsockname(sock, &(sockname.sa), &size) >= 0) { int flags = reverseDNS; found = 1; - + getnameinfo(&sockname.sa, size, host, sizeof(host), NULL, 0, NI_NUMERICHOST); Tcl_DStringAppendElement(dsPtr, host); - + /* * We don't want to resolve INADDR_ANY and sin6addr_any; they * can sometimes cause problems (and never have a name). @@ -2228,7 +2228,7 @@ TcpGetOptionProc( return TCL_ERROR; } } - + #ifdef TCL_FEATURE_KEEPALIVE_NAGLE if (len == 0 || !strncmp(optionName, "-keepalive", len)) { int optlen; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 73aaaae..3e6c6e3 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.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: tclWinTest.c,v 1.27.2.1 2010/10/20 01:50:19 kennykb Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.29 2010/10/12 10:21:55 nijtmans Exp $ */ #ifndef USE_TCL_STUBS diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 7154496..8c1d2f8 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.53 2010/06/16 14:49:51 nijtmans Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.54 2011/01/25 22:33:56 nijtmans Exp $ */ #include "tclWinInt.h" @@ -263,7 +263,7 @@ TclpThreadExit( Tcl_ThreadId Tcl_GetCurrentThread(void) { - return (Tcl_ThreadId) GetCurrentThreadId(); + return (Tcl_ThreadId)(size_t)GetCurrentThreadId(); } /* |