~ubuntu-branches/ubuntu/karmic/virtualbox-ose/karmic-updates

« back to all changes in this revision

Viewing changes to src/VBox/Additions/x11/x11include/4.2/programs/Xserver/include/misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-09-14 18:25:07 UTC
  • mfrom: (0.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090914182507-c98g07mq16hjmn6d
Tags: 3.0.6-dfsg-1ubuntu1
* Merge from debian unstable (LP: #429697), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
  - virtualbox, virtualbox-* (names of the upstream proprietary packages)
    conflict with virtualbox-ose (LP: #379878)
* Make debug package depend on normal or guest utils package
* Drop patches/22-pulseaudio-stubs.dpatch (applied upstream)
* Rename Ubuntu specific patches to uXX-*.dpatch
* Fix lintian warnings in maintainer scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.28 2001/12/14 19:59:55 dawes Exp $ */
2
 
/***********************************************************
3
 
 
4
 
Copyright 1987, 1998  The Open Group
5
 
 
6
 
Permission to use, copy, modify, distribute, and sell this software and its
7
 
documentation for any purpose is hereby granted without fee, provided that
8
 
the above copyright notice appear in all copies and that both that
9
 
copyright notice and this permission notice appear in supporting
10
 
documentation.
11
 
 
12
 
The above copyright notice and this permission notice shall be included in
13
 
all copies or substantial portions of the Software.
14
 
 
15
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18
 
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
 
 
22
 
Except as contained in this notice, the name of The Open Group shall not be
23
 
used in advertising or otherwise to promote the sale, use or other dealings
24
 
in this Software without prior written authorization from The Open Group.
25
 
 
26
 
 
27
 
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
 
 
29
 
                        All Rights Reserved
30
 
 
31
 
Permission to use, copy, modify, and distribute this software and its 
32
 
documentation for any purpose and without fee is hereby granted, 
33
 
provided that the above copyright notice appear in all copies and that
34
 
both that copyright notice and this permission notice appear in 
35
 
supporting documentation, and that the name of Digital not be
36
 
used in advertising or publicity pertaining to distribution of the
37
 
software without specific, written prior permission.  
38
 
 
39
 
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40
 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41
 
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43
 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44
 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45
 
SOFTWARE.
46
 
 
47
 
Copyright 1992, 1993 Data General Corporation;
48
 
Copyright 1992, 1993 OMRON Corporation  
49
 
 
50
 
Permission to use, copy, modify, distribute, and sell this software and its
51
 
documentation for any purpose is hereby granted without fee, provided that the
52
 
above copyright notice appear in all copies and that both that copyright
53
 
notice and this permission notice appear in supporting documentation, and that
54
 
neither the name OMRON or DATA GENERAL be used in advertising or publicity
55
 
pertaining to distribution of the software without specific, written prior
56
 
permission of the party whose name is to be used.  Neither OMRON or 
57
 
DATA GENERAL make any representation about the suitability of this software
58
 
for any purpose.  It is provided "as is" without express or implied warranty.  
59
 
 
60
 
OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
61
 
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
62
 
IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT
63
 
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
64
 
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65
 
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
66
 
OF 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
 
 
77
 
extern unsigned long globalSerialNumber;
78
 
extern 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
 
 
101
 
typedef unsigned long PIXEL;
102
 
typedef unsigned long ATOM;
103
 
 
104
 
 
105
 
#ifndef TRUE
106
 
#define TRUE 1
107
 
#define FALSE 0
108
 
#endif
109
 
 
110
 
#ifndef _XTYPEDEF_CALLBACKLISTPTR
111
 
typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
112
 
#define _XTYPEDEF_CALLBACKLISTPTR
113
 
#endif
114
 
 
115
 
typedef 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
 
 
240
 
extern void SwapLongs(
241
 
#if NeedFunctionPrototypes
242
 
    CARD32 *list,
243
 
    unsigned long count
244
 
#endif
245
 
);
246
 
 
247
 
extern void SwapShorts(
248
 
#if NeedFunctionPrototypes
249
 
    short *list,
250
 
    unsigned long count
251
 
#endif
252
 
);
253
 
 
254
 
extern void MakePredeclaredAtoms(
255
 
#if NeedFunctionPrototypes
256
 
    void
257
 
#endif
258
 
);
259
 
 
260
 
extern int Ones(
261
 
#if NeedFunctionPrototypes
262
 
    unsigned long /*mask*/
263
 
#endif
264
 
);
265
 
 
266
 
typedef struct _xPoint *DDXPointPtr;
267
 
typedef struct _Box *BoxPtr;
268
 
typedef struct _xEvent *xEventPtr;
269
 
typedef struct _xRectangle *xRectanglePtr;
270
 
typedef struct _GrabRec *GrabPtr;
271
 
 
272
 
/*  typedefs from other places - duplicated here to minimize the amount
273
 
 *  of unnecessary junk that one would normally have to include to get
274
 
 *  these symbols defined
275
 
 */
276
 
 
277
 
#ifndef _XTYPEDEF_CHARINFOPTR
278
 
typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
279
 
#define _XTYPEDEF_CHARINFOPTR
280
 
#endif
281
 
 
282
 
#endif /* MISC_H */