Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:27

0001 /*
0002  * tkUnixPort.h --
0003  *
0004  *  This file is included by all of the Tk C files.  It contains
0005  *  information that may be configuration-dependent, such as
0006  *  #includes for system include files and a few other things.
0007  *
0008  * Copyright (c) 1991-1993 The Regents of the University of California.
0009  * Copyright (c) 1994-1996 Sun Microsystems, Inc.
0010  *
0011  * See the file "license.terms" for information on usage and redistribution
0012  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
0013  */
0014 
0015 #ifndef _UNIXPORT
0016 #define _UNIXPORT
0017 
0018 #define __UNIX__ 1
0019 
0020 #include <stdio.h>
0021 #include <pwd.h>
0022 #include <assert.h>
0023 #include <errno.h>
0024 #include <fcntl.h>
0025 #include <ctype.h>
0026 #include <math.h>
0027 #include <string.h>
0028 #include <limits.h>
0029 #ifdef NO_STDLIB_H
0030 #   include "../compat/stdlib.h"
0031 #else
0032 #   include <stdlib.h>
0033 #endif
0034 #include <sys/types.h>
0035 #include <sys/file.h>
0036 #ifdef HAVE_SYS_SELECT_H
0037 #   include <sys/select.h>
0038 #endif
0039 #include <sys/stat.h>
0040 #ifndef _TCL
0041 #   include <tcl.h>
0042 #endif
0043 #if TIME_WITH_SYS_TIME
0044 #   include <sys/time.h>
0045 #   include <time.h>
0046 #else
0047 #   if HAVE_SYS_TIME_H
0048 #   include <sys/time.h>
0049 #   else
0050 #   include <time.h>
0051 #   endif
0052 #endif
0053 #if HAVE_INTTYPES_H
0054 #    include <inttypes.h>
0055 #endif
0056 #ifndef NO_UNISTD_H
0057 #   include <unistd.h>
0058 #else
0059 #   include "../compat/unistd.h"
0060 #endif
0061 #include <X11/Xlib.h>
0062 #include <X11/cursorfont.h>
0063 #include <X11/keysym.h>
0064 #include <X11/Xatom.h>
0065 #include <X11/Xproto.h>
0066 #include <X11/Xresource.h>
0067 #include <X11/Xutil.h>
0068 
0069 /*
0070  * The following macro defines the type of the mask arguments to
0071  * select:
0072  */
0073 
0074 #ifndef NO_FD_SET
0075 #   define SELECT_MASK fd_set
0076 #else
0077 #   ifndef _AIX
0078     typedef long fd_mask;
0079 #   endif
0080 #   if defined(_IBMR2)
0081 #   define SELECT_MASK void
0082 #   else
0083 #   define SELECT_MASK int
0084 #   endif
0085 #endif
0086 
0087 /*
0088  * The following macro defines the number of fd_masks in an fd_set:
0089  */
0090 
0091 #ifndef FD_SETSIZE
0092 #   ifdef OPEN_MAX
0093 #   define FD_SETSIZE OPEN_MAX
0094 #   else
0095 #   define FD_SETSIZE 256
0096 #   endif
0097 #endif
0098 #if !defined(howmany)
0099 #   define howmany(x, y) (((x)+((y)-1))/(y))
0100 #endif
0101 #ifndef NFDBITS
0102 #   define NFDBITS NBBY*sizeof(fd_mask)
0103 #endif
0104 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
0105 
0106 /*
0107  * Define "NBBY" (number of bits per byte) if it's not already defined.
0108  */
0109 
0110 #ifndef NBBY
0111 #   define NBBY 8
0112 #endif
0113 
0114 #ifdef __CYGWIN__
0115 #   include "tkIntXlibDecls.h"
0116 #   define UINT unsigned int
0117 #   define HWND void *
0118 #   define HDC void *
0119 #   define HINSTANCE void *
0120 #   define COLORREF void *
0121 #   define HMENU void *
0122 #   define TkWinDCState void
0123 #   define HPALETTE void *
0124 #   define WNDPROC void *
0125 #   define WPARAM void *
0126 #   define LPARAM void *
0127 #   define LRESULT void *
0128 
0129 #else /* !__CYGWIN__ */
0130     /*
0131      * The TkPutImage macro strips off the color table information, which isn't
0132      * needed for X.
0133      */
0134 
0135 #   define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
0136         XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
0137         desty, width, height);
0138 
0139 #endif /* !__CYGWIN__ */
0140 
0141 /*
0142  * Supply macros for seek offsets, if they're not already provided by
0143  * an include file.
0144  */
0145 
0146 #ifndef SEEK_SET
0147 #   define SEEK_SET 0
0148 #endif
0149 
0150 #ifndef SEEK_CUR
0151 #   define SEEK_CUR 1
0152 #endif
0153 
0154 #ifndef SEEK_END
0155 #   define SEEK_END 2
0156 #endif
0157 
0158 /*
0159  * Declarations for various library procedures that may not be declared
0160  * in any other header file.
0161  */
0162 
0163 
0164 /*
0165  * These functions do nothing under Unix, so we just eliminate calls to them.
0166  */
0167 
0168 #define TkpButtonSetDefaults() {}
0169 #define TkpDestroyButton(butPtr) {}
0170 #define TkSelUpdateClipboard(a,b) {}
0171 #ifndef __CYGWIN__
0172 #define TkSetPixmapColormap(p,c) {}
0173 #endif
0174 
0175 /*
0176  * These calls implement native bitmaps which are not supported under
0177  * UNIX.  The macros eliminate the calls.
0178  */
0179 
0180 #define TkpDefineNativeBitmaps()
0181 #define TkpCreateNativeBitmap(display, source) None
0182 #define TkpGetNativeAppBitmap(display, name, w, h) None
0183 
0184 /*
0185  * This macro stores a representation of the window handle in a string.
0186  * This should perhaps use the real size of an XID.
0187  */
0188 
0189 #ifndef __CYGWIN__
0190 #define TkpPrintWindowId(buf,w) \
0191     sprintf((buf), "%#08lx", (unsigned long) (w))
0192 #endif
0193 
0194 /*
0195  * Used by tkWindow.c
0196  */
0197 
0198 #define TkpHandleMapOrUnmap(tkwin, event)  Tk_HandleEvent(event)
0199 
0200 #endif /* _UNIXPORT */