File: t410x.trm

package info (click to toggle)
gnuplot 3.7.1p1-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,808 kB
  • ctags: 4,418
  • sloc: ansic: 43,279; lisp: 661; makefile: 647; asm: 539; sh: 416; objc: 379; csh: 297; pascal: 194; perl: 138
file content (323 lines) | stat: -rw-r--r-- 8,097 bytes parent folder | download | duplicates (2)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*
 * $Id: t410x.trm,v 1.7 1998/11/26 19:02:59 lhecking Exp $
 *
 */

/* GNUPLOT - t410x.trm */

/*[
 * Copyright 1990 - 1993, 1998
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the complete modified source code.  Modifications are to
 * be distributed as patches to the released version.  Permission to
 * distribute binaries produced by compiling modified sources is granted,
 * provided you
 *   1. distribute the corresponding source modifications from the
 *    released version in the form of a patch file along with the binaries,
 *   2. add special version identification to distinguish your version
 *    in addition to the base release version number,
 *   3. provide your name and address as the primary contact for the
 *    support of your modified version, and
 *   4. retain our contact information in regard to use of the base
 *    software.
 * Permission to distribute the released version of the source code along
 * with corresponding source modifications in the form of a patch file is
 * granted with same provisions 2 through 4 for binary distributions.
 *
 * This software is provided "as is" without express or implied warranty
 * to the extent permitted by applicable law.
]*/

/*
 * This file is included by ../term.c.
 *
 * This terminal driver supports: Tektronix 410x and 420x series terminals
 *
 * AUTHORS
 *   Colin Kelley, Thomas Williams
 * 
 * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
 * 
 */

/* Tektronix 410X and 420X driver written by Cary D. Renzema.
 * email address: caryr@mxim.com
 *
 * I've tested this driver on the following terminals: 4106, 4107A, 4109
 * and 4207.  It should work, without editing, on other terminals in the
 * 410x and 420x families.  It will probably need to be changed to work
 * on a 4105 (screen size and character rotation are two guesses).  This
 * file can also be used as a start for a 411x driver.
 *
 * Cary R.
 * April 5, 1990
 */

/*
 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
 */

#include "driver.h"

#ifdef TERM_REGISTER
register_term(tek410x)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void T410X_init __PROTO((void));
TERM_PUBLIC void T410X_reset __PROTO((void));
TERM_PUBLIC void T410X_graphics __PROTO((void));
TERM_PUBLIC void T410X_text __PROTO((void));
TERM_PUBLIC void T410X_move __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void T410X_vector __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void T410X_point __PROTO((unsigned int x, unsigned int y, int number));
TERM_PUBLIC void T410X_linetype __PROTO((int linetype));
TERM_PUBLIC void T410X_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
TERM_PUBLIC int T410X_text_angle __PROTO((int ang));
#define T410XXMAX 4095
#define T410XYMAX 3131

#define T410XVCHAR	71
#define T410XHCHAR	51
#define T410XVTIC	36
#define T410XHTIC	36
#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
void T410X_encode_x_y __PROTO((unsigned int x, unsigned int y));
void T410X_encode_int __PROTO((int number));


static int T410X_angle = 0;

