/***********************************************************12Copyright 1987, 1998 The Open Group34Permission to use, copy, modify, distribute, and sell this software and its5documentation for any purpose is hereby granted without fee, provided that6the above copyright notice appear in all copies and that both that7copyright notice and this permission notice appear in supporting8documentation.910The above copyright notice and this permission notice shall be included in11all copies or substantial portions of the Software.1213THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN17AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN18CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.1920Except as contained in this notice, the name of The Open Group shall not be21used in advertising or otherwise to promote the sale, use or other dealings22in this Software without prior written authorization from The Open Group.232425Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.2627All Rights Reserved2829Permission to use, copy, modify, and distribute this software and its30documentation for any purpose and without fee is hereby granted,31provided that the above copyright notice appear in all copies and that32both that copyright notice and this permission notice appear in33supporting documentation, and that the name of Digital not be34used in advertising or publicity pertaining to distribution of the35software without specific, written prior permission.3637DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS43SOFTWARE.4445******************************************************************/46#ifndef XMD_H47# define XMD_H 148/*49* Xmd.h: MACHINE DEPENDENT DECLARATIONS.50*/5152/*53* Special per-machine configuration flags.54*/55# if defined(__sun) && defined(__SVR4)56# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */57# endif5859# if defined (_LP64) || defined(__LP64__) || \60defined(__alpha) || defined(__alpha__) || \61defined(__ia64__) || defined(ia64) || \62defined(__sparc64__) || \63defined(__s390x__) || \64defined(__amd64__) || defined(amd64) || \65defined(__powerpc64__)66# define LONG64 /* 32/64-bit architecture */67# endif6869/*70* Stuff to handle large architecture machines; the constants were generated71* on a 32-bit machine and must correspond to the protocol.72*/73# ifdef WORD6474# define MUSTCOPY75# endif /* WORD64 */767778/*79* Definition of macro used to set constants for size of network structures;80* machines with preprocessors that can't handle all of the sz_ symbols81* can define this macro to be sizeof(x) if and only if their compiler doesn't82* pad out structures (esp. the xTextElt structure which contains only two83* one-byte fields). Network structures should always define sz_symbols.84*85* The sz_ prefix is used instead of something more descriptive so that the86* symbols are no more than 32 characters long (which causes problems for some87* compilers and preprocessors).88*89* The extra indirection is to get macro arguments to expand correctly before90* the concatenation, rather than afterward.91*/92# define _SIZEOF(x) sz_##x93# define SIZEOF(x) _SIZEOF(x)9495/*96* Bitfield suffixes for the protocol structure elements, if you97* need them. Note that bitfields are not guaranteed to be signed98* (or even unsigned) according to ANSI C.99*/100# ifdef WORD64101typedef long INT64;102typedef unsigned long CARD64;103# define B32 :32104# define B16 :16105# ifdef UNSIGNEDBITFIELDS106typedef unsigned int INT32;107typedef unsigned int INT16;108# else109typedef signed int INT32;110typedef signed int INT16;111# endif112# else113# define B32114# define B16115# ifdef LONG64116typedef long INT64;117typedef int INT32;118# else119typedef long INT32;120# endif121typedef short INT16;122# endif123124typedef signed char INT8;125126# ifdef LONG64127typedef unsigned long CARD64;128typedef unsigned int CARD32;129# else130typedef unsigned long CARD32;131# endif132# if !defined(WORD64) && !defined(LONG64)133typedef unsigned long long CARD64;134# endif135typedef unsigned short CARD16;136typedef unsigned char CARD8;137138typedef CARD32 BITS32;139typedef CARD16 BITS16;140141typedef CARD8 BYTE;142typedef CARD8 BOOL;143144/*145* definitions for sign-extending bitfields on 64-bit architectures146*/147# if defined(WORD64) && defined(UNSIGNEDBITFIELDS)148# define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val))149# define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val))150# define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val))151# define cvtINT8toShort(val) cvtINT8toInt(val)152# define cvtINT16toShort(val) cvtINT16toInt(val)153# define cvtINT32toShort(val) cvtINT32toInt(val)154# define cvtINT8toLong(val) cvtINT8toInt(val)155# define cvtINT16toLong(val) cvtINT16toInt(val)156# define cvtINT32toLong(val) cvtINT32toInt(val)157# else158# define cvtINT8toInt(val) (val)159# define cvtINT16toInt(val) (val)160# define cvtINT32toInt(val) (val)161# define cvtINT8toShort(val) (val)162# define cvtINT16toShort(val) (val)163# define cvtINT32toShort(val) (val)164# define cvtINT8toLong(val) (val)165# define cvtINT16toLong(val) (val)166# define cvtINT32toLong(val) (val)167# endif /* WORD64 and UNSIGNEDBITFIELDS */168169170171# ifdef MUSTCOPY172/*173* This macro must not cast or else pointers will get aligned and be wrong174*/175# define NEXTPTR(p,t) (((char *) p) + SIZEOF(t))176# else /* else not MUSTCOPY, this is used for 32-bit machines */177/*178* this version should leave result of type (t *), but that should only be179* used when not in MUSTCOPY180*/181# define NEXTPTR(p,t) (((t *)(p)) + 1)182# endif /* MUSTCOPY - used machines whose C structs don't line up with proto */183184#endif /* XMD_H */185186187