summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/macros.h
blob: 2dc47421e91832c6d84e1b134c896be6342b5490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* $Log:	macros.h,v $
 * Revision 0.8  92/11/23  19:47:03  19:47:03  bt (Bo Thide')
 * Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
 * 
 * Revision 0.7  92/11/13  02:41:18  02:41:18  bt (Bo Thide')
 * More bug fixes and improvements. Support for PaintJet XL
 * 
 * Revision 0.6  92/11/10  21:48:44  21:48:44  bt (Bo Thide')
 * Bug fixes. Added -R option. Better font handling.
 * 
 * Revision 0.5  92/11/09  16:25:50  16:25:50  bt (Bo Thide')
 * Rewrite of dospecial.c. Extended \special support
 * 
 * Revision 0.4  92/11/08  02:46:07  02:46:07  bt (Bo Thide')
 * Changed to portable bit manipulations. Replaced strrstr for non-POSIX compliant C. Fixed numerous bugs. Added support for more \special's.
 * 
 * Revision 0.3  92/08/24  12:45:29  12:45:29  bt (Bo Thide')
 * Fixed 8 bit (dc font) support.
 * 
 * Revision 0.2  92/08/23  17:28:53  17:28:53  bt (Bo Thide')
 * Source cleaned up.  Changed certain function calls.  Removed globals.
 * 
 * Revision 0.1  92/08/22  23:58:47  23:58:47  bt (Bo Thide')
 * First Release.
 *  */

/* Use the "," operator to ensure proper evaluation order */
/* Help to fix bugs from Joel M. Hoffman <joel@wam.umd.edu> */

#ifndef _DVI2PCL_MACROS_INCLUDED
#define _DVI2PCL_MACROS_INCLUDED

long		_i;
/* Get unsigned one-, two-, three-, or four-byte values from a file "f" */
#define getubyte(f) (unsigned char)getc(f)
#define getupair(f) (_i=getubyte(f),_i<<=8,_i|=getubyte(f))
#define getutrio(f) (getupair(f),_i<<=8,_i|=getubyte(f))

/* Get signed one-, two-, three-, or four-byte values from a file "f" */
#define getsbyte(f) (char)getc(f)
#define getspair(f) (_i=getsbyte(f),_i<<=8,_i|=getubyte(f))
#define getstrio(f) (getspair(f),_i<<=8,_i|=getubyte(f))
#define getsquad(f) (getstrio(f),_i<<=8,_i|=getubyte(f))

/* Get unsigned one-, two-, three-, or four-byte values from a pointer "p" */
#define getpubyte(p) ((unsigned char)*p++)
#define getpupair(p) (_i=getpubyte(p),_i<<=8,_i|=getpubyte(p))
#define getputrio(p) (getpupair(p),_i<<=8,_i|=getpubyte(p))
#define getpuquad(p) (getputrio(p),_i<<=8,_i|=getpubyte(p))

/* Get signed one-, two-, three-, or four-byte values from a pointer "p" */
#define getpsbyte(p) ((char)*p++)
#define getpspair(p) (_i=getpsbyte(p),_i<<=8,_i|getpubyte(p))
#define getpstrio(p) (getpupair(p),_i<<=8,_i|getpubyte(p))
#define getpsquad(p) (getputrio(p),_i<<=8,_i|getpubyte(p))

double _f;
#define round(f) (long)((_f = (f)) < 0.0 ? _f - 0.5 : _f + 0.5)

/*
#define rulepixels(x)  (!(_a = round(convdot * x)) ? 1 : _a)
*/

#endif /* _DVI2PCL_MACROS_INCLUDED */