Xmd.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /***********************************************************
  2. Copyright 1987, 1998 The Open Group
  3. Permission to use, copy, modify, distribute, and sell this software and its
  4. documentation for any purpose is hereby granted without fee, provided that
  5. the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation.
  8. The above copyright notice and this permission notice shall be included in
  9. all copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  14. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. Except as contained in this notice, the name of The Open Group shall not be
  17. used in advertising or otherwise to promote the sale, use or other dealings
  18. in this Software without prior written authorization from The Open Group.
  19. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  20. All Rights Reserved
  21. Permission to use, copy, modify, and distribute this software and its
  22. documentation for any purpose and without fee is hereby granted,
  23. provided that the above copyright notice appear in all copies and that
  24. both that copyright notice and this permission notice appear in
  25. supporting documentation, and that the name of Digital not be
  26. used in advertising or publicity pertaining to distribution of the
  27. software without specific, written prior permission.
  28. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  29. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  30. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  31. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  32. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  33. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  34. SOFTWARE.
  35. ******************************************************************/
  36. #ifndef XMD_H
  37. # define XMD_H 1
  38. /*
  39. * Xmd.h: MACHINE DEPENDENT DECLARATIONS.
  40. */
  41. /*
  42. * Special per-machine configuration flags.
  43. */
  44. # if defined(__sun) && defined(__SVR4)
  45. # include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */
  46. # endif
  47. # if defined (_LP64) || defined(__LP64__) || \
  48. defined(__alpha) || defined(__alpha__) || \
  49. defined(__ia64__) || defined(ia64) || \
  50. defined(__sparc64__) || \
  51. defined(__s390x__) || \
  52. defined(__amd64__) || defined(amd64) || \
  53. defined(__powerpc64__)
  54. # if !defined(__ILP32__) /* amd64-x32 is 32bit */
  55. # define LONG64 /* 32/64-bit architecture */
  56. # endif /* !__ILP32__ */
  57. # endif
  58. /*
  59. * Definition of macro used to set constants for size of network structures;
  60. * machines with preprocessors that can't handle all of the sz_ symbols
  61. * can define this macro to be sizeof(x) if and only if their compiler doesn't
  62. * pad out structures (esp. the xTextElt structure which contains only two
  63. * one-byte fields). Network structures should always define sz_symbols.
  64. *
  65. * The sz_ prefix is used instead of something more descriptive so that the
  66. * symbols are no more than 32 characters long (which causes problems for some
  67. * compilers and preprocessors).
  68. *
  69. * The extra indirection is to get macro arguments to expand correctly before
  70. * the concatenation, rather than afterward.
  71. */
  72. # define _SIZEOF(x) sz_##x
  73. # define SIZEOF(x) _SIZEOF(x)
  74. /*
  75. * Bitfield suffixes for the protocol structure elements, if you
  76. * need them. Note that bitfields are not guaranteed to be signed
  77. * (or even unsigned) according to ANSI C.
  78. */
  79. # define B32 /* bitfield not needed on architectures with native 32-bit type */
  80. # define B16 /* bitfield not needed on architectures with native 16-bit type */
  81. # ifdef LONG64
  82. typedef long INT64;
  83. typedef int INT32;
  84. # else
  85. typedef long INT32;
  86. # endif
  87. typedef short INT16;
  88. typedef signed char INT8;
  89. # ifdef LONG64
  90. typedef unsigned long CARD64;
  91. typedef unsigned int CARD32;
  92. # else
  93. typedef unsigned long long CARD64;
  94. typedef unsigned long CARD32;
  95. # endif
  96. typedef unsigned short CARD16;
  97. typedef unsigned char CARD8;
  98. typedef CARD32 BITS32;
  99. typedef CARD16 BITS16;
  100. typedef CARD8 BYTE;
  101. typedef CARD8 BOOL;
  102. /*
  103. * was definitions for sign-extending bitfields on architectures without
  104. * native types smaller than 64-bit, now just backwards compatibility
  105. */
  106. # define cvtINT8toInt(val) (val)
  107. # define cvtINT16toInt(val) (val)
  108. # define cvtINT32toInt(val) (val)
  109. # define cvtINT8toShort(val) (val)
  110. # define cvtINT16toShort(val) (val)
  111. # define cvtINT32toShort(val) (val)
  112. # define cvtINT8toLong(val) (val)
  113. # define cvtINT16toLong(val) (val)
  114. # define cvtINT32toLong(val) (val)
  115. /*
  116. * this version should leave result of type (t *), but that should only be
  117. * used when not in MUSTCOPY
  118. */
  119. # define NEXTPTR(p,t) (((t *)(p)) + 1)
  120. #endif /* XMD_H */