1 |
/* $Header$ */ |
2 |
|
3 |
/* |
4 |
* tkWinPort.h -- |
5 |
* |
6 |
* This header file handles porting issues that occur because of |
7 |
* differences between Windows and Unix. It should be the only |
8 |
* file that contains #ifdefs to handle different flavors of OS. |
9 |
* |
10 |
* Copyright (c) 1995-1996 Sun Microsystems, Inc. |
11 |
* |
12 |
* See the file "license.terms" for information on usage and redistribution |
13 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
14 |
* |
15 |
* RCS: @(#) $Id: tkwinport.h,v 1.1.1.1 2001/06/13 05:14:15 dtashley Exp $ |
16 |
*/ |
17 |
|
18 |
#ifndef _WINPORT |
19 |
#define _WINPORT |
20 |
|
21 |
#include "Xlib.h" |
22 |
#include "cursorfont.h" |
23 |
#include "keysym.h" |
24 |
#include "Xatom.h" |
25 |
#include "Xutil.h" |
26 |
|
27 |
#include <malloc.h> |
28 |
#include <errno.h> |
29 |
#include <ctype.h> |
30 |
#include <math.h> |
31 |
#include <stdlib.h> |
32 |
#include <string.h> |
33 |
#include <limits.h> |
34 |
#include <fcntl.h> |
35 |
#include <io.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 |
#include <tchar.h> |
48 |
|
49 |
#ifdef _MSC_VER |
50 |
# define hypot _hypot |
51 |
#endif /* _MSC_VER */ |
52 |
|
53 |
#ifndef __GNUC__ |
54 |
# define strncasecmp strnicmp |
55 |
# define strcasecmp stricmp |
56 |
#endif |
57 |
|
58 |
#define NBBY 8 |
59 |
|
60 |
#define OPEN_MAX 32 |
61 |
|
62 |
/* |
63 |
* The following define causes Tk to use its internal keysym hash table |
64 |
*/ |
65 |
|
66 |
#define REDO_KEYSYM_LOOKUP |
67 |
|
68 |
/* |
69 |
* The following macro checks to see whether there is buffered |
70 |
* input data available for a stdio FILE. |
71 |
*/ |
72 |
|
73 |
#ifdef _MSC_VER |
74 |
# define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0) |
75 |
#else /* _MSC_VER */ |
76 |
# define TK_READ_DATA_PENDING(f) ((f)->level > 0) |
77 |
#endif /* _MSC_VER */ |
78 |
|
79 |
/* |
80 |
* The following stubs implement various calls that don't do anything |
81 |
* under Windows. |
82 |
*/ |
83 |
|
84 |
#define TkFreeWindowId(dispPtr,w) |
85 |
#define TkInitXId(dispPtr) |
86 |
#define TkpCmapStressed(tkwin,colormap) (0) |
87 |
#define XFlush(display) |
88 |
#define XGrabServer(display) |
89 |
#define XUngrabServer(display) |
90 |
#define TkpSync(display) |
91 |
|
92 |
/* |
93 |
* The following functions are implemented as macros under Windows. |
94 |
*/ |
95 |
|
96 |
#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));} |
97 |
#define XNoOp(display) {display->request++;} |
98 |
#define XSynchronize(display, bool) {display->request++;} |
99 |
#define XSync(display, bool) {display->request++;} |
100 |
#define XVisualIDFromVisual(visual) (visual->visualid) |
101 |
|
102 |
/* |
103 |
* The following Tk functions are implemented as macros under Windows. |
104 |
*/ |
105 |
|
106 |
#define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ |
107 |
| ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) |
108 |
|
109 |
/* |
110 |
* These calls implement native bitmaps which are not currently |
111 |
* supported under Windows. The macros eliminate the calls. |
112 |
*/ |
113 |
|
114 |
#define TkpDefineNativeBitmaps() |
115 |
#define TkpCreateNativeBitmap(display, source) None |
116 |
#define TkpGetNativeAppBitmap(display, name, w, h) None |
117 |
|
118 |
/* |
119 |
* Define timezone for gettimeofday. |
120 |
*/ |
121 |
|
122 |
struct timezone { |
123 |
int tz_minuteswest; |
124 |
int tz_dsttime; |
125 |
}; |
126 |
|
127 |
#ifndef _TCLINT |
128 |
#include <tclInt.h> |
129 |
#endif |
130 |
|
131 |
#endif /* _WINPORT */ |
132 |
|
133 |
/* End of tkwinport.h */ |