home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume5 / lwf / part01 / servermd.h < prev    next >
C/C++ Source or Header  |  1989-02-03  |  6KB  |  173 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. #ifndef SERVERMD_H
  25. #define SERVERMD_H 1
  26. /* $Header: servermd.h,v 1.30 88/05/17 13:41:01 rws Exp $ */
  27.  
  28. /*
  29.  * The vendor string identifies the vendor responsible for the
  30.  * server executable.
  31.  */
  32. #ifndef VENDOR_STRING
  33. #define VENDOR_STRING "MIT X Consortium"
  34. #endif    VENDOR_STRING
  35.  
  36. /*
  37.  * The vendor release number identifies, for the purpose of submitting
  38.  * traceable bug reports, the release number of software produced
  39.  * by the vendor.
  40.  */
  41. #ifndef VENDOR_RELEASE
  42. #define VENDOR_RELEASE    2
  43. #endif    VENDOR_RELEASE
  44.  
  45. /*
  46.  * Machine dependent values:
  47.  * GLYPHPADBYTES should be chosen with consideration for the space-time
  48.  * trade-off.  Padding to 0 bytes means that there is no wasted space
  49.  * in the font bitmaps (both on disk and in memory), but that access of
  50.  * the bitmaps will cause odd-address memory references.  Padding to
  51.  * 2 bytes would ensure even address memory references and would
  52.  * be suitable for a 68010-class machine, but at the expense of wasted
  53.  * space in the font bitmaps.  Padding to 4 bytes would be good
  54.  * for real 32 bit machines, etc.  Be sure that you tell the font
  55.  * compiler what kind of padding you want because its defines are
  56.  * kept separate from this.  See server/include/fonts.h for how
  57.  * GLYPHPADBYTES is used.
  58.  *
  59.  * Along with this, you should choose an appropriate value for
  60.  * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
  61.  * constant choses what kind of memory references are guarenteed during
  62.  * font access; either 1, 2 or 4, for byte, word or longword access,
  63.  * respectively.  For instance, if you have decided to to have
  64.  * GLYPHPADBYTES == 4, then it is pointless for you to have a
  65.  * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
  66.  * guarenteed you that your fonts are longword aligned.  On the other
  67.  * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
  68.  * also decide that the computing involved in aligning the pointer is more
  69.  * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
  70.  * 
  71.  * XXX: this code has changed since beta test and only GLYPHPADBYTES == 4
  72.  * has been tested, hence all machines have this same value.
  73.  *
  74.  */
  75.  
  76. #ifdef vax
  77.  
  78. #define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the VAX only */
  79. #define BITMAP_BIT_ORDER    LSBFirst
  80. #define    GLYPHPADBYTES        1
  81. #define GETLEFTBITS_ALIGNMENT    4
  82.  
  83. #else
  84. # ifdef sun
  85.  
  86. # if (sun386 || sun5)
  87. #define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the SUN only */
  88. #define BITMAP_BIT_ORDER    LSBFirst
  89. # else
  90. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the SUN only */
  91. #define BITMAP_BIT_ORDER    MSBFirst
  92. # endif
  93.  
  94. #define    GLYPHPADBYTES        4
  95. #define GETLEFTBITS_ALIGNMENT    4
  96.  
  97. # else
  98. #  ifdef apollo
  99.  
  100. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the Apollo only*/
  101. #define BITMAP_BIT_ORDER    MSBFirst
  102. #define    GLYPHPADBYTES        2
  103. #define GETLEFTBITS_ALIGNMENT    4
  104.  
  105. #  else
  106. #   ifdef ibm032
  107.  
  108. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the RT only*/
  109. #define BITMAP_BIT_ORDER    MSBFirst
  110. #define    GLYPHPADBYTES        1
  111. #define GETLEFTBITS_ALIGNMENT    4
  112. /* ibm pcc doesn't understand pragmas. */
  113.  
  114. #   else
  115. #    ifdef hpux
  116.  
  117. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the HP only */
  118. #define BITMAP_BIT_ORDER    MSBFirst
  119. #define    GLYPHPADBYTES        2
  120. #define    GETLEFTBITS_ALIGNMENT    4
  121.  
  122. #    endif
  123.  
  124. #   endif
  125. #  endif
  126. # endif
  127. #endif
  128.  
  129. /* size of buffer to use with GetImage, measured in bytes. There's obviously
  130.  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
  131.  * you) used and the number of times the ddx routine has to be called.
  132.  * 
  133.  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get 
  134.  * 8192/4 words per buffer 
  135.  * (1024/32) = 32 words per scanline
  136.  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
  137.  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
  138.  */
  139. #define IMAGE_BUFSIZE        8192
  140.  
  141. /* pad scanline to a longword */
  142. #define BITMAP_SCANLINE_UNIT    32
  143. #define BITMAP_SCANLINE_PAD  32
  144.  
  145. #define LOG2_BITMAP_PAD        5
  146. #define LOG2_BYTES_PER_SCANLINE_PAD    2
  147.  
  148. /* 
  149.  *   This returns the number of padding units, for depth d and width w.
  150.  * For bitmaps this can be calculated with the macros above.
  151.  * Other depths require either grovelling over the formats field of the
  152.  * screenInfo or hardwired constants.
  153.  */
  154.  
  155. typedef struct _PaddingInfo {
  156.     int    scanlinePad;
  157.     int    bitmapPadLog2;
  158. } PaddingInfo;
  159. extern PaddingInfo PixmapWidthPaddingInfo[];
  160.  
  161. #define PixmapWidthInPadUnits(w, d) \
  162.     (((w) + PixmapWidthPaddingInfo[d].scanlinePad) >> \
  163.     PixmapWidthPaddingInfo[d].bitmapPadLog2)
  164.  
  165. /*
  166.  *    Return the number of bytes to which a scanline of the given
  167.  * depth and width will be padded.
  168.  */
  169. #define PixmapBytePad(w, d) \
  170.     (PixmapWidthInPadUnits(w, d) << LOG2_BYTES_PER_SCANLINE_PAD)
  171.  
  172. #endif SERVERMD_H
  173.