home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcltk805.zip / tcl805s.zip / tk8.0.5 / os2 / tkOS2Port.h < prev    next >
C/C++ Source or Header  |  2000-01-01  |  3KB  |  138 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-2000 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. #define strcasecmp stricmp
  42.  
  43. #define NBBY 8
  44.  
  45. #define OPEN_MAX 32
  46.  
  47. /*
  48.  * Define MAXPATHLEN in terms of MAXPATH if available
  49.  */
  50.  
  51. #ifndef MAX_PATH
  52. #define MAX_PATH CCHMAXPATH
  53. #endif
  54.  
  55. #ifndef MAXPATH
  56. #define MAXPATH MAX_PATH
  57. #endif /* MAXPATH */
  58.  
  59. #ifndef MAXPATHLEN
  60. #define MAXPATHLEN MAXPATH
  61. #endif /* MAXPATHLEN */
  62.  
  63. /*
  64.  * The following define causes Tk to use its internal keysym hash table
  65.  */
  66.  
  67. #define REDO_KEYSYM_LOOKUP
  68.  
  69. /*
  70.  * The following macro checks to see whether there is buffered
  71.  * input data available for a stdio FILE.
  72.  */
  73.  
  74. #ifdef __EMX__
  75. #    define TK_READ_DATA_PENDING(f) ((f)->rcount > 0)
  76. #elif __BORLANDC__
  77. #    define TK_READ_DATA_PENDING(f) ((f)->level > 0)
  78. #elif __IBMC__
  79. #    define TK_READ_DATA_PENDING(f) ((f)->_count > 0)
  80. #endif /* __EMX__ */
  81.  
  82. /*
  83.  * The following stubs implement various calls that don't do anything
  84.  * under OS/2.
  85.  */
  86.  
  87. #define TkFreeWindowId(dispPtr,w)
  88. #define TkInitXId(dispPtr)
  89. #define TkpCmapStressed(tkwin,colormap) (0)
  90. #define XFlush(display)
  91. #define XGrabServer(display)
  92. #define XUngrabServer(display)
  93. #define TkpSync(display)
  94.  
  95. /*
  96.  * The following X functions are implemented as macros under OS/2.
  97.  */
  98.  
  99. #define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
  100. #define XNoOp(display) {display->request++;}
  101. #define XSynchronize(display, bool) {display->request++;}
  102. #define XSync(display, bool) {display->request++;}
  103. #define XVisualIDFromVisual(visual) (visual->visualid)
  104.  
  105. /*
  106.  * The following Tk functions are implemented as macros under OS/2.
  107.  */
  108.  
  109. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  110. #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \
  111.         | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
  112.  
  113. /*
  114.  * These calls implement native bitmaps which are not currently
  115.  * supported under OS/2.  The macros eliminate the calls.
  116.  */
  117.  
  118. #define TkpDefineNativeBitmaps()
  119. #define TkpCreateNativeBitmap(display, source) None
  120. #define TkpGetNativeAppBitmap(display, name, w, h) None
  121.  
  122. #ifndef __EMX__
  123.  
  124. /*
  125.  * Define timezone for gettimeofday.
  126.  */
  127. struct timezone {
  128.     int tz_minuteswest;
  129.     int tz_dsttime;
  130. };
  131. extern int gettimeofday(struct timeval *, struct timezone *);
  132.  
  133. #endif /* __EMX__ */
  134.  
  135. extern void     panic _ANSI_ARGS_(TCL_VARARGS(char *,format));
  136.  
  137. #endif /* _OS2PORT */
  138.