VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.0/misc.h@ 17448

Last change on this file since 17448 was 17448, checked in by vboxsync, 16 years ago

Additions/x11: added a full header set for X.Org server 1.5 and 1.6

  • Property svn:eol-style set to native
File size: 8.2 KB
Line 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46Copyright 1992, 1993 Data General Corporation;
47Copyright 1992, 1993 OMRON Corporation
48
49Permission to use, copy, modify, distribute, and sell this software and its
50documentation for any purpose is hereby granted without fee, provided that the
51above copyright notice appear in all copies and that both that copyright
52notice and this permission notice appear in supporting documentation, and that
53neither the name OMRON or DATA GENERAL be used in advertising or publicity
54pertaining to distribution of the software without specific, written prior
55permission of the party whose name is to be used. Neither OMRON or
56DATA GENERAL make any representation about the suitability of this software
57for any purpose. It is provided "as is" without express or implied warranty.
58
59OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
60SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
61IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT
62OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
63DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
64TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
65OF THIS SOFTWARE.
66
67******************************************************************/
68#ifndef MISC_H
69#define MISC_H 1
70/*
71 * X internal definitions
72 *
73 */
74
75extern unsigned long globalSerialNumber;
76extern unsigned long serverGeneration;
77
78#include <X11/Xosdefs.h>
79#include <X11/Xfuncproto.h>
80#include <X11/Xmd.h>
81#include <X11/X.h>
82#include <X11/Xdefs.h>
83
84#include <stddef.h>
85
86#ifndef MAXSCREENS
87#define MAXSCREENS 16
88#endif
89#define MAXCLIENTS 256
90#define MAXEXTENSIONS 128
91#define MAXFORMATS 8
92#define MAXDEVICES 20 /* input devices */
93
94#define EXTENSION_EVENT_BASE 64
95#define EXTENSION_BASE 128
96
97typedef unsigned long PIXEL;
98typedef unsigned long ATOM;
99
100
101#ifndef TRUE
102#define TRUE 1
103#define FALSE 0
104#endif
105
106#ifndef _XTYPEDEF_CALLBACKLISTPTR
107typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
108#define _XTYPEDEF_CALLBACKLISTPTR
109#endif
110
111typedef struct _xReq *xReqPtr;
112
113#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */
114#include <X11/Xfuncs.h> /* for bcopy, bzero, and bcmp */
115
116#define NullBox ((BoxPtr)0)
117#define MILLI_PER_MIN (1000 * 60)
118#define MILLI_PER_SECOND (1000)
119
120 /* this next is used with None and ParentRelative to tell
121 PaintWin() what to use to paint the background. Also used
122 in the macro IS_VALID_PIXMAP */
123
124#define USE_BACKGROUND_PIXEL 3
125#define USE_BORDER_PIXEL 3
126
127
128/* byte swap a 32-bit literal */
129#define lswapl(x) ((((x) & 0xff) << 24) |\
130 (((x) & 0xff00) << 8) |\
131 (((x) & 0xff0000) >> 8) |\
132 (((x) >> 24) & 0xff))
133
134/* byte swap a short literal */
135#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
136
137#undef min
138#undef max
139
140#define min(a, b) (((a) < (b)) ? (a) : (b))
141#define max(a, b) (((a) > (b)) ? (a) : (b))
142/* abs() is a function, not a macro; include the file declaring
143 * it in case we haven't done that yet.
144 */
145#include <stdlib.h>
146#ifndef Fabs
147#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
148#endif
149#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
150/* this assumes b > 0 */
151#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
152/*
153 * return the least significant bit in x which is set
154 *
155 * This works on 1's complement and 2's complement machines.
156 * If you care about the extra instruction on 2's complement
157 * machines, change to ((x) & (-(x)))
158 */
159#define lowbit(x) ((x) & (~(x) + 1))
160
161/* XXX Not for modules */
162#include <limits.h>
163#if !defined(MAXSHORT) || !defined(MINSHORT) || \
164 !defined(MAXINT) || !defined(MININT)
165/*
166 * Some implementations #define these through <math.h>, so preclude
167 * #include'ing it later.
168 */
169
170#include <math.h>
171#undef MAXSHORT
172#define MAXSHORT SHRT_MAX
173#undef MINSHORT
174#define MINSHORT SHRT_MIN
175#undef MAXINT
176#define MAXINT INT_MAX
177#undef MININT
178#define MININT INT_MIN
179
180#include <assert.h>
181#include <ctype.h>
182#include <stdio.h> /* for fopen, etc... */
183
184#endif
185
186/* some macros to help swap requests, replies, and events */
187
188#define LengthRestB(stuff) \
189 ((client->req_len << 2) - sizeof(*stuff))
190
191#define LengthRestS(stuff) \
192 ((client->req_len << 1) - (sizeof(*stuff) >> 1))
193
194#define LengthRestL(stuff) \
195 (client->req_len - (sizeof(*stuff) >> 2))
196
197#define SwapRestS(stuff) \
198 SwapShorts((short *)(stuff + 1), LengthRestS(stuff))
199
200#define SwapRestL(stuff) \
201 SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
202
203/* byte swap a 32-bit value */
204#define swapl(x, n) { \
205 n = ((char *) (x))[0];\
206 ((char *) (x))[0] = ((char *) (x))[3];\
207 ((char *) (x))[3] = n;\
208 n = ((char *) (x))[1];\
209 ((char *) (x))[1] = ((char *) (x))[2];\
210 ((char *) (x))[2] = n; }
211
212/* byte swap a short */
213#define swaps(x, n) { \
214 n = ((char *) (x))[0];\
215 ((char *) (x))[0] = ((char *) (x))[1];\
216 ((char *) (x))[1] = n; }
217
218/* copy 32-bit value from src to dst byteswapping on the way */
219#define cpswapl(src, dst) { \
220 ((char *)&(dst))[0] = ((char *) &(src))[3];\
221 ((char *)&(dst))[1] = ((char *) &(src))[2];\
222 ((char *)&(dst))[2] = ((char *) &(src))[1];\
223 ((char *)&(dst))[3] = ((char *) &(src))[0]; }
224
225/* copy short from src to dst byteswapping on the way */
226#define cpswaps(src, dst) { \
227 ((char *) &(dst))[0] = ((char *) &(src))[1];\
228 ((char *) &(dst))[1] = ((char *) &(src))[0]; }
229
230extern void SwapLongs(
231 CARD32 *list,
232 unsigned long count);
233
234extern void SwapShorts(
235 short *list,
236 unsigned long count);
237
238extern void MakePredeclaredAtoms(void);
239
240extern int Ones(
241 unsigned long /*mask*/);
242
243typedef struct _xPoint *DDXPointPtr;
244typedef struct pixman_box16 *BoxPtr;
245typedef struct _xEvent *xEventPtr;
246typedef struct _xRectangle *xRectanglePtr;
247typedef struct _GrabRec *GrabPtr;
248
249/* typedefs from other places - duplicated here to minimize the amount
250 * of unnecessary junk that one would normally have to include to get
251 * these symbols defined
252 */
253
254#ifndef _XTYPEDEF_CHARINFOPTR
255typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
256#define _XTYPEDEF_CHARINFOPTR
257#endif
258
259#endif /* MISC_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette