1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: iris4d.trm,v 1.15 2006/07/21 02:35:47 sfeam Exp $
6 /* GNUPLOT - iris4d.trm */
9 * Copyright 1990 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
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:
46 * (Applied Research Corporation) 7/1/89
47 * INTERNET: merritt@iris613.gsfc.nasa.gov
49 * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
53 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
63 TERM_PUBLIC void IRIS4D_options __PROTO((void));
64 TERM_PUBLIC void IRIS4D_init __PROTO((void));
65 TERM_PUBLIC void IRIS4D_graphics __PROTO((void));
66 TERM_PUBLIC void IRIS4D_text __PROTO((void));
67 TERM_PUBLIC void IRIS4D_linetype __PROTO((int linetype));
68 TERM_PUBLIC void IRIS4D_move __PROTO((unsigned int x, unsigned int y));
69 TERM_PUBLIC void IRIS4D_vector __PROTO((unsigned int x, unsigned int y));
70 TERM_PUBLIC void IRIS4D_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
71 TERM_PUBLIC void IRIS4D_reset __PROTO((void));
72 #define IRIS4D_XMAX 1024
73 #define IRIS4D_YMAX 1024
74 #define IRIS4D_VCHAR (IRIS4D_YMAX/30)
75 #define IRIS4D_HCHAR (IRIS4D_XMAX/72)
76 #define IRIS4D_VTIC (IRIS4D_YMAX/80)
77 #define IRIS4D_HTIC (IRIS4D_XMAX/80)
78 #endif /* TERM_PROTO */
80 #ifndef TERM_PROTO_ONLY
82 void IRIS4D_cmove __PROTO((unsigned int x, unsigned int y));
86 extern const char *user_homedir;
88 #define IRIS4DRC ".gnuplot_iris4d"
90 #define IRIS4D_XLAST (IRIS4D_XMAX - 1)
91 #define IRIS4D_YLAST (IRIS4D_YMAX - 1)
93 static short colors24bits[][3] =
95 {85, 85, 85}, /* 0. BACK GROUND ( DARKGRAY ) */
96 {0, 0, 0}, /* 1. BLACK */
97 {170, 0, 170}, /* 2. MAGENTA */
98 {85, 255, 255}, /* 3. LIGHTCYAN */
99 {170, 0, 0}, /* 4. RED */
100 {0, 170, 0}, /* 5. GREEN */
101 {255, 85, 255}, /* 6. LIGHTMAGENTA */
102 {255, 255, 85}, /* 7. YELLOW */
103 {255, 85, 85}, /* 8. LIGHTRED */
104 {85, 255, 85}, /* 9. LIGHTGREEN */
105 {0, 170, 170}, /* 10. CYAN */
106 {170, 170, 0}, /* 11. BROWN */
108 #define COLOR24_SIZE (sizeof(colors24bits) / (sizeof(short) * 3))
110 static iris24bits = FALSE;
112 #define IRIS4D_BACKGROUND 0
113 #define IRIS4D_BLACK 1
114 #define IRIS4D_MAGENTA 2
115 #define IRIS4D_LIGHTCYAN 3
117 #define IRIS4D_GREEN 5
118 #define IRIS4D_LIGHTMAGENTA 6
119 #define IRIS4D_YELLOW 7
120 #define IRIS4D_LIGHTRED 8
121 #define IRIS4D_LIGHTGREEN 9
122 #define IRIS4D_CYAN 10
123 #define IRIS4D_BROWN 11
131 if (!END_OF_COMMAND) {
132 i = (int) real(const_express(&a));
134 iris24bits = (i == 24);
136 sprintf(term_options, "%s", iris24bits ? "24" : "8");
144 char *irisinitfile = NULL;
147 irisinitfile = (char *) gp_alloc (( user_homedir ? strlen(user_homedir) : 0 )+1+strlen(IRIS4DRC)+1, "irisinitfile");
157 /* inhibit check of init file in current directory for security reasons */
159 f = fopen(IRIS4DRC, "r");
163 strcpy (irisinitfile, user_homedir);
164 PATH_CONCAT(irisinitfile,IRIS4DRC);
165 f = fopen (irisinitfile, "r");
171 for (i = 0; i < COLOR24_SIZE; i++) {
172 if (fgets(line, 79, f) == NULL ||
173 sscanf(line, "%d %d %d", &c1, &c2, &c3) != 3)
174 int_error(NO_CARET, "Iris4d color file terminated prematurely or wrong format.\n");
175 colors24bits[i][0] = c1;
176 colors24bits[i][1] = c2;
177 colors24bits[i][2] = c3;
182 deflinestyle(1, 0x3FFF); /* long dash */
183 deflinestyle(2, 0x5555); /* dotted */
184 deflinestyle(3, 0x3333); /* short dash */
185 deflinestyle(4, 0xB5AD); /* dotdashed */
186 deflinestyle(5, 0x0F0F); /* dashed */
187 deflinestyle(6, 0xBBBB); /* dotdashed */
188 deflinestyle(7, 0x3F3F); /* mid-long dash */
189 deflinestyle(8, 0x7777); /* mid-long dash */
198 ortho2((Coord) 0, (Coord) IRIS4D_XMAX, (Coord) 0, (Coord) IRIS4D_YMAX);
200 RGBcolor(colors24bits[IRIS4D_BACKGROUND][0],
201 colors24bits[IRIS4D_BACKGROUND][1],
202 colors24bits[IRIS4D_BACKGROUND][2]);
214 gflush(); /* flush buffer */
215 return; /* enter text from another window!!! */
218 TERM_PUBLIC void IRIS4D_linetype(int linetype)
220 static int pen_color_24[11] =
222 IRIS4D_BLACK, /* reserved for border and numbers */
223 IRIS4D_MAGENTA, /* reserved for axis traces */
234 static int pen_color[8] = { 0, 1, 4, 5, 6, 1, 2, 4 };
240 int pencolor = pen_color_24[linetype < 0 ? linetype + 2 : linetype % 9 + 2];
242 RGBcolor(colors24bits[pencolor][0],
243 colors24bits[pencolor][1],
244 colors24bits[pencolor][2]);
245 /* Make all lines solid (linestyle 0) upto to the ninth. If more than
246 * 9 colors are needed, start to use the different line styles (1 to 8).
248 setlinestyle(linetype < 9 ? 0 : (linetype + 2) % 8 + 1);
250 linetype = (linetype+2) % 8;
251 color((Colorindex) pen_color[linetype]);
252 setlinestyle(linetype);
258 IRIS4D_move(unsigned int x, unsigned int y)
265 IRIS4D_cmove(unsigned int x, unsigned int y)
272 IRIS4D_vector(unsigned int x, unsigned int y)
280 IRIS4D_put_text(unsigned int x, unsigned int y, const char *str)
282 IRIS4D_cmove(x, y - IRIS4D_VCHAR / 2);
294 #endif /* TERM_BODY */
298 TERM_TABLE_START(iris4d_driver)
299 "iris4d", "Silicon Graphics IRIS 4D Series Computer",
300 IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR,
301 IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset,
302 IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
303 IRIS4D_linetype, IRIS4D_put_text, null_text_angle,
304 null_justify_text, do_point, do_arrow, set_font_null
305 TERM_TABLE_END(iris4d_driver)
308 #define LAST_TERM iris4d_driver
310 #endif /* TERM_TABLE */
311 #endif /* TERM_PROTO_ONLY */
316 "?commands set terminal iris4d",
317 "?set terminal iris4d",
322 " The `iris4d` terminal driver supports Silicon Graphics IRIS 4D computers.",
323 " Its only option is 8- or 24-bit color depth. The default is 8.",
326 " set terminal iris4d {8 | 24}",
328 " The color depth is not really a choice -- the value appropriate for the",
329 " hardware should be selected.",
331 " When using 24-bit mode, the colors can be directly specified via the file",
332 " .gnuplot_iris4d that is searched in the current directory and then in the",
333 " home directory specified by the HOME environment variable. This file holds",
334 " RGB values for the background, border, labels and nine plotting colors, in",
335 " that order. For example, here is a file containing the default colors:",
337 " 85 85 85 Background (dark gray)",
338 " 0 0 0 Boundary (black)",
339 " 170 0 170 Labeling (magenta)",
340 " 85 255 255 Plot Color 1 (light cyan)",
341 " 170 0 0 Plot Color 2 (red)",
342 " 0 170 0 Plot Color 3 (green)",
343 " 255 85 255 Plot Color 4 (light magenta)",
344 " 255 255 85 Plot Color 5 (yellow)",
345 " 255 85 85 Plot Color 6 (light red)",
346 " 85 255 85 Plot Color 7 (light green)",
347 " 0 170 170 Plot Color 8 (cyan)",
348 " 170 170 0 Plot Color 9 (brown)",
350 " This file must have exactly 12 lines of RGB triples. No empty lines are",
351 " allowed, and anything after the third number on a line is ignored."
353 #endif /* TERM_TABLE */