1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: t410x.trm,v 1.16 2006/07/21 02:35:48 sfeam Exp $
6 /* GNUPLOT - t410x.trm */
9 * Copyright 1990 - 1993, 1998, 2004
11 * Permission to use, copy, and distribute this software and its
12 * documentation for any purpose with or without fee is hereby granted,
13 * provided that the above copyright notice appear in all copies and
14 * that both that copyright notice and this permission notice appear
15 * in supporting documentation.
17 * Permission to modify the software is granted, but not the right to
18 * distribute the complete modified source code. Modifications are to
19 * be distributed as patches to the released version. Permission to
20 * distribute binaries produced by compiling modified sources is granted,
22 * 1. distribute the corresponding source modifications from the
23 * released version in the form of a patch file along with the binaries,
24 * 2. add special version identification to distinguish your version
25 * in addition to the base release version number,
26 * 3. provide your name and address as the primary contact for the
27 * support of your modified version, and
28 * 4. retain our contact information in regard to use of the base
30 * Permission to distribute the released version of the source code along
31 * with corresponding source modifications in the form of a patch file is
32 * granted with same provisions 2 through 4 for binary distributions.
34 * This software is provided "as is" without express or implied warranty
35 * to the extent permitted by applicable law.
39 * This file is included by ../term.c.
41 * This terminal driver supports: Tektronix 410x and 420x series terminals
44 * Colin Kelley, Thomas Williams
46 * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
50 /* Tektronix 410X and 420X driver written by Cary D. Renzema.
51 * email address: caryr@mxim.com
53 * I've tested this driver on the following terminals: 4106, 4107A, 4109
54 * and 4207. It should work, without editing, on other terminals in the
55 * 410x and 420x families. It will probably need to be changed to work
56 * on a 4105 (screen size and character rotation are two guesses). This
57 * file can also be used as a start for a 411x driver.
64 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
70 register_term(tek410x)
74 TERM_PUBLIC void T410X_init __PROTO((void));
75 TERM_PUBLIC void T410X_reset __PROTO((void));
76 TERM_PUBLIC void T410X_graphics __PROTO((void));
77 TERM_PUBLIC void T410X_text __PROTO((void));
78 TERM_PUBLIC void T410X_move __PROTO((unsigned int x, unsigned int y));
79 TERM_PUBLIC void T410X_vector __PROTO((unsigned int x, unsigned int y));
80 TERM_PUBLIC void T410X_point __PROTO((unsigned int x, unsigned int y, int number));
81 TERM_PUBLIC void T410X_linetype __PROTO((int linetype));
82 TERM_PUBLIC void T410X_put_text __PROTO((unsigned int x, unsigned int y, const char str[]));
83 TERM_PUBLIC int T410X_text_angle __PROTO((int ang));
84 #define T410XXMAX 4095
85 #define T410XYMAX 3131
91 #endif /* TERM_PROTO */
93 #ifndef TERM_PROTO_ONLY
95 static void T410X_encode_x_y __PROTO((unsigned int x, unsigned int y));
96 static void T410X_encode_int __PROTO((int number));
99 static int T410X_angle = 0;
104 fputs("\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1", gpoutfile);
105 fputs("\033MG1\033RK!\033SK!\033LZ\033%%!1", gpoutfile);
108 2. set character path to 0 (characters placed equal to rotation)
109 3. set character size to 59 height
110 4. set character precision to string
111 5. set character text index to 1
112 6. set character write mode to overstrike
114 8. clear the segments
115 9. clear the dialog buffer
118 (void) fflush(gpoutfile);
125 fputs("\033%%!0\033LZ\033%%!1", gpoutfile);
128 2. clear the dialog buffer
131 (void) fflush(gpoutfile);
138 fputs("\033%%!0\033\014\033LV0", gpoutfile);
142 3. set dialog area invisible
144 (void) fflush(gpoutfile);
150 fputs("\033LV1\033%%!1", gpoutfile);
152 1. set dialog area visible
155 (void) fflush(gpoutfile);
160 T410X_move(unsigned int x, unsigned int y)
162 fputs("\033LF", gpoutfile);
164 (void) T410X_encode_x_y(x, y);
165 (void) fflush(gpoutfile);
170 T410X_vector(unsigned int x, unsigned int y)
172 fputs("\033LG", gpoutfile);
173 (void) T410X_encode_x_y(x, y);
174 (void) fflush(gpoutfile);
179 T410X_point(unsigned int x, unsigned int y, int number)
181 fputs("\033MM", gpoutfile);
182 (void) T410X_encode_int(GPMAX(number, 0) % 11);
183 fputs("\033LH", gpoutfile);
184 (void) T410X_encode_x_y(x, y);
185 (void) fflush(gpoutfile);
190 T410X_linetype(int linetype)
197 fputs("\033ML5", gpoutfile);
200 fputs("\033ML?", gpoutfile);
203 fputs("\033ML", gpoutfile);
204 (void) T410X_encode_int(linetype % 14 + 2);
207 fputs("\033MV", gpoutfile);
208 (void) T410X_encode_int(GPMAX(linetype, 0) % 8);
209 (void) fflush(gpoutfile);
214 T410X_put_text(unsigned int x, unsigned int y, const char str[])
217 if (T410X_angle == 0) {
218 (void) T410X_move(x, y - T410XVCHAR / 2 + 6);
219 fputs("\033MR00", gpoutfile);
221 (void) T410X_move(x + T410XHCHAR / 2 - 6, y);
222 fputs("\033MRE:0", gpoutfile);
224 (void) fputs("\033LT", gpoutfile);
225 (void) T410X_encode_int(strlen(str));
226 (void) fputs(str, gpoutfile);
227 (void) fflush(gpoutfile);
231 T410X_text_angle(int ang)
238 /* These last two routines are based on fortran code found in the
239 * 4106/4107/4109/CX PROGRAMMERS manual.
243 T410X_encode_x_y(unsigned int x, unsigned int y)
245 static char chix = 0, chiy = 0, cloy = 0, ceb = 0;
247 register unsigned int hix, lox, hiy, loy, eb, lx, ly;
249 lx = (x <= T410XXMAX) ? x : T410XXMAX;
250 ly = (y <= T410XYMAX) ? y : T410XYMAX;
253 lox = (lx / 4) % 32 + 64;
255 loy = (ly / 4) % 32 + 96;
256 eb = (ly % 4) * 4 + lx % 4 + 96;
259 (void) putc(hiy, gpoutfile);
261 (void) putc(eb, gpoutfile);
262 if ((cloy != loy) || (ceb != eb) || (chix != hix))
263 (void) putc(loy, gpoutfile);
265 (void) putc(hix, gpoutfile);
266 (void) putc(lox, gpoutfile);
276 T410X_encode_int(int number)
278 register unsigned int mag, hi1, hi2, lo;
282 hi1 = mag / 1024 + 64;
283 hi2 = (mag / 16) % 64 + 64;
290 (void) putc(hi1, gpoutfile);
291 if ((hi2 != 64) || (hi1 != 64))
292 (void) putc(hi2, gpoutfile);
293 (void) putc(lo, gpoutfile);
297 #endif /* TERM_BODY */
301 TERM_TABLE_START(tek410x_driver)
302 "tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
303 T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR,
304 T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset,
305 T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
306 T410X_linetype, T410X_put_text, T410X_text_angle,
307 null_justify_text, T410X_point, do_arrow, set_font_null
308 TERM_TABLE_END(tek410x_driver)
311 #define LAST_TERM tek410x_driver
313 #endif /* TERM_TABLE */
314 #endif /* TERM_PROTO_ONLY */
319 "?commands set terminal tek410x",
320 "?set terminal tek410x",
325 " The `tek410x` terminal driver supports the 410x and 420x family of Tektronix",
326 " terminals. It has no options."