Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libtk/unix/tkUnixPort.h
1811 views
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-1995 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
* SCCS: @(#) tkUnixPort.h 1.19 96/10/02 15:40:33
15
*/
16
17
#ifndef _UNIXPORT
18
#define _UNIXPORT
19
20
/*
21
* Macro to use instead of "void" for arguments that must have
22
* type "void *" in ANSI C; maps them to type "char *" in
23
* non-ANSI systems. This macro may be used in some of the include
24
* files below, which is why it is defined here.
25
*/
26
27
#ifndef VOID
28
# ifdef __STDC__
29
# define VOID void
30
# else
31
# define VOID char
32
# endif
33
#endif
34
35
#include <stdio.h>
36
#include <ctype.h>
37
#include <fcntl.h>
38
#ifdef HAVE_LIMITS_H
39
# include <limits.h>
40
#else
41
# include "../compat/limits.h"
42
#endif
43
#include <math.h>
44
#include <pwd.h>
45
#ifdef NO_STDLIB_H
46
# include "../compat/stdlib.h"
47
#else
48
# include <stdlib.h>
49
#endif
50
#include <string.h>
51
#include <sys/types.h>
52
#include <sys/file.h>
53
#include <sys/stat.h>
54
#ifndef _TCL
55
# include <tcl.h>
56
#endif
57
#ifdef HAVE_UNISTD_H
58
# include <unistd.h>
59
#else
60
# include "../compat/unistd.h"
61
#endif
62
#if _PACKAGE_ast
63
# include <Xlib.h>
64
# include <cursorfont.h>
65
# include <keysym.h>
66
# include <Xatom.h>
67
# include <Xproto.h>
68
# include <Xresource.h>
69
# include <Xutil.h>
70
#else
71
# include <X11/Xlib.h>
72
# include <X11/cursorfont.h>
73
# include <X11/keysym.h>
74
# include <X11/Xatom.h>
75
# include <X11/Xproto.h>
76
# include <X11/Xresource.h>
77
# include <X11/Xutil.h>
78
#endif
79
80
/*
81
* Not all systems declare the errno variable in errno.h. so this
82
* file does it explicitly.
83
*/
84
85
extern int errno;
86
87
/*
88
* Define "NBBY" (number of bits per byte) if it's not already defined.
89
*/
90
91
#ifndef NBBY
92
# define NBBY 8
93
#endif
94
95
/*
96
* These macros are just wrappers for the equivalent X Region calls.
97
*/
98
99
#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
100
#define TkCreateRegion() (TkRegion) XCreateRegion()
101
#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
102
#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
103
(Region) b, (Region) r)
104
#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
105
#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
106
#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
107
(Region) src, (Region) ret)
108
109
/*
110
* The TkPutImage macro strips off the color table information, which isn't
111
* needed for X.
112
*/
113
114
#define TkPutImage(colors, ncolors, display, pixels, gc, image, destx, desty, srcx, srcy, width, height) \
115
XPutImage(display, pixels, gc, image, destx, desty, srcx, \
116
srcy, width, height);
117
118
/*
119
* The following Tk functions are implemented as macros under Windows.
120
*/
121
122
#define TkGetNativeProlog(interp) TkGetProlog(interp)
123
124
/*
125
* Supply macros for seek offsets, if they're not already provided by
126
* an include file.
127
*/
128
129
#ifndef SEEK_SET
130
# define SEEK_SET 0
131
#endif
132
133
#ifndef SEEK_CUR
134
# define SEEK_CUR 1
135
#endif
136
137
#ifndef SEEK_END
138
# define SEEK_END 2
139
#endif
140
141
/*
142
* Declarations for various library procedures that may not be declared
143
* in any other header file.
144
*/
145
146
extern void panic();
147
148
/*
149
* These functions do nothing under Unix, so we just eliminate calls them.
150
*/
151
152
#define TkSelUpdateClipboard(a,b) {}
153
#define TkSetPixmapColormap(p,c) {}
154
155
#endif /* _UNIXPORT */
156
157