[BACK]Return to t410x.trm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / term

Annotation of OpenXM_contrib/gnuplot/term/t410x.trm, Revision 1.1.1.2

1.1       maekawa     1: /*
1.1.1.2 ! maekawa     2:  * $Id: t410x.trm,v 1.7 1998/11/26 19:02:59 lhecking Exp $
1.1       maekawa     3:  *
                      4:  */
                      5:
                      6: /* GNUPLOT - t410x.trm */
                      7:
                      8: /*[
                      9:  * Copyright 1990 - 1993, 1998
                     10:  *
                     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.
                     16:  *
                     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,
                     21:  * provided you
                     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
                     29:  *    software.
                     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.
                     33:  *
                     34:  * This software is provided "as is" without express or implied warranty
                     35:  * to the extent permitted by applicable law.
                     36: ]*/
                     37:
                     38: /*
                     39:  * This file is included by ../term.c.
                     40:  *
                     41:  * This terminal driver supports: Tektronix 410x and 420x series terminals
                     42:  *
                     43:  * AUTHORS
                     44:  *   Colin Kelley, Thomas Williams
                     45:  *
                     46:  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
                     47:  *
                     48:  */
                     49:
                     50: /* Tektronix 410X and 420X driver written by Cary D. Renzema.
                     51:  * email address: caryr@mxim.com
                     52:  *
                     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.
                     58:  *
                     59:  * Cary R.
                     60:  * April 5, 1990
                     61:  */
                     62:
                     63: /*
                     64:  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
                     65:  */
                     66:
                     67: #include "driver.h"
                     68:
                     69: #ifdef TERM_REGISTER
                     70: register_term(tek410x)
                     71: #endif
                     72:
                     73: #ifdef TERM_PROTO
                     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, char str[]));
                     83: TERM_PUBLIC int T410X_text_angle __PROTO((int ang));
                     84: #define T410XXMAX 4095
                     85: #define T410XYMAX 3131
                     86:
                     87: #define T410XVCHAR     71
                     88: #define T410XHCHAR     51
                     89: #define T410XVTIC      36
                     90: #define T410XHTIC      36
                     91: #endif /* TERM_PROTO */
                     92:
                     93: #ifndef TERM_PROTO_ONLY
                     94: #ifdef TERM_BODY
                     95: void T410X_encode_x_y __PROTO((unsigned int x, unsigned int y));
                     96: void T410X_encode_int __PROTO((int number));
                     97:
                     98:
                     99: static int T410X_angle = 0;
                    100:
                    101: TERM_PUBLIC void T410X_init()
                    102: {
                    103:     fputs("\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1", gpoutfile);
                    104:     fputs("\033MG1\033RK!\033SK!\033LZ\033%%!1", gpoutfile);
                    105: /*
                    106:         1. set tek mode
                    107:         2. set character path to 0 (characters placed equal to rotation)
                    108:         3. set character size to 59 height
                    109:         4. set character precision to string
                    110:         5. set character text index to 1
                    111:         6. set character write mode to overstrike
                    112:         7. clear the view
                    113:         8. clear the segments
                    114:         9. clear the dialog buffer
                    115:        10. set ansi mode
                    116: */
                    117:     (void) fflush(gpoutfile);
                    118: }
                    119:
                    120:
                    121: TERM_PUBLIC void T410X_reset()
                    122: {
                    123:     fputs("\033%%!0\033LZ\033%%!1", gpoutfile);
                    124: /*
                    125:        1. set tek mode
                    126:        2. clear the dialog buffer
                    127:        3. set ansi mode
                    128: */
                    129:     (void) fflush(gpoutfile);
                    130: }
                    131:
                    132:
                    133: TERM_PUBLIC void T410X_graphics()
                    134: {
                    135:     fputs("\033%%!0\033\014\033LV0", gpoutfile);
                    136: /*
                    137:        1. set tek mode
                    138:        2. clear the screen
                    139:        3. set dialog area invisible
                    140: */
                    141:     (void) fflush(gpoutfile);
                    142: }
                    143:
                    144: TERM_PUBLIC void T410X_text()
                    145: {
                    146:     fputs("\033LV1\033%%!1", gpoutfile);
                    147: /*
                    148:        1. set dialog area visible
                    149:        2. set ansi mode
                    150: */
                    151:     (void) fflush(gpoutfile);
                    152: }
                    153:
                    154:
                    155: TERM_PUBLIC void T410X_move(x, y)
                    156: unsigned int x, y;
                    157: {
                    158:     fputs("\033LF", gpoutfile);
                    159:
                    160:     (void) T410X_encode_x_y(x, y);
                    161:     (void) fflush(gpoutfile);
                    162: }
                    163:
                    164:
                    165: TERM_PUBLIC void T410X_vector(x, y)
                    166: unsigned int x, y;
                    167: {
                    168:     fputs("\033LG", gpoutfile);
                    169:     (void) T410X_encode_x_y(x, y);
                    170:     (void) fflush(gpoutfile);
                    171: }
                    172:
                    173:
                    174: TERM_PUBLIC void T410X_point(x, y, number)
                    175: unsigned int x, y;
                    176: int number;
                    177: {
                    178:     fputs("\033MM", gpoutfile);
                    179:     (void) T410X_encode_int(GPMAX(number, 0) % 11);
                    180:     fputs("\033LH", gpoutfile);
                    181:     (void) T410X_encode_x_y(x, y);
                    182:     (void) fflush(gpoutfile);
                    183: }
                    184:
                    185:
                    186: TERM_PUBLIC void T410X_linetype(linetype)
                    187: int linetype;
                    188: {
                    189:     switch (linetype) {
                    190:     case -1:
                    191:        fputs("\033ML5", gpoutfile);
                    192:        break;
                    193:     case -2:
                    194:        fputs("\033ML?", gpoutfile);
                    195:        break;
                    196:     default:
                    197:        fputs("\033ML", gpoutfile);
                    198:        (void) T410X_encode_int(linetype % 14 + 2);
                    199:        break;
                    200:     }
                    201:     fputs("\033MV", gpoutfile);
                    202:     (void) T410X_encode_int(GPMAX(linetype, 0) % 8);
                    203:     (void) fflush(gpoutfile);
                    204: }
                    205:
                    206:
                    207: TERM_PUBLIC void T410X_put_text(x, y, str)
                    208: unsigned int x, y;
                    209: char str[];
                    210: {
                    211:
                    212:     if (T410X_angle == 0) {
                    213:        (void) T410X_move(x, y - T410XVCHAR / 2 + 6);
                    214:        fputs("\033MR00", gpoutfile);
                    215:     } else {
                    216:        (void) T410X_move(x + T410XHCHAR / 2 - 6, y);
                    217:        fputs("\033MRE:0", gpoutfile);
                    218:     }
                    219:     (void) fputs("\033LT", gpoutfile);
                    220:     (void) T410X_encode_int(strlen(str));
                    221:     (void) fputs(str, gpoutfile);
                    222:     (void) fflush(gpoutfile);
                    223: }
                    224:
                    225: TERM_PUBLIC int T410X_text_angle(ang)
                    226: int ang;
                    227: {
                    228:
                    229:     T410X_angle = ang;
                    230:     return (TRUE);
                    231: }
                    232:
                    233: /* These last two routines are based on fortran code found in the
                    234:  * 4106/4107/4109/CX PROGRAMMERS manual.
                    235:  */
                    236:
                    237: void T410X_encode_x_y(x, y)
                    238: unsigned int x, y;
                    239: {
                    240:     static char chix = 0, chiy = 0, cloy = 0, ceb = 0;
                    241:
                    242:     register unsigned int hix, lox, hiy, loy, eb, lx, ly;
                    243:
                    244:     lx = (x <= T410XXMAX) ? x : T410XXMAX;
                    245:     ly = (y <= T410XYMAX) ? y : T410XYMAX;
                    246:
                    247:     hix = lx / 128 + 32;
                    248:     lox = (lx / 4) % 32 + 64;
                    249:     hiy = ly / 128 + 32;
                    250:     loy = (ly / 4) % 32 + 96;
                    251:     eb = (ly % 4) * 4 + lx % 4 + 96;
                    252:
                    253:     if (chiy != hiy)
                    254:        (void) putc(hiy, gpoutfile);
                    255:     if (ceb != eb)
                    256:        (void) putc(eb, gpoutfile);
                    257:     if ((cloy != loy) || (ceb != eb) || (chix != hix))
                    258:        (void) putc(loy, gpoutfile);
                    259:     if (chix != hix)
                    260:        (void) putc(hix, gpoutfile);
                    261:     (void) putc(lox, gpoutfile);
                    262:
                    263:     chix = hix;
                    264:     chiy = hiy;
                    265:     cloy = loy;
                    266:     ceb = eb;
                    267: }
                    268:
                    269:
                    270: void T410X_encode_int(number)
                    271: int number;
                    272: {
                    273:     register unsigned int mag, hi1, hi2, lo;
                    274:
                    275:     mag = ABS(number);
                    276:
                    277:     hi1 = mag / 1024 + 64;
                    278:     hi2 = (mag / 16) % 64 + 64;
                    279:     lo = mag % 16 + 32;
                    280:
                    281:     if (number >= 0)
                    282:        lo += 16;
                    283:
                    284:     if (hi1 != 64)
                    285:        (void) putc(hi1, gpoutfile);
                    286:     if ((hi2 != 64) || (hi1 != 64))
                    287:        (void) putc(hi2, gpoutfile);
                    288:     (void) putc(lo, gpoutfile);
                    289:
                    290: }
                    291:
                    292: #endif /* TERM_BODY */
                    293:
                    294: #ifdef TERM_TABLE
                    295:
                    296: TERM_TABLE_START(tek410x_driver)
                    297:     "tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
                    298:     T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR,
                    299:     T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset,
                    300:     T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
                    301:     T410X_linetype, T410X_put_text, T410X_text_angle,
                    302:     null_justify_text, T410X_point, do_arrow, set_font_null
                    303: TERM_TABLE_END(tek410x_driver)
                    304:
                    305: #undef LAST_TERM
                    306: #define LAST_TERM tek410x_driver
                    307:
                    308: #endif /* TERM_TABLE */
                    309: #endif /* TERM_PROTO_ONLY */
                    310:
                    311: #ifdef TERM_HELP
                    312: START_HELP(tek410x)
                    313: "1 tek410x",
                    314: "?commands set terminal tek410x",
                    315: "?set terminal tek410x",
                    316: "?set term tek410x",
                    317: "?terminal tek410x",
                    318: "?term tek410x",
                    319: "?tek410x",
                    320: " The `tek410x` terminal driver supports the 410x and 420x family of Tektronix",
                    321: " terminals.  It has no options."
                    322: END_HELP(tek410x)
                    323: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>