1 /* Copyright (c) 1987, 1989, 2012 University of Maryland Department of
2    Computer Science.
3 
4    Permission is hereby granted, free of charge, to any person obtaining
5    a copy of this software and associated documentation files (the
6    "Software"), to deal in the Software without restriction, including
7    without limitation, the rights to use, copy, modify, merge, publish,
8    distribute, sublicense, and/or sell copies of the Software, and to
9    permit persons to whom the Software is furnished to do so, subject to
10    the following conditions: The above copyright notice, this permission
11    notice and the disclaimer statement shall be included in all copies
12    or substantial portions of the Software.
13 
14    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22 
23 /*
24  * Macros to convert DVI opcodes to (hopefully) simpler values.
25  */
26 
27 /*
28  * Large range types---code may be any value (including EOF).
29  */
30 #define DVI_IsChar(code) ((ui32)(code) < 128)
31 #define DVI_IsFont(code) ((code) >= 171 && (code) < 235)
32 
33 /*
34  * Symbolic names for generic types (for things with parameters).
35  * These are obtained via the macro DVI_DT(int c), where 0 <= c <= 255.
36  */
37 #define	DT_CHAR		 0
38 #define DT_SET		 1
39 #define	DT_SETRULE	 2
40 #define DT_PUT		 3
41 #define	DT_PUTRULE	 4
42 #define	DT_NOP		 5
43 #define	DT_BOP		 6
44 #define	DT_EOP		 7
45 #define	DT_PUSH		 8
46 #define	DT_POP		 9
47 #define DT_RIGHT	10
48 #define DT_W0		11
49 #define	DT_W		12
50 #define	DT_X0		13
51 #define DT_X		14
52 #define DT_DOWN		15
53 #define	DT_Y0		16
54 #define DT_Y		17
55 #define	DT_Z0		18
56 #define DT_Z		19
57 #define	DT_FNTNUM	20
58 #define DT_FNT		21
59 #define DT_XXX		22
60 #define DT_FNTDEF	23
61 #define	DT_PRE		24
62 #define	DT_POST		25
63 #define	DT_POSTPOST	26
64 #define	DT_UNDEF	27
65 
66 /*
67  * Symbolic names for parameter lengths, obtained via the macro
68  * DVL_OpLen(int c).
69  *
70  * N.B.: older drivers may assume that 0 => none, 1-4 => 1-4 bytes
71  * and 5-7 => unsigned version of 1-4---so DO NOT change these values!
72  */
73 #define	DPL_NONE	0
74 #define	DPL_SGN1	1
75 #define	DPL_SGN2	2
76 #define	DPL_SGN3	3
77 #define	DPL_SGN4	4
78 #define	DPL_UNS1	5
79 #define	DPL_UNS2	6
80 #define	DPL_UNS3	7
81 /* there are no unsigned four byte parameters */
82 
83 #define DVI_OpLen(code)  (dvi_oplen[code])
84 #define DVI_DT(code)	 (dvi_dt[code])
85 extern char dvi_oplen[];
86 extern char dvi_dt[];
87