home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / unix / tkUnixPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  5.2 KB  |  236 lines  |  [TEXT/CWIE]

  1. /*
  2.  * tkUnixPort.h --
  3.  *
  4.  *    This file is included by all of the Tk C files.  It contains
  5.  *    information that may be configuration-dependent, such as
  6.  *    #includes for system include files and a few other things.
  7.  *
  8.  * Copyright (c) 1991-1993 The Regents of the University of California.
  9.  * Copyright (c) 1994-1996 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.  * SCCS: @(#) tkUnixPort.h 1.38 97/05/17 16:48:19
  15.  */
  16.  
  17. #ifndef _UNIXPORT
  18. #define _UNIXPORT
  19.  
  20. #define __UNIX__ 1
  21.  
  22. /*
  23.  * Macro to use instead of "void" for arguments that must have
  24.  * type "void *" in ANSI C;  maps them to type "char *" in
  25.  * non-ANSI systems.  This macro may be used in some of the include
  26.  * files below, which is why it is defined here.
  27.  */
  28.  
  29. #ifndef VOID
  30. #   ifdef __STDC__
  31. #       define VOID void
  32. #   else
  33. #       define VOID char
  34. #   endif
  35. #endif
  36.  
  37. #include <stdio.h>
  38. #include <ctype.h>
  39. #include <fcntl.h>
  40. #ifdef HAVE_LIMITS_H
  41. #   include <limits.h>
  42. #else
  43. #   include "../compat/limits.h"
  44. #endif
  45. #include <math.h>
  46. #include <pwd.h>
  47. #ifdef NO_STDLIB_H
  48. #   include "../compat/stdlib.h"
  49. #else
  50. #   include <stdlib.h>
  51. #endif
  52. #include <string.h>
  53. #include <sys/types.h>
  54. #include <sys/file.h>
  55. #ifdef HAVE_SYS_SELECT_H
  56. #   include <sys/select.h>
  57. #endif
  58. #include <sys/stat.h>
  59. #ifndef _TCL
  60. #   include <tcl.h>
  61. #endif
  62. #if TIME_WITH_SYS_TIME
  63. #   include <sys/time.h>
  64. #   include <time.h>
  65. #else
  66. #   if HAVE_SYS_TIME_H
  67. #       include <sys/time.h>
  68. #   else
  69. #       include <time.h>
  70. #   endif
  71. #endif
  72. #ifdef HAVE_UNISTD_H
  73. #   include <unistd.h>
  74. #else
  75. #   include "../compat/unistd.h"
  76. #endif
  77. #include <X11/Xlib.h>
  78. #include <X11/cursorfont.h>
  79. #include <X11/keysym.h>
  80. #include <X11/Xatom.h>
  81. #include <X11/Xproto.h>
  82. #include <X11/Xresource.h>
  83. #include <X11/Xutil.h>
  84.  
  85. /*
  86.  * The following macro defines the type of the mask arguments to
  87.  * select:
  88.  */
  89.  
  90. #ifndef NO_FD_SET
  91. #   define SELECT_MASK fd_set
  92. #else
  93. #   ifndef _AIX
  94.     typedef long fd_mask;
  95. #   endif
  96. #   if defined(_IBMR2)
  97. #    define SELECT_MASK void
  98. #   else
  99. #    define SELECT_MASK int
  100. #   endif
  101. #endif
  102.  
  103. /*
  104.  * The following macro defines the number of fd_masks in an fd_set:
  105.  */
  106.  
  107. #ifndef FD_SETSIZE
  108. #   ifdef OPEN_MAX
  109. #    define FD_SETSIZE OPEN_MAX
  110. #   else
  111. #    define FD_SETSIZE 256
  112. #   endif
  113. #endif
  114. #if !defined(howmany)
  115. #   define howmany(x, y) (((x)+((y)-1))/(y))
  116. #endif
  117. #ifndef NFDBITS
  118. #   define NFDBITS NBBY*sizeof(fd_mask)
  119. #endif
  120. #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
  121.  
  122. /*
  123.  * Not all systems declare the errno variable in errno.h. so this
  124.  * file does it explicitly.
  125.  */
  126.  
  127. extern int errno;
  128.  
  129. /*
  130.  * Define "NBBY" (number of bits per byte) if it's not already defined.
  131.  */
  132.  
  133. #ifndef NBBY
  134. #   define NBBY 8
  135. #endif
  136.  
  137. /*
  138.  * These macros are just wrappers for the equivalent X Region calls.
  139.  */
  140.  
  141. #define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
  142. #define TkCreateRegion() (TkRegion) XCreateRegion()
  143. #define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
  144. #define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
  145.     (Region) b, (Region) r)
  146. #define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
  147. #define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
  148. #define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
  149.     (Region) src, (Region) ret)
  150.  
  151. /*
  152.  * The TkPutImage macro strips off the color table information, which isn't
  153.  * needed for X.
  154.  */
  155.  
  156. #define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
  157.     XPutImage(display, pixels, gc, image, destx, desty, srcx, \
  158.     srcy, width, height);
  159.  
  160. /*
  161.  * The following Tk functions are implemented as macros under Windows.
  162.  */
  163.  
  164. #define TkGetNativeProlog(interp) TkGetProlog(interp)
  165.  
  166. /*
  167.  * Supply macros for seek offsets, if they're not already provided by
  168.  * an include file.
  169.  */
  170.  
  171. #ifndef SEEK_SET
  172. #   define SEEK_SET 0
  173. #endif
  174.  
  175. #ifndef SEEK_CUR
  176. #   define SEEK_CUR 1
  177. #endif
  178.  
  179. #ifndef SEEK_END
  180. #   define SEEK_END 2
  181. #endif
  182.  
  183. /*
  184.  * Declarations for various library procedures that may not be declared
  185.  * in any other header file.
  186.  */
  187.  
  188. extern void        panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
  189.  
  190. /*
  191.  * These functions do nothing under Unix, so we just eliminate calls to them.
  192.  */
  193.  
  194. #define TkpDestroyButton(butPtr) {}
  195. #define TkSelUpdateClipboard(a,b) {}
  196. #define TkSetPixmapColormap(p,c) {}
  197.  
  198. /*
  199.  * These calls implement native bitmaps which are not supported under
  200.  * UNIX.  The macros eliminate the calls.
  201.  */
  202.  
  203. #define TkpDefineNativeBitmaps()
  204. #define TkpCreateNativeBitmap(display, source) None
  205. #define TkpGetNativeAppBitmap(display, name, w, h) None
  206.  
  207. /*
  208.  * This macro stores a representation of the window handle in a string.
  209.  */
  210.  
  211. #define TkpPrintWindowId(buf,w) \
  212.     sprintf((buf), "0x%x", (unsigned int) (w))
  213.         
  214. /*
  215.  * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
  216.  */
  217.  
  218. #define TkpScanWindowId(i,s,wp) \
  219.     Tcl_GetInt((i),(s),(wp))
  220.         
  221. /*
  222.  * This macro indicates that entry and text widgets should display
  223.  * the selection highlight regardless of which window has the focus.
  224.  */
  225.  
  226. #define ALWAYS_SHOW_SELECTION
  227.  
  228. /*
  229.  * The following declaration is used to get access to a private Tcl interface
  230.  * that is needed for portability reasons.
  231.  */
  232.  
  233. EXTERN void        TclpGetTime _ANSI_ARGS_((Tcl_Time *time));
  234.  
  235. #endif /* _UNIXPORT */
  236.