home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Tk / pTk / tkWinPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-10  |  3.0 KB  |  124 lines

  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.12 96/10/02 15:40:59
  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 <malloc.h>
  26. #include <errno.h>
  27. #include <ctype.h>
  28. #include <math.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31. #include <limits.h>
  32. #include <fcntl.h>
  33. #include <io.h>
  34. #ifdef __EMX__
  35. #   include <sys/types.h>
  36. #endif
  37. #include <sys/stat.h>
  38. #include <sys/timeb.h>
  39. #include <time.h>
  40.  
  41. #ifdef _MSC_VER
  42. #    define strncasecmp strnicmp
  43. #    define hypot _hypot
  44. #else /* _MSC_VER */
  45. #    ifdef __EMX__
  46. #        define strncasecmp strnicmp
  47. #    else
  48. #        define strncasecmp strncmpi
  49. #    endif
  50. #endif /* _MSC_VER */
  51.  
  52. #define NBBY 8
  53.  
  54. #define OPEN_MAX 32
  55.  
  56. /*
  57.  * The following define causes Tk to use its internal keysym hash table
  58.  */
  59.  
  60. #define REDO_KEYSYM_LOOKUP
  61.  
  62. /*
  63.  * The following macro checks to see whether there is buffered
  64.  * input data available for a stdio FILE.
  65.  */
  66.  
  67. #ifdef _MSC_VER
  68. #    define TK_READ_DATA_PENDING(f) ((f)->_cnt > 0)
  69. #else /* _MSC_VER */
  70. #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
  71. #endif /* _MSC_VER */
  72.  
  73. /*
  74.  * The following stubs implement various calls that don't do anything
  75.  * under Windows.
  76.  */
  77.  
  78. #define TkFreeWindowId(dispPtr,w)
  79. #define TkInitXId(dispPtr)
  80. #define XFlush(display)
  81. #define XGrabServer(display)
  82. #define XUngrabServer(display)
  83.  
  84. /*
  85.  * The following X functions are implemented as macros under Windows.
  86.  */
  87.  
  88. #define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
  89. #define XNoOp(display) {display->request++;}
  90. #define XSynchronize(display, bool) {display->request++;}
  91. #define XSync(display, bool) {display->request++;}
  92. #define XVisualIDFromVisual(visual) (visual->visualid)
  93.  
  94. /* Additional translations needed for Tk extensions (Pixmap). */
  95.  
  96. #define XPutImage(display, dr, gc, i, a, b, c, d, e, f) \
  97.     TkPutImage(NULL, 0, display, dr, gc, i, a, b, c, d, e, f)
  98. #define XDefaultVisual(display, screen) ((screen)->root_visual)
  99. #define XDefaultScreen(display) ((display)->screens)
  100. #define XDefaultColormap(display, screen) ((screen)->cmap)
  101. #define XDefaultDepth(display, screen) ((screen)->root_depth)
  102.  
  103. /*
  104.  * The following Tk functions are implemented as macros under Windows.
  105.  */
  106.  
  107. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  108.  
  109. /*
  110.  * Define timezone for gettimeofday.
  111.  */
  112. #if 0
  113. struct timezone {
  114.     int tz_minuteswest;
  115.     int tz_dsttime;
  116. };
  117. #else
  118. struct timezone;
  119. #endif 
  120.  
  121. extern int gettimeofday(struct timeval *, struct timezone *);
  122.  
  123. #endif /* _WINPORT */
  124.