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

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

1.1       maekawa     1: /*
1.1.1.2 ! maekawa     2:  * $Id: regis.trm,v 1.6 1998/11/25 21:07:58 lhecking Exp $
1.1       maekawa     3:  *
                      4:  */
                      5:
                      6: /* GNUPLOT - regis.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:
                     42:  *  REGIS devices
                     43:  *
                     44:  * AUTHORS
                     45:  *  Colin Kelley, Thomas Williams
                     46:  *
                     47:  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
                     48:  *
                     49:  */
                     50:
                     51: #include "driver.h"
                     52:
                     53: #ifdef TERM_REGISTER
                     54: register_term(regis)
                     55: #endif
                     56:
                     57:
                     58: #ifdef TERM_PROTO
                     59: TERM_PUBLIC void REGISinit __PROTO((void));
                     60: TERM_PUBLIC void REGISgraphics __PROTO((void));
                     61: TERM_PUBLIC void REGISinit __PROTO((void));
                     62: TERM_PUBLIC void REGISgraphics __PROTO((void));
                     63: TERM_PUBLIC void REGIStext __PROTO((void));
                     64: TERM_PUBLIC void REGISlinetype __PROTO((int linetype));
                     65: TERM_PUBLIC void REGISmove __PROTO((unsigned int x, unsigned int y));
                     66: TERM_PUBLIC void REGISvector __PROTO((unsigned int x, unsigned int y));
                     67: TERM_PUBLIC void REGISput_text __PROTO((unsigned int x, unsigned int y, char *str));
                     68: TERM_PUBLIC int REGIStext_angle __PROTO((int ang));
                     69: TERM_PUBLIC void REGISreset __PROTO((void));
                     70: TERM_PUBLIC void REGISoptions __PROTO((void));
                     71:
                     72: #define REGISXMAX 800
                     73: #define REGISYMAX 440
                     74:
                     75: #define REGISXLAST (REGISXMAX - 1)
                     76: #define REGISYLAST (REGISYMAX - 1)
                     77:
                     78: #define REGISVCHAR             20
                     79: #define REGISHCHAR             9
                     80: #define REGISVTIC              8
                     81: #define REGISHTIC              6
                     82:
                     83: /* is defined in plot.h
                     84: #define TRUE 1
                     85: #define FALSE 0
                     86: */
                     87: #endif
                     88:
                     89:
                     90:
                     91: #ifndef TERM_PROTO_ONLY
                     92: #ifdef TERM_BODY
                     93:
                     94: static int REGIS16color = FALSE;
                     95:
                     96: static int REGISang = 0;
                     97:
                     98: TERM_PUBLIC void REGISinit()
                     99: {
                    100:     fputs("\033[r\033[24;1H", gpoutfile);
                    101:     /*     1     2
                    102:      * 1. reset scrolling region
                    103:      * 2. locate cursor on bottom line
                    104:      */
                    105: }
                    106:
                    107:
                    108: /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
                    109: TERM_PUBLIC void REGISgraphics()
                    110: {
                    111:     fputs("\033[2J\033P1pS(C0)S(E)T(A0)\n", gpoutfile);
                    112:     /*     1      2      3    4   5
                    113:      * 1. clear screen
                    114:      * 2. enter ReGIS graphics
                    115:      * 3. turn off graphics diamond cursor
                    116:      * 4. clear graphics screen
                    117:      * 5. character set option.
                    118:      */
                    119:     (void) REGIStext_angle(0); /* select text size and angle */
                    120: }
                    121:
                    122:
                    123: TERM_PUBLIC void REGIStext()
                    124: {
                    125:     fputs("\033\\\033[24;1H", gpoutfile);
                    126:     /*     1    2
                    127:      * 1. Leave ReGIS graphics mode
                    128:      * 2. locate cursor on last line of screen
                    129:      */
                    130: }
                    131:
                    132:
                    133: TERM_PUBLIC void REGISlinetype(linetype)
                    134: int linetype;
                    135: {
                    136:     /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
                    137:
                    138:     static int in_16_map[15 + 2] = { 7, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
                    139:     static int lt_16_map[15 + 2] = { 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
                    140:     static int in_map[9 + 2] = { 2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1 };
                    141:     static int lt_map[9 + 2] = { 1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6 };
                    142:
                    143:     if (!REGIS16color) {
                    144:        if (linetype >= 9)
                    145:            linetype %= 9;
                    146:        fprintf(gpoutfile, "W(I%d)\n", in_map[linetype + 2]);
                    147:        fprintf(gpoutfile, "W(P%d)\n", lt_map[linetype + 2]);
                    148:     } else {
                    149:        if (linetype >= 15)
                    150:            linetype %= 15;
                    151:        fprintf(gpoutfile, "W(I%d)\n", in_16_map[linetype + 2]);
                    152:        fprintf(gpoutfile, "W(P%d)\n", lt_16_map[linetype + 2]);
                    153:     }
                    154: }
                    155:
                    156:
                    157:
                    158: /*
                    159: ** The \n was added in the functions below (and above) in order to not cause
                    160: ** a buffer overflow in devices that can't deal with long line lengths.
                    161: ** The DEC vt-340 doesn't need this, but Reflection 4, a vt-340 emulator
                    162: ** for PC's under MS-DOS and Microsoft Windows does need it.
                    163: ** Also needed for DECterm, a vt-340 emulator for use with Motif 1.0
                    164: ** on Open/VMS.
                    165: ** NGB 9/13/93
                    166: */
                    167:
                    168: TERM_PUBLIC void REGISmove(x, y)
                    169: unsigned int x, y;
                    170: {
                    171:     fprintf(gpoutfile, "P[%d,%d]\n", x, REGISYLAST - y);
                    172: }
                    173:
                    174:
                    175: TERM_PUBLIC void REGISvector(x, y)
                    176: unsigned int x, y;
                    177: {
                    178:     fprintf(gpoutfile, "v[]v[%d,%d]\n", x, REGISYLAST - y);
                    179:     /* the initial v[] is needed to get the first pixel plotted */
                    180: }
                    181:
                    182:
                    183: /* put_text and text_angle by rjl */
                    184: TERM_PUBLIC void REGISput_text(x, y, str)
                    185: unsigned int x, y;
                    186: char *str;
                    187: {
                    188:     if (REGISang == 1)
                    189:        REGISmove(x - REGISVCHAR / 2 - 1, y);
                    190:     else
                    191:        REGISmove(x, y + REGISVCHAR / 2 - 1);
                    192:     (void) putc('T', gpoutfile);
                    193:     (void) putc('\'', gpoutfile);
                    194:     while (*str) {
                    195:        (void) putc(*str, gpoutfile);
                    196:        if (*str == '\'')
                    197:            (void) putc('\'', gpoutfile);       /* send out another one */
                    198:        str++;
                    199:     }
                    200:     (void) putc('\'', gpoutfile);
                    201:     (void) putc('\n', gpoutfile);
                    202: }
                    203:
                    204:
                    205: TERM_PUBLIC int REGIStext_angle(ang)
                    206: int ang;
                    207: {
                    208:     REGISang = ang;
                    209:     if (ang == 1)
                    210:        fputs("T(D90,S1)\n", gpoutfile);
                    211:     else
                    212:        fputs("T(D0,S1)\n", gpoutfile);
                    213:     return TRUE;
                    214: }
                    215:
                    216:
                    217: TERM_PUBLIC void REGISreset()
                    218: {
                    219:     fputs("\033[2J\033[24;1H", gpoutfile);
                    220: }
                    221:
                    222: TERM_PUBLIC void REGISoptions()
                    223: {
                    224:     int i = 0;
                    225:     struct value a;
                    226:
                    227:     if (!END_OF_COMMAND) {
                    228:        i = (int) real(const_express(&a));
                    229:     }
                    230:     REGIS16color = (i == 16);
                    231:     sprintf(term_options, "%s", REGIS16color ? "16" : "4");
                    232: }
                    233:
                    234: #endif
                    235:
                    236:
                    237: #ifdef TERM_TABLE
                    238: TERM_TABLE_START(regis_driver)
                    239:     "regis", "REGIS graphics language",
                    240:     REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR,
                    241:     REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset,
                    242:     REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
                    243:     REGISlinetype, REGISput_text, REGIStext_angle,
                    244:     null_justify_text, line_and_point, do_arrow, set_font_null
                    245: TERM_TABLE_END(regis_driver)
                    246:
                    247: #undef LAST_TERM
                    248: #define LAST_TERM regis_driver
                    249: #endif
                    250: #endif /* TERM_PROTO_ONLY */
                    251:
                    252: #ifdef TERM_HELP
                    253: START_HELP(regis)
                    254: "1 regis",
                    255: "?commands set terminal regis",
                    256: "?set terminal regis",
                    257: "?set term regis",
                    258: "?terminal regis",
                    259: "?term regis",
                    260: "?regis",
                    261: " The `regis` terminal device generates output in the REGIS graphics language.",
                    262: " It has the option of using 4 (the default) or 16 colors.",
                    263: "",
                    264: " Syntax:",
                    265: "       set terminal regis {4 | 16}"
                    266: END_HELP(regis)
                    267: #endif

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