home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / macros.h < prev    next >
C/C++ Source or Header  |  1992-11-25  |  3KB  |  65 lines

  1. /* $Log:    macros.h,v $
  2.  * Revision 0.8  92/11/23  19:47:03  19:47:03  bt (Bo Thide')
  3.  * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
  4.  * 
  5.  * Revision 0.7  92/11/13  02:41:18  02:41:18  bt (Bo Thide')
  6.  * More bug fixes and improvements. Support for PaintJet XL
  7.  * 
  8.  * Revision 0.6  92/11/10  21:48:44  21:48:44  bt (Bo Thide')
  9.  * Bug fixes. Added -R option. Better font handling.
  10.  * 
  11.  * Revision 0.5  92/11/09  16:25:50  16:25:50  bt (Bo Thide')
  12.  * Rewrite of dospecial.c. Extended \special support
  13.  * 
  14.  * Revision 0.4  92/11/08  02:46:07  02:46:07  bt (Bo Thide')
  15.  * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
  16.  * 
  17.  * Revision 0.3  92/08/24  12:45:29  12:45:29  bt (Bo Thide')
  18.  * Fixed 8 bit (dc font) support.
  19.  * 
  20.  * Revision 0.2  92/08/23  17:28:53  17:28:53  bt (Bo Thide')
  21.  * Source cleaned up.  Changed certain function calls.  Removed globals.
  22.  * 
  23.  * Revision 0.1  92/08/22  23:58:47  23:58:47  bt (Bo Thide')
  24.  * First Release.
  25.  *  */
  26.  
  27. /* Use the "," operator to ensure proper evaluation order */
  28. /* Help to fix bugs from Joel M. Hoffman <joel@wam.umd.edu> */
  29.  
  30. #ifndef _DVI2PCL_MACROS_INCLUDED
  31. #define _DVI2PCL_MACROS_INCLUDED
  32.  
  33. long        _i;
  34. /* Get unsigned one-, two-, three-, or four-byte values from a file "f" */
  35. #define getubyte(f) (unsigned char)getc(f)
  36. #define getupair(f) (_i=getubyte(f),_i<<=8,_i|=getubyte(f))
  37. #define getutrio(f) (getupair(f),_i<<=8,_i|=getubyte(f))
  38.  
  39. /* Get signed one-, two-, three-, or four-byte values from a file "f" */
  40. #define getsbyte(f) (char)getc(f)
  41. #define getspair(f) (_i=getsbyte(f),_i<<=8,_i|=getubyte(f))
  42. #define getstrio(f) (getspair(f),_i<<=8,_i|=getubyte(f))
  43. #define getsquad(f) (getstrio(f),_i<<=8,_i|=getubyte(f))
  44.  
  45. /* Get unsigned one-, two-, three-, or four-byte values from a pointer "p" */
  46. #define getpubyte(p) ((unsigned char)*p++)
  47. #define getpupair(p) (_i=getpubyte(p),_i<<=8,_i|=getpubyte(p))
  48. #define getputrio(p) (getpupair(p),_i<<=8,_i|=getpubyte(p))
  49. #define getpuquad(p) (getputrio(p),_i<<=8,_i|=getpubyte(p))
  50.  
  51. /* Get signed one-, two-, three-, or four-byte values from a pointer "p" */
  52. #define getpsbyte(p) ((char)*p++)
  53. #define getpspair(p) (_i=getpsbyte(p),_i<<=8,_i|getpubyte(p))
  54. #define getpstrio(p) (getpupair(p),_i<<=8,_i|getpubyte(p))
  55. #define getpsquad(p) (getputrio(p),_i<<=8,_i|getpubyte(p))
  56.  
  57. double _f;
  58. #define round(f) (long)((_f = (f)) < 0.0 ? _f - 0.5 : _f + 0.5)
  59.  
  60. /*
  61. #define rulepixels(x)  (!(_a = round(convdot * x)) ? 1 : _a)
  62. */
  63.  
  64. #endif /* _DVI2PCL_MACROS_INCLUDED */
  65.