home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / clients / xpr / pmp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-19  |  1.7 KB  |  67 lines

  1. /*
  2.  *    $XConsortium: pmp.h,v 1.5 91/02/19 22:13:33 converse Exp $
  3.  */
  4.  
  5. /* Written by Jose' J. Capo' */
  6. /* (jjc@comet.lcs.mit.edu), June 1987 */
  7.  
  8. /* WARNING!!!:  Include this header after the standard headers (like */
  9.  /* <stdio.h>) of  the following might cause another header to */
  10.  /* redefine BUFSIZ */
  11. #ifndef BUFSIZ
  12. #define BUFSIZ    1024
  13. #endif
  14.  
  15. #define MAX_FRAME_LEN    512
  16. #define MAX_VECTOR_LEN    65535
  17.  
  18. #define DBG(cond)    if (dbg cond)
  19. #define DEBUG(cond)    if (debug cond)
  20. #define min(a,b)    ((a) < (b)? (a) : (b))
  21.  
  22. #define pel2inch(pels)        ((float) ((pels) / PPI))
  23. #define ppmask(rounded,thickness)    (0x20 * (rounded) + (thickness))
  24.  
  25.  
  26. #define min(a,b)    ((a) < (b)? (a) : (b))
  27. #define lo(x)    ((x) & 0xFF)
  28. #define hi(x)    (((x) & 0xFF00) >>8)
  29. #define hi2(x)    (((x) & 0xFF0000) >>16)
  30. #define p_wput(w, f)    {\
  31.                (void) putc(hi(w), (f)); \
  32.                (void) putc(lo(w), (f));\
  33.                }
  34. #define PMP(f, len)    { fprintf(f, "\033[C"); \
  35.                 p_putlh(f, len);\
  36.               }
  37. #define p_putlh(f, w)    {\
  38.                (void) putc(lo(w), (f));\
  39.                (void) putc(hi(w), (f)); \
  40.                }
  41.  
  42. /* hi-lo 2-byte integer */
  43. /* int hl2int(unsigned char *) */
  44. #define hl2int(hl2)    ((int) (0x100 * *(hl2) + *((hl2)+1)))
  45.  
  46. /* putlh2(FILE *, int) */
  47. #define puthl2(i, f) { (void) putc(hi((i)), (f));\
  48.                (void) putc(lo((i)), (f));\
  49.              }
  50.  
  51. /* hi-lo 3-byte integer */
  52. /* long hl3long(unsigned char *) */
  53. #define hl3long(hl3)    ((long) (0x10000 * *(hl3) + \
  54.                  0x100 * *((hl3)+1) + *((hl3)+2)))
  55.  
  56. /* puthl3(FILE *, long) */
  57. #define puthl3(l, f) { (void) putc(hi2((l)), (f));\
  58.                (void) putc(hi((l)), (f));\
  59.                (void) putc(lo((l)), (f));\
  60.              }
  61.  
  62. /* int int2sgn(int) */
  63. #define int2sgn(i)    (((i) > 0x8000 - 1)? (i)- 0x10000: (i))
  64.  
  65. /* int long3sgn(long) */
  66. #define long3sgn(l)    (((l) > 0x800000 - 1)? (l) - 0x1000000 : (l))
  67.