home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / hetero.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.5 KB  |  108 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_HETERO_H
  11. #define _SYS_HETERO_H
  12.  
  13. #ident    "@(#)/usr/include/sys/hetero.h.sl 1.1 4.0 12/08/90 57260 AT&T-USL"
  14.  
  15. /*
  16.  *    Define machine attributes for heterogeneity.
  17.  *
  18.  *    Also define macros for determining the resultant size of a
  19.  *    conversion.
  20.  *
  21.  *    Machine attribute consists of three components -
  22.  *    byte ordering, alignment, and data unit size.
  23.  *    The machine attributes are defined in a byte (8 bits),
  24.  *    the lower 2 bits are used to define the byte ordering,
  25.  *    the middle 3 bits are used to define the alignment,
  26.  *    the higher 3 bits are used to define the data unit size.
  27.  *
  28.  *
  29.  *    BYTE_ORDER    0x01    3B, IBM byte ordering
  30.  *            0x02    VAX byte ordering
  31.  *    ALIGNMENT    0x04    word aligned (4 bytes boundary)
  32.  *            0x08    half-word aligned (2 bytes boundary)
  33.  *            0x0c    byte aligned
  34.  *    UNIT_SIZE    0x20    4 bytes integer, 2 bytes short, 4 bytes pointer
  35.  *            0x40    2 bytes integer, 2 bytes short, 2 bytes pointer
  36.  */
  37.  
  38.  
  39. /*
  40.  *    Define masks for machine attributes
  41.  */
  42.  
  43. #define BYTE_MASK    0x03
  44. #define ALIGN_MASK    0x1c
  45. #define UNIT_MASK    0xe0
  46.  
  47.  
  48. /*
  49.  *    Define what need to be converted - header or data parts
  50.  */
  51.  
  52. #define ALL_CONV    0    /* convert both header and data parts */
  53. #define DATA_CONV    1    /* convert data part */
  54. #define NO_CONV        2    /* no conversion needed */
  55.  
  56.  
  57.  
  58. #ifdef u3b2
  59. /*
  60.  *    Define machine attributes for 3B
  61.  */
  62.  
  63. #define BYTE_ORDER    0x01
  64. #define ALIGNMENT    0x04
  65. #define UNIT_SIZE    0x20
  66. #endif
  67.  
  68. #ifdef i286
  69. /*
  70.  *    Define machine attributes for Intel 286
  71.  */
  72.  
  73. #define BYTE_ORDER    0x02
  74. #define ALIGNMENT    0x08
  75. #define UNIT_SIZE    0x40
  76. #endif
  77.  
  78. #ifdef i386
  79. /*
  80.  *    Define machine attributes for Intel 386
  81.  */
  82.  
  83. #define BYTE_ORDER    0x02
  84. #define ALIGNMENT    0x04
  85. #define UNIT_SIZE    0x20
  86. #endif
  87.  
  88.  
  89. #define MACHTYPE    (BYTE_ORDER | ALIGNMENT | UNIT_SIZE)
  90.  
  91.  
  92. /*
  93.  *    Define macros for determining the size in bytes of the result of a
  94.  *     conversion.
  95.  *
  96.  */
  97.  
  98. /*     A c0 conversion produces a buffer aligned on long boundary both at
  99.  *    the beginning and at the end, containing a long for the character
  100.  *    string length (including a NULL) and the character string itself
  101.  *    (including a NULL).
  102.  */
  103.  
  104. #define C0SIZE(stringlen) (stringlen) + 2 * (sizeof(long) - 1) + \
  105.         sizeof(long) + sizeof(char)
  106.  
  107. #endif        /* _SYS_HETERO_H */
  108.