VirtualBox

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

Last change on this file was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

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