X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=term%2Firis4d.trm;fp=term%2Firis4d.trm;h=65b9e67e042f5b77f51e20108d46521ab4fa4b9e;hb=39ec1247a71f61152a4a7f502a30f06a3896c5da;hp=0000000000000000000000000000000000000000;hpb=06be459be4f5f6a7c6ff878e84f355fb2575caa8;p=gnuplot diff --git a/term/iris4d.trm b/term/iris4d.trm new file mode 100644 index 0000000..65b9e67 --- /dev/null +++ b/term/iris4d.trm @@ -0,0 +1,353 @@ +/* Hello, Emacs, this is -*-C-*- + * $Id: iris4d.trm,v 1.15 2006/07/21 02:35:47 sfeam Exp $ + * + */ + +/* GNUPLOT - iris4d.trm */ + +/*[ + * Copyright 1990 - 1993, 1998, 2004 Thomas Williams, Colin Kelley + * + * 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 complete modified source code. Modifications are to + * be distributed as patches to the released version. Permission to + * distribute binaries produced by compiling modified sources is granted, + * provided you + * 1. distribute the corresponding source modifications from the + * released version in the form of a patch file along with the binaries, + * 2. add special version identification to distinguish your version + * in addition to the base release version number, + * 3. provide your name and address as the primary contact for the + * support of your modified version, and + * 4. retain our contact information in regard to use of the base + * software. + * Permission to distribute the released version of the source code along + * with corresponding source modifications in the form of a patch file is + * granted with same provisions 2 through 4 for binary distributions. + * + * This software is provided "as is" without express or implied warranty + * to the extent permitted by applicable law. +]*/ + +/* + * This file is included by ../term.c. + * + * This terminal driver supports: + * IRIS terminals + * + * AUTHORS + * John H. Merritt + * (Applied Research Corporation) 7/1/89 + * INTERNET: merritt@iris613.gsfc.nasa.gov + * + * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net). + * + */ +/* + * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995) + */ + +#include "driver.h" + +#ifdef TERM_REGISTER +register_term(iris4d) +#endif + +#ifdef TERM_PROTO +TERM_PUBLIC void IRIS4D_options __PROTO((void)); +TERM_PUBLIC void IRIS4D_init __PROTO((void)); +TERM_PUBLIC void IRIS4D_graphics __PROTO((void)); +TERM_PUBLIC void IRIS4D_text __PROTO((void)); +TERM_PUBLIC void IRIS4D_linetype __PROTO((int linetype)); +TERM_PUBLIC void IRIS4D_move __PROTO((unsigned int x, unsigned int y)); +TERM_PUBLIC void IRIS4D_vector __PROTO((unsigned int x, unsigned int y)); +TERM_PUBLIC void IRIS4D_put_text __PROTO((unsigned int x, unsigned int y, const char *str)); +TERM_PUBLIC void IRIS4D_reset __PROTO((void)); +#define IRIS4D_XMAX 1024 +#define IRIS4D_YMAX 1024 +#define IRIS4D_VCHAR (IRIS4D_YMAX/30) +#define IRIS4D_HCHAR (IRIS4D_XMAX/72) +#define IRIS4D_VTIC (IRIS4D_YMAX/80) +#define IRIS4D_HTIC (IRIS4D_XMAX/80) +#endif /* TERM_PROTO */ + +#ifndef TERM_PROTO_ONLY +#ifdef TERM_BODY +void IRIS4D_cmove __PROTO((unsigned int x, unsigned int y)); +#include + +/* plot.c */ +extern const char *user_homedir; + +#define IRIS4DRC ".gnuplot_iris4d" + +#define IRIS4D_XLAST (IRIS4D_XMAX - 1) +#define IRIS4D_YLAST (IRIS4D_YMAX - 1) + +static short colors24bits[][3] = +{ + {85, 85, 85}, /* 0. BACK GROUND ( DARKGRAY ) */ + {0, 0, 0}, /* 1. BLACK */ + {170, 0, 170}, /* 2. MAGENTA */ + {85, 255, 255}, /* 3. LIGHTCYAN */ + {170, 0, 0}, /* 4. RED */ + {0, 170, 0}, /* 5. GREEN */ + {255, 85, 255}, /* 6. LIGHTMAGENTA */ + {255, 255, 85}, /* 7. YELLOW */ + {255, 85, 85}, /* 8. LIGHTRED */ + {85, 255, 85}, /* 9. LIGHTGREEN */ + {0, 170, 170}, /* 10. CYAN */ + {170, 170, 0}, /* 11. BROWN */ +}; +#define COLOR24_SIZE (sizeof(colors24bits) / (sizeof(short) * 3)) + +static iris24bits = FALSE; + +#define IRIS4D_BACKGROUND 0 +#define IRIS4D_BLACK 1 +#define IRIS4D_MAGENTA 2 +#define IRIS4D_LIGHTCYAN 3 +#define IRIS4D_RED 4 +#define IRIS4D_GREEN 5 +#define IRIS4D_LIGHTMAGENTA 6 +#define IRIS4D_YELLOW 7 +#define IRIS4D_LIGHTRED 8 +#define IRIS4D_LIGHTGREEN 9 +#define IRIS4D_CYAN 10 +#define IRIS4D_BROWN 11 + +TERM_PUBLIC void +IRIS4D_options() +{ + int i = 0; + struct value a; + + if (!END_OF_COMMAND) { + i = (int) real(const_express(&a)); + } + iris24bits = (i == 24); + + sprintf(term_options, "%s", iris24bits ? "24" : "8"); +} + +TERM_PUBLIC void +IRIS4D_init() +{ + int i; + char line[80]; + char *irisinitfile = NULL; + FILE *f = NULL: + + irisinitfile = (char *) gp_alloc (( user_homedir ? strlen(user_homedir) : 0 )+1+strlen(IRIS4DRC)+1, "irisinitfile"); + + foreground(); + winopen("Gnuplot"); + if (iris24bits) { + RGBmode(); + gconfig(); + } + +#ifdef NOCWDRC + /* inhibit check of init file in current directory for security reasons */ +#else + f = fopen(IRIS4DRC, "r"); +#endif + if (!f) { + if (user_homedir) { + strcpy (irisinitfile, user_homedir); + PATH_CONCAT(irisinitfile,IRIS4DRC); + f = fopen (irisinitfile, "r"); + } + } + + if (f) { + int c1, c2, c3; + for (i = 0; i < COLOR24_SIZE; i++) { + if (fgets(line, 79, f) == NULL || + sscanf(line, "%d %d %d", &c1, &c2, &c3) != 3) + int_error(NO_CARET, "Iris4d color file terminated prematurely or wrong format.\n"); + colors24bits[i][0] = c1; + colors24bits[i][1] = c2; + colors24bits[i][2] = c3; + } + + fclose(f); + } + deflinestyle(1, 0x3FFF); /* long dash */ + deflinestyle(2, 0x5555); /* dotted */ + deflinestyle(3, 0x3333); /* short dash */ + deflinestyle(4, 0xB5AD); /* dotdashed */ + deflinestyle(5, 0x0F0F); /* dashed */ + deflinestyle(6, 0xBBBB); /* dotdashed */ + deflinestyle(7, 0x3F3F); /* mid-long dash */ + deflinestyle(8, 0x7777); /* mid-long dash */ + + return; +} + +TERM_PUBLIC void +IRIS4D_graphics() +{ + reshapeviewport(); + ortho2((Coord) 0, (Coord) IRIS4D_XMAX, (Coord) 0, (Coord) IRIS4D_YMAX); + if (iris24bits) + RGBcolor(colors24bits[IRIS4D_BACKGROUND][0], + colors24bits[IRIS4D_BACKGROUND][1], + colors24bits[IRIS4D_BACKGROUND][2]); + else + color(WHITE); + + clear(); + + return; +} + +TERM_PUBLIC void +IRIS4D_text() +{ + gflush(); /* flush buffer */ + return; /* enter text from another window!!! */ +} + +TERM_PUBLIC void IRIS4D_linetype(int linetype) +{ + static int pen_color_24[11] = + { + IRIS4D_BLACK, /* reserved for border and numbers */ + IRIS4D_MAGENTA, /* reserved for axis traces */ + IRIS4D_LIGHTCYAN, + IRIS4D_RED, + IRIS4D_GREEN, + IRIS4D_LIGHTMAGENTA, + IRIS4D_YELLOW, + IRIS4D_LIGHTRED, + IRIS4D_LIGHTGREEN, + IRIS4D_CYAN, + IRIS4D_BROWN, + }; + static int pen_color[8] = { 0, 1, 4, 5, 6, 1, 2, 4 }; + + if (linetype < -2) + linetype = LT_BLACK; + + if (iris24bits) { + int pencolor = pen_color_24[linetype < 0 ? linetype + 2 : linetype % 9 + 2]; + + RGBcolor(colors24bits[pencolor][0], + colors24bits[pencolor][1], + colors24bits[pencolor][2]); + /* Make all lines solid (linestyle 0) upto to the ninth. If more than + * 9 colors are needed, start to use the different line styles (1 to 8). + */ + setlinestyle(linetype < 9 ? 0 : (linetype + 2) % 8 + 1); + } else { + linetype = (linetype+2) % 8; + color((Colorindex) pen_color[linetype]); + setlinestyle(linetype); + } + return; +} + +TERM_PUBLIC void +IRIS4D_move(unsigned int x, unsigned int y) +{ + move2i(x, y); + return; +} + +void +IRIS4D_cmove(unsigned int x, unsigned int y) +{ + cmov2i(x, y); + return; +} + +TERM_PUBLIC void +IRIS4D_vector(unsigned int x, unsigned int y) +{ + draw2i(x, y); + return; +} + + +TERM_PUBLIC void +IRIS4D_put_text(unsigned int x, unsigned int y, const char *str) +{ + IRIS4D_cmove(x, y - IRIS4D_VCHAR / 2); + charstr(str); + return; +} + + +TERM_PUBLIC void +IRIS4D_reset() +{ + return; +} + +#endif /* TERM_BODY */ + +#ifdef TERM_TABLE + +TERM_TABLE_START(iris4d_driver) + "iris4d", "Silicon Graphics IRIS 4D Series Computer", + IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, + IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, + IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector, + IRIS4D_linetype, IRIS4D_put_text, null_text_angle, + null_justify_text, do_point, do_arrow, set_font_null +TERM_TABLE_END(iris4d_driver) + +#undef LAST_TERM +#define LAST_TERM iris4d_driver + +#endif /* TERM_TABLE */ +#endif /* TERM_PROTO_ONLY */ + +#ifdef TERM_HELP +START_HELP(iris4d) +"1 iris4d", +"?commands set terminal iris4d", +"?set terminal iris4d", +"?set term iris4d", +"?terminal iris4d", +"?term iris4d", +"?iris4d", +" The `iris4d` terminal driver supports Silicon Graphics IRIS 4D computers.", +" Its only option is 8- or 24-bit color depth. The default is 8.", +"", +" Syntax:", +" set terminal iris4d {8 | 24}", +"", +" The color depth is not really a choice -- the value appropriate for the", +" hardware should be selected.", +"", +" When using 24-bit mode, the colors can be directly specified via the file", +" .gnuplot_iris4d that is searched in the current directory and then in the", +" home directory specified by the HOME environment variable. This file holds", +" RGB values for the background, border, labels and nine plotting colors, in", +" that order. For example, here is a file containing the default colors:", +"", +" 85 85 85 Background (dark gray)", +" 0 0 0 Boundary (black)", +" 170 0 170 Labeling (magenta)", +" 85 255 255 Plot Color 1 (light cyan)", +" 170 0 0 Plot Color 2 (red)", +" 0 170 0 Plot Color 3 (green)", +" 255 85 255 Plot Color 4 (light magenta)", +" 255 255 85 Plot Color 5 (yellow)", +" 255 85 85 Plot Color 6 (light red)", +" 85 255 85 Plot Color 7 (light green)", +" 0 170 170 Plot Color 8 (cyan)", +" 170 170 0 Plot Color 9 (brown)", +"", +" This file must have exactly 12 lines of RGB triples. No empty lines are", +" allowed, and anything after the third number on a line is ignored." +END_HELP(iris4d) +#endif /* TERM_TABLE */