/* Hello, Emacs, this is -*-C-*- * $Id: unixplot.trm,v 1.16 2006/07/21 02:35:48 sfeam Exp $ * */ /* GNUPLOT -- unixplot.trm */ /*[ * Copyright 1990 - 1993, 1998, 2004 * * 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: * Unix plot(5) graphics language * * AUTHORS * Colin Kelley, Thomas Williams, Russell Lang * * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net). * */ /* * Unixplot library writes to stdout. A fix was put in place by * ..!arizona!naucse!jdc to let set term and set output redirect * stdout. All other terminals write to gpoutfile. */ /* * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995) */ #include "driver.h" #ifdef TERM_REGISTER register_term(unixplot) #endif #ifdef TERM_PROTO TERM_PUBLIC void UP_init __PROTO((void)); TERM_PUBLIC void UP_graphics __PROTO((void)); TERM_PUBLIC void UP_text __PROTO((void)); TERM_PUBLIC void UP_linetype __PROTO((int linetype)); TERM_PUBLIC void UP_move __PROTO((unsigned int x, unsigned int y)); TERM_PUBLIC void UP_vector __PROTO((unsigned int x, unsigned int y)); TERM_PUBLIC void UP_put_text __PROTO((unsigned int x, unsigned int y, const char str[])); TERM_PUBLIC void UP_reset __PROTO((void)); #define UP_XMAX 4096 #define UP_YMAX 4096 #define UP_XLAST (UP_XMAX - 1) #define UP_YLAST (UP_YMAX - 1) #define UP_VCHAR (UP_YMAX/30) /* just a guess--no way to know this! */ #define UP_HCHAR (UP_XMAX/60) /* just a guess--no way to know this! */ #define UP_VTIC (UP_YMAX/80) #define UP_HTIC (UP_XMAX/80) #endif /* TERM_PROTO */ #ifndef TERM_PROTO_ONLY #ifdef TERM_BODY TERM_PUBLIC void UP_init() { openpl(); space(0, 0, UP_XMAX, UP_YMAX); } TERM_PUBLIC void UP_graphics() { erase(); } TERM_PUBLIC void UP_text() { /* empty */ } TERM_PUBLIC void UP_linetype(int linetype) { static char *lt[2 + 5] = {"solid", "longdashed", "solid", "dotted", "shortdashed", "dotdashed", "longdashed"}; if (linetype < -2) linetype = LT_BLACK; if (linetype >= 5) linetype %= 5; linemod(lt[linetype + 2]); } TERM_PUBLIC void UP_move(unsigned int x, unsigned int y) { move(x, y); } TERM_PUBLIC void UP_vector(unsigned int x, unsigned int y) { cont(x, y); } TERM_PUBLIC void UP_put_text(unsigned int x, unsigned int y, const char str[]) { UP_move(x + UP_HCHAR / 2, y + UP_VCHAR / 5); label(str); } TERM_PUBLIC void UP_reset() { closepl(); } #endif /* TERM_BODY */ #ifdef TERM_TABLE TERM_TABLE_START(unixplot_driver) "unixplot", "Unix plotting standard (see plot(1))", UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, UP_text, null_scale, UP_graphics, UP_move, UP_vector, UP_linetype, UP_put_text, null_text_angle, null_justify_text, line_and_point, do_arrow, set_font_null TERM_TABLE_END(unixplot_driver) #undef LAST_TERM #define LAST_TERM unixplot_driver #endif /* TERM_TABLE */ #endif /* TERM_PROTO_ONLY */ #ifdef TERM_HELP #ifndef TERM_HELP_GNUGRAPH START_HELP(unixplot) "1 unixplot", "?commands set terminal unixplot", "?set terminal unixplot", "?set term unixplot", "?terminal unixplot", "?term unixplot", "?unixplot", " The `unixplot` terminal driver generates output in the Unix \"plot\" graphics", " language. It has no options.", "", " This terminal cannot be compiled if the GNU version of plot is to be used;", " in that case, use the `gnugraph` terminal instead." END_HELP(unixplot) #endif #endif