tkUnixPort.h

Go to the documentation of this file.
00001 /*
00002  * tkUnixPort.h --
00003  *
00004  *      This file is included by all of the Tk C files.  It contains
00005  *      information that may be configuration-dependent, such as
00006  *      #includes for system include files and a few other things.
00007  *
00008  * Copyright (c) 1991-1993 The Regents of the University of California.
00009  * Copyright (c) 1994-1996 Sun Microsystems, Inc.
00010  *
00011  * See the file "license.terms" for information on usage and redistribution
00012  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00013  *
00014  * RCS: @(#) $Id: tkUnixPort.h,v 1.1 2001/08/18 00:48:57 fmk Exp $
00015  */
00016 
00017 #ifndef _UNIXPORT
00018 #define _UNIXPORT
00019 
00020 #define __UNIX__ 1
00021 
00022 /*
00023  * Macro to use instead of "void" for arguments that must have
00024  * type "void *" in ANSI C;  maps them to type "char *" in
00025  * non-ANSI systems.  This macro may be used in some of the include
00026  * files below, which is why it is defined here.
00027  */
00028 
00029 #ifndef VOID
00030 #   ifdef __STDC__
00031 #       define VOID void
00032 #   else
00033 #       define VOID char
00034 #   endif
00035 #endif
00036 
00037 #include <stdio.h>
00038 #include <ctype.h>
00039 #include <fcntl.h>
00040 #ifdef HAVE_LIMITS_H
00041 #   include <limits.h>
00042 #else
00043 #   include "../compat/limits.h"
00044 #endif
00045 #include <math.h>
00046 #include <pwd.h>
00047 #ifdef NO_STDLIB_H
00048 #   include "../compat/stdlib.h"
00049 #else
00050 #   include <stdlib.h>
00051 #endif
00052 #include <string.h>
00053 #include <sys/types.h>
00054 #include <sys/file.h>
00055 #ifdef HAVE_SYS_SELECT_H
00056 #   include <sys/select.h>
00057 #endif
00058 #include <sys/stat.h>
00059 #ifndef _TCL
00060 #   include <tcl.h>
00061 #endif
00062 #if TIME_WITH_SYS_TIME
00063 #   include <sys/time.h>
00064 #   include <time.h>
00065 #else
00066 #   if HAVE_SYS_TIME_H
00067 #       include <sys/time.h>
00068 #   else
00069 #       include <time.h>
00070 #   endif
00071 #endif
00072 #ifdef HAVE_UNISTD_H
00073 #   include <unistd.h>
00074 #else
00075 #   include "../compat/unistd.h"
00076 #endif
00077 #include <X11/Xlib.h>
00078 #include <X11/cursorfont.h>
00079 #include <X11/keysym.h>
00080 #include <X11/Xatom.h>
00081 #include <X11/Xproto.h>
00082 #include <X11/Xresource.h>
00083 #include <X11/Xutil.h>
00084 
00085 /*
00086  * The following macro defines the type of the mask arguments to
00087  * select:
00088  */
00089 
00090 #ifndef NO_FD_SET
00091 #   define SELECT_MASK fd_set
00092 #else
00093 #   ifndef _AIX
00094         typedef long fd_mask;
00095 #   endif
00096 #   if defined(_IBMR2)
00097 #       define SELECT_MASK void
00098 #   else
00099 #       define SELECT_MASK int
00100 #   endif
00101 #endif
00102 
00103 /*
00104  * The following macro defines the number of fd_masks in an fd_set:
00105  */
00106 
00107 #ifndef FD_SETSIZE
00108 #   ifdef OPEN_MAX
00109 #       define FD_SETSIZE OPEN_MAX
00110 #   else
00111 #       define FD_SETSIZE 256
00112 #   endif
00113 #endif
00114 #if !defined(howmany)
00115 #   define howmany(x, y) (((x)+((y)-1))/(y))
00116 #endif
00117 #ifndef NFDBITS
00118 #   define NFDBITS NBBY*sizeof(fd_mask)
00119 #endif
00120 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
00121 
00122 /*
00123  * Not all systems declare the errno variable in errno.h. so this
00124  * file does it explicitly.
00125  */
00126 
00127 extern int errno;
00128 
00129 /*
00130  * Define "NBBY" (number of bits per byte) if it's not already defined.
00131  */
00132 
00133 #ifndef NBBY
00134 #   define NBBY 8
00135 #endif
00136 
00137 /*
00138  * These macros are just wrappers for the equivalent X Region calls.
00139  */
00140 
00141 #define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
00142 #define TkCreateRegion() (TkRegion) XCreateRegion()
00143 #define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
00144 #define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
00145         (Region) b, (Region) r)
00146 #define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
00147 #define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
00148 #define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
00149         (Region) src, (Region) ret)
00150 
00151 /*
00152  * The TkPutImage macro strips off the color table information, which isn't
00153  * needed for X.
00154  */
00155 
00156 #define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
00157         XPutImage(display, pixels, gc, image, destx, desty, srcx, \
00158         srcy, width, height);
00159 
00160 /*
00161  * Supply macros for seek offsets, if they're not already provided by
00162  * an include file.
00163  */
00164 
00165 #ifndef SEEK_SET
00166 #   define SEEK_SET 0
00167 #endif
00168 
00169 #ifndef SEEK_CUR
00170 #   define SEEK_CUR 1
00171 #endif
00172 
00173 #ifndef SEEK_END
00174 #   define SEEK_END 2
00175 #endif
00176 
00177 /*
00178  * Declarations for various library procedures that may not be declared
00179  * in any other header file.
00180  */
00181 
00182 
00183 /*
00184  * These functions do nothing under Unix, so we just eliminate calls to them.
00185  */
00186 
00187 #define TkpButtonSetDefaults(specPtr) {}
00188 #define TkpDestroyButton(butPtr) {}
00189 #define TkSelUpdateClipboard(a,b) {}
00190 #define TkSetPixmapColormap(p,c) {}
00191 
00192 /*
00193  * These calls implement native bitmaps which are not supported under
00194  * UNIX.  The macros eliminate the calls.
00195  */
00196 
00197 #define TkpDefineNativeBitmaps()
00198 #define TkpCreateNativeBitmap(display, source) None
00199 #define TkpGetNativeAppBitmap(display, name, w, h) None
00200 
00201 /*
00202  * This macro stores a representation of the window handle in a string.
00203  */
00204 
00205 #define TkpPrintWindowId(buf,w) \
00206         sprintf((buf), "0x%x", (unsigned int) (w))
00207             
00208 /*
00209  * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
00210  */
00211 
00212 #define TkpScanWindowId(i,s,wp) \
00213         Tcl_GetInt((i),(s),(wp))
00214             
00215 /*
00216  * This macro indicates that entry and text widgets should display
00217  * the selection highlight regardless of which window has the focus.
00218  */
00219 
00220 #define ALWAYS_SHOW_SELECTION
00221 
00222 /*
00223  * The following declaration is used to get access to a private Tcl interface
00224  * that is needed for portability reasons.
00225  */
00226 
00227 #ifndef _TCLINT
00228 #include <tclInt.h>
00229 #endif
00230 
00231 #endif /* _UNIXPORT */

Generated on Mon Oct 23 15:05:30 2006 for OpenSees by doxygen 1.5.0