tkWinPort.h
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:3k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  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.  * SCCS: @(#) tkWinPort.h 1.25 97/04/21 17:08:42
  14.  */
  15. #ifndef _WINPORT
  16. #define _WINPORT
  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. #include <malloc.h>
  23. #include <errno.h>
  24. #include <ctype.h>
  25. #include <math.h>
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <limits.h>
  29. #include <fcntl.h>
  30. #include <io.h>
  31. #include <sys/stat.h>
  32. #include <time.h>
  33. #ifdef _MSC_VER
  34. #    define hypot _hypot
  35. #endif /* _MSC_VER */
  36. #define strncasecmp strnicmp
  37. #define strcasecmp stricmp
  38. #define NBBY 8
  39. #if 0
  40. #define OPEN_MAX 32
  41. #endif
  42. /*
  43.  * The following define causes Tk to use its internal keysym hash table
  44.  */
  45. #define REDO_KEYSYM_LOOKUP
  46. /*
  47.  * The following macro checks to see whether there is buffered
  48.  * input data available for a stdio FILE.
  49.  */
  50. #ifdef _MSC_VER
  51. #    define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0)
  52. #else /* _MSC_VER */
  53. #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
  54. #endif /* _MSC_VER */
  55. /*
  56.  * The following stubs implement various calls that don't do anything
  57.  * under Windows.
  58.  */
  59. #define TkFreeWindowId(dispPtr,w)
  60. #define TkInitXId(dispPtr)
  61. #define TkpCmapStressed(tkwin,colormap) (0)
  62. #define XFlush(display)
  63. #define XGrabServer(display)
  64. #define XUngrabServer(display)
  65. #define TkpSync(display)
  66. /*
  67.  * The following functions are implemented as macros under Windows.
  68.  */
  69. #define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
  70. #define XNoOp(display) {display->request++;}
  71. #define XSynchronize(display, bool) {display->request++;}
  72. #define XSync(display, bool) {display->request++;}
  73. #define XVisualIDFromVisual(visual) (visual->visualid)
  74. /*
  75.  * The following Tk functions are implemented as macros under Windows.
  76.  */
  77. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  78. #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) 
  79. | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
  80. /*
  81.  * These calls implement native bitmaps which are not currently 
  82.  * supported under Windows.  The macros eliminate the calls.
  83.  */
  84. #define TkpDefineNativeBitmaps()
  85. #define TkpCreateNativeBitmap(display, source) None
  86. #define TkpGetNativeAppBitmap(display, name, w, h) None
  87. /*
  88.  * Define timezone for gettimeofday.
  89.  */
  90. #if 0
  91. struct timezone {
  92.     int tz_minuteswest;
  93.     int tz_dsttime;
  94. };
  95. extern int gettimeofday(struct timeval *, struct timezone *);
  96. EXTERN void panic _ANSI_ARGS_(TCL_VARARGS(char *,format));
  97. #endif
  98. #endif /* _WINPORT */