]> git.sesse.net Git - rdpsrv/blob - Xserver/include/Xmd.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / include / Xmd.h
1 /***********************************************************
2
3 Copyright (c) 1987  X Consortium
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
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 X CONSORTIUM 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 X Consortium 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 X Consortium.
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 ******************************************************************/
48 #ifndef XMD_H
49 #define XMD_H 1
50 /* $XConsortium: Xmd.h,v 1.49 95/06/08 23:20:39 gildea Exp $ */
51 /* $XFree86: xc/include/Xmd.h,v 3.4 1996/12/31 04:15:20 dawes Exp $ */
52 /*
53  *  Xmd.h: MACHINE DEPENDENT DECLARATIONS.
54  */
55
56 /*
57  * Special per-machine configuration flags.
58  */
59 #ifdef CRAY
60 #define WORD64                          /* 64-bit architecture */
61 #endif
62 #if defined(__alpha) || defined(__alpha__)
63 #define LONG64                          /* 32/64-bit architecture */
64 #endif
65 #ifdef __sgi
66 #if (_MIPS_SZLONG == 64)
67 #define LONG64
68 #endif
69 #endif
70
71 /*
72  * Stuff to handle large architecture machines; the constants were generated
73  * on a 32-bit machine and must coorespond to the protocol.
74  */
75 #ifdef WORD64
76 #define MUSTCOPY
77 #endif /* WORD64 */
78
79
80 /*
81  * Definition of macro used to set constants for size of network structures;
82  * machines with preprocessors that can't handle all of the sz_ symbols
83  * can define this macro to be sizeof(x) if and only if their compiler doesn't
84  * pad out structures (esp. the xTextElt structure which contains only two 
85  * one-byte fields).  Network structures should always define sz_symbols.
86  *
87  * The sz_ prefix is used instead of something more descriptive so that the
88  * symbols are no more than 32 characters long (which causes problems for some
89  * compilers and preprocessors).
90  *
91  * The extra indirection in the __STDC__ case is to get macro arguments to
92  * expand correctly before the concatenation, rather than afterward.
93  */
94 #if ((defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)) && !defined(UNIXCPP)) || defined(ANSICPP)
95 #define _SIZEOF(x) sz_##x
96 #define SIZEOF(x) _SIZEOF(x)
97 #else
98 #define SIZEOF(x) sz_/**/x
99 #endif /* if ANSI C compiler else not */
100
101 /*
102  * Bitfield suffixes for the protocol structure elements, if you
103  * need them.  Note that bitfields are not guarranteed to be signed
104  * (or even unsigned) according to ANSI C.
105  */
106 #ifdef WORD64
107 typedef long INT64;
108 typedef unsigned long CARD64;
109 #define B32 :32
110 #define B16 :16
111 #ifdef UNSIGNEDBITFIELDS
112 typedef unsigned int INT32;
113 typedef unsigned int INT16;
114 #else
115 #ifdef __STDC__
116 typedef signed int INT32;
117 typedef signed int INT16;
118 #else
119 typedef int INT32;
120 typedef int INT16;
121 #endif
122 #endif
123 #else
124 #define B32
125 #define B16
126 #ifdef LONG64
127 typedef long INT64;
128 typedef int INT32;
129 #else
130 typedef long INT32;
131 #endif
132 typedef short INT16;
133 #endif
134
135 #if defined(__STDC__) || defined(sgi) || defined(AIXV3)
136 typedef signed char    INT8;
137 #else
138 typedef char           INT8;
139 #endif
140
141 #ifdef LONG64
142 typedef unsigned long CARD64;
143 typedef unsigned int CARD32;
144 #else
145 typedef unsigned long CARD32;
146 #endif
147 typedef unsigned short CARD16;
148 typedef unsigned char  CARD8;
149
150 typedef CARD32          BITS32;
151 typedef CARD16          BITS16;
152
153 #ifndef __EMX__
154 typedef CARD8           BYTE;
155 typedef CARD8           BOOL;
156 #else
157 /*
158  * This is bad style, but the central include file <os2.h> declares them
159  * as well
160  */
161 #define BYTE            CARD8
162 #define BOOL            CARD8
163 #endif
164
165
166 /*
167  * definitions for sign-extending bitfields on 64-bit architectures
168  */
169 #if defined(WORD64) && defined(UNSIGNEDBITFIELDS)
170 #define cvtINT8toInt(val)   (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val))
171 #define cvtINT16toInt(val)  (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val))
172 #define cvtINT32toInt(val)  (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val))
173 #define cvtINT8toShort(val)  cvtINT8toInt(val)
174 #define cvtINT16toShort(val) cvtINT16toInt(val)
175 #define cvtINT32toShort(val) cvtINT32toInt(val)
176 #define cvtINT8toLong(val)  cvtINT8toInt(val)
177 #define cvtINT16toLong(val) cvtINT16toInt(val)
178 #define cvtINT32toLong(val) cvtINT32toInt(val)
179 #else
180 #define cvtINT8toInt(val) (val)
181 #define cvtINT16toInt(val) (val)
182 #define cvtINT32toInt(val) (val)
183 #define cvtINT8toShort(val) (val)
184 #define cvtINT16toShort(val) (val)
185 #define cvtINT32toShort(val) (val)
186 #define cvtINT8toLong(val) (val)
187 #define cvtINT16toLong(val) (val)
188 #define cvtINT32toLong(val) (val)
189 #endif /* WORD64 and UNSIGNEDBITFIELDS */
190
191
192
193 #ifdef MUSTCOPY
194 /*
195  * This macro must not cast or else pointers will get aligned and be wrong
196  */
197 #define NEXTPTR(p,t)  (((char *) p) + SIZEOF(t))
198 #else /* else not MUSTCOPY, this is used for 32-bit machines */
199 /*
200  * this version should leave result of type (t *), but that should only be 
201  * used when not in MUSTCOPY
202  */  
203 #define NEXTPTR(p,t) (((t *)(p)) + 1)
204 #endif /* MUSTCOPY - used machines whose C structs don't line up with proto */
205
206 #endif /* XMD_H */