OSDN Git Service

0118608a0d73b37380f3b86846afc121a029e1a7
[eos/base.git] / util / src / TclTk / tk8.6.12 / win / tkWinPort.h
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 /*
18  *---------------------------------------------------------------------------
19  * The following sets of #includes and #ifdefs are required to get Tcl to
20  * compile under the windows compilers.
21  *---------------------------------------------------------------------------
22  */
23
24 #include <stdio.h>
25 #include <wchar.h>
26 #include <io.h>
27 #include <stdlib.h>
28 #include <assert.h>
29 #include <errno.h>
30 #include <fcntl.h>
31 #include <malloc.h>
32 #include <ctype.h>
33 #include <math.h>
34 #include <string.h>
35 #include <limits.h>
36
37 /*
38  * Need to block out this include for building extensions with MetroWerks
39  * compiler for Win32.
40  */
41
42 #ifndef __MWERKS__
43 #include <sys/stat.h>
44 #endif
45
46 #include <time.h>
47
48 #ifdef _MSC_VER
49 #   ifndef hypot
50 #       define hypot _hypot
51 #   endif
52 #endif /* _MSC_VER */
53
54 /*
55  *  Pull in the typedef of TCHAR for windows.
56  */
57 #include <tchar.h>
58 #ifndef _TCHAR_DEFINED
59     /* Borland seems to forget to set this. */
60     typedef _TCHAR TCHAR;
61 #   define _TCHAR_DEFINED
62 #endif
63 #if defined(_MSC_VER) && defined(__STDC__)
64     /* VS2005 SP1 misses this. See [Bug #3110161] */
65     typedef _TCHAR TCHAR;
66 #endif
67
68 #if defined(__GNUC__) && !defined(__cplusplus)
69 #   pragma GCC diagnostic ignored "-Wc++-compat"
70 #endif
71 #include <X11/Xlib.h>
72 #include <X11/cursorfont.h>
73 #include <X11/keysym.h>
74 #include <X11/Xatom.h>
75 #include <X11/Xutil.h>
76
77 #ifndef __GNUC__
78 #    define strncasecmp _strnicmp
79 #    define strcasecmp _stricmp
80 #endif
81
82 #define NBBY 8
83
84 #ifndef OPEN_MAX
85 #define OPEN_MAX 32
86 #endif
87
88 /*
89  * The following define causes Tk to use its internal keysym hash table
90  */
91
92 #define REDO_KEYSYM_LOOKUP
93
94 /*
95  * See ticket [916c1095438eae56]: GetVersionExW triggers warnings
96  */
97 #if defined(_MSC_VER)
98 #   pragma warning(disable:4146)
99 #   pragma warning(disable:4267)
100 #   pragma warning(disable:4244)
101 #   pragma warning(disable:4311)
102 #   pragma warning(disable:4312)
103 #   pragma warning(disable:4996)
104 #if !defined(_WIN64)
105 #   pragma warning(disable:4305)
106 #endif
107 #endif
108
109 /*
110  * The following macro checks to see whether there is buffered
111  * input data available for a stdio FILE.
112  */
113
114 #ifdef _MSC_VER
115 #    define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0)
116 #else /* _MSC_VER */
117 #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
118 #endif /* _MSC_VER */
119
120 /*
121  * The following Tk functions are implemented as macros under Windows.
122  */
123
124 #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \
125         | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
126
127 /*
128  * Used by tkWindow.c
129  */
130
131 #define TkpHandleMapOrUnmap(tkwin, event)  Tk_HandleEvent(event)
132
133 /*
134  * These calls implement native bitmaps which are not currently
135  * supported under Windows.  The macros eliminate the calls.
136  */
137
138 #define TkpDefineNativeBitmaps()
139 #define TkpCreateNativeBitmap(display, source) None
140 #define TkpGetNativeAppBitmap(display, name, w, h) None
141
142 #endif /* _WINPORT */