summaryrefslogtreecommitdiffstats
path: root/win/tclWinPort.h
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinPort.h')
-rw-r--r--win/tclWinPort.h163
1 files changed, 76 insertions, 87 deletions
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index aca3279..da685ad 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -14,10 +14,27 @@
#ifndef _TCLWINPORT
#define _TCLWINPORT
-#ifndef _TCLINT
-# include "tclInt.h"
+#ifndef _WIN64
+/* See [Bug 2935503]: file mtime sets wrong time */
+# define _USE_32BIT_TIME_T
#endif
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+
+/* Compatibility to older visual studio / windows platform SDK */
+#if !defined(MAXULONG_PTR)
+typedef DWORD DWORD_PTR;
+typedef DWORD_PTR * PDWORD_PTR;
+#endif
+
+/*
+ * Ask for the winsock function typedefs, also.
+ */
+#define INCL_WINSOCK_API_TYPEDEFS 1
+#include <winsock2.h>
+
#ifdef CHECK_UNICODE_CALLS
# define _UNICODE
# define UNICODE
@@ -34,17 +51,24 @@
*---------------------------------------------------------------------------
*/
+#include <io.h>
#include <stdio.h>
#include <stdlib.h>
-
#include <errno.h>
#include <fcntl.h>
#include <float.h>
-#include <io.h>
#include <malloc.h>
#include <process.h>
#include <signal.h>
#include <string.h>
+#include <limits.h>
+
+#ifndef strncasecmp
+# define strncasecmp strnicmp
+#endif
+#ifndef strcasecmp
+# define strcasecmp stricmp
+#endif
/*
* Need to block out these includes for building extensions with MetroWerks
@@ -63,27 +87,6 @@
#include <time.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-/* Compatibility to older visual studio / windows platform SDK */
-#if !defined(MAXULONG_PTR)
-typedef DWORD DWORD_PTR;
-typedef DWORD_PTR * PDWORD_PTR;
-#endif
-
-/*
- * Ask for the winsock function typedefs, also.
- */
-#define INCL_WINSOCK_API_TYPEDEFS 1
-#include <winsock2.h>
-
-#ifdef BUILD_tcl
-# undef TCL_STORAGE_CLASS
-# define TCL_STORAGE_CLASS DLLEXPORT
-#endif /* BUILD_tcl */
-
/*
* Define EINPROGRESS in terms of WSAEINPROGRESS.
*/
@@ -189,6 +192,18 @@ typedef DWORD_PTR * PDWORD_PTR;
#define EOVERFLOW EFBIG /* The object couldn't fit in the datatype */
/*
+ * Signals not known to the standard ANSI signal.h. These are used
+ * by Tcl_WaitPid() and generic/tclPosixStr.c
+ */
+
+#ifndef SIGTRAP
+# define SIGTRAP 5
+#endif
+#ifndef SIGBUS
+# define SIGBUS 10
+#endif
+
+/*
* Supply definitions for macros to query wait status, if not already
* defined in header files above.
*/
@@ -258,7 +273,7 @@ typedef DWORD_PTR * PDWORD_PTR;
*/
#ifndef S_IFLNK
-#define S_IFLNK 0120000 /* Symbolic Link */
+# define S_IFLNK 0120000 /* Symbolic Link */
#endif
#ifndef S_ISREG
@@ -310,11 +325,11 @@ typedef DWORD_PTR * PDWORD_PTR;
*/
#ifndef MAXPATH
-#define MAXPATH MAX_PATH
+# define MAXPATH MAX_PATH
#endif /* MAXPATH */
#ifndef MAXPATHLEN
-#define MAXPATHLEN MAXPATH
+# define MAXPATHLEN MAXPATH
#endif /* MAXPATHLEN */
/*
@@ -335,15 +350,15 @@ typedef DWORD_PTR * PDWORD_PTR;
*/
#if defined(_MSC_VER) || defined(__MINGW32__)
-# define environ _environ
+# define environ _environ
# if defined(_MSC_VER) && (_MSC_VER < 1600)
# define hypot _hypot
# endif
-# define exception _exception
-# undef EDEADLOCK
-# if defined(__MINGW32__) && !defined(__MSVCRT__)
+# define exception _exception
+# undef EDEADLOCK
+# if defined(__MINGW32__) && !defined(__MSVCRT__)
# define timezone _timezone
-# endif
+# endif
#endif /* _MSC_VER || __MINGW32__ */
/*
@@ -355,6 +370,23 @@ typedef DWORD_PTR * PDWORD_PTR;
# define environ _environ
#endif /* __BORLANDC__ */
+#ifdef __WATCOMC__
+# if !defined(__CHAR_SIGNED__)
+# error "You must use the -j switch to ensure char is signed."
+# endif
+#endif
+
+
+/*
+ * MSVC 8.0 started to mark many standard C library functions depreciated
+ * including the *printf family and others. Tell it to shut up.
+ * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0)
+ */
+#if _MSC_VER >= 1400
+#pragma warning(disable:4996)
+#endif
+
+
/*
* There is no platform-specific panic routine for Windows in the Tcl internals.
*/
@@ -363,8 +395,8 @@ typedef DWORD_PTR * PDWORD_PTR;
/*
*---------------------------------------------------------------------------
- * The following macros and declarations represent the interface between
- * generic and windows-specific parts of Tcl. Some of the macros may
+ * The following macros and declarations represent the interface between
+ * generic and windows-specific parts of Tcl. Some of the macros may
* override functions declared in tclInt.h.
*---------------------------------------------------------------------------
*/
@@ -399,6 +431,13 @@ typedef DWORD_PTR * PDWORD_PTR;
#endif
/*
+ * Older version of Mingw are known to lack a MWMO_ALERTABLE define.
+ */
+#if !defined(MWMO_ALERTABLE)
+# define MWMO_ALERTABLE 2
+#endif
+
+/*
* The following defines wrap the system memory allocation routines for
* use by tclAlloc.c.
*/
@@ -425,63 +464,19 @@ typedef DWORD_PTR * PDWORD_PTR;
/*
- * The following macros have trivial definitions, allowing generic code to
+ * The following macros have trivial definitions, allowing generic code to
* address platform-specific issues.
*/
#define TclpReleaseFile(file) ckfree((char *) file)
/*
- * The following macros and declarations wrap the C runtime library
+ * The following macros and declarations wrap the C runtime library
* functions.
*/
#define TclpExit exit
-/*
- * Declarations for Windows-only functions.
- */
-
-EXTERN HANDLE TclWinSerialReopen _ANSI_ARGS_(( HANDLE handle,
- CONST TCHAR *name, DWORD access));
-
-EXTERN Tcl_Channel TclWinOpenSerialChannel _ANSI_ARGS_((HANDLE handle,
- char *channelName, int permissions));
-
-EXTERN Tcl_Channel TclWinOpenConsoleChannel _ANSI_ARGS_((HANDLE handle,
- char *channelName, int permissions));
-
-EXTERN Tcl_Channel TclWinOpenFileChannel _ANSI_ARGS_((HANDLE handle,
- char *channelName, int permissions, int appendMode));
-
-EXTERN TclFile TclWinMakeFile _ANSI_ARGS_((HANDLE handle));
-
-/*
- * Platform specific mutex definition used by memory allocators.
- * These mutexes are statically allocated and explicitly initialized.
- * Most modules do not use this, but instead use Tcl_Mutex types and
- * Tcl_MutexLock and Tcl_MutexUnlock that are self-initializing.
- */
-
-#ifdef TCL_THREADS
-typedef CRITICAL_SECTION TclpMutex;
-EXTERN void TclpMutexInit _ANSI_ARGS_((TclpMutex *mPtr));
-EXTERN void TclpMutexLock _ANSI_ARGS_((TclpMutex *mPtr));
-EXTERN void TclpMutexUnlock _ANSI_ARGS_((TclpMutex *mPtr));
-#else /* !TCL_THREADS */
-typedef int TclpMutex;
-#define TclpMutexInit(a)
-#define TclpMutexLock(a)
-#define TclpMutexUnlock(a)
-#endif /* TCL_THREADS */
-
-#ifdef TCL_WIDE_INT_TYPE
-EXTERN Tcl_WideInt strtoll _ANSI_ARGS_((CONST char *string,
- char **endPtr, int base));
-EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string,
- char **endPtr, int base));
-#endif /* TCL_WIDE_INT_TYPE */
-
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
#endif /* INVALID_SET_FILE_POINTER */
@@ -490,10 +485,4 @@ EXTERN Tcl_WideUInt strtoull _ANSI_ARGS_((CONST char *string,
# define LABEL_SECURITY_INFORMATION (0x00000010L)
#endif
-#include "tclPlatDecls.h"
-#include "tclIntPlatDecls.h"
-
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLIMPORT
-
#endif /* _TCLWINPORT */