jpayne@69: /* jpayne@69: * tkUnixPort.h -- jpayne@69: * jpayne@69: * This file is included by all of the Tk C files. It contains jpayne@69: * information that may be configuration-dependent, such as jpayne@69: * #includes for system include files and a few other things. jpayne@69: * jpayne@69: * Copyright (c) 1991-1993 The Regents of the University of California. jpayne@69: * Copyright (c) 1994-1996 Sun Microsystems, Inc. jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution jpayne@69: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _UNIXPORT jpayne@69: #define _UNIXPORT jpayne@69: jpayne@69: #define __UNIX__ 1 jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #ifdef NO_STDLIB_H jpayne@69: # include "../compat/stdlib.h" jpayne@69: #else jpayne@69: # include jpayne@69: #endif jpayne@69: #include jpayne@69: #include jpayne@69: #ifdef HAVE_SYS_SELECT_H jpayne@69: # include jpayne@69: #endif jpayne@69: #include jpayne@69: #ifndef _TCL jpayne@69: # include jpayne@69: #endif jpayne@69: #ifdef TIME_WITH_SYS_TIME jpayne@69: # include jpayne@69: # include jpayne@69: #else jpayne@69: # ifdef HAVE_SYS_TIME_H jpayne@69: # include jpayne@69: # else jpayne@69: # include jpayne@69: # endif jpayne@69: #endif jpayne@69: #ifdef HAVE_INTTYPES_H jpayne@69: # include jpayne@69: #endif jpayne@69: #ifndef NO_UNISTD_H jpayne@69: # include jpayne@69: #else jpayne@69: # include "../compat/unistd.h" jpayne@69: #endif jpayne@69: #if defined(__GNUC__) && !defined(__cplusplus) jpayne@69: # pragma GCC diagnostic ignored "-Wc++-compat" jpayne@69: #endif jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* jpayne@69: * The following macro defines the type of the mask arguments to jpayne@69: * select: jpayne@69: */ jpayne@69: jpayne@69: #ifndef NO_FD_SET jpayne@69: # define SELECT_MASK fd_set jpayne@69: #else jpayne@69: # ifndef _AIX jpayne@69: typedef long fd_mask; jpayne@69: # endif jpayne@69: # if defined(_IBMR2) jpayne@69: # define SELECT_MASK void jpayne@69: # else jpayne@69: # define SELECT_MASK int jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following macro defines the number of fd_masks in an fd_set: jpayne@69: */ jpayne@69: jpayne@69: #ifndef FD_SETSIZE jpayne@69: # ifdef OPEN_MAX jpayne@69: # define FD_SETSIZE OPEN_MAX jpayne@69: # else jpayne@69: # define FD_SETSIZE 256 jpayne@69: # endif jpayne@69: #endif jpayne@69: #if !defined(howmany) jpayne@69: # define howmany(x, y) (((x)+((y)-1))/(y)) jpayne@69: #endif jpayne@69: #ifndef NFDBITS jpayne@69: # define NFDBITS NBBY*sizeof(fd_mask) jpayne@69: #endif jpayne@69: #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) jpayne@69: jpayne@69: /* jpayne@69: * Define "NBBY" (number of bits per byte) if it's not already defined. jpayne@69: */ jpayne@69: jpayne@69: #ifndef NBBY jpayne@69: # define NBBY 8 jpayne@69: #endif jpayne@69: jpayne@69: #ifdef __CYGWIN__ jpayne@69: # include "tkIntXlibDecls.h" jpayne@69: # define UINT unsigned int jpayne@69: # define HWND void * jpayne@69: # define HDC void * jpayne@69: # define HINSTANCE void * jpayne@69: # define COLORREF void * jpayne@69: # define HMENU void * jpayne@69: # define TkWinDCState void jpayne@69: # define HPALETTE void * jpayne@69: # define WNDPROC void * jpayne@69: # define WPARAM void * jpayne@69: # define LPARAM void * jpayne@69: # define LRESULT void * jpayne@69: jpayne@69: #else /* !__CYGWIN__ */ jpayne@69: /* jpayne@69: * The TkPutImage macro strips off the color table information, which isn't jpayne@69: * needed for X. jpayne@69: */ jpayne@69: jpayne@69: # define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \ jpayne@69: XPutImage(display, pixels, gc, image, srcx, srcy, destx, \ jpayne@69: desty, width, height); jpayne@69: jpayne@69: #endif /* !__CYGWIN__ */ jpayne@69: jpayne@69: /* jpayne@69: * Supply macros for seek offsets, if they're not already provided by jpayne@69: * an include file. jpayne@69: */ jpayne@69: jpayne@69: #ifndef SEEK_SET jpayne@69: # define SEEK_SET 0 jpayne@69: #endif jpayne@69: jpayne@69: #ifndef SEEK_CUR jpayne@69: # define SEEK_CUR 1 jpayne@69: #endif jpayne@69: jpayne@69: #ifndef SEEK_END jpayne@69: # define SEEK_END 2 jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Declarations for various library procedures that may not be declared jpayne@69: * in any other header file. jpayne@69: */ jpayne@69: jpayne@69: jpayne@69: /* jpayne@69: * These functions do nothing under Unix, so we just eliminate calls to them. jpayne@69: */ jpayne@69: jpayne@69: #define TkpButtonSetDefaults() {} jpayne@69: #define TkpDestroyButton(butPtr) {} jpayne@69: #define TkSelUpdateClipboard(a,b) {} jpayne@69: #ifndef __CYGWIN__ jpayne@69: #define TkSetPixmapColormap(p,c) {} jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * These calls implement native bitmaps which are not supported under jpayne@69: * UNIX. The macros eliminate the calls. jpayne@69: */ jpayne@69: jpayne@69: #define TkpDefineNativeBitmaps() jpayne@69: #define TkpCreateNativeBitmap(display, source) None jpayne@69: #define TkpGetNativeAppBitmap(display, name, w, h) None jpayne@69: jpayne@69: /* jpayne@69: * This macro stores a representation of the window handle in a string. jpayne@69: * This should perhaps use the real size of an XID. jpayne@69: */ jpayne@69: jpayne@69: #ifndef __CYGWIN__ jpayne@69: #define TkpPrintWindowId(buf,w) \ jpayne@69: sprintf((buf), "0x%08lx", (unsigned long) (w)) jpayne@69: #endif jpayne@69: jpayne@69: #endif /* _UNIXPORT */