summaryrefslogtreecommitdiffstats
path: root/win/tclWinPort.h
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinPort.h')
-rw-r--r--win/tclWinPort.h171
1 files changed, 82 insertions, 89 deletions
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index f14e1a9..6d7ffa2 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -14,9 +14,15 @@
#ifndef _TCLWINPORT
#define _TCLWINPORT
-#ifndef _TCLINT
-# include "tclInt.h"
-#endif
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+
+/*
+ * Ask for the winsock function typedefs, also.
+ */
+#define INCL_WINSOCK_API_TYPEDEFS 1
+#include <winsock2.h>
#ifdef CHECK_UNICODE_CALLS
# define _UNICODE
@@ -34,17 +40,36 @@
*---------------------------------------------------------------------------
*/
+#ifdef __CYGWIN__
+# include <unistd.h>
+# include <wchar.h>
+#else
+# include <io.h>
+#endif
#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>
+
+#ifdef __CYGWIN__
+# include <unistd.h>
+# ifndef _wcsicmp
+# define _wcsicmp wcscasecmp
+# endif
+#else
+# ifndef strncasecmp
+# define strncasecmp strnicmp
+# endif
+# ifndef strcasecmp
+# define strcasecmp stricmp
+# endif
+#endif
/*
* Need to block out these includes for building extensions with MetroWerks
@@ -63,21 +88,6 @@
#include <time.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-/*
- * 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.
*/
@@ -242,6 +252,18 @@
#endif /* !EOVERFLOW */
/*
+ * 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.
*/
@@ -311,7 +333,7 @@
*/
#ifndef S_IFLNK
-#define S_IFLNK 0120000 /* Symbolic Link */
+# define S_IFLNK 0120000 /* Symbolic Link */
#endif
#ifndef S_ISREG
@@ -363,11 +385,11 @@
*/
#ifndef MAXPATH
-#define MAXPATH MAX_PATH
+# define MAXPATH MAX_PATH
#endif /* MAXPATH */
#ifndef MAXPATHLEN
-#define MAXPATHLEN MAXPATH
+# define MAXPATHLEN MAXPATH
#endif /* MAXPATHLEN */
/*
@@ -388,15 +410,15 @@
*/
#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__ */
/*
@@ -408,13 +430,27 @@
# define environ _environ
#endif /* __BORLANDC__ */
-#ifdef __CYGWIN__
-/* On Cygwin, the environment is imported from the Cygwin DLL. */
- DLLIMPORT extern char **__cygwin_environ;
-# define environ __cygwin_environ
-# define putenv TclCygwinPutenv
-# define timezone _timezone
-#endif /* __CYGWIN__ */
+#ifdef __WATCOMC__
+ /*
+ * OpenWatcom uses a wine derived winsock2.h that is missing the
+ * LPFN_* typedefs.
+ */
+# define HAVE_NO_LPFN_DECLS
+# 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.
@@ -424,8 +460,8 @@
/*
*---------------------------------------------------------------------------
- * 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.
*---------------------------------------------------------------------------
*/
@@ -460,6 +496,13 @@
#endif
/*
+ * Older version of Mingw are known to lack a MWMO_ALERTABLE define.
+ */
+#if defined(HAVE_NO_MWMO_ALERTABLE)
+# define MWMO_ALERTABLE 2
+#endif
+
+/*
* The following defines wrap the system memory allocation routines for
* use by tclAlloc.c.
*/
@@ -492,71 +535,21 @@
/*
- * 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 */
-#include "tclPlatDecls.h"
-#include "tclIntPlatDecls.h"
-
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLIMPORT
-
#endif /* _TCLWINPORT */