TERM_PUBLIC void T410X_init()
{
    fputs("\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1", gpoutfile);
    fputs("\033MG1\033RK!\033SK!\033LZ\033%%!1", gpoutfile);
/*
	 1. set tek mode
	 2. set character path to 0 (characters placed equal to rotation)
	 3. set character size to 59 height
	 4. set character precision to string
	 5. set character text index to 1
	 6. set character write mode to overstrike
	 7. clear the view
	 8. clear the segments
	 9. clear the dialog buffer
	10. set ansi mode
*/
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_reset()
{
    fputs("\033%%!0\033LZ\033%%!1", gpoutfile);
/*
	1. set tek mode
	2. clear the dialog buffer
	3. set ansi mode
*/
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_graphics()
{
    fputs("\033%%!0\033\014\033LV0", gpoutfile);
/*
	1. set tek mode
	2. clear the screen
	3. set dialog area invisible
*/
    (void) fflush(gpoutfile);
}

TERM_PUBLIC void T410X_text()
{
    fputs("\033LV1\033%%!1", gpoutfile);
/*
	1. set dialog area visible
	2. set ansi mode
*/
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_move(x, y)
unsigned int x, y;
{
    fputs("\033LF", gpoutfile);

    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_vector(x, y)
unsigned int x, y;
{
    fputs("\033LG", gpoutfile);
    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_point(x, y, number)
unsigned int x, y;
int number;
{
    fputs("\033MM", gpoutfile);
    (void) T410X_encode_int(GPMAX(number, 0) % 11);
    fputs("\033LH", gpoutfile);
    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_linetype(linetype)
int linetype;
{
    switch (linetype) {
    case -1:
	fputs("\033ML5", gpoutfile);
	break;
    case -2:
	fputs("\033ML?", gpoutfile);
	break;
    default:
	fputs("\033ML", gpoutfile);
	(void) T410X_encode_int(linetype % 14 + 2);
	break;
    }
    fputs("\033MV", gpoutfile);
    (void) T410X_encode_int(GPMAX(linetype, 0) % 8);
    (void) fflush(gpoutfile);
}


TERM_PUBLIC void T410X_put_text(x, y, str)
unsigned int x, y;
char str[];
{

    if (T410X_angle == 0) {
	(void) T410X_move(x, y - T410XVCHAR / 2 + 6);
	fputs("\033MR00", gpoutfile);
    } else {
	(void) T410X_move(x + T410XHCHAR / 2 - 6, y);
	fputs("\033MRE:0", gpoutfile);
    }
    (void) fputs("\033LT", gpoutfile);
    (void) T410X_encode_int(strlen(str));
    (void) fputs(str, gpoutfile);
    (void) fflush(gpoutfile);
}

TERM_PUBLIC int T410X_text_angle(ang)
int ang;
{

    T410X_angle = ang;
    return (TRUE);
}

/* These last two routines are based on fortran code found in the
 * 4106/4107/4109/CX PROGRAMMERS manual.
 */

void T410X_encode_x_y(x, y)
unsigned int x, y;
{
    static char chix = 0, chiy = 0, cloy = 0, ceb = 0;

    register unsigned int hix, lox, hiy, loy, eb, lx, ly;

    lx = (x <= T410XXMAX) ? x : T410XXMAX;
    ly = (y <= T410XYMAX) ? y : T410XYMAX;

    hix = lx / 128 + 32;
    lox = (lx / 4) % 32 + 64;
    hiy = ly / 128 + 32;
    loy = (ly / 4) % 32 + 96;
    eb = (ly % 4) * 4 + lx % 4 + 96;

    if (chiy != hiy)
	(void) putc(hiy, gpoutfile);
    if (ceb != eb)
	(void) putc(eb, gpoutfile);
    if ((cloy != loy) || (ceb != eb) || (chix != hix))
	(void) putc(loy, gpoutfile);
    if (chix != hix)
	(void) putc(hix, gpoutfile);
    (void) putc(lox, gpoutfile);

    chix = hix;
    chiy = hiy;
    cloy = loy;
    ceb = eb;
}


void T410X_encode_int(number)
int number;
{
    register unsigned int mag, hi1, hi2, lo;

    mag = ABS(number);

    hi1 = mag / 1024 + 64;
    hi2 = (mag / 16) % 64 + 64;
    lo = mag % 16 + 32;

    if (number >= 0)
	lo += 16;

    if (hi1 != 64)
	(void) putc(hi1, gpoutfile);
    if ((hi2 != 64) || (hi1 != 64))
	(void) putc(hi2, gpoutfile);
    (void) putc(lo, gpoutfile);

}

#endif /* TERM_BODY */

#ifdef TERM_TABLE

TERM_TABLE_START(tek410x_driver)
    "tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
    T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR,
    T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset,
    T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
    T410X_linetype, T410X_put_text, T410X_text_angle,
    null_justify_text, T410X_point, do_arrow, set_font_null
TERM_TABLE_END(tek410x_driver)

#undef LAST_TERM
#define LAST_TERM tek410x_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */

#ifdef TERM_HELP
START_HELP(tek410x)
"1 tek410x",
"?commands set terminal tek410x",
"?set terminal tek410x",
"?set term tek410x",
"?terminal tek410x",
"?term tek410x",
"?tek410x",
" The `tek410x` terminal driver supports the 410x and 420x family of Tektronix",
" terminals.  It has no options."
END_HELP(tek410x)
#endif