xref: /plan9/sys/src/cmd/postscript/posttek/posttek.h (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 /*
2  *
3  * Tektronix 4014 control codes.
4  *
5  */
6 
7 #define NUL '\000'
8 #define SOH '\001'
9 #define STX '\002'
10 #define ETX '\003'
11 #define EOT '\004'
12 #define ENQ '\005'
13 #define ACK '\006'
14 #define BEL '\007'
15 #define BS  '\010'
16 #define HT  '\011'
17 #define NL  '\012'
18 #define VT  '\013'
19 #define FF  '\014'
20 #define CR  '\015'
21 #define SO  '\016'
22 #define SI  '\017'
23 #define DLE '\020'
24 #define DC1 '\021'
25 #define DC2 '\022'
26 #define DC3 '\023'
27 #define DC4 '\024'
28 #define NAK '\025'
29 #define SYN '\026'
30 #define ETB '\027'
31 #define CAN '\030'
32 #define EM  '\031'
33 #define SUB '\032'
34 #define ESC '\033'
35 #define FS  '\034'
36 #define GS  '\035'
37 #define RS  '\036'
38 #define US  '\037'
39 #define DEL '\177'
40 
41 /*
42  *
43  * A few definitions used to classify the different tektronix states. OUTMODED
44  * is returned by control() and esc(), and typically means the state has changed.
45  *
46  */
47 
48 #define OUTMODED	-1
49 #define ALPHA		0
50 #define GIN		1
51 #define GRAPH		2
52 #define POINT		3
53 #define SPECIALPOINT	4
54 #define INCREMENTAL	5
55 #define RESET		6
56 #define EXIT		7
57 
58 /*
59  *
60  * The pen state, either UP or DOWN, controls whether vectors are drawn.
61  *
62  */
63 
64 #define UP		0
65 #define DOWN		1
66 
67 /*
68  *
69  * Coordinates of the upper right corner of the screen - almost the real screen
70  * dimensions.
71  *
72  */
73 
74 #define TEKXMAX		4096
75 #define TEKYMAX		3120
76 
77 /*
78  *
79  * The size of the spot in SPECIALPOINT mode is controlled by a non-linear
80  * function that has a domain that consists of the integers from 040 to 0175.
81  * The next definition is used to initialize the special point mode intensity
82  * array that implements the function. Data came from table F-6 in the tektronix
83  * 4014 manual.
84  *
85  */
86 
87 #define INTENSITY							\
88 									\
89 	{								\
90 	    14, 16, 17, 19, 20, 22, 23, 25,				\
91 	    28, 31, 34, 38, 41, 44, 47, 50,				\
92 	    56, 62, 69, 75, 81, 88, 94,100,				\
93 	    56, 62, 69, 75, 81, 88, 94,100,				\
94 	     0,  1,  1,  1,  1,  1,  1,  2,				\
95 	     2,  2,  2,  2,  3,  3,  3,  3,				\
96 	     4,  4,  4,  5,  5,  5,  6,  6,				\
97 	     7,  8,  9, 10, 11, 12, 12, 13,				\
98 	    14, 16, 17, 19, 20, 22, 23, 25,				\
99 	    28, 31, 34, 38, 41, 44, 47, 50,				\
100 	    56, 62, 69, 75, 81, 88, 94,100,				\
101 	    56, 62, 69, 75, 81, 88, 94,100,				\
102 	}
103 
104 /*
105  *
106  * The next two definitions give the height and width of characters in the four
107  * different sizes available on tektronix terminals. TEKFONT is the default index
108  * into CHARHEIGHT and CHARWIDTH.
109  *
110  */
111 
112 #define CHARHEIGHT	{88, 82, 53, 48}
113 #define CHARWIDTH	{56, 51, 34, 31}
114 #define TEKFONT		2
115 
116 /*
117  *
118  * The entries defined in STYLES are passed on to the PostScript operator setdash.
119  * They're used to implement the different tektronix line styles. Belongs in the
120  * prologue!
121  *
122  */
123 
124 #define STYLES								\
125 									\
126 	{								\
127 	    "[]",							\
128 	    "[.5 2]",							\
129 	    "[.5 2 4 2]",						\
130 	    "[4 4]",							\
131 	    "[8 4]",							\
132 	    "[]"							\
133 	}
134 
135 /*
136  *
137  * Variables of type Point are used to keep track of the cursor position.
138  *
139  */
140 
141 typedef struct {
142 	int	x;
143 	int	y;
144 } Point;
145 
146 /*
147  *
148  * An array of type Fontmap helps convert font names requested by users into
149  * legitimate PostScript names. The array is initialized using FONTMAP, which must
150  * end with an entry that has NULL defined as its name field.
151  *
152  */
153 
154 typedef struct {
155 	char	*name;			/* user's font name */
156 	char	*val;			/* corresponding PostScript name */
157 } Fontmap;
158 
159 #define FONTMAP								\
160 									\
161 	{								\
162 	    "R", "Courier",						\
163 	    "I", "Courier-Oblique",					\
164 	    "B", "Courier-Bold",					\
165 	    "CO", "Courier",						\
166 	    "CI", "Courier-Oblique",					\
167 	    "CB", "Courier-Bold",					\
168 	    "CW", "Courier",						\
169 	    "PO", "Courier",						\
170 	    "courier", "Courier",					\
171 	    "cour", "Courier",						\
172 	    "co", "Courier",						\
173 	    NULL, NULL							\
174 	}
175 
176 /*
177  *
178  * Some of the non-integer valued functions in posttek.c.
179  *
180  */
181 
182 char	*get_font();
183 
184