| 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 |
* RCS: @(#) $Id: tkWinPort.h,v 1.9 2002/10/19 02:10:20 hobbs Exp $ |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef _WINPORT |
| 17 |
#define _WINPORT |
| 18 |
#define NEED_REAL_STDIO |
| 19 |
#include <X11/Xlib.h> |
| 20 |
#include <X11/cursorfont.h> |
| 21 |
#include <X11/keysym.h> |
| 22 |
#include <X11/Xatom.h> |
| 23 |
#include <X11/Xutil.h> |
| 24 |
|
| 25 |
#include <errno.h> |
| 26 |
#include <ctype.h> |
| 27 |
#include <math.h> |
| 28 |
#include <stdlib.h> |
| 29 |
#include <string.h> |
| 30 |
#include <limits.h> |
| 31 |
#include <fcntl.h> |
| 32 |
#include <io.h> |
| 33 |
#ifdef __EMX__ |
| 34 |
# include <sys/types.h> |
| 35 |
#endif |
| 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 |
#ifdef __CYGWIN__ |
| 48 |
# define _T(x) L##x |
| 49 |
#else |
| 50 |
# include <tchar.h> |
| 51 |
#endif |
| 52 |
|
| 53 |
#ifdef _MSC_VER |
| 54 |
# define hypot _hypot |
| 55 |
#else /* _MSC_VER */ |
| 56 |
# ifdef __EMX__ |
| 57 |
# define strncasecmp strnicmp |
| 58 |
# endif |
| 59 |
#endif /* _MSC_VER */ |
| 60 |
|
| 61 |
#ifndef __GNUC__ |
| 62 |
# define strncasecmp strnicmp |
| 63 |
# define strcasecmp stricmp |
| 64 |
#endif |
| 65 |
|
| 66 |
#define NBBY 8 |
| 67 |
|
| 68 |
#ifndef OPEN_MAX |
| 69 |
#define OPEN_MAX 32 |
| 70 |
#endif |
| 71 |
|
| 72 |
/* |
| 73 |
* The following define causes Tk to use its internal keysym hash table |
| 74 |
*/ |
| 75 |
|
| 76 |
#define REDO_KEYSYM_LOOKUP |
| 77 |
|
| 78 |
/* |
| 79 |
* The following macro checks to see whether there is buffered |
| 80 |
* input data available for a stdio FILE. |
| 81 |
*/ |
| 82 |
|
| 83 |
#ifdef _MSC_VER |
| 84 |
# define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0) |
| 85 |
#else /* _MSC_VER */ |
| 86 |
# define TK_READ_DATA_PENDING(f) ((f)->level > 0) |
| 87 |
#endif /* _MSC_VER */ |
| 88 |
|
| 89 |
/* |
| 90 |
* The following stubs implement various calls that don't do anything |
| 91 |
* under Windows. |
| 92 |
*/ |
| 93 |
|
| 94 |
#define TkFreeWindowId(dispPtr,w) |
| 95 |
#define TkInitXId(dispPtr) |
| 96 |
#define TkpCmapStressed(tkwin,colormap) (0) |
| 97 |
#define XFlush(display) |
| 98 |
#define XGrabServer(display) |
| 99 |
#define XUngrabServer(display) |
| 100 |
#define TkpSync(display) |
| 101 |
|
| 102 |
/* |
| 103 |
* The following functions are implemented as macros under Windows. |
| 104 |
*/ |
| 105 |
|
| 106 |
#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));} |
| 107 |
#define XNoOp(display) {display->request++;} |
| 108 |
#define XSynchronize(display, bool) {display->request++;} |
| 109 |
#define XSync(display, bool) {display->request++;} |
| 110 |
#define XVisualIDFromVisual(visual) (visual->visualid) |
| 111 |
|
| 112 |
/* Additional translations needed for Tk extensions (Pixmap). */ |
| 113 |
|
| 114 |
#define XPutImage(display, dr, gc, i, a, b, c, d, e, f) \ |
| 115 |
TkPutImage(NULL, 0, display, dr, gc, i, a, b, c, d, e, f) |
| 116 |
#define XDefaultVisual(display, screen) ((screen)->root_visual) |
| 117 |
#define XDefaultScreen(display) ((display)->screens) |
| 118 |
#define XDefaultColormap(display, screen) ((screen)->cmap) |
| 119 |
#define XDefaultDepth(display, screen) ((screen)->root_depth) |
| 120 |
|
| 121 |
/* |
| 122 |
* The following Tk functions are implemented as macros under Windows. |
| 123 |
*/ |
| 124 |
|
| 125 |
#define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ |
| 126 |
| ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) |
| 127 |
|
| 128 |
/* |
| 129 |
* These calls implement native bitmaps which are not currently |
| 130 |
* supported under Windows. The macros eliminate the calls. |
| 131 |
*/ |
| 132 |
|
| 133 |
#define TkpDefineNativeBitmaps() |
| 134 |
#define TkpCreateNativeBitmap(display, source) None |
| 135 |
#define TkpGetNativeAppBitmap(display, name, w, h) None |
| 136 |
|
| 137 |
/* |
| 138 |
* Define timezone for gettimeofday. |
| 139 |
*/ |
| 140 |
#if 0 |
| 141 |
struct timezone { |
| 142 |
int tz_minuteswest; |
| 143 |
int tz_dsttime; |
| 144 |
}; |
| 145 |
#else |
| 146 |
#undef timezone |
| 147 |
struct timezone; |
| 148 |
struct timeval; |
| 149 |
#endif |
| 150 |
|
| 151 |
#ifndef _TCLINT |
| 152 |
#include <tclInt.h> |
| 153 |
#endif |
| 154 |
|
| 155 |
|
| 156 |
#endif /* _WINPORT */ |