Debian Codegraph @

pTk/mTk/unix/tkUnixPort.h

raw symbols SCIP
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 * RCS: @(#) $Id: tkUnixPort.h,v 1.8 2002/06/14 13:35:49 dkf Exp $
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 <ctype.h>
38 #include <fcntl.h>
39 #ifdef HAVE_LIMITS_H
40 # include <limits.h>
41 #else
42 # include "compat/limits.h"
43 #endif
44 #include <math.h>
45 #include <pwd.h>
46 #ifdef NO_STDLIB_H
47 # include "compat/stdlib.h"
48 #else
49 # include <stdlib.h>
50 #endif
51 #include <string.h>
52 #include <sys/types.h>
53 #include <sys/file.h>
54 #ifdef HAVE_SYS_SELECT_H
55 # include <sys/select.h>
56 #endif
57 #include <sys/stat.h>
58 #ifdef HAVE_SYS_TIME_H
59 #include <sys/time.h>
60 #endif
61 #ifndef _LANG
62 # include "Lang.h"
63 #endif
64 #if 0 /* Used in tk8 merge */
65 #if TIME_WITH_SYS_TIME
66 # include <sys/time.h>
67 # include <time.h>
68 #else
69 # if HAVE_SYS_TIME_H
70 # include <sys/time.h>
71 # else
72 # include <time.h>
73 # endif
74 #endif
75 #endif
76 #if TIME_WITH_SYS_TIME
77 # include <sys/time.h>
78 # include <time.h>
79 #else
80 # if HAVE_SYS_TIME_H
81 # include <sys/time.h>
82 # else
83 # include <time.h>
84 # endif
85 #endif
86 #ifdef HAVE_UNISTD_H
87 # include <unistd.h>
88 #else
89 # include "compat/unistd.h"
90 #endif
91 #include <X11/Xlib.h>
92 #include <X11/cursorfont.h>
93 #include <X11/keysym.h>
94 #include <X11/Xatom.h>
95 #include <X11/Xproto.h>
96 #include <X11/Xresource.h>
97 #include <X11/Xutil.h>
98
99 /*
100 * The following macro defines the type of the mask arguments to
101 * select:
102 */
103
104 #ifndef NO_FD_SET
105 # define SELECT_MASK fd_set
106 #else
107 # ifndef _AIX
108 typedef long fd_mask;
109 # endif
110 # if defined(_IBMR2)
111 # define SELECT_MASK void
112 # else
113 # define SELECT_MASK int
114 # endif
115 #endif
116
117 /*
118 * The following macro defines the number of fd_masks in an fd_set:
119 */
120
121 #ifndef FD_SETSIZE
122 # ifdef OPEN_MAX
123 # define FD_SETSIZE OPEN_MAX
124 # else
125 # define FD_SETSIZE 256
126 # endif
127 #endif
128 #if !defined(howmany)
129 # define howmany(x, y) (((x)+((y)-1))/(y))
130 #endif
131 #ifndef NFDBITS
132 # define NFDBITS NBBY*sizeof(fd_mask)
133 #endif
134 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
135
136 /*
137 * Not all systems declare the errno variable in errno.h. so this
138 * file does it explicitly (maybe).
139 */
140
141 #include <errno.h>
142 #ifndef errno
143 extern int errno;
144 #endif
145
146 /*
147 * Define "NBBY" (number of bits per byte) if it's not already defined.
148 */
149
150 #ifndef NBBY
151 # define NBBY 8
152 #endif
153
154 /*
155 * These macros are just wrappers for the equivalent X Region calls.
156 */
157
158 #define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
159 #define TkCreateRegion() (TkRegion) XCreateRegion()
160 #define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
161 #define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
162 (Region) b, (Region) r)
163 #define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
164 #define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
165 #define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
166 (Region) b, (Region) r)
167 #define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
168 (Region) src, (Region) ret)
169
170 /*
171 * The TkPutImage macro strips off the color table information, which isn't
172 * needed for X.
173 */
174
175 #define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
176 XPutImage(display, pixels, gc, image, destx, desty, srcx, \
177 srcy, width, height);
178
179 /*
180 * Supply macros for seek offsets, if they're not already provided by
181 * an include file.
182 */
183
184 #ifndef SEEK_SET
185 # define SEEK_SET 0
186 #endif
187
188 #ifndef SEEK_CUR
189 # define SEEK_CUR 1
190 #endif
191
192 #ifndef SEEK_END
193 # define SEEK_END 2
194 #endif
195
196 /*
197 * Declarations for various library procedures that may not be declared
198 * in any other header file.
199 */
200
201
202 /*
203 * These functions do nothing under Unix, so we just eliminate calls to them.
204 */
205
206 #define TkpButtonSetDefaults(specPtr) {}
207 #define TkpDestroyButton(butPtr) {}
208 #define TkSelUpdateClipboard(a,b) {}
209 #define TkSetPixmapColormap(p,c) {}
210
211 /*
212 * These calls implement native bitmaps which are not supported under
213 * UNIX. The macros eliminate the calls.
214 */
215
216 #define TkpDefineNativeBitmaps()
217 #define TkpCreateNativeBitmap(display, source) None
218 #define TkpGetNativeAppBitmap(display, name, w, h) None
219
220 /*
221 * This macro stores a representation of the window handle in a string.
222 * This should perhaps use the real size of an XID.
223 */
224
225 #define TkpPrintWindowId(buf,w) \
226 sprintf((buf), "%#08lx", (unsigned long) (w))
227
228 /*
229 * This macro indicates that entry and text widgets should display
230 * the selection highlight regardless of which window has the focus.
231 */
232
233 #define ALWAYS_SHOW_SELECTION
234
235 /*
236 * The following declaration is used to get access to a private Tcl interface
237 * that is needed for portability reasons.
238 */
239
240 #ifndef _TCLINT
241 #include <tclInt.h>
242 #endif
243
244 #endif /* _UNIXPORT */
245