home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-10-27 | 48.8 KB | 2,047 lines |
- Newsgroups: comp.sources.misc
- From: gershon%gr@cs.utah.edu (Elber Gershon)
- Subject: v24i037: gnuplot3 - interactive function plotting utility, Part15/26
- Message-ID: <1991Oct28.002252.12402@sparky.imd.sterling.com>
- X-Md4-Signature: 5e63790cfeb8a0ccbd5a506a41303504
- Date: Mon, 28 Oct 1991 00:22:52 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
- Posting-number: Volume 24, Issue 37
- Archive-name: gnuplot3/part15
- Environment: UNIX, MS-DOS, VMS
- Supersedes: gnuplot2: Volume 11, Issue 65-79
-
- #!/bin/sh
- # this is Part.15 (part 15 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file gnuplot/term/bigfig.trm continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 15; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping gnuplot/term/bigfig.trm'
- else
- echo 'x - continuing file gnuplot/term/bigfig.trm'
- sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/bigfig.trm' &&
- X FIG_poly_vec_cnt++;
- X if (FIG_poly_vec_cnt > 50)
- X FIG_poly_clean(FIG_polyvec_stat);
- X
- X FIG_posx = x;
- X FIG_posy = y;
- }
- X
- X
- X
- X
- BFIG_arrow(sx, sy, ex, ey, head)
- X int sx, sy; /* start coord */
- X int ex, ey; /* end coord */
- X BOOLEAN head;
- {
- X FIG_poly_clean(FIG_polyvec_stat);
- X fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d\n",
- X O_POLYLINE, T_POLYLINE,
- X FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
- X head ? 1 : 0, 0);
- X /* arrow line */
- X if ( head )
- X fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
- X 0, 0, 1.0,
- X (double)BFIG_ARROW_WIDTH, (double)BFIG_ARROW_HEIGHT);
- X fprintf(outfile, "%d %d %d %d 9999 9999\n",
- X BFIG_XOFF + sx, BFIG_YOFF + BFIG_YMAX - sy,
- X BFIG_XOFF + ex, BFIG_YOFF + BFIG_YMAX - ey);
- X
- X FIG_posx = ex;
- X FIG_posy = ey;
- }
- X
- BFIG_put_text(x, y, str)
- X int x, y;
- X char *str;
- {
- X if (strlen(str) == 0) return;
- X FIG_poly_clean(FIG_polyvec_stat);
- X y = y - BFIG_VCHAR/2; /* assuming vertical center justified */
- X
- X fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
- X O_TEXT, FIG_justify,
- X FIG_ROMAN_FONT, BFIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
- X 1, BFIG_VCHAR, BFIG_HCHAR*strlen(str), BFIG_XOFF + x,
- X BFIG_YMAX + BFIG_YOFF-y, str);
- }
- X
- SHAR_EOF
- echo 'File gnuplot/term/bigfig.trm is complete' &&
- chmod 0666 gnuplot/term/bigfig.trm ||
- echo 'restore of gnuplot/term/bigfig.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/bigfig.trm'`"
- test 3598 -eq "$Wc_c" ||
- echo 'gnuplot/term/bigfig.trm: original size 3598, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/cgi.trm ==============
- if test -f 'gnuplot/term/cgi.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/cgi.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/cgi.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/cgi.trm' &&
- /* GNUPLOT - cgi.trm */
- /*
- X * Copyright (C) 1990 Ronald Florence
- X *
- X * Permission is hereby granted for unlimited non-commercial
- X * use of this code, on condition that the copyright
- X * notices are left intact and any modifications to the source
- X * code are noted as such. No warranty of any kind is implied
- X * or granted for this material.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports SCO CGI drivers
- X *
- X * AUTHOR
- X * Ronald Florence <ron@mlfarm.com>
- X */
- X
- #ifdef VGA_MONO
- static short rgb[16][3] = {
- X 0, 0, 0, /* Black */
- X 1000, 1000, 1000, /* White */
- X 800, 800, 0, /* Red */
- X 0, 600, 0, /* Green */
- X 0, 800, 800, /* Blue */
- X 1000, 1000, 400, /* Yellow */
- X 0, 600, 600, /* Cyan */
- X 600, 600, 600, /* Magenta */
- X 800, 800, 0, /* Brown */
- X 600, 600, 600, /* Lt. Grey */
- X 400, 600, 400, /* Dark Grey */
- X 400, 600, 1000, /* Lt. Blue */
- X 400, 1000, 400, /* Lt Green */
- X 400, 1000, 1000, /* Lt Cyan */
- X 1000, 600, 400, /* Lt Red */
- X 600, 600, 1000 /* Lt Magenta */
- };
- #endif
- X
- #define CGI_XMAX 32767
- #define CGI_YMAX 32767
- #define CGI_VTIC (CGI_YMAX / 75)
- #define CGI_HTIC term_tbl[term].h_tic
- #define CGI_VCHAR term_tbl[term].v_char
- #define CGI_HCHAR term_tbl[term].h_char
- #define CRT (gout[45] == 0)
- #define CGICOLORS gout[13]
- #define CGILINES gout[6]
- #define CGIROTATES gout[36]
- #define CGITEXTALIGN gout[48]
- X
- static short gout[66];
- static short cgidev;
- static short vect[4];
- static short gin[19] = {
- X 0, /* default aspect ratio */
- X 1, /* solid line */
- X 1, /* line color */
- X 1, /* marker type . */
- X 1, /* marker color */
- X 1, /* graphics text font */
- X 1, /* graphics text color */
- X 0, /* fill interior style */
- X 0, /* fill style index */
- X 1, /* fill color index */
- X 1 /* prompt for paper changes */
- X };
- X
- char *cgidriver, *getenv();
- X
- X
- CGI_init()
- {
- X if (getenv(cgidriver = "CGIDISP") == NULL)
- X HCGI_init();
- }
- X
- X
- HCGI_init()
- {
- X if (getenv(cgidriver = "CGIPRNT") == NULL)
- X int_error("no CGI driver", NO_CARET);
- }
- X
- X
- CGI_graphics()
- {
- X int i, aspect;
- X char *s;
- X short font_cap[9];
- X char err_str[80];
- X
- X if ( (s=getenv("ASPECT")) != NULL && (aspect=atoi(s)) >= 0 && aspect <= 3 )
- X gin[0] = aspect;
- X for (i = 0; cgidriver[i]; i++)
- X gin[11+i] = cgidriver[i];
- X gin[18] = ' ';
- X
- X if (v_opnwk(gin, &cgidev, gout) < 0)
- X {
- X sprintf(err_str, "CGI error %d opening %s", -vq_error(), cgidriver);
- X int_error(err_str, NO_CARET);
- X }
- X vqt_representation(cgidev, 9, font_cap);
- X CGI_VCHAR = font_cap[8] * 3 / 2;
- X CGI_HCHAR = font_cap[7];
- X CGI_HTIC = CGI_VTIC * ((double) gout[1] / (double) gout[4]) /
- X ((double) gout[0] / (double) gout[3]);
- #ifdef VGA_MONO
- X if (CGICOLORS > 2)
- X vsc_table(cgidev, 0, CGICOLORS, rgb);
- #endif
- }
- X
- X
- CGI_text()
- {
- X if (CRT)
- X {
- X short ptin[2];
- X char strin[2];
- X
- X ptin[0] = 0;
- X ptin[1] = 0;
- X vrq_string(cgidev, 1, 0, ptin, strin);
- X }
- X v_clswk(cgidev);
- }
- X
- X
- CGI_reset()
- {
- }
- X
- X
- CGI_move(x, y)
- X int x, y;
- {
- X vect[0] = x;
- X vect[1] = y;
- }
- X
- CGI_vector(x, y)
- X int x, y;
- {
- X vect[2] = x;
- X vect[3] = y;
- X v_pline(cgidev, 2, vect);
- X vect[0] = x;
- X vect[1] = y;
- }
- X
- X
- CGI_linetype(linetype)
- X int linetype;
- {
- X short lcolor;
- X
- X if (CGICOLORS > 2)
- X {
- X lcolor = (linetype + 2) % CGICOLORS + 1;
- X vsl_color(cgidev, lcolor);
- X vsm_color(cgidev, lcolor);
- X }
- X vsl_type(cgidev, (linetype < 1) ? 1 : (linetype % CGILINES) + 1);
- }
- X
- X
- CGI_put_text(x, y, str)
- int x, y;
- char *str;
- {
- X v_gtext(cgidev, (short) x, (short) y, str);
- }
- X
- X
- CGI_text_angle(ang)
- int ang;
- {
- X if (!CGIROTATES)
- X return FALSE;
- X /* angles are 1/10 degree ccw */
- X vst_rotation(cgidev, (ang) ? 900 : 0);
- X return TRUE;
- }
- X
- X
- CGI_justify_text(mode)
- enum JUSTIFY mode;
- {
- X short hor_in, hor_out, vert_out;
- X
- X if (!CGITEXTALIGN)
- X return FALSE;
- X
- X switch (mode)
- X {
- X case LEFT: hor_in = 0; break;
- X case CENTRE: hor_in = 1; break;
- X case RIGHT: hor_in = 2; break;
- X }
- X vst_alignment(cgidev, hor_in, 1, &hor_out, &vert_out);
- X return TRUE;
- }
- X
- X
- #define POINT_TYPES 6
- X
- CGI_point(x,y,num)
- X int x, y, num;
- {
- X short point[2];
- X static short cgimarker[POINT_TYPES] = {1, 2, 6, 4, 5, 3};
- X /* . + <> [] X * */
- X if (num < 0)
- X {
- X CGI_move(x, y);
- X CGI_vector(x, y);
- X }
- X else
- X {
- X vsm_type(cgidev, cgimarker[num % POINT_TYPES]);
- X point[0] = x;
- X point[1] = y;
- X v_pmarker(cgidev, 1, point);
- X }
- }
- SHAR_EOF
- chmod 0666 gnuplot/term/cgi.trm ||
- echo 'restore of gnuplot/term/cgi.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/cgi.trm'`"
- test 4407 -eq "$Wc_c" ||
- echo 'gnuplot/term/cgi.trm: original size 4407, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/dxy.trm ==============
- if test -f 'gnuplot/term/dxy.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/dxy.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/dxy.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/dxy.trm' &&
- /* GNUPLOT - dxy.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * Roland DXY800A plotter
- X *
- X * AUTHORS
- X * Martin Yii, eln557h@monu3.OZ
- X * Further modified Jan 1990 by Russell Lang, rjl@monu1.cc.monash.oz
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- #define DXY_XMAX 2470
- #define DXY_YMAX 1700
- X
- #define DXY_XLAST (DXY_XMAX - 1)
- #define DXY_YLAST (DXY_XMAX - 1)
- X
- #define DXY_VCHAR (56) /* double actual height of characters */
- #define DXY_HCHAR (28) /* actual width including spacing */
- #define DXY_VTIC (28)
- #define DXY_HTIC (28)
- X
- int dxy_angle = 0;
- X
- DXY_init()
- {
- /*
- X No initialisation sequences for DXY 800A
- */
- }
- X
- X
- DXY_graphics()
- {
- X /* HOME, Character size 3 */
- X fprintf(outfile,"H\nS3\n");
- }
- X
- X
- DXY_text()
- {
- /*
- X No sequences needed
- */
- }
- X
- X
- DXY_linetype(linetype)
- int linetype;
- {
- X /* select pen */
- X fprintf(outfile,"J%d\n",(linetype+2)%8+1);
- X switch(linetype) {
- X case -1 : /* use dotted line for axis */
- X fprintf(outfile,"L1\nB50\n");
- X break;
- X default : /* use solid line for all others */
- X fprintf(outfile,"L0\n");
- X break;
- X }
- }
- X
- X
- DXY_move(x,y)
- int x,y;
- {
- X fprintf(outfile,"M%d,%d\n",x,y);
- }
- X
- X
- DXY_vector(x,y)
- int x,y;
- {
- X fprintf(outfile,"D%d,%d\n",x,y);
- }
- X
- X
- DXY_put_text(x,y,str)
- int x, y;
- char *str;
- {
- X if (dxy_angle == 1 )
- X /* vertical */
- X DXY_move(x + DXY_VCHAR/4,y);
- X else
- X /* horiz */
- X DXY_move(x,y - DXY_VCHAR/4);
- X fprintf(outfile,"P%s\n",str);
- }
- X
- X
- int DXY_text_angle(ang)
- int ang;
- {
- X dxy_angle = ang;
- X fprintf(outfile,"Q%d\n",ang);
- X return TRUE;
- }
- X
- X
- DXY_reset()
- {
- X /* Home pen */
- X fprintf(outfile,"H\n");
- }
- X
- SHAR_EOF
- chmod 0666 gnuplot/term/dxy.trm ||
- echo 'restore of gnuplot/term/dxy.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/dxy.trm'`"
- test 2238 -eq "$Wc_c" ||
- echo 'gnuplot/term/dxy.trm: original size 2238, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/eepic.trm ==============
- if test -f 'gnuplot/term/eepic.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/eepic.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/eepic.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/eepic.trm' &&
- /* GNUPLOT - eepic.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * The EEPIC macros for LaTeX.
- X *
- X * AUTHORS
- X * David Kotz
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- /*
- X * This file contains the eepic terminal driver, intended for use with the
- X * eepic.sty macro package for LaTeX. This is an alternative to the
- X * latex driver. You need eepic.sty, epic.sty, and a printer driver that
- X * supports the tpic \specials.
- X *
- X * Although dotted and dashed lines are possible with EEPIC, and are
- X * tempting, they do not work well for high-sample-rate curves, mushing
- X * the dashes all together into a solid line. For now anyway, the EEPIC
- X * driver will have only solid lines. Anyone got a solution?
- X *
- X * LATEX must also be defined.
- X */
- X
- #define EEPIC_PTS_PER_INCH (72.27)
- #define DOTS_PER_INCH (300) /* resolution of printer we expect to use */
- #define EEPIC_UNIT (EEPIC_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
- X
- /* 5 inches wide by 3 inches high (default) */
- #define EEPIC_XMAX (5*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*5.0) */
- #define EEPIC_YMAX (3*DOTS_PER_INCH) /* (EEPIC_PTS_PER_INCH/EEPIC_UNIT*3.0) */
- X
- #define EEPIC_HTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- #define EEPIC_VTIC (5*DOTS_PER_INCH/72) /* (5./EEPIC_UNIT) */
- #define EEPIC_HCHAR (DOTS_PER_INCH*53/10/72) /* (5.3/EEPIC_UNIT) */
- #define EEPIC_VCHAR (DOTS_PER_INCH*11/72) /* (11./EEPIC_UNIT) */
- X
- static unsigned int EEPIC_posx;
- static unsigned int EEPIC_posy;
- enum JUSTIFY eepic_justify=LEFT;
- static int eepic_angle=0;
- X
- /* for DOTS point style */
- #define EEPIC_TINY_DOT "\\rule{.1pt}{.1pt}"
- X
- /* POINTS */
- #define EEPIC_POINT_TYPES 12 /* we supply more point types */
- static char *EEPIC_points[] = {
- X "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
- X "\\makebox(0,0){$+$}",
- X "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
- X "\\makebox(0,0){$\\times$}",
- X "\\makebox(0,0){$\\triangle$}",
- X "\\makebox(0,0){$\\star$}",
- X "\\circle{12}", "\\circle{18}", "\\circle{24}",
- X "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
- };
- X
- /* LINES */
- #define EEPIC_NUMLINES 5 /* number of linetypes below */
- static char *EEPIC_lines[] = {
- X "\\thicklines \\path", /* -2 border */
- X "\\thinlines \\drawline[-50]", /* -1 axes */
- X "\\thinlines \\path", /* 0 solid thin */
- X "\\thicklines \\path", /* 1 solid thick */
- X "\\Thicklines \\path", /* 2 solid Thick */
- };
- /* These are other possibilities
- X "\\thinlines \\dottedline{30}",
- X "\\thinlines \\drawline[-30]",
- X "\\thinlines \\dottedline{60}",
- X "\\thinlines \\drawline[-60]",
- X "\\thinlines \\dashline[-10]{20}[6]"
- */
- static int EEPIC_type; /* current line type */
- static BOOLEAN EEPIC_inline = FALSE; /* are we in the middle of a line */
- static void EEPIC_endline(); /* terminate any line in progress */
- static int EEPIC_linecount = 0; /* number of points in line so far */
- #define EEPIC_LINEMAX 50 /* max value for linecount */
- X
- /* ARROWS */
- /* we use the same code as for LATEX */
- static void best_latex_arrow(); /* figure out the best arrow */
- X
- EEPIC_init()
- {
- X EEPIC_posx = EEPIC_posy = 0;
- X EEPIC_linetype(-1);
- X fprintf(outfile, "%% GNUPLOT: LaTeX picture using EEPIC macros\n");
- X fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", EEPIC_UNIT);
- }
- X
- X
- EEPIC_scale(xs, ys)
- X double xs, ys; /* scaling factors */
- {
- X register struct termentry *t = &term_tbl[term];
- X
- X /* we change the table for use in graphics.c and EEPIC_graphics */
- X t->xmax = (unsigned int)(EEPIC_XMAX * xs);
- X t->ymax = (unsigned int)(EEPIC_YMAX * ys);
- X
- X return(TRUE);
- }
- X
- EEPIC_graphics()
- {
- X register struct termentry *t = &term_tbl[term];
- X
- X fprintf(outfile, "\\begin{picture}(%d,%d)(0,0)\n", t->xmax, t->ymax);
- X fprintf(outfile, "\\tenrm\n");
- }
- X
- X
- EEPIC_text()
- {
- X EEPIC_endline();
- X fprintf(outfile, "\\end{picture}\n");
- }
- X
- X
- EEPIC_linetype(linetype)
- X int linetype;
- {
- X EEPIC_endline();
- X
- X if (linetype >= EEPIC_NUMLINES-2)
- X linetype %= (EEPIC_NUMLINES-2);
- X
- X EEPIC_type = linetype;
- }
- X
- X
- X
- EEPIC_move(x,y)
- X unsigned int x,y;
- {
- X EEPIC_endline();
- X
- X EEPIC_posx = x;
- X EEPIC_posy = y;
- }
- X
- X
- EEPIC_point(x,y, number) /* version of line_and_point */
- X unsigned int x,y;
- X int number; /* type of point */
- {
- X EEPIC_move(x,y);
- X
- X /* Print the character defined by 'number'; number < 0 means
- X to use a dot, otherwise one of the defined points. */
- X fprintf(outfile, "\\put(%d,%d){%s}\n", x, y,
- X (number < 0 ? EEPIC_TINY_DOT
- X : EEPIC_points[number % EEPIC_POINT_TYPES]));
- }
- X
- X
- EEPIC_vector(ux,uy)
- X unsigned int ux,uy;
- {
- X if (!EEPIC_inline) {
- X EEPIC_inline = TRUE;
- X
- X /* Start a new line. This depends on line type */
- X fprintf(outfile, "%s(%u,%u)",
- X EEPIC_lines[EEPIC_type+2],
- X EEPIC_posx, EEPIC_posy);
- X EEPIC_linecount = 1;
- X } else {
- X /* Even though we are in middle of a path,
- X * we may want to start a new path command.
- X * If they are too long then latex will choke.
- X */
- X if (EEPIC_linecount++ >= EEPIC_LINEMAX) {
- X fprintf(outfile, "\n");
- X fprintf(outfile, "%s(%u,%u)",
- X EEPIC_lines[EEPIC_type+2],
- X EEPIC_posx, EEPIC_posy);
- X EEPIC_linecount = 1;
- X }
- X }
- X fprintf(outfile, "(%u,%u)", ux,uy);
- X EEPIC_posx = ux;
- X EEPIC_posy = uy;
- }
- X
- static void
- EEPIC_endline()
- {
- X if (EEPIC_inline) {
- X fprintf(outfile, "\n");
- X EEPIC_inline = FALSE;
- X }
- }
- X
- X
- EEPIC_arrow(sx,sy, ex,ey, head)
- X int sx,sy, ex,ey;
- X BOOLEAN head;
- {
- X best_latex_arrow(sx,sy, ex,ey, 2, head); /* call latex routine */
- X
- X EEPIC_posx = ex;
- X EEPIC_posy = ey;
- }
- X
- X
- EEPIC_put_text(x, y, str)
- X int x,y; /* reference point of string */
- X char str[]; /* the text */
- {
- X EEPIC_endline();
- X
- X fprintf(outfile, "\\put(%d,%d)",x,y);
- X switch(eepic_angle) {
- X case 0: {
- X switch(eepic_justify) {
- X case LEFT: {
- X fprintf(outfile,
- X "{\\makebox(0,0)[l]{%s}}\n", str);
- X break;
- X }
- X case CENTRE: {
- X fprintf(outfile,
- X "{\\makebox(0,0){%s}}\n", str);
- X break;
- X }
- X case RIGHT: {
- X fprintf(outfile,
- X "{\\makebox(0,0)[r]{%s}}\n", str);
- X break;
- X }
- X }
- X break;
- X }
- X case 1: { /* put text in a short stack */
- X switch(eepic_justify) {
- X case LEFT: {
- X fprintf(outfile,
- X "{\\makebox(0,0)[lb]{\\shortstack{%s}}}\n", str);
- X break;
- X }
- X case CENTRE: {
- X fprintf(outfile,
- X "{\\makebox(0,0)[l]{\\shortstack{%s}}}\n", str);
- X break;
- X }
- X case RIGHT: {
- X fprintf(outfile,
- X "{\\makebox(0,0)[lt]{\\shortstack{%s}}}\n", str);
- X break;
- X }
- X }
- X break;
- X }
- X }
- }
- X
- X
- X
- int EEPIC_justify_text(mode)
- X enum JUSTIFY mode;
- {
- X eepic_justify = mode;
- X return (TRUE);
- }
- X
- int EEPIC_text_angle(angle)
- X int angle;
- {
- X /* we can't really write text vertically, but this will
- X put the ylabel centred at the left of the plot, and
- X then we'll make a \shortstack */
- X eepic_angle = angle;
- X return (TRUE);
- }
- X
- EEPIC_reset()
- {
- X EEPIC_endline();
- X EEPIC_posx = EEPIC_posy = 0;
- }
- X
- SHAR_EOF
- chmod 0644 gnuplot/term/eepic.trm ||
- echo 'restore of gnuplot/term/eepic.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/eepic.trm'`"
- test 7640 -eq "$Wc_c" ||
- echo 'gnuplot/term/eepic.trm: original size 7640, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/epson.trm ==============
- if test -f 'gnuplot/term/epson.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/epson.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/epson.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/epson.trm' &&
- /* GNUPLOT - epson.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * epson_lx800, nec_cp6c, nec_cp6d, nec_cp6b, starc,
- X * epson_60dpi, tandy_60dpi
- X *
- X * AUTHORS
- X * Russell Lang
- X * William Wilson
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- /* The following epson lx800 driver uses generic bit mapped graphics
- X routines to build up a bit map in memory. */
- /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
- /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- /* EPSON_init changes outfile to binary mode on PC's */
- X
- #ifdef EPSONP
- X
- #define EPSONXMAX 512
- #define EPSONYMAX 384
- X
- #define EPSONXLAST (EPSONXMAX - 1)
- #define EPSONYLAST (EPSONYMAX - 1)
- X
- #define EPSONVCHAR FNT5X9_VCHAR
- #define EPSONHCHAR FNT5X9_HCHAR
- #define EPSONVTIC 6
- #define EPSONHTIC 6
- X
- EPSONinit()
- {
- #ifdef PC
- X reopen_binary();
- #endif
- #ifdef vms
- X reopen_binary();
- #endif
- }
- X
- X
- EPSONgraphics()
- {
- X b_charsize(FNT5X9);
- X b_makebitmap((unsigned int)(EPSONXMAX*xsize),
- X (unsigned int)(EPSONYMAX*ysize),1);
- }
- X
- X
- EPSONtext()
- {
- X epson_dump();
- X b_freebitmap();
- }
- X
- X
- #define EPSONlinetype b_setlinetype
- #define EPSONmove b_move
- #define EPSONvector b_vector
- #define EPSONput_text b_put_text
- #define EPSON_text_angle b_text_angle
- X
- EPSONreset()
- {
- #ifdef vms
- X fflush_binary();
- #endif
- }
- X
- X
- /* output file must be binary mode for epson_dump */
- epson_dump()
- {
- X register unsigned int x;
- X int j;
- X for (j=(b_ysize/8)-1; j>=0; j--) {
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\033J\030"); /* line feed 8/72" = 8 dots */
- X fprintf(outfile,"\r\033*\005");
- X (void) fputc((char)(b_xsize%256),outfile);
- X (void) fputc((char)(b_xsize/256),outfile);
- X for (x=0; x<b_xsize; x++) {
- X (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
- X }
- X }
- #ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- #endif
- }
- X
- #endif /* EPSONP */
- X
- X
- /* The following NEC CP6 Pinwriter driver uses generic bit mapped graphics
- X routines to build up a bit map in memory. */
- /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
- /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- /* NECinit changes outfile to binary mode for PC's */
- X
- /* Add a Monochrome NEC printer (for faster speed and line types) jdc */
- X
- #ifdef NEC
- X
- #define NECXMAX 400
- #define NECYMAX 320
- X
- #define NECXLAST (NECXMAX - 1)
- #define NECYLAST (NECYMAX - 1)
- X
- #define NECVCHAR FNT5X9_VCHAR
- #define NECHCHAR FNT5X9_HCHAR
- #define NECVTIC 6
- #define NECHTIC 6
- X
- /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
- static unsigned int neccolor[] = {1,8,4,2,10,12,6,14};
- static unsigned int necpcolor[]= {0,2,1,4};
- X
- NECinit()
- {
- #ifdef PC
- X reopen_binary();
- #endif
- #ifdef vms
- X reopen_binary();
- #endif
- }
- X
- X
- /* Monochrome only NEC CP6 printer (set term nec_cp6m or nec_cp6d). */
- /* will probably work with NEC P6 printer */
- NECMgraphics()
- {
- X b_charsize(FNT5X9);
- X b_makebitmap((unsigned int)(NECXMAX*xsize),
- X (unsigned int)(NECYMAX*ysize),1);
- }
- X
- /* Color ribbon in NEC CP6 printer (set term nec_cp6c) */
- NECCgraphics()
- {
- X b_charsize(FNT5X9);
- X b_makebitmap((unsigned int)(NECXMAX*xsize),
- X (unsigned int)(NECYMAX*ysize),4);
- }
- X
- X
- NECdraft_text()
- {
- X nec_draft_dump();
- X b_freebitmap();
- }
- X
- NECtext()
- {
- X nec_dump();
- X b_freebitmap();
- }
- X
- NECClinetype(linetype)
- int linetype;
- {
- X if (linetype>=6)
- X linetype %= 6;
- X b_setvalue(neccolor[linetype+2]);
- }
- X
- #define NECMlinetype b_setlinetype
- #define NECmove b_move
- #define NECvector b_vector
- #define NECput_text b_put_text
- #define NEC_text_angle b_text_angle
- X
- X
- NECreset()
- {
- #ifdef vms
- X fflush_binary();
- #endif
- }
- X
- X
- /* output file must be binary mode for nec_dump */
- nec_dump()
- {
- unsigned int x;
- unsigned int plane,offset;
- int j;
- unsigned int column8;
- unsigned long column24;
- char column3, column2, column1;
- X fprintf(outfile,"\033P\033l\005"); /* 10cpi, left margin 5 char */
- X for (j=(b_ysize/8)-1;j>=0;j--) {
- X fprintf(outfile,"\033J\030"); /* 24/180" line feed */
- X for (plane=0; plane<b_planes; plane++) {
- X offset=plane*b_psize;
- X if (b_planes>1) {
- X /* select colour for plane */
- X fprintf(outfile,"\033r");
- X (void) fputc((char)necpcolor[plane],outfile);
- X }
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\r\033*\047");
- X (void) fputc((char)((b_xsize*3)%256),outfile);
- X (void) fputc((char)((b_xsize*3)/256),outfile);
- X for (x=0; x<b_xsize; x++) {
- X column8= (unsigned int)(*((*b_p)[j+offset]+x));
- X column24=0;
- X if (column8&0x01) column24|=(long)0x000007;
- X if (column8&0x02) column24|=(long)0x000038;
- X if (column8&0x04) column24|=(long)0x0001c0;
- X if (column8&0x08) column24|=(long)0x000e00;
- X if (column8&0x10) column24|=(long)0x007000;
- X if (column8&0x20) column24|=(long)0x038000;
- X if (column8&0x40) column24|=(long)0x1c0000;
- X if (column8&0x80) column24|=(long)0xe00000;
- X column1 = (char) ( column24 & (long)0xff);
- X column2 = (char) ((column24>>8) & (long)0xff);
- X column3 = (char) ((column24>>16) & (long)0xff);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X (void) fputc(column3,outfile);
- X (void) fputc(column2,outfile);
- X (void) fputc(column1,outfile);
- X }
- X }
- X }
- X fprintf(outfile,"\r\033l");
- X (void) fputc('\0',outfile); /* set left margin to 0 */
- X if (b_planes > 1) {
- X fprintf(outfile,"\033r");
- X (void) fputc('\0',outfile); /* set color to black */
- X }
- #ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- #endif
- #ifdef vms
- X fflush_binary();
- #endif
- }
- X
- /* output file must be binary mode for nec_dump */
- nec_draft_dump()
- {
- unsigned int x;
- unsigned int plane,offset;
- int j;
- X fprintf(outfile,"\033P\033l\005\r"); /* 10cpi, left margin 5 char */
- X for (j=(b_ysize/8)-1;j>=0;j--) {
- X fprintf(outfile,"\033J\030"); /* 24/180" line feed */
- X for (plane=0; plane<b_planes; plane++) {
- X offset=plane*b_psize;
- X if (b_planes>1) {
- X /* select colour for plane */
- X fprintf(outfile,"\033r");
- X (void) fputc((char)necpcolor[plane],outfile);
- X }
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\r\033*");
- X (void) fputc('\0',outfile);
- X (void) fputc((char)(b_xsize%256),outfile);
- X (void) fputc((char)(b_xsize/256),outfile);
- X for (x=0; x<b_xsize; x++) {
- X (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
- X }
- X }
- X }
- X fprintf(outfile,"\r\033l");
- X (void) fputc('\0',outfile); /* set left margin to 0 */
- X if (b_planes > 1) {
- X fprintf(outfile,"\033r");
- X (void) fputc('\0',outfile); /* set color to black */
- X }
- #ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- #endif
- }
- X
- #endif /* NEC */
- X
- #ifdef STARC
- /* The following Star color driver uses generic bit mapped graphics
- X routines to build up a bit map in memory. */
- /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
- /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
- /* STARC_init changes outfile to binary mode on PC's */
- X
- #define STARCXMAX 512
- #define STARCYMAX 384
- X
- #define STARCXLAST (STARCXMAX - 1)
- #define STARCYLAST (STARCYMAX - 1)
- X
- #define STARCVCHAR FNT5X9_VCHAR
- #define STARCHCHAR FNT5X9_HCHAR
- #define STARCVTIC 6
- #define STARCHTIC 6
- X
- /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
- static unsigned int STARCcolor[] = {1,8,4,2,10,12,6,14};
- static unsigned int STARCpcolor[]= {0,2,1,4};
- X
- STARCinit()
- {
- #ifdef PC
- X reopen_binary();
- #endif
- #ifdef vms
- X reopen_binary();
- #endif
- }
- X
- X
- STARCgraphics()
- {
- X b_charsize(FNT5X9);
- X b_makebitmap((unsigned int)(STARCXMAX*xsize),
- X (unsigned int)(STARCYMAX*ysize),4);
- }
- X
- X
- STARCtext()
- {
- X STARC_dump();
- X b_freebitmap();
- }
- X
- STARClinetype(linetype)
- int linetype;
- {
- X if (linetype>=6)
- X linetype %= 6;
- X b_setvalue(STARCcolor[linetype+2]);
- }
- X
- X
- #define STARCmove b_move
- #define STARCvector b_vector
- #define STARCput_text b_put_text
- #define STARC_text_angle b_text_angle
- X
- STARCreset()
- {
- #ifdef vms
- X fflush_binary();
- #endif
- }
- X
- X
- /* output file must be binary mode for STARC_dump */
- STARC_dump()
- {
- unsigned int x;
- unsigned int plane,offset;
- int j;
- X for (j=(b_ysize/8)-1;j>=0;j--) {
- X fprintf(outfile,"\033J\030"); /* line feed 8/72" = 8 dots */
- X for (plane=0; plane<b_planes; plane++) {
- X offset=plane*b_psize;
- X if (b_planes>1) {
- X /* select colour for plane */
- X fprintf(outfile,"\033r");
- X (void) fputc((char)STARCpcolor[plane],outfile);
- X }
- X /* select plotter graphics mode (square pixels) */
- X fprintf(outfile,"\r\033*\005");
- X (void) fputc((char)(b_xsize%256),outfile);
- X (void) fputc((char)(b_xsize/256),outfile);
- X for (x=0; x<b_xsize; x++) {
- X (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
- X }
- X }
- X }
- X if (b_planes > 1) {
- X fprintf(outfile,"\033r");
- X (void) fputc('\0',outfile); /* set color to black */
- X }
- #ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- #endif
- }
- X
- #endif /* STARC */
- X
- X
- #ifdef EPS60
- X
- /* make the total dimensions 8 inches by 5 inches */
- #define EPS60XMAX 480
- #define EPS60YMAX 360
- X
- #define EPS60XLAST (EPS60XMAX - 1)
- #define EPS60YLAST (EPS60YMAX - 1)
- X
- EPS60graphics()
- {
- X b_charsize(FNT5X9);
- X b_makebitmap((unsigned int)(EPS60XMAX*xsize),
- X (unsigned int)(EPS60YMAX*ysize),1);
- }
- X
- X
- EPS60text()
- {
- X eps60_dump();
- X b_freebitmap();
- }
- X
- X
- X
- /* output file must be binary mode for eps60_dump */
- eps60_dump()
- {
- X register unsigned int x;
- X int j;
- X fprintf(outfile,"\033%c\030",'3'); /* set line spacing 24/216" = 8 dots */
- X for (j=(b_ysize/8)-1; j>=0; j--) {
- X /* select printer graphics mode 'K' */
- X fprintf(outfile,"\r\n\033K");
- X (void) fputc((char)(b_xsize%256),outfile);
- X (void) fputc((char)(b_xsize/256),outfile);
- X for (x=0; x<b_xsize; x++) {
- X (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
- X }
- X }
- X fprintf(outfile,"\033%c\044\r\n",'3'); /* set line spacing 36/216" = 1/6" */
- #ifdef PC
- X fprintf(stderr,"Print using: COPY /B\n");
- #endif
- }
- X
- #endif /* EPS60 */
- X
- #ifdef TANDY60
- X
- /* The only difference between TANDY60 and EPS60 is the inclusion
- X of codes to swap the Tandy printer into IBM mode and back
- X into Tandy mode. For a Tandy already in IBM mode, use EPS60. */
- X
- X
- TANDY60text()
- {
- #ifdef PC
- X fprintf(stderr, "Inserting Tandy/IBM mode conversion codes\n");
- #endif
- X /* Switch to IBM mode, and leave 3 inches above the plot so as
- X to get rough vertical centring on the page. Perform the
- X centring by setting 1" line feeds and issuing 3 of them. */
- X fprintf(outfile, "\033!\033%c%c\n\n\n", '3',216);
- X eps60_dump();
- X b_freebitmap();
- X /* A form feed must be sent before switching back to Tandy mode,
- X or else the form setting will be messed up. */
- X fprintf(outfile, "\f\033!");
- }
- X
- X
- #endif /* TANDY60 */
- SHAR_EOF
- chmod 0666 gnuplot/term/epson.trm ||
- echo 'restore of gnuplot/term/epson.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/epson.trm'`"
- test 11330 -eq "$Wc_c" ||
- echo 'gnuplot/term/epson.trm: original size 11330, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/fig.trm ==============
- if test -f 'gnuplot/term/fig.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/fig.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/fig.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/fig.trm' &&
- /* GNUPLOT - fig.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * Fig graphics language
- X *
- X * AUTHORS
- X * Micah Beck, David Kotz
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- #ifdef MSDOS
- #define long int
- #endif /* MSDOS */
- X
- /*
- X * Original for Fig code output by Micah Beck, 1989
- X * Department of Computer Science, Cornell University
- X * Updated by David Kotz for gnuplot 2.0
- X * More efficient output Ian by Dall
- X */
- #include "object.h" /* from the TransFig distribution */
- #define FIG_DEFAULT (-1)
- #define FIG_ROMAN_FONT (0)
- X
- #ifndef FIG_RES
- /* Must be 80 for the Fig editor, but may be increased if used
- X * only by TransFig filters.
- X * Represents resolution per inch.
- X */
- #define FIG_RES 80
- #endif
- X
- #define FIG_COORD_SYS 2
- X
- #define FIG_MAGIC "#FIG 1.4-TFX"
- #define FIG_HTIC (5*FIG_RES/80)
- #define FIG_VTIC (5*FIG_RES/80)
- #define FIG_FONT_S FIG_DEFAULT
- #define FIG_HCHAR (6*FIG_RES/80) /* Change if FIG_FONT_S is changed */
- #define FIG_VCHAR (12*FIG_RES/80) /* Change if FIG_FONT_S is changed */
- #define FIG_ARROW_WIDTH FIG_HTIC
- #define FIG_ARROW_HEIGHT FIG_HTIC
- X
- static long FIG_xbase = FIG_RES/2;
- static long FIG_ybase = FIG_RES/2;
- X
- static long FIG_posx;
- static long FIG_posy;
- static int FIG_poly_vec_cnt;
- enum FIG_poly_stat {FIG_poly_new, FIG_poly_part};
- static enum FIG_poly_stat FIG_polyvec_stat;
- /* 5 inches wide by 3 inches high */
- #define FIG_XMAX (5 * FIG_RES)
- #define FIG_YMAX (3 * FIG_RES)
- X
- #define FIG_XOFF (FIG_RES/4)
- #define FIG_YOFF (FIG_RES/4)
- X
- static int FIG_type; /* negative types use real lines */
- static float FIG_spacing; /* length of dash or dot spacing */
- static int FIG_justify; /* Fig justification T_*_JUSTIFIED */
- static float FIG_angle; /* Fig text angle 0=horiz, Pi/2=vert */
- X
- #define FIG_POINT_TYPES POINT_TYPES /* we use the same points */
- X
- static
- X FIG_poly_clean(stat)
- enum FIG_poly_stat stat;
- {
- X if(stat == FIG_poly_part)
- X fprintf(outfile, " 9999 9999\n");
- X FIG_polyvec_stat = FIG_poly_new;
- }
- X
- FIG_init()
- {
- X FIG_posx = FIG_posy = 0;
- X FIG_polyvec_stat = FIG_poly_new;
- X FIG_linetype(-1);
- X FIG_justify_text(LEFT);
- X FIG_text_angle(0);
- X
- X fprintf(outfile, "%s\n", FIG_MAGIC);
- X fprintf(outfile, "%d %d\n", FIG_RES, FIG_COORD_SYS);
- }
- X
- X
- FIG_graphics()
- {
- X FIG_posx = FIG_posy = 0;
- X FIG_polyvec_stat = FIG_poly_new;
- X /* there is no way to have separate pictures in a FIG file */
- }
- X
- X
- FIG_text()
- {
- X /* there is no way to have separate pictures in a FIG file */
- X FIG_poly_clean(FIG_polyvec_stat);
- X FIG_posx = FIG_posy = 0;
- X fflush(outfile);
- }
- X
- X
- /* Line types for FIG work like this:
- X * -2 : solid (border)
- X * -1 : dashed 4 (axes)
- X * 0 : solid (first curve)
- X * 1 : dotted 3
- X * 2 : dashed 3
- X * 3 : dotted 6
- X * 4 : dashed 6
- X * ... ...
- X */
- X
- FIG_linetype(linetype)
- X int linetype; /* expect linetype >= -2 */
- {
- X int last_FIG_type = FIG_type;
- X int last_FIG_spacing = FIG_spacing;
- X switch (linetype) {
- X case 0:
- X case -2: {
- X FIG_type = 0; /* solid line */
- X FIG_spacing = 0.0;
- X break;
- X }
- X case -1: {
- X FIG_type = 1; /* dashed */
- X FIG_spacing = 4.0; /* dash length */
- X break;
- X }
- X default: {
- X linetype = abs(linetype); /* shouldn't be negative anyway */
- X /* now linetype >= 1 */
- X FIG_type = linetype % 2 + 1; /* dotted, dashed, ... */
- X FIG_spacing = (linetype+1) / 2 * 3;
- X break;
- X }
- X }
- X if (FIG_type != last_FIG_type || FIG_spacing != last_FIG_spacing)
- X FIG_poly_clean(FIG_polyvec_stat);
- }
- X
- FIG_move(x,y)
- X unsigned int x,y;
- {
- X int last_FIG_posx = FIG_posx;
- X int last_FIG_posy = FIG_posy;
- X FIG_posx = x;
- X FIG_posy = y;
- X if (FIG_posx != last_FIG_posx || FIG_posy != last_FIG_posy)
- X FIG_poly_clean(FIG_polyvec_stat);
- }
- X
- X
- FIG_vector(ux,uy)
- X unsigned int ux,uy;
- {
- X int x=ux, y=uy;
- X
- X if (FIG_polyvec_stat != FIG_poly_part)
- X {
- X fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d\n",
- X O_POLYLINE, T_POLYLINE,
- X FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
- X 0, 0);
- X fprintf(outfile, "%d %d",
- X FIG_XOFF + FIG_posx, FIG_YMAX + FIG_YOFF - FIG_posy);
- X FIG_poly_vec_cnt = 1;
- X FIG_polyvec_stat = FIG_poly_part;
- X }
- X fprintf(outfile, " %d %d",
- X FIG_XOFF + x, FIG_YMAX + FIG_YOFF-y);
- X FIG_poly_vec_cnt++;
- X if (FIG_poly_vec_cnt > 50)
- X FIG_poly_clean(FIG_polyvec_stat);
- X
- X FIG_posx = x;
- X FIG_posy = y;
- }
- X
- X
- FIG_arrow(sx, sy, ex, ey, head)
- X int sx, sy; /* start coord */
- X int ex, ey; /* end coord */
- X BOOLEAN head;
- {
- X FIG_poly_clean(FIG_polyvec_stat);
- X fprintf(outfile, "%d %d %d %d %d %d %d %d %6.3f %d %d\n",
- X O_POLYLINE, T_POLYLINE,
- X FIG_type, 1, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_spacing,
- X head ? 1 : 0, 0);
- X /* arrow line */
- X if ( head )
- X fprintf(outfile, "%d %d %.3f %.3f %.3f\n",
- X 0, 0, 1.0,
- X (double)FIG_ARROW_WIDTH, (double)FIG_ARROW_HEIGHT);
- X fprintf(outfile, "%d %d %d %d 9999 9999\n",
- X FIG_XOFF + sx, FIG_YOFF + FIG_YMAX - sy,
- X FIG_XOFF + ex, FIG_YOFF + FIG_YMAX - ey);
- X
- X FIG_posx = ex;
- X FIG_posy = ey;
- }
- X
- X
- FIG_put_text(x, y, str)
- X int x, y;
- X char *str;
- {
- X if (strlen(str) == 0) return;
- X FIG_poly_clean(FIG_polyvec_stat);
- X y = y - FIG_VCHAR/2; /* assuming vertical center justified */
- X
- X fprintf(outfile, "%d %d %d %d %d %d %d %6.3f %d %d %d %d %d %s\01\n",
- X O_TEXT, FIG_justify,
- X FIG_ROMAN_FONT, FIG_FONT_S, FIG_DEFAULT, FIG_DEFAULT, FIG_DEFAULT, FIG_angle,
- X FIG_DEFAULT, FIG_VCHAR, FIG_HCHAR*strlen(str), FIG_XOFF + x,
- X FIG_YMAX + FIG_YOFF-y, str);
- }
- X
- int FIG_justify_text(mode)
- X enum JUSTIFY mode;
- {
- X switch(mode) {
- X case LEFT: FIG_justify = T_LEFT_JUSTIFIED; break;
- X case CENTRE: FIG_justify = T_CENTER_JUSTIFIED; break;
- X case RIGHT: FIG_justify = T_RIGHT_JUSTIFIED; break;
- X /* shouldn't happen */
- X default: FIG_justify = T_LEFT_JUSTIFIED; break;
- X }
- X return (TRUE);
- }
- X
- int FIG_text_angle(angle)
- X int angle;
- {
- X if (angle)
- X FIG_angle = Pi / 2.0; /* vertical is pi/2 radians */
- X else
- X FIG_angle = 0.0; /* horizontal */
- X return (TRUE);
- }
- X
- FIG_reset()
- {
- X FIG_poly_clean(FIG_polyvec_stat);
- X FIG_posx = FIG_posy = 0;
- X fflush(outfile);
- }
- X
- #ifdef MSDOS
- #undef long
- #endif /* MSDOS */
- SHAR_EOF
- chmod 0644 gnuplot/term/fig.trm ||
- echo 'restore of gnuplot/term/fig.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/fig.trm'`"
- test 7494 -eq "$Wc_c" ||
- echo 'gnuplot/term/fig.trm: original size 7494, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/hp26.trm ==============
- if test -f 'gnuplot/term/hp26.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/hp26.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/hp26.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hp26.trm' &&
- /* GNUPLOT - hp26.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * HP2623A
- X *
- X * AUTHORS
- X * hplvlch!ch (Chuck Heller)
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- X
- #define HP26_XMAX 512
- #define HP26_YMAX 390
- X
- #define HP26_XLAST (HP26_XMAX - 1)
- #define HP26_YLAST (HP26_XMAX - 1)
- X
- /* Assume a character size of 1, or a 7 x 10 grid. */
- #define HP26_VCHAR 10
- #define HP26_HCHAR 7
- #define HP26_VTIC (HP26_YMAX/70)
- #define HP26_HTIC (HP26_XMAX/75)
- X
- HP26_init()
- {
- X /* The HP2623A needs no initialization. */
- }
- X
- X
- HP26_graphics()
- {
- X /* Clear and enable the display */
- X
- X fputs("\033*daZ\033*dcZ",outfile);
- }
- X
- X
- HP26_text()
- {
- X fputs("\033*dT",outfile); /* back to text mode */
- }
- X
- X
- HP26_linetype(linetype)
- int linetype;
- {
- #define SOLID 1
- #define LINE4 4
- #define LINE5 5
- #define LINE6 6
- #define LINE8 8
- #define DOTS 7
- #define LINE9 9
- #define LINE10 10
- X
- static int map[2+9] = { SOLID, /* border */
- X SOLID, /* axes */
- X DOTS, /* plot 0 */
- X LINE4, /* plot 1 */
- X LINE5, /* plot 2 */
- X LINE6, /* plot 3 */
- X LINE8, /* plot 4 */
- X LINE9, /* plot 5 */
- X LINE10, /* plot 6 */
- X SOLID, /* plot 7 */
- X SOLID /* plot 8 */ };
- X
- X if (linetype >= 9)
- X linetype %= 9;
- X fprintf(outfile,"\033*m%dB",map[linetype + 2]);
- }
- X
- X
- HP26_move(x,y)
- int x,y;
- {
- X fprintf(outfile,"\033*pa%d,%dZ",x,y);
- }
- X
- X
- HP26_vector(x,y)
- int x,y;
- {
- X fprintf(outfile,"\033*pb%d,%dZ",x,y);
- }
- X
- X
- HP26_put_text(x,y,str)
- int x, y;
- char *str;
- {
- X HP26_move(x,y - HP26_VCHAR/2);
- X fputs("\033*dS",outfile);
- X fprintf(outfile,"\033*m3Q\033*l%s\n",str);
- X fputs("\033*dT",outfile);
- }
- X
- X
- X
- HP26_reset()
- {
- }
- X
- SHAR_EOF
- chmod 0666 gnuplot/term/hp26.trm ||
- echo 'restore of gnuplot/term/hp26.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/hp26.trm'`"
- test 2262 -eq "$Wc_c" ||
- echo 'gnuplot/term/hp26.trm: original size 2262, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/hp2648.trm ==============
- if test -f 'gnuplot/term/hp2648.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/hp2648.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/hp2648.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hp2648.trm' &&
- /* GNUPLOT - hp2648.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * HP2648 and HP2647
- X *
- X * AUTHORS
- X * Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- #define HP2648XMAX 720
- #define HP2648YMAX 360
- X
- #define HP2648XLAST (HP2648XMAX - 1)
- #define HP2648YLAST (HP2648YMAX - 1)
- X
- #define HP2648VCHAR 12
- #define HP2648HCHAR 7
- #define HP2648VTIC 8
- #define HP2648HTIC 8
- X
- X
- HP2648init()
- {
- X fprintf(outfile,"\033*m1m1n136,1cZ");
- /* 1 2 3 4
- X 1. mode
- X 2. textsize=1
- X 3. textangle=1
- X 4. define line type 2 to be * * * * etc.
- */
- }
- X
- X
- HP2648graphics()
- {
- X fprintf(outfile,"\033*dacZ");
- /* 1 23
- X 1. mode
- X 2. clear grahics screen
- X 3. graphics video on
- */
- }
- X
- X
- HP2648text()
- {
- }
- X
- X
- HP2648linetype(linetype)
- int linetype;
- {
- X static int hpline[] = {1,7,1,4,5,6,8,9,10,7,2};
- X fprintf(outfile,"\033*m%dbZ",hpline[(linetype+2)%11]);
- }
- X
- X
- HP2648move(x,y)
- int x,y;
- {
- X fprintf(outfile,"\033*paf%d,%dZ",x,y);
- X /* 1 23 4
- X 1 plot mode
- X 2 "pen up"
- X 3 goto absolute x,y
- X 4 end command
- X */
- }
- X
- X
- HP2648vector(x,y)
- int x,y;
- {
- X fprintf(outfile,"\033*pbf%d,%dZ",x,y);
- X /* 1
- X 1 "pen down"
- X */
- }
- X
- X
- HP2648put_text(x,y,str)
- int x, y;
- char *str;
- {
- X HP2648move(x,y-HP2648VCHAR/2 + 1);
- X fprintf(outfile,"\033*l%s\n",str);
- }
- X
- X
- int HP2648_text_angle(ang)
- int ang;
- {
- X fprintf(outfile,"\033*m%dnZ\n",ang+1);
- X return TRUE;
- }
- X
- HP2648reset()
- {
- }
- X
- SHAR_EOF
- chmod 0666 gnuplot/term/hp2648.trm ||
- echo 'restore of gnuplot/term/hp2648.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/hp2648.trm'`"
- test 2113 -eq "$Wc_c" ||
- echo 'gnuplot/term/hp2648.trm: original size 2113, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/hpgl.trm ==============
- if test -f 'gnuplot/term/hpgl.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/hpgl.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/hpgl.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hpgl.trm' &&
- /* GNUPLOT - hpgl.trm */
- /*
- X * Copyright (C) 1990
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and
- X * that both that copyright notice and this permission notice appear
- X * in supporting documentation.
- X *
- X * Permission to modify the software is granted, but not the right to
- X * distribute the modified code. Modifications are to be distributed
- X * as patches to released version.
- X *
- X * This software is provided "as is" without express or implied warranty.
- X *
- X * This file is included by ../term.c.
- X *
- X * This terminal driver supports:
- X * hpgl, hp7580b, HP Laserjet III
- X *
- X * AUTHORS
- X * Colin Kelley, Thomas Williams, Russell Lang
- X *
- X * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- X *
- X */
- X
- #define HPGL_XMAX 15200
- #define HPGL_YMAX 10000
- X
- #define HPGL_XLAST (HPGL_XMAX - 1)
- #define HPGL_YLAST (HPGL_XMAX - 1)
- X
- /* HPGL_VCHAR, HPGL_HCHAR are not used */
- #define HPGL_VCHAR (HPGL_YMAX/100*32/10) /* 3.2% */
- #define HPGL_HCHAR (HPGL_XMAX/100*12/10) /* 1.2% */
- #define HPGL_VTIC (HPGL_YMAX/70)
- #define HPGL_HTIC (HPGL_YMAX/70)
- X
- int HPGL_ang = 0;
- X
- HPGL_init()
- {
- X fputs("\033.Y\n",outfile);
- /* 1
- X 1. enable eavesdropping
- */
- }
- X
- HPLJIII_PORT_init()
- {
- X fputs("\033E\033&l1X\033&l0O\033%0B;PW0.15\n",outfile);
- }
- X
- HPLJIII_LAND_init()
- {
- X fputs("\033E\033&l1X\033&l1O\033%0B;PW0.15\n",outfile);
- }
- X
- X
- HPGL_graphics()
- {
- X fprintf(outfile,
- X "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
- X HPGL_XMAX,HPGL_YMAX,
- X ((double)(HPGL_HCHAR)*200/3/HPGL_XMAX),
- X ((double)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
- /* 1 2 3
- X 1. reset to power-up defaults
- X 2. set SCaling
- X 3. set character size
- */
- X HPGL_ang = 0;
- }
- X
- X
- HPGL_text()
- {
- X fputs("PU;\nSP0;\n\033.Z\0",outfile);
- /* 1 2 3
- X 1. pen up
- X 2. park pen
- X 3. disable eavesdropping
- */
- }
- X
- X
- HPGL_linetype(linetype)
- int linetype;
- {
- /* allow for 6 pens */
- X fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1);
- }
- X
- X
- HP75_linetype(linetype)
- int linetype;
- {
- /* allow for 4 pens */
- X fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1);
- }
- X
- X
- /* some early HPGL plotters (e.g. HP7220C) require the
- X * Pen Up/Down and Pen (move) Absolute commands to be separate
- X */
- HPGL_move(x,y)
- int x,y;
- {
- X fprintf(outfile,"PU;PA%d,%d;\n",x,y);
- }
- X
- X
- HPGL_vector(x,y)
- int x,y;
- {
- X fprintf(outfile,"PD;PA%d,%d;\n",x,y);
- }
- X
- X
- HPGL_put_text(x,y,str)
- int x, y;
- char *str;
- {
- X if (HPGL_ang == 1)
- X HPGL_move(x + HPGL_VCHAR/4,y);
- X else
- X HPGL_move(x,y - HPGL_VCHAR/4);
- X fprintf(outfile,"LB%s\003\n",str);
- }
- X
- X
- int HPGL_text_angle(ang)
- int ang;
- {
- X HPGL_ang = ang;
- X if (ang == 1)
- X /* vertical */
- X fprintf(outfile,"DI0,1;\n");
- X else
- X /* horizontal */
- X fprintf(outfile,"DI1,0;\n");
- X return TRUE;
- }
- X
- X
- HPGL_reset()
- {
- }
- X
- HPLJIII_reset()
- {
- X fputs("\033E\n",outfile);
- }
- SHAR_EOF
- chmod 0644 gnuplot/term/hpgl.trm ||
- echo 'restore of gnuplot/term/hpgl.trm failed'
- Wc_c="`wc -c < 'gnuplot/term/hpgl.trm'`"
- test 2857 -eq "$Wc_c" ||
- echo 'gnuplot/term/hpgl.trm: original size 2857, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= gnuplot/term/hpljii.trm ==============
- if test -f 'gnuplot/term/hpljii.trm' -a X"$1" != X"-c"; then
- echo 'x - skipping gnuplot/term/hpljii.trm (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting gnuplot/term/hpljii.trm (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/hpljii.trm' &&
- /* GNUPLOT - hpljii.trm */
- SHAR_EOF
- true || echo 'restore of gnuplot/term/hpljii.trm failed'
- fi
- echo 'End of part 15'
- echo 'File gnuplot/term/hpljii.trm is continued in part 16'
- echo 16 > _shar_seq_.tmp
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-