/* prototypes for this file are in regis.trm-proto */ /* GNUPLOT - regis.trm */ /* * Copyright (C) 1990 * * 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 modified code. Modifications are to be distributed * as patches to released version. * * This software is provided "as is" without express or implied warranty. * * This file is included by ../term.c. * * This terminal driver supports: * REGIS devices * * AUTHORS * Colin Kelley, Thomas Williams * * send your comments or suggestions to (pixar!info-gnuplot@sun.com). * */ #define REGISXMAX 800 #define REGISYMAX 440 #define REGISXLAST (REGISXMAX - 1) #define REGISYLAST (REGISYMAX - 1) #define REGISVCHAR 20 #define REGISHCHAR 9 #define REGISVTIC 8 #define REGISHTIC 6 int REGISang = 0; #if defined(_WIN32) #include #define sleep(sec) Sleep(sec * 1000) #else #include #endif int REGISinit(void) { fprintf(outfile, "\033[r\033[24;1H"); /* 1 2 1. reset scrolling region 2. locate cursor on bottom line */ fflush(outfile); return 0; } /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */ int REGISgraphics(void) { fprintf(outfile, "\033[2J\033P1pS(C0)S(E)"); /* 1 2 3 4 5 1. clear screen 2. enter ReGIS graphics 3. turn off graphics diamond cursor 4. clear graphics screen */ fflush(outfile); (void) REGIStext_angle(0); /* select text size and angle */ return 0; } int REGIStext(void) { fprintf(outfile, "\033\\\033[H"); /* 1 2 1. Leave ReGIS graphics mode 2. locate cursor on top line of screen */ fflush(outfile); return 0; } int REGISlinetype(int linetype) { /* This will change color in order G, R, B, G-dot, R-dot, B-dot */ static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1}; static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6}; if (linetype >= 9) linetype %= 9; fprintf(outfile, "W(I%d)", in_map[linetype + 2]); fprintf(outfile, "W(P%d)", lt_map[linetype + 2]); return 0; } int REGISmove(int x, int y) { fprintf(outfile, "\033P1pP[%d, %d]", x, REGISYLAST-y); return 0; } int REGISvector(int x, int y) { fprintf(outfile, ";v[]v[%d, %d]", x, REGISYLAST - y); /* the initial v[] is needed to get the first pixel plotted */ return 0; } /* put_text and text_angle by rjl */ int REGISput_text(int x, int y, char *str) { if (REGISang==1) REGISmove(x-REGISVCHAR/2-1, y); else REGISmove(x, y+REGISVCHAR/2-1); (void) putc('T', outfile); (void) putc('\'', outfile); while (*str) { (void) putc(*str, outfile); if (*str == '\'') (void) putc('\'', outfile); /* send out another one */ str++; } (void) putc('\'', outfile); return 0; } int REGIStext_angle(int ang) { REGISang = ang; if (ang == 1) fputs("T(D90, S1)", outfile); else fputs("T(D0, S1)", outfile); return TRUE; } int REGISreset(void) { REGISgraphics(); sleep(1); REGIStext(); /* fprintf(outfile, "\033[2J\033[24;1H"); */ fflush(outfile); return 0; } int REGIS_fill_box(int shade, int xl, int xh, int yl, int yh) { int linetype; linetype = get_linetype(); shade = ((int)(shade*0.07))%7; if (shade>3) fprintf(outfile, "W(P4)W(I%d)", shade-3); else fprintf(outfile, "W(I%d)", shade); yl = REGISYLAST-yl; yh = REGISYLAST-yh; fprintf(outfile, "F(V[%d, %d]V[%d, %d]V[%d, %d]V[%d, %d])", xl, yl, xl, yh, xh, yh, xh, yl); set_linetype(linetype); return 0; }