OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [unix/] [tkUnixPort.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
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
 * Copyright (c) 1998 by Scriptics Corporation.
11
 *
12
 * See the file "license.terms" for information on usage and redistribution
13
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14
 *
15
 * RCS: @(#) $Id: tkUnixPort.h,v 1.1.1.1 2002-01-16 10:26:01 markom Exp $
16
 */
17
 
18
#ifndef _UNIXPORT
19
#define _UNIXPORT
20
 
21
#define __UNIX__ 1
22
 
23
/*
24
 * Macro to use instead of "void" for arguments that must have
25
 * type "void *" in ANSI C;  maps them to type "char *" in
26
 * non-ANSI systems.  This macro may be used in some of the include
27
 * files below, which is why it is defined here.
28
 */
29
 
30
#ifndef VOID
31
#   ifdef __STDC__
32
#       define VOID void
33
#   else
34
#       define VOID char
35
#   endif
36
#endif
37
 
38
#include <stdio.h>
39
#include <ctype.h>
40
#include <fcntl.h>
41
#ifdef HAVE_LIMITS_H
42
#   include <limits.h>
43
#else
44
#   include "../compat/limits.h"
45
#endif
46
#include <math.h>
47
#include <pwd.h>
48
#ifdef NO_STDLIB_H
49
#   include "../compat/stdlib.h"
50
#else
51
#   include <stdlib.h>
52
#endif
53
/* CYGNUS LOCAL: Don't include the system string.h if we've already
54
   included tcl/compat/string.h.  Otherwise you can't include both
55
   tclInt.h and tkInt.h (not that you should anyhow, but some SN code
56
   does).  */
57
#ifndef _STRING
58
#   include <string.h>
59
#endif
60
#include <sys/types.h>
61
#include <sys/file.h>
62
#ifdef HAVE_SYS_SELECT_H
63
#   include <sys/select.h>
64
#endif
65
#include <sys/stat.h>
66
#ifndef _TCL
67
#   include <tcl.h>
68
#endif
69
#if TIME_WITH_SYS_TIME
70
#   include <sys/time.h>
71
#   include <time.h>
72
#else
73
#   if HAVE_SYS_TIME_H
74
#       include <sys/time.h>
75
#   else
76
#       include <time.h>
77
#   endif
78
#endif
79
#ifdef HAVE_UNISTD_H
80
#   include <unistd.h>
81
#else
82
#   include "../compat/unistd.h"
83
#endif
84
#include <X11/Xlib.h>
85
#include <X11/cursorfont.h>
86
#include <X11/keysym.h>
87
#include <X11/Xatom.h>
88
#include <X11/Xproto.h>
89
#include <X11/Xresource.h>
90
#include <X11/Xutil.h>
91
 
92
/*
93
 * The following macro defines the type of the mask arguments to
94
 * select:
95
 */
96
 
97
#ifndef NO_FD_SET
98
#   define SELECT_MASK fd_set
99
#else
100
#   ifndef _AIX
101
        typedef long fd_mask;
102
#   endif
103
#   if defined(_IBMR2)
104
#       define SELECT_MASK void
105
#   else
106
#       define SELECT_MASK int
107
#   endif
108
#endif
109
 
110
/*
111
 * The following macro defines the number of fd_masks in an fd_set:
112
 */
113
 
114
#ifndef FD_SETSIZE
115
#   ifdef OPEN_MAX
116
#       define FD_SETSIZE OPEN_MAX
117
#   else
118
#       define FD_SETSIZE 256
119
#   endif
120
#endif
121
#if !defined(howmany)
122
#   define howmany(x, y) (((x)+((y)-1))/(y))
123
#endif
124
#ifndef NFDBITS
125
#   define NFDBITS NBBY*sizeof(fd_mask)
126
#endif
127
#define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
128
 
129
/*
130
 * Not all systems declare the errno variable in errno.h. so this
131
 * file does it explicitly.
132
 */
133
 
134
extern int errno;
135
 
136
/*
137
 * Define "NBBY" (number of bits per byte) if it's not already defined.
138
 */
139
 
140
#ifndef NBBY
141
#   define NBBY 8
142
#endif
143
 
144
/*
145
 * These macros are just wrappers for the equivalent X Region calls.
146
 */
147
 
148
#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
149
#define TkCreateRegion() (TkRegion) XCreateRegion()
150
#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
151
#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
152
        (Region) b, (Region) r)
153
#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
154
#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
155
#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
156
        (Region) src, (Region) ret)
157
 
158
/*
159
 * The TkPutImage macro strips off the color table information, which isn't
160
 * needed for X.
161
 */
162
 
163
#define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
164
        XPutImage(display, pixels, gc, image, destx, desty, srcx, \
165
        srcy, width, height);
166
 
167
/*
168
 * Supply macros for seek offsets, if they're not already provided by
169
 * an include file.
170
 */
171
 
172
#ifndef SEEK_SET
173
#   define SEEK_SET 0
174
#endif
175
 
176
#ifndef SEEK_CUR
177
#   define SEEK_CUR 1
178
#endif
179
 
180
#ifndef SEEK_END
181
#   define SEEK_END 2
182
#endif
183
 
184
/*
185
 * Declarations for various library procedures that may not be declared
186
 * in any other header file.
187
 */
188
 
189
extern void             panic _ANSI_ARGS_(TCL_VARARGS(char *, string));
190
 
191
/*
192
 * These functions do nothing under Unix, so we just eliminate calls to them.
193
 */
194
 
195
#define TkpDestroyButton(butPtr) {}
196
#define TkSelUpdateClipboard(a,b) {}
197
#define TkSetPixmapColormap(p,c) {}
198
 
199
/*
200
 * These calls implement native bitmaps which are not supported under
201
 * UNIX.  The macros eliminate the calls.
202
 */
203
 
204
#define TkpDefineNativeBitmaps()
205
#define TkpCreateNativeBitmap(display, source) None
206
#define TkpGetNativeAppBitmap(display, name, w, h) None
207
 
208
/*
209
 * This macro stores a representation of the window handle in a string.
210
 */
211
 
212
#define TkpPrintWindowId(buf,w) \
213
        sprintf((buf), "0x%x", (unsigned int) (w))
214
 
215
/*
216
 * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
217
 */
218
 
219
#define TkpScanWindowId(i,s,wp) \
220
        Tcl_GetInt((i),(s),(wp))
221
 
222
/*
223
 * This macro indicates that entry and text widgets should display
224
 * the selection highlight regardless of which window has the focus.
225
 */
226
 
227
#define ALWAYS_SHOW_SELECTION
228
 
229
/*
230
 * The following declaration is used to get access to a private Tcl interface
231
 * that is needed for portability reasons.
232
 */
233
 
234
EXTERN void             TclpGetTime _ANSI_ARGS_((Tcl_Time *time));
235
 
236
#endif /* _UNIXPORT */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.