home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / tkConfig.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-26  |  4.2 KB  |  160 lines

  1. /*
  2.  * tkConfig.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.  * All rights reserved.
  10.  *
  11.  * Permission is hereby granted, without written agreement and without
  12.  * license or royalty fees, to use, copy, modify, and distribute this
  13.  * software and its documentation for any purpose, provided that the
  14.  * above copyright notice and the following two paragraphs appear in
  15.  * all copies of this software.
  16.  * 
  17.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  18.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  19.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  20.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21.  *
  22.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  23.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  24.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  25.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  26.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  27.  *
  28.  * $Header: /user6/ouster/wish/RCS/tkConfig.h,v 1.23 93/06/26 14:47:26 ouster Exp $ SPRITE (Berkeley)
  29.  */
  30.  
  31. #ifndef _TKCONFIG
  32. #define _TKCONFIG
  33.  
  34. /*
  35.  * Macro to use instead of "void" for arguments that must have
  36.  * type "void *" in ANSI C;  maps them to type "char *" in
  37.  * non-ANSI systems.  This macro may be used in some of the include
  38.  * files below, which is why it is defined here.
  39.  */
  40.  
  41. #ifndef VOID
  42. #   ifdef __STDC__
  43. #       define VOID void
  44. #   else
  45. #       define VOID char
  46. #   endif
  47. #endif
  48.  
  49. #include <stdio.h>
  50. #include <ctype.h>
  51. #include <fcntl.h>
  52. #include <math.h>
  53. #include <pwd.h>
  54. #include <stdlib.h>
  55. #include <string.h>
  56. #include <sys/types.h>
  57. #include <sys/file.h>
  58. #ifdef HAVE_SYS_SELECT_H
  59. #   include <sys/select.h>
  60. #endif
  61. #include <sys/stat.h>
  62. #include <sys/time.h>
  63. #ifndef _TCL
  64. #   include <tcl.h>
  65. #endif
  66. #ifndef HAVE_UNISTD
  67. #   include <unistd.h>
  68. #else
  69. #   include <compat/unistd.h>
  70. #endif
  71. #include <X11/Xlib.h>
  72. #include <X11/cursorfont.h>
  73. #include <X11/keysym.h>
  74. #include <X11/Xatom.h>
  75. #include <X11/Xproto.h>
  76. #include <X11/Xresource.h>
  77. #include <X11/Xutil.h>
  78.  
  79. /*
  80.  * Not all systems declare the errno variable in errno.h. so this
  81.  * file does it explicitly.
  82.  */
  83.  
  84. extern int errno;
  85.  
  86. /*
  87.  * Define OPEN_MAX if it isn't already defined for this system.
  88.  */
  89.  
  90. #ifndef OPEN_MAX
  91. #   define OPEN_MAX 256
  92. #endif
  93.  
  94. /*
  95.  * The following macro defines the type of the mask arguments to
  96.  * select:
  97.  */
  98.  
  99. #if (defined(sun) && !defined(sprite)) || defined(linux) || defined(SVR4)
  100. #   define SELECT_MASK fd_set
  101. #else
  102. #   if defined(_IBMR2)
  103. #    define SELECT_MASK void
  104. #   else
  105. #    define SELECT_MASK int
  106. #   endif
  107. #endif
  108.  
  109. /*
  110.  * Define "NBBY" (number of bits per byte) and type "fd_mask" if they're
  111.  * not already defined.
  112.  */
  113.  
  114. #ifndef NBBY
  115. #   define NBBY 8
  116. #endif
  117. #ifndef FD_SET
  118.     typedef long fd_mask;
  119. #endif
  120.  
  121. /*
  122.  * The following macro defines the number of fd_masks in an fd_set:
  123.  */
  124.  
  125. #ifdef NFDBITS
  126. #   define MASK_SIZE (howmany(FD_SETSIZE, NFDBITS))
  127. #else
  128. #   define MASK_SIZE ((OPEN_MAX+(8*sizeof(int))-1)/(8*sizeof(int)))
  129. #endif
  130.  
  131. /*
  132.  * Substitute Tcl's own versions for several system calls.  The
  133.  * Tcl versions retry automatically if interrupted by signals.
  134.  */
  135.  
  136. #define open(a,b,c) TclOpen(a,b,c)
  137. #define read(a,b,c) TclRead(a,b,c)
  138. #define waitpid(a,b,c) TclWaitPid(a,b,c)
  139. #define write(a,b,c) TclWrite(a,b,c)
  140. EXTERN int    TclOpen _ANSI_ARGS_((char *path, int oflag, mode_t mode));
  141. EXTERN int    TclRead _ANSI_ARGS_((int fd, char *buf,
  142.             unsigned int numBytes));
  143. EXTERN int    TclWaitpid _ANSI_ARGS_((pid_t pid, int *statPtr, int options));
  144. EXTERN int    TclWrite _ANSI_ARGS_((int fd, char *buf,
  145.             unsigned int numBytes));
  146.  
  147. /*
  148.  * Declarations for various library procedures that may not be declared
  149.  * in any other header file.
  150.  */
  151.  
  152. extern void        panic();
  153. #ifndef HAVE_SYS_SELECT_H
  154. extern int        select _ANSI_ARGS_((int nfds, SELECT_MASK *readfds,
  155.                 SELECT_MASK *writefds, SELECT_MASK *exceptfds,
  156.                 struct timeval *timeout));
  157. #endif
  158.  
  159. #endif /* _TKCONFIG */
  160.