1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: regis.trm,v 1.15 2006/07/21 02:35:48 sfeam Exp $
6 /* GNUPLOT - regis.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:
45 * Colin Kelley, Thomas Williams
47 * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
59 TERM_PUBLIC void REGIS_init __PROTO((void));
60 TERM_PUBLIC void REGIS_graphics __PROTO((void));
61 TERM_PUBLIC void REGIS_init __PROTO((void));
62 TERM_PUBLIC void REGIS_graphics __PROTO((void));
63 TERM_PUBLIC void REGIS_text __PROTO((void));
64 TERM_PUBLIC void REGIS_linetype __PROTO((int linetype));
65 TERM_PUBLIC void REGIS_move __PROTO((unsigned int x, unsigned int y));
66 TERM_PUBLIC void REGIS_vector __PROTO((unsigned int x, unsigned int y));
67 TERM_PUBLIC void REGIS_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
68 TERM_PUBLIC int REGIS_text_angle __PROTO((int ang));
69 TERM_PUBLIC void REGIS_reset __PROTO((void));
70 TERM_PUBLIC void REGIS_options __PROTO((void));
75 #define REGISXLAST (REGISXMAX - 1)
76 #define REGISYLAST (REGISYMAX - 1)
83 /* is defined in plot.h
91 #ifndef TERM_PROTO_ONLY
94 static int REGIS16color = FALSE;
96 static int REGISang = 0;
101 fputs("\033[r\033[24;1H", gpoutfile);
103 * 1. reset scrolling region
104 * 2. locate cursor on bottom line
109 /* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
113 fputs("\033[2J\033P1pS(C0)S(E)T(A0)\n", gpoutfile);
116 * 2. enter ReGIS graphics
117 * 3. turn off graphics diamond cursor
118 * 4. clear graphics screen
119 * 5. character set option.
121 (void) REGIS_text_angle(0); /* select text size and angle */
128 fputs("\033\\\033[24;1H", gpoutfile);
130 * 1. Leave ReGIS graphics mode
131 * 2. locate cursor on last line of screen
137 REGIS_linetype(int linetype)
139 /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
141 static int in_16_map[15 + 2] = { 7, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
142 static int lt_16_map[15 + 2] = { 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
143 static int in_map[9 + 2] = { 2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1 };
144 static int lt_map[9 + 2] = { 1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6 };
152 fprintf(gpoutfile, "W(I%d)\n", in_map[linetype + 2]);
153 fprintf(gpoutfile, "W(P%d)\n", lt_map[linetype + 2]);
157 fprintf(gpoutfile, "W(I%d)\n", in_16_map[linetype + 2]);
158 fprintf(gpoutfile, "W(P%d)\n", lt_16_map[linetype + 2]);
165 ** The \n was added in the functions below (and above) in order to not cause
166 ** a buffer overflow in devices that can't deal with long line lengths.
167 ** The DEC vt-340 doesn't need this, but Reflection 4, a vt-340 emulator
168 ** for PC's under MS-DOS and Microsoft Windows does need it.
169 ** Also needed for DECterm, a vt-340 emulator for use with Motif 1.0
175 REGIS_move(unsigned int x, unsigned int y)
177 fprintf(gpoutfile, "P[%d,%d]\n", x, REGISYLAST - y);
182 REGIS_vector(unsigned int x, unsigned int y)
184 fprintf(gpoutfile, "v[]v[%d,%d]\n", x, REGISYLAST - y);
185 /* the initial v[] is needed to get the first pixel plotted */
189 /* put_text and text_angle by rjl */
191 REGIS_put_text(unsigned int x, unsigned int y, const char *str)
194 REGIS_move(x - REGISVCHAR / 2 - 1, y);
196 REGIS_move(x, y + REGISVCHAR / 2 - 1);
197 (void) putc('T', gpoutfile);
198 (void) putc('\'', gpoutfile);
200 (void) putc(*str, gpoutfile);
202 (void) putc('\'', gpoutfile); /* send out another one */
205 (void) putc('\'', gpoutfile);
206 (void) putc('\n', gpoutfile);
211 REGIS_text_angle(int ang)
213 REGISang = (ang ? 1 : 0);
215 fputs("T(D90,S1)\n", gpoutfile);
217 fputs("T(D0,S1)\n", gpoutfile);
225 fputs("\033[2J\033[24;1H", gpoutfile);
234 if (!END_OF_COMMAND) {
235 i = (int) real(const_express(&a));
237 REGIS16color = (i == 16);
238 sprintf(term_options, "%s", REGIS16color ? "16" : "4");
245 TERM_TABLE_START(regis_driver)
246 "regis", "REGIS graphics language",
247 REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR,
248 REGISVTIC, REGISHTIC, REGIS_options, REGIS_init, REGIS_reset,
249 REGIS_text, null_scale, REGIS_graphics, REGIS_move, REGIS_vector,
250 REGIS_linetype, REGIS_put_text, REGIS_text_angle,
251 null_justify_text, line_and_point, do_arrow, set_font_null
252 TERM_TABLE_END(regis_driver)
255 #define LAST_TERM regis_driver
257 #endif /* TERM_PROTO_ONLY */
262 "?commands set terminal regis",
263 "?set terminal regis",
268 " The `regis` terminal device generates output in the REGIS graphics language.",
269 " It has the option of using 4 (the default) or 16 colors.",
272 " set terminal regis {4 | 16}"