home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tk42r2x.zip / TclTk / lib / tkOS2Port.h < prev    next >
C/C++ Source or Header  |  1999-07-27  |  3KB  |  124 lines

  1. /*
  2.  * tkOS2Port.h --
  3.  *
  4.  *    This header file handles porting issues that occur because of
  5.  *    differences between OS/2 and Unix. It should be the only
  6.  *    file that contains #ifdefs to handle different flavors of OS.
  7.  *
  8.  * Copyright (c) 1996-1998 Illya Vaes
  9.  * Copyright (c) 1995 Sun Microsystems, Inc.
  10.  *
  11.  * See the file "license.terms" for information on usage and redistribution
  12.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  13.  *
  14.  */
  15.  
  16. #ifndef _OS2PORT
  17. #define _OS2PORT
  18.  
  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 <stdarg.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <malloc.h>
  29. #include <ctype.h>
  30. #include <math.h>
  31. #include <string.h>
  32. #include <limits.h>
  33. #include <fcntl.h>
  34. #include <io.h>
  35. #include <sys/types.h>
  36. #include <sys/stat.h>
  37. #include <time.h>
  38. #include <sys/time.h>
  39.  
  40. #define strncasecmp strnicmp
  41.  
  42. #define NBBY 8
  43.  
  44. #define OPEN_MAX 32
  45.  
  46. /*
  47.  * Define MAXPATHLEN in terms of MAXPATH if available
  48.  */
  49.  
  50. #ifndef MAX_PATH
  51. #define MAX_PATH CCHMAXPATH
  52. #endif
  53.  
  54. #ifndef MAXPATH
  55. #define MAXPATH MAX_PATH
  56. #endif /* MAXPATH */
  57.  
  58. #ifndef MAXPATHLEN
  59. #define MAXPATHLEN MAXPATH
  60. #endif /* MAXPATHLEN */
  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 __EMX__
  74. #    define TK_READ_DATA_PENDING(f) ((f)->rcount > 0)
  75. #elif __BORLANDC__
  76. #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
  77. #elif __IBMC__
  78. #    define TK_READ_DATA_PENDING(f) ((f)->_count > 0)
  79. #endif /* __EMX__ */
  80.  
  81. /*
  82.  * The following stubs implement various calls that don't do anything
  83.  * under OS/2.
  84.  */
  85.  
  86. #define TkFreeWindowId(dispPtr,w)
  87. #define TkInitXId(dispPtr)
  88. #define XFlush(display)
  89. #define XGrabServer(display)
  90. #define XUngrabServer(display)
  91.  
  92. /*
  93.  * The following X functions are implemented as macros under OS/2.
  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 OS/2.
  104.  */
  105.  
  106. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  107.  
  108. #ifndef __EMX__
  109.  
  110. /*
  111.  * Define timezone for gettimeofday.
  112.  */
  113. struct timezone {
  114.     int tz_minuteswest;
  115.     int tz_dsttime;
  116. };
  117. extern int gettimeofday(struct timeval *, struct timezone *);
  118.  
  119. #endif /* __EMX__ */
  120.  
  121. extern void panic();
  122.  
  123. #endif /* _OS2PORT */
  124.