tkWinPort.h 3.2 KB

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