1 /* 2 * tkWinPort.h -- 3 * 4 * This header file handles porting issues that occur because of 5 * differences between Windows and Unix. It should be the only 6 * file that contains #ifdefs to handle different flavors of OS. 7 * 8 * Copyright (c) 1995-1996 Sun Microsystems, Inc. 9 * 10 * See the file "license.terms" for information on usage and redistribution 11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 */ 13 14 #ifndef _WINPORT 15 #define _WINPORT 16 17 #include <X11/Xlib.h> 18 #include <X11/cursorfont.h> 19 #include <X11/keysym.h> 20 #include <X11/Xatom.h> 21 #include <X11/Xutil.h> 22 23 #include <malloc.h> 24 #include <errno.h> 25 #include <ctype.h> 26 #include <math.h> 27 #include <stdlib.h> 28 #include <string.h> 29 #include <limits.h> 30 #include <fcntl.h> 31 #include <io.h> 32 33 /* 34 * Need to block out this include for building extensions with MetroWerks 35 * compiler for Win32. 36 */ 37 38 #ifndef __MWERKS__ 39 #include <sys/stat.h> 40 #endif 41 42 #include <time.h> 43 44 #ifdef _MSC_VER 45 # ifndef hypot 46 # define hypot _hypot 47 # endif 48 #endif /* _MSC_VER */ 49 50 /* 51 * Pull in the typedef of TCHAR for windows. 52 */ 53 #include <tchar.h> 54 #ifndef _TCHAR_DEFINED 55 /* Borland seems to forget to set this. */ 56 typedef _TCHAR TCHAR; 57 # define _TCHAR_DEFINED 58 #endif 59 #if defined(_MSC_VER) && defined(__STDC__) 60 /* VS2005 SP1 misses this. See [Bug #3110161] */ 61 typedef _TCHAR TCHAR; 62 #endif 63 64 65 #ifndef __GNUC__ 66 # define strncasecmp _strnicmp 67 # define strcasecmp _stricmp 68 #endif 69 70 #define NBBY 8 71 72 #ifndef OPEN_MAX 73 #define OPEN_MAX 32 74 #endif 75 76 /* 77 * The following define causes Tk to use its internal keysym hash table 78 */ 79 80 #define REDO_KEYSYM_LOOKUP 81 82 /* 83 * See ticket [916c1095438eae56]: GetVersionExW triggers warnings 84 */ 85 #if defined(_MSC_VER) 86 # pragma warning(disable:4996) 87 #endif 88 89 /* 90 * The following macro checks to see whether there is buffered 91 * input data available for a stdio FILE. 92 */ 93 94 #ifdef _MSC_VER 95 # define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0) 96 #else /* _MSC_VER */ 97 # define TK_READ_DATA_PENDING(f) ((f)->level > 0) 98 #endif /* _MSC_VER */ 99 100 /* 101 * The following stubs implement various calls that don't do anything 102 * under Windows. 103 */ 104 105 #define TkFreeWindowId(dispPtr,w) 106 #define TkInitXId(dispPtr) 107 108 /* 109 * The following Tk functions are implemented as macros under Windows. 110 */ 111 112 #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ 113 | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) 114 115 /* 116 * These calls implement native bitmaps which are not currently 117 * supported under Windows. The macros eliminate the calls. 118 */ 119 120 #define TkpDefineNativeBitmaps() 121 #define TkpCreateNativeBitmap(display, source) None 122 #define TkpGetNativeAppBitmap(display, name, w, h) None 123 124 #endif /* _WINPORT */ 125