annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tkUnixPort.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /*
jpayne@69 2 * tkUnixPort.h --
jpayne@69 3 *
jpayne@69 4 * This file is included by all of the Tk C files. It contains
jpayne@69 5 * information that may be configuration-dependent, such as
jpayne@69 6 * #includes for system include files and a few other things.
jpayne@69 7 *
jpayne@69 8 * Copyright (c) 1991-1993 The Regents of the University of California.
jpayne@69 9 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
jpayne@69 10 *
jpayne@69 11 * See the file "license.terms" for information on usage and redistribution
jpayne@69 12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
jpayne@69 13 */
jpayne@69 14
jpayne@69 15 #ifndef _UNIXPORT
jpayne@69 16 #define _UNIXPORT
jpayne@69 17
jpayne@69 18 #define __UNIX__ 1
jpayne@69 19
jpayne@69 20 #include <stdio.h>
jpayne@69 21 #include <pwd.h>
jpayne@69 22 #include <assert.h>
jpayne@69 23 #include <errno.h>
jpayne@69 24 #include <fcntl.h>
jpayne@69 25 #include <ctype.h>
jpayne@69 26 #include <math.h>
jpayne@69 27 #include <string.h>
jpayne@69 28 #include <limits.h>
jpayne@69 29 #ifdef NO_STDLIB_H
jpayne@69 30 # include "../compat/stdlib.h"
jpayne@69 31 #else
jpayne@69 32 # include <stdlib.h>
jpayne@69 33 #endif
jpayne@69 34 #include <sys/types.h>
jpayne@69 35 #include <sys/file.h>
jpayne@69 36 #ifdef HAVE_SYS_SELECT_H
jpayne@69 37 # include <sys/select.h>
jpayne@69 38 #endif
jpayne@69 39 #include <sys/stat.h>
jpayne@69 40 #ifndef _TCL
jpayne@69 41 # include <tcl.h>
jpayne@69 42 #endif
jpayne@69 43 #ifdef TIME_WITH_SYS_TIME
jpayne@69 44 # include <sys/time.h>
jpayne@69 45 # include <time.h>
jpayne@69 46 #else
jpayne@69 47 # ifdef HAVE_SYS_TIME_H
jpayne@69 48 # include <sys/time.h>
jpayne@69 49 # else
jpayne@69 50 # include <time.h>
jpayne@69 51 # endif
jpayne@69 52 #endif
jpayne@69 53 #ifdef HAVE_INTTYPES_H
jpayne@69 54 # include <inttypes.h>
jpayne@69 55 #endif
jpayne@69 56 #ifndef NO_UNISTD_H
jpayne@69 57 # include <unistd.h>
jpayne@69 58 #else
jpayne@69 59 # include "../compat/unistd.h"
jpayne@69 60 #endif
jpayne@69 61 #if defined(__GNUC__) && !defined(__cplusplus)
jpayne@69 62 # pragma GCC diagnostic ignored "-Wc++-compat"
jpayne@69 63 #endif
jpayne@69 64 #include <X11/Xlib.h>
jpayne@69 65 #include <X11/cursorfont.h>
jpayne@69 66 #include <X11/keysym.h>
jpayne@69 67 #include <X11/Xatom.h>
jpayne@69 68 #include <X11/Xproto.h>
jpayne@69 69 #include <X11/Xresource.h>
jpayne@69 70 #include <X11/Xutil.h>
jpayne@69 71
jpayne@69 72 /*
jpayne@69 73 * The following macro defines the type of the mask arguments to
jpayne@69 74 * select:
jpayne@69 75 */
jpayne@69 76
jpayne@69 77 #ifndef NO_FD_SET
jpayne@69 78 # define SELECT_MASK fd_set
jpayne@69 79 #else
jpayne@69 80 # ifndef _AIX
jpayne@69 81 typedef long fd_mask;
jpayne@69 82 # endif
jpayne@69 83 # if defined(_IBMR2)
jpayne@69 84 # define SELECT_MASK void
jpayne@69 85 # else
jpayne@69 86 # define SELECT_MASK int
jpayne@69 87 # endif
jpayne@69 88 #endif
jpayne@69 89
jpayne@69 90 /*
jpayne@69 91 * The following macro defines the number of fd_masks in an fd_set:
jpayne@69 92 */
jpayne@69 93
jpayne@69 94 #ifndef FD_SETSIZE
jpayne@69 95 # ifdef OPEN_MAX
jpayne@69 96 # define FD_SETSIZE OPEN_MAX
jpayne@69 97 # else
jpayne@69 98 # define FD_SETSIZE 256
jpayne@69 99 # endif
jpayne@69 100 #endif
jpayne@69 101 #if !defined(howmany)
jpayne@69 102 # define howmany(x, y) (((x)+((y)-1))/(y))
jpayne@69 103 #endif
jpayne@69 104 #ifndef NFDBITS
jpayne@69 105 # define NFDBITS NBBY*sizeof(fd_mask)
jpayne@69 106 #endif
jpayne@69 107 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
jpayne@69 108
jpayne@69 109 /*
jpayne@69 110 * Define "NBBY" (number of bits per byte) if it's not already defined.
jpayne@69 111 */
jpayne@69 112
jpayne@69 113 #ifndef NBBY
jpayne@69 114 # define NBBY 8
jpayne@69 115 #endif
jpayne@69 116
jpayne@69 117 #ifdef __CYGWIN__
jpayne@69 118 # include "tkIntXlibDecls.h"
jpayne@69 119 # define UINT unsigned int
jpayne@69 120 # define HWND void *
jpayne@69 121 # define HDC void *
jpayne@69 122 # define HINSTANCE void *
jpayne@69 123 # define COLORREF void *
jpayne@69 124 # define HMENU void *
jpayne@69 125 # define TkWinDCState void
jpayne@69 126 # define HPALETTE void *
jpayne@69 127 # define WNDPROC void *
jpayne@69 128 # define WPARAM void *
jpayne@69 129 # define LPARAM void *
jpayne@69 130 # define LRESULT void *
jpayne@69 131
jpayne@69 132 #else /* !__CYGWIN__ */
jpayne@69 133 /*
jpayne@69 134 * The TkPutImage macro strips off the color table information, which isn't
jpayne@69 135 * needed for X.
jpayne@69 136 */
jpayne@69 137
jpayne@69 138 # define TkPutImage(colors, ncolors, display, pixels, gc, image, srcx, srcy, destx, desty, width, height) \
jpayne@69 139 XPutImage(display, pixels, gc, image, srcx, srcy, destx, \
jpayne@69 140 desty, width, height);
jpayne@69 141
jpayne@69 142 #endif /* !__CYGWIN__ */
jpayne@69 143
jpayne@69 144 /*
jpayne@69 145 * Supply macros for seek offsets, if they're not already provided by
jpayne@69 146 * an include file.
jpayne@69 147 */
jpayne@69 148
jpayne@69 149 #ifndef SEEK_SET
jpayne@69 150 # define SEEK_SET 0
jpayne@69 151 #endif
jpayne@69 152
jpayne@69 153 #ifndef SEEK_CUR
jpayne@69 154 # define SEEK_CUR 1
jpayne@69 155 #endif
jpayne@69 156
jpayne@69 157 #ifndef SEEK_END
jpayne@69 158 # define SEEK_END 2
jpayne@69 159 #endif
jpayne@69 160
jpayne@69 161 /*
jpayne@69 162 * Declarations for various library procedures that may not be declared
jpayne@69 163 * in any other header file.
jpayne@69 164 */
jpayne@69 165
jpayne@69 166
jpayne@69 167 /*
jpayne@69 168 * These functions do nothing under Unix, so we just eliminate calls to them.
jpayne@69 169 */
jpayne@69 170
jpayne@69 171 #define TkpButtonSetDefaults() {}
jpayne@69 172 #define TkpDestroyButton(butPtr) {}
jpayne@69 173 #define TkSelUpdateClipboard(a,b) {}
jpayne@69 174 #ifndef __CYGWIN__
jpayne@69 175 #define TkSetPixmapColormap(p,c) {}
jpayne@69 176 #endif
jpayne@69 177
jpayne@69 178 /*
jpayne@69 179 * These calls implement native bitmaps which are not supported under
jpayne@69 180 * UNIX. The macros eliminate the calls.
jpayne@69 181 */
jpayne@69 182
jpayne@69 183 #define TkpDefineNativeBitmaps()
jpayne@69 184 #define TkpCreateNativeBitmap(display, source) None
jpayne@69 185 #define TkpGetNativeAppBitmap(display, name, w, h) None
jpayne@69 186
jpayne@69 187 /*
jpayne@69 188 * This macro stores a representation of the window handle in a string.
jpayne@69 189 * This should perhaps use the real size of an XID.
jpayne@69 190 */
jpayne@69 191
jpayne@69 192 #ifndef __CYGWIN__
jpayne@69 193 #define TkpPrintWindowId(buf,w) \
jpayne@69 194 sprintf((buf), "0x%08lx", (unsigned long) (w))
jpayne@69 195 #endif
jpayne@69 196
jpayne@69 197 #endif /* _UNIXPORT */