v15i016: gnuplot 2.0 patch 1 (1 of 4)

Russell Lang rjl at monu1.cc.monash.edu.au
Sat Oct 6 10:12:13 AEST 1990


Posting-number: Volume 15, Issue 16
Submitted-by: Russell Lang <rjl at monu1.cc.monash.edu.au>
Archive-name: gnuplot2/patch01

# This is patch 1 to gnuplot 2.0.

# This patch is made up of 4 shar files.
# The first shar file must by unshared with the command 
# `sh gnuplot_patch1.sh1 -c` to allow it to overwrite the files
# version.c, setshow.c, docs/doc2tex.c, docs/titlepage.ms and 
# docs/titlepage.tex.  

# Russell Lang <rjl at monu1.cc.monash.edu.au>




#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README.patch1 version.c setshow.c docs docs/doc2tex.c
#   docs/titlepage.ms docs/titlepage.tex
# Wrapped by eln272v at monu1 on Tue Sep 18 14:52:44 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README.patch1 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README.patch1\"
else
echo shar: Extracting \"README.patch1\" \(4083 characters\)
sed "s/^X//" >README.patch1 <<'END_OF_README.patch1'
XPatch 1 to gnuplot 2.0.
X-----------------------
X
XThe files in this patch are
X
Xgnuplot_patch1.sh1:
X    README.patch1 (this file)
X    version.c
X    setshow.c
X    docs/doc2tex.c
X    docs/titlepage.ms
X    docs/titlepage.tex
X
Xgnuplot_patch1.sh2
X    patch1a
X
Xgnuplot_patch1.sh3
X    patch1b
X
Xgnuplot_patch1.sh4
X    patch1c
X
X
XTo apply this patch copy the files patch1a, patch1b and patch1c to the 
Xgnuplot directory.  
XOverwrite the original gnuplot files version.c, setshow.c, docs/doc2tex.c, 
Xdocs/titlepage.ms and docs/titlepage.tex with the replacements in this patch.
X
XChange directory to the gnuplot directory, and then apply the patches
Xwith the following commands:
X
X    patch -p < patch1a
X    patch -p < patch1b
X    patch -p < patch1c
X
XThen recompile gnuplot!
X
X
XBuilding Gnuplot on Ultrix.
X---------------------------
X
XChanges have been made to several term/*.trm files so that the Ultrix
Xstandard cc compiler can now be used.  Use makefile.unx instead of 
Xmakefile.ult.   makefile.ult may be deleted.
X
X
XBuilding Gnuplot on RS/6000 AIX 3.1
X-----------------------------------
X
XOne small source changes is needed to successfully compile gnuplot on AIX 3.1:
X
X   o Comment out the "extern char *malloc();" declaration in misc.c
X
XProper CFLAGS setting is -O -Dunix -DBCOPY -DBZERO -DGAMMA.
X
X
XBuilding Gnuplot for X11
X------------------------
X
XRead README.x11.
X
X
XSignificant changes in this patch
X---------------------------------
X
Xcommand.c:
X	Fixed bug in replot command that arose under Turbo C.
X        Added cd (change directory) and pwd (print working directory) 
X        commands.
Xgraphics.c:
X	Fixed bugs in the ticmark-series code, by adding new functions 
X	specifically for ticmark series.
X	Corrected problems using user-defined ticmark sets with logscale.
Xparse.c: 
X	Catch a situation where no floating point exception occured and 
X	yet the value computed was Inf (IEEE infinite).  
X	This happens on the 3b1 when plotting x**-4 + x.
Xpcgraph.asm:
X	Changed the 'jmp _inter' to a far jump.
Xstandard.c:
X	Bessel functions fixed.  However, they only accept real arguments.
Xterm.h:
X	Moved most terminal defines from makefiles to new file term.h.
X
Xdocs/gnuplot.doc:
X        Fixed a troff problem.
X        Added note about bessel function limitations.
X        Added cd and pwd commands.
Xdocs/titlepage.ms:
Xdocs/titlepage.tex:
X        Updated version number to 2.0.
X
Xdocs/latextut/tutorial.tex:
X	Mentioned a new package of useful auxiliary programs for latex users.
X
Xterm/eepic.trm:
X        Ultrix cc initialiser problem fixed.
Xterm/eps60.trm:
X	New epson driver for 60dpi printers.
Xterm/epson.trm:
X	New Star color printer driver.
Xterm/hpljet.trm:
X	Fixed text placement.
Xterm/hpgl.trm:
X        Ultrix cc initialiser problem fixed.
Xterm/imagen.trm:
X        Ultrix cc initialiser problem fixed.
Xterm/latex.trm: 
X	Many bugs fixed: some to help out different compilers, some bugs
X	  in LATEX_linetype that had caused coredumps, and several
X	  details in the line-drawing routines. This last one had
X	  sometimes left gaps in lines that were near-vertical.
X	New emTeX driver.
X        Ultrix cc initialiser problem fixed.
Xterm/pc.trm:
X	Added Turbo C ATT6300 driver.
Xterm/post.trm:
X	Added "0 setgray" to epsf output.
X        Ultrix cc initialiser problem fixed.
X        Added stroke before show.
Xterm/t410x.trm:
X	New Tektronix 410x driver.
Xterm/x11.trm:
Xgnuplot_x11.c:
X	New X11 driver.
Xterm/unixpc.trm: 
X	Use stdout and not stdin as the window device.
X
X
XMail Addresses
X--------------
X
XThe mailing list info-gnuplot exists as a forum for discussions about 
Xgnuplot.  About the only gnuplot topic not supported by this list is 
Xbug reports.  They are handled by a different mail alias, bug-gnuplot.  
X
XTo be removed or add someone to the mailing list send mail to:
X
Xpixar!info-gnuplot-request at sun.com
X
X
XTo report bugs send mail to:
X
Xpixar!bug-gnuplot at sun.com
X
X
XTo ask a question or discuss gnuplot send mail to:
X
Xpixar!info-gnuplot at sun.com
X
X
Xpixar is a UUCP site.  sun.com is a UUCP and Internet site.  
XIn the above addresses, sun.com can be replaced by ucbvax.berkeley.edu.
X
X
XEnd of README.patch1
END_OF_README.patch1
if test 4083 -ne `wc -c <README.patch1`; then
    echo shar: \"README.patch1\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f version.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"version.c\"
else
echo shar: Extracting \"version.c\" \(220 characters\)
sed "s/^X//" >version.c <<'END_OF_version.c'
Xchar version[] = "2.0";
Xchar patchlevel[] = "1";
Xchar date[] = "Tue Sep 18 14:46:32 EST 1990";
X
X/* override in Makefile */
X#ifndef CONTACT
X# define CONTACT "pixar!bug-gnuplot at sun.com";
X#endif
Xchar bug_email[] = CONTACT;
END_OF_version.c
if test 220 -ne `wc -c <version.c`; then
    echo shar: \"version.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f setshow.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"setshow.c\"
else
echo shar: Extracting \"setshow.c\" \(41480 characters\)
sed "s/^X//" >setshow.c <<'END_OF_setshow.c'
X/* GNUPLOT - setshow.c */
X/*
X * Copyright (C) 1986, 1987, 1990   Thomas Williams, Colin Kelley
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 *
X * AUTHORS
X * 
X *   Original Software:
X *     Thomas Williams,  Colin Kelley.
X * 
X *   Gnuplot 2.0 additions:
X *       Russell Lang, Dave Kotz, John Campbell.
X * 
X * send your comments or suggestions to (pixar!info-gnuplot at sun.com).
X * 
X */
X
X#include <stdio.h>
X#include <math.h>
X#include "plot.h"
X#include "setshow.h"
X
X#define DEF_FORMAT   "%g"	/* default format for tic mark labels */
X#define SIGNIF (0.01)		/* less than one hundredth of a tic mark */
X
X/*
X * global variables to hold status of 'set' options
X *
X */
XBOOLEAN			autoscale_x	= TRUE;
XBOOLEAN			autoscale_y	= TRUE;
XBOOLEAN			autoscale_lx	= TRUE;
XBOOLEAN			autoscale_ly	= TRUE;
XBOOLEAN 	  	 	clip_points    = FALSE;
XBOOLEAN 	  	 	clip_lines1    = TRUE;
XBOOLEAN 	  	 	clip_lines2    = FALSE;
Xchar			dummy_var[MAX_ID_LEN+1] = "x";
Xchar			xformat[MAX_ID_LEN+1] = DEF_FORMAT;
Xchar			yformat[MAX_ID_LEN+1] = DEF_FORMAT;
Xenum PLOT_STYLE data_style	= POINTS,
X				func_style	= LINES;
XBOOLEAN			grid		= FALSE;
Xint				key			= -1;	/* default position */
Xdouble			key_x, key_y;		/* user specified position for key */
XBOOLEAN			log_x		= FALSE,
X				log_y		= FALSE;
XFILE*			outfile;
Xchar			outstr[MAX_ID_LEN+1] = "STDOUT";
XBOOLEAN			polar		= FALSE;
Xint				samples		= SAMPLES;
Xfloat			xsize		= 1.0;  /* scale factor for size */
Xfloat			ysize		= 1.0;  /* scale factor for size */
Xint				term		= 0;				/* unknown term is 0 */
Xchar			title[MAX_LINE_LEN+1] = "";
Xchar			xlabel[MAX_LINE_LEN+1] = "";
Xchar			ylabel[MAX_LINE_LEN+1] = "";
Xdouble			xmin		= -10.0,
X				xmax		= 10.0,
X				ymin		= -10.0,
X				ymax		= 10.0;
Xdouble			loff		= 0.0,
X				roff		= 0.0,
X				toff		= 0.0,
X				boff		= 0.0;
Xdouble			zero = ZERO;			/* zero threshold, not 0! */
X
XBOOLEAN xtics = TRUE;
XBOOLEAN ytics = TRUE;
X
Xstruct ticdef xticdef = {TIC_COMPUTED};
Xstruct ticdef yticdef = {TIC_COMPUTED};
X
XBOOLEAN			tic_in		= TRUE;
X
Xstruct text_label *first_label = NULL;
Xstruct arrow_def *first_arrow = NULL;
X
X/*** other things we need *****/
Xextern char *strcpy(),*strcat();
Xextern int strlen();
X
X/* input data, parsing variables */
Xextern struct lexical_unit token[];
Xextern char input_line[];
Xextern int num_tokens, c_token;
X
Xextern char replot_line[];
Xextern struct udvt_entry *first_udv;
X
Xextern double magnitude(),real();
Xextern struct value *const_express();
X
X/******** Local functions ********/
Xstatic void set_label();
Xstatic void set_nolabel();
Xstatic void set_arrow();
Xstatic void set_noarrow();
Xstatic void load_tics();
Xstatic void load_tic_user();
Xstatic void free_marklist();
Xstatic void load_tic_series();
Xstatic void load_offsets();
X
Xstatic void show_style(), show_range(), show_zero();
Xstatic void show_offsets(), show_output(), show_samples(), show_size();
Xstatic void show_title(), show_xlabel(), show_ylabel();
Xstatic void show_label(), show_arrow(), show_grid(), show_key();
Xstatic void show_polar(), show_tics(), show_ticdef();
Xstatic void show_term(), show_plot(), show_autoscale(), show_clip();
Xstatic void show_format(), show_logscale(), show_variables();
X
Xstatic void delete_label();
Xstatic int assign_label_tag();
Xstatic void delete_arrow();
Xstatic int assign_arrow_tag();
X
X/******** The 'set' command ********/
Xvoid
Xset_command()
X{
X     static char testfile[MAX_LINE_LEN+1];
X
X	c_token++;
X
X	if (almost_equals(c_token,"ar$row")) {
X		c_token++;
X		set_arrow();
X	}
X	else if (almost_equals(c_token,"noar$row")) {
X		c_token++;
X		set_noarrow();
X	}
X     else if (almost_equals(c_token,"au$toscale")) {
X	    c_token++;
X	    if (END_OF_COMMAND) {
X		   autoscale_x = autoscale_y = TRUE;
X	    } else if (equals(c_token, "xy") || equals(c_token, "yx")) {
X		   autoscale_x = autoscale_y = TRUE;
X		   c_token++;
X	    } else if (equals(c_token, "x")) {
X		   autoscale_x = TRUE;
X		   c_token++;
X	    } else if (equals(c_token, "y")) {
X		   autoscale_y = TRUE;
X		   c_token++;
X	    }
X	} 
X	else if (almost_equals(c_token,"noau$toscale")) {
X	    c_token++;
X	    if (END_OF_COMMAND) {
X		   autoscale_x = autoscale_y = FALSE;
X	    } else if (equals(c_token, "xy") || equals(c_token, "yx")) {
X		   autoscale_x = autoscale_y = FALSE;
X		   c_token++;
X	    } else if (equals(c_token, "x")) {
X		   autoscale_x = FALSE;
X		   c_token++;
X	    } else if (equals(c_token, "y")) {
X		   autoscale_y = FALSE;
X		   c_token++;
X	    }
X	} 
X	else if (almost_equals(c_token,"c$lip")) {
X	    c_token++;
X	    if (END_OF_COMMAND)
X		 /* assuming same as points */
X		 clip_points = TRUE;
X	    else if (almost_equals(c_token, "p$oints"))
X		 clip_points = TRUE;
X	    else if (almost_equals(c_token, "o$ne"))
X		 clip_lines1 = TRUE;
X	    else if (almost_equals(c_token, "t$wo"))
X		 clip_lines2 = TRUE;
X	    else
X		 int_error("expecting 'points', 'one', or 'two'", c_token);
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"noc$lip")) {
X	    c_token++;
X	    if (END_OF_COMMAND) {
X		   /* same as all three */
X		   clip_points = FALSE;
X		   clip_lines1 = FALSE;
X		   clip_lines2 = FALSE;
X	    } else if (almost_equals(c_token, "p$oints"))
X		 clip_points = FALSE;
X	    else if (almost_equals(c_token, "o$ne"))
X		 clip_lines1 = FALSE;
X	    else if (almost_equals(c_token, "t$wo"))
X		 clip_lines2 = FALSE;
X	    else
X		 int_error("expecting 'points', 'one', or 'two'", c_token);
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"d$ata")) {
X		c_token++;
X		if (!almost_equals(c_token,"s$tyle"))
X			int_error("expecting keyword 'style'",c_token);
X		data_style = get_style();
X	}
X	else if (almost_equals(c_token,"d$ummy")) {
X		c_token++;
X		copy_str(dummy_var,c_token++);
X	}
X	else if (almost_equals(c_token,"fo$rmat")) {
X		BOOLEAN setx, sety;
X		c_token++;
X		if (equals(c_token,"x")) {
X			setx = TRUE; sety = FALSE;
X			c_token++;
X		}
X		else if (equals(c_token,"y")) {
X			setx = FALSE; sety = TRUE;
X			c_token++;
X		}
X		else if (equals(c_token,"xy") || equals(c_token,"yx")) {
X			setx = sety = TRUE;
X			c_token++;
X		}
X		else if (isstring(c_token) || END_OF_COMMAND) {
X			/* Assume he wants both */
X			setx = sety = TRUE;
X		}
X		if (END_OF_COMMAND) {
X			if (setx)
X				(void) strcpy(xformat,DEF_FORMAT);
X			if (sety)
X				(void) strcpy(yformat,DEF_FORMAT);
X		}
X		else {
X			if (!isstring(c_token))
X			  int_error("expecting format string",c_token);
X			else {
X				if (setx)
X				 quote_str(xformat,c_token);
X				if (sety)
X				 quote_str(yformat,c_token);
X				c_token++;
X			}
X		}
X	}
X	else if (almost_equals(c_token,"fu$nction")) {
X		c_token++;
X		if (!almost_equals(c_token,"s$tyle"))
X			int_error("expecting keyword 'style'",c_token);
X		func_style = get_style();
X	}
X	else if (almost_equals(c_token,"la$bel")) {
X		c_token++;
X		set_label();
X	}
X	else if (almost_equals(c_token,"nola$bel")) {
X		c_token++;
X		set_nolabel();
X	}
X	else if (almost_equals(c_token,"lo$gscale")) {
X		c_token++;
X	    if (END_OF_COMMAND) {
X		   log_x = log_y = TRUE;
X	    } else if (equals(c_token, "xy") || equals(c_token, "yx")) {
X		   log_x = log_y = TRUE;
X		   c_token++;
X	    } else if (equals(c_token, "x")) {
X		   log_x = TRUE;
X		   c_token++;
X	    } else if (equals(c_token, "y")) {
X		   log_y = TRUE;
X		   c_token++;
X	    }
X	}
X	else if (almost_equals(c_token,"nolo$gscale")) {
X		c_token++;
X		if (END_OF_COMMAND) {
X		   log_x = log_y = FALSE;
X		} else if (equals(c_token, "xy") || equals(c_token, "yx")) {
X		   log_x = log_y = FALSE;
X		   c_token++;
X		} else if (equals(c_token, "x")) {
X		   log_x = FALSE;
X		   c_token++;
X		} else if (equals(c_token, "y")) {
X		   log_y = FALSE;
X		   c_token++;
X		}
X	} 
X	else if (almost_equals(c_token,"of$fsets")) {
X		c_token++;
X		if (END_OF_COMMAND) {
X			loff = roff = toff = boff = 0.0;  /* Reset offsets */
X		}
X		else {
X			load_offsets (&loff,&roff,&toff,&boff);
X		}
X	}
X	else if (almost_equals(c_token,"o$utput")) {
X		register FILE *f;
X
X		c_token++;
X		if (term && term_init)
X			(*term_tbl[term].reset)();
X		if (END_OF_COMMAND) {	/* no file specified */
X 			UP_redirect (4);
X			if (outfile != stdout) /* Never close stdout */
X				(void) fclose(outfile);
X			outfile = stdout; /* Don't dup... */
X			term_init = FALSE;
X			(void) strcpy(outstr,"STDOUT");
X		} else if (!isstring(c_token))
X			int_error("expecting filename",c_token);
X		else {
X			quote_str(testfile,c_token);
X			if ((f = fopen(testfile,"w")) == (FILE *)NULL) {
X			  os_error("cannot open file; output not changed",c_token);
X			}
X			if (outfile != stdout) /* Never close stdout */
X				(void) fclose(outfile);
X			outfile = f;
X			term_init = FALSE;
X			outstr[0] = '\'';
X			(void) strcat(strcpy(outstr+1,testfile),"'");
X 			UP_redirect (1);
X		}
X		c_token++;
X	}
X	else if (almost_equals(c_token,"tit$le")) {
X		c_token++;
X		if (END_OF_COMMAND) {	/* no label specified */
X			title[0] = '\0';
X		} else {
X		quotel_str(title,c_token);
X		c_token++;
X		}
X	} 
X	else if (almost_equals(c_token,"xl$abel")) {
X		c_token++;
X		if (END_OF_COMMAND) {	/* no label specified */
X			xlabel[0] = '\0';
X		} else {
X		quotel_str(xlabel,c_token);
X		c_token++;
X		}
X	} 
X	else if (almost_equals(c_token,"yl$abel")) {
X		c_token++;
X		if (END_OF_COMMAND) {	/* no label specified */
X			ylabel[0] = '\0';
X		} else {
X		quotel_str(ylabel,c_token);
X		c_token++;
X		}
X	} 
X	else if (almost_equals(c_token,"pol$ar")) {
X	    if (!polar) {
X		   polar = TRUE;
X		   xmin = 0.0;
X		   xmax = 2*Pi;
X	    }
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"nopo$lar")) {
X	    if (polar) {
X		   polar = FALSE;
X		   xmin = -10.0;
X		   xmax = 10.0;
X	    }
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"g$rid")) {
X		grid = TRUE;
X		c_token++;
X	}
X	else if (almost_equals(c_token,"nog$rid")) {
X		grid = FALSE;
X		c_token++;
X	}
X	else if (almost_equals(c_token,"k$ey")) {
X		struct value a;
X		c_token++;
X		if (END_OF_COMMAND) {
X			key = -1;
X		} 
X		else {
X			key_x = real(const_express(&a));
X			if (!equals(c_token,","))
X				int_error("',' expected",c_token);
X			c_token++;
X			key_y = real(const_express(&a));
X			key = 1;
X		} 
X	}
X	else if (almost_equals(c_token,"nok$ey")) {
X		key = 0;
X		c_token++;
X	}
X	else if (almost_equals(c_token,"tic$s")) {
X		tic_in = TRUE;
X		c_token++;
X		if (almost_equals(c_token,"i$n")) {
X			tic_in = TRUE;
X			c_token++;
X		}
X		else if (almost_equals(c_token,"o$ut")) {
X			tic_in = FALSE;
X			c_token++;
X		}
X	}
X     else if (almost_equals(c_token,"xt$ics")) {
X	    xtics = TRUE;
X	    c_token++;
X	    if (END_OF_COMMAND) { /* reset to default */
X		   if (xticdef.type == TIC_USER) {
X			  free_marklist(xticdef.def.user);
X			  xticdef.def.user = NULL;
X		   }
X		   xticdef.type = TIC_COMPUTED;
X	    }
X	    else
X		 load_tics(&xticdef);
X	} 
X     else if (almost_equals(c_token,"noxt$ics")) {
X	    xtics = FALSE;
X	    c_token++;
X	} 
X     else if (almost_equals(c_token,"yt$ics")) {
X	    ytics = TRUE;
X	    c_token++;
X	    if (END_OF_COMMAND) { /* reset to default */
X		   if (yticdef.type == TIC_USER) {
X			  free_marklist(yticdef.def.user);
X			  yticdef.def.user = NULL;
X		   }
X		   yticdef.type = TIC_COMPUTED;
X	    }
X	    else
X		 load_tics(&yticdef);
X	} 
X     else if (almost_equals(c_token,"noyt$ics")) {
X	    ytics = FALSE;
X	    c_token++;
X	} 
X	else if (almost_equals(c_token,"sa$mples")) {
X		register int tsamp;
X		struct value a;
X
X		c_token++;
X		tsamp = (int)magnitude(const_express(&a));
X		if (tsamp < 1)
X			int_error("sampling rate must be > 0; sampling unchanged",
X				c_token);
X		else {
X		     extern struct curve_points *first_plot;
X			register struct curve_points *f_p = first_plot;
X
X			first_plot = NULL;
X			cp_free(f_p);
X			samples = tsamp;
X		}
X	}
X	else if (almost_equals(c_token,"si$ze")) {
X		struct value s;
X		c_token++;
X		if (END_OF_COMMAND) {
X			xsize = 1.0;
X			ysize = 1.0;
X		} 
X		else {
X				xsize=real(const_express(&s));
X				if (!equals(c_token,","))
X					int_error("',' expected",c_token);
X				c_token++;
X				ysize=real(const_express(&s));
X		} 
X	} 
X	else if (almost_equals(c_token,"t$erminal")) {
X		c_token++;
X		if (END_OF_COMMAND) {
X			list_terms();
X			screen_ok = FALSE;
X		}
X		else {
X			if (term && term_init) {
X				(*term_tbl[term].reset)();
X				(void) fflush(outfile);
X			}
X			term = set_term(c_token);
X			c_token++;
X		}
X	}
X	else if (almost_equals(c_token,"xr$ange")) {
X	     BOOLEAN changed;
X		c_token++;
X		if (!equals(c_token,"["))
X			int_error("expecting '['",c_token);
X		c_token++;
X		changed = load_range(&xmin,&xmax);
X		if (!equals(c_token,"]"))
X		  int_error("expecting ']'",c_token);
X		c_token++;
X		if (changed)
X		  autoscale_x = FALSE;
X	}
X	else if (almost_equals(c_token,"yr$ange")) {
X	     BOOLEAN changed;
X		c_token++;
X		if (!equals(c_token,"["))
X			int_error("expecting '['",c_token);
X		c_token++;
X		changed = load_range(&ymin,&ymax);
X		if (!equals(c_token,"]"))
X		  int_error("expecting ']'",c_token);
X		c_token++;
X		if (changed)
X		  autoscale_y = FALSE;
X	}
X	else if (almost_equals(c_token,"z$ero")) {
X		struct value a;
X		c_token++;
X		zero = magnitude(const_express(&a));
X	}
X	else
X		int_error(
X	"valid set options:  '{no}arrow', {no}autoscale', '{no}clip', data', \n\
X	'dummy', 'format', 'function', '{no}grid', '{no}key', '{no}label', \n\
X	'{no}logscale','offsets', 'output', '{no}polar', 'samples', \n\
X	'size', 'terminal', 'tics', 'title', 'xlabel', 'xrange', 'xtics', \n\
X	'ylabel', 'yrange', 'ytics', 'zero',\n",
X	c_token);
X}
X
X/*********** Support functions for set_command ***********/
X
X/* process a 'set label' command */
X/* set label {tag} {label_text} {at x,y} {pos} */
Xstatic void
Xset_label()
X{
X    struct value a;
X    struct text_label *this_label = NULL;
X    struct text_label *new_label = NULL;
X    struct text_label *prev_label = NULL;
X    double x, y;
X    char text[MAX_LINE_LEN+1];
X    enum JUSTIFY just;
X    int tag;
X    BOOLEAN set_text, set_position, set_just;
X
X    /* get tag */
X    if (!END_OF_COMMAND 
X	   && !isstring(c_token) 
X	   && !equals(c_token, "at")
X	   && !equals(c_token, "left")
X	   && !equals(c_token, "center")
X	   && !equals(c_token, "centre")
X	   && !equals(c_token, "right")) {
X	   /* must be a tag expression! */
X	   tag = (int)real(const_express(&a));
X	   if (tag <= 0)
X		int_error("tag must be > zero", c_token);
X    } else
X	 tag = assign_label_tag(); /* default next tag */
X	 
X    /* get text */
X    if (!END_OF_COMMAND && isstring(c_token)) {
X	   /* get text */
X	   quotel_str(text, c_token);
X	   c_token++;
X	   set_text = TRUE;
X    } else {
X	   text[0] = '\0';		/* default no text */
X	   set_text = FALSE;
X    }
X	 
X    /* get justification - what the heck, let him put it here */
X    if (!END_OF_COMMAND && !equals(c_token, "at")) {
X	   if (almost_equals(c_token,"l$eft")) {
X		  just = LEFT;
X	   }
X	   else if (almost_equals(c_token,"c$entre")
X			  || almost_equals(c_token,"c$enter")) {
X		  just = CENTRE;
X	   }
X	   else if (almost_equals(c_token,"r$ight")) {
X		  just = RIGHT;
X	   }
X	   else
X		int_error("bad syntax in set label", c_token);
X	   c_token++;
X	   set_just = TRUE;
X    } else {
X	   just = LEFT;			/* default left justified */
X	   set_just = FALSE;
X    } 
X
X    /* get position */
X    if (!END_OF_COMMAND && equals(c_token, "at")) {
X	   c_token++;
X	   if (END_OF_COMMAND)
X		int_error("coordinates expected", c_token);
X	   /* get coordinates */
X	   x = real(const_express(&a));
X	   if (!equals(c_token,","))
X		int_error("',' expected",c_token);
X	   c_token++;
X	   y = real(const_express(&a));
X	   set_position = TRUE;
X    } else {
X	   x = y = 0;			/* default at origin */
X	   set_position = FALSE;
X    }
X
X    /* get justification */
X    if (!END_OF_COMMAND) {
X	   if (set_just)
X		int_error("only one justification is allowed", c_token);
X	   if (almost_equals(c_token,"l$eft")) {
X		  just = LEFT;
X	   }
X	   else if (almost_equals(c_token,"c$entre")
X			  || almost_equals(c_token,"c$enter")) {
X		  just = CENTRE;
X	   }
X	   else if (almost_equals(c_token,"r$ight")) {
X		  just = RIGHT;
X	   }
X	   else
X		int_error("bad syntax in set label", c_token);
X	   c_token++;
X	   set_just = TRUE;
X    } 
X
X    if (!END_OF_COMMAND)
X	 int_error("extraneous or out-of-order arguments in set label", c_token);
X
X    /* OK! add label */
X    if (first_label != NULL) { /* skip to last label */
X	   for (this_label = first_label; this_label != NULL ; 
X		   prev_label = this_label, this_label = this_label->next)
X		/* is this the label we want? */
X		if (tag <= this_label->tag)
X		  break;
X    }
X    if (this_label != NULL && tag == this_label->tag) {
X	   /* changing the label */
X	   if (set_position) {
X		  this_label->x = x;
X		  this_label->y = y;
X	   }
X	   if (set_text)
X		(void) strcpy(this_label->text, text);
X	   if (set_just)
X		this_label->pos = just;
X    } else {
X	   /* adding the label */
X	   new_label = (struct text_label *) 
X		alloc ( (unsigned int) sizeof(struct text_label), "label");
X	   if (prev_label != NULL)
X		prev_label->next = new_label; /* add it to end of list */
X	   else 
X		first_label = new_label; /* make it start of list */
X	   new_label->tag = tag;
X	   new_label->next = this_label;
X	   new_label->x = x;
X	   new_label->y = y;
X	   (void) strcpy(new_label->text, text);
X	   new_label->pos = just;
X    }
X}
X
X/* process 'set nolabel' command */
X/* set nolabel {tag} */
Xstatic void
Xset_nolabel()
X{
X    struct value a;
X    struct text_label *this_label;
X    struct text_label *prev_label; 
X    int tag;
X
X    if (END_OF_COMMAND) {
X	   /* delete all labels */
X	   while (first_label != NULL)
X		delete_label((struct text_label *)NULL,first_label);
X    }
X    else {
X	   /* get tag */
X	   tag = (int)real(const_express(&a));
X	   if (!END_OF_COMMAND)
X		int_error("extraneous arguments to set nolabel", c_token);
X	   for (this_label = first_label, prev_label = NULL;
X		   this_label != NULL;
X		   prev_label = this_label, this_label = this_label->next) {
X		  if (this_label->tag == tag) {
X			 delete_label(prev_label,this_label);
X			 return;		/* exit, our job is done */
X		  }
X	   }
X	   int_error("label not found", c_token);
X    }
X}
X
X/* assign a new label tag */
X/* labels are kept sorted by tag number, so this is easy */
Xstatic int				/* the lowest unassigned tag number */
Xassign_label_tag()
X{
X    struct text_label *this_label;
X    int last = 0;			/* previous tag value */
X
X    for (this_label = first_label; this_label != NULL;
X	    this_label = this_label->next)
X	 if (this_label->tag == last+1)
X	   last++;
X	 else
X	   break;
X    
X    return (last+1);
X}
X
X/* delete label from linked list started by first_label.
X * called with pointers to the previous label (prev) and the 
X * label to delete (this).
X * If there is no previous label (the label to delete is
X * first_label) then call with prev = NULL.
X */
Xstatic void
Xdelete_label(prev,this)
X	struct text_label *prev, *this;
X{
X    if (this!=NULL)	{		/* there really is something to delete */
X	   if (prev!=NULL)		/* there is a previous label */
X		prev->next = this->next; 
X	   else				/* this = first_label so change first_label */
X		first_label = this->next;
X	   free((char *)this);
X    }
X}
X
X
X/* process a 'set arrow' command */
X/* set arrow {tag} {from x,y} {to x,y} */
Xstatic void
Xset_arrow()
X{
X    struct value a;
X    struct arrow_def *this_arrow = NULL;
X    struct arrow_def *new_arrow = NULL;
X    struct arrow_def *prev_arrow = NULL;
X    double sx, sy;
X    double ex, ey;
X    int tag;
X    BOOLEAN set_start, set_end;
X
X    /* get tag */
X    if (!END_OF_COMMAND 
X	   && !equals(c_token, "from")
X	   && !equals(c_token, "to")) {
X	   /* must be a tag expression! */
X	   tag = (int)real(const_express(&a));
X	   if (tag <= 0)
X		int_error("tag must be > zero", c_token);
X    } else
X	 tag = assign_arrow_tag(); /* default next tag */
X	 
X    /* get start position */
X    if (!END_OF_COMMAND && equals(c_token, "from")) {
X	   c_token++;
X	   if (END_OF_COMMAND)
X		int_error("start coordinates expected", c_token);
X	   /* get coordinates */
X	   sx = real(const_express(&a));
X	   if (!equals(c_token,","))
X		int_error("',' expected",c_token);
X	   c_token++;
X	   sy = real(const_express(&a));
X	   set_start = TRUE;
X    } else {
X	   sx = sy = 0;			/* default at origin */
X	   set_start = FALSE;
X    }
X
X    /* get end position */
X    if (!END_OF_COMMAND && equals(c_token, "to")) {
X	   c_token++;
X	   if (END_OF_COMMAND)
X		int_error("end coordinates expected", c_token);
X	   /* get coordinates */
X	   ex = real(const_express(&a));
X	   if (!equals(c_token,","))
X		int_error("',' expected",c_token);
X	   c_token++;
X	   ey = real(const_express(&a));
X	   set_end = TRUE;
X    } else {
X	   ex = ey = 0;			/* default at origin */
X	   set_end = FALSE;
X    }
X
X    /* get start position - what the heck, either order is ok */
X    if (!END_OF_COMMAND && equals(c_token, "from")) {
X	   if (set_start)
X		int_error("only one 'from' is allowed", c_token);
X	   c_token++;
X	   if (END_OF_COMMAND)
X		int_error("start coordinates expected", c_token);
X	   /* get coordinates */
X	   sx = real(const_express(&a));
X	   if (!equals(c_token,","))
X		int_error("',' expected",c_token);
X	   c_token++;
X	   sy = real(const_express(&a));
X	   set_start = TRUE;
X    }
X
X    if (!END_OF_COMMAND)
X	 int_error("extraneous or out-of-order arguments in set arrow", c_token);
X
X    /* OK! add arrow */
X    if (first_arrow != NULL) { /* skip to last arrow */
X	   for (this_arrow = first_arrow; this_arrow != NULL ; 
X		   prev_arrow = this_arrow, this_arrow = this_arrow->next)
X		/* is this the arrow we want? */
X		if (tag <= this_arrow->tag)
X		  break;
X    }
X    if (this_arrow != NULL && tag == this_arrow->tag) {
X	   /* changing the arrow */
X	   if (set_start) {
X		  this_arrow->sx = sx;
X		  this_arrow->sy = sy;
X	   }
X	   if (set_end) {
X		  this_arrow->ex = ex;
X		  this_arrow->ey = ey;
X	   }
X    } else {
X	   /* adding the arrow */
X	   new_arrow = (struct arrow_def *) 
X		alloc ( (unsigned int) sizeof(struct arrow_def), "arrow");
X	   if (prev_arrow != NULL)
X		prev_arrow->next = new_arrow; /* add it to end of list */
X	   else 
X		first_arrow = new_arrow; /* make it start of list */
X	   new_arrow->tag = tag;
X	   new_arrow->next = this_arrow;
X	   new_arrow->sx = sx;
X	   new_arrow->sy = sy;
X	   new_arrow->ex = ex;
X	   new_arrow->ey = ey;
X    }
X}
X
X/* process 'set noarrow' command */
X/* set noarrow {tag} */
Xstatic void
Xset_noarrow()
X{
X    struct value a;
X    struct arrow_def *this_arrow;
X    struct arrow_def *prev_arrow; 
X    int tag;
X
X    if (END_OF_COMMAND) {
X	   /* delete all arrows */
X	   while (first_arrow != NULL)
X		delete_arrow((struct arrow_def *)NULL,first_arrow);
X    }
X    else {
X	   /* get tag */
X	   tag = (int)real(const_express(&a));
X	   if (!END_OF_COMMAND)
X		int_error("extraneous arguments to set noarrow", c_token);
X	   for (this_arrow = first_arrow, prev_arrow = NULL;
X		   this_arrow != NULL;
X		   prev_arrow = this_arrow, this_arrow = this_arrow->next) {
X		  if (this_arrow->tag == tag) {
X			 delete_arrow(prev_arrow,this_arrow);
X			 return;		/* exit, our job is done */
X		  }
X	   }
X	   int_error("arrow not found", c_token);
X    }
X}
X
X/* assign a new arrow tag */
X/* arrows are kept sorted by tag number, so this is easy */
Xstatic int				/* the lowest unassigned tag number */
Xassign_arrow_tag()
X{
X    struct arrow_def *this_arrow;
X    int last = 0;			/* previous tag value */
X
X    for (this_arrow = first_arrow; this_arrow != NULL;
X	    this_arrow = this_arrow->next)
X	 if (this_arrow->tag == last+1)
X	   last++;
X	 else
X	   break;
X
X    return (last+1);
X}
X
X/* delete arrow from linked list started by first_arrow.
X * called with pointers to the previous arrow (prev) and the 
X * arrow to delete (this).
X * If there is no previous arrow (the arrow to delete is
X * first_arrow) then call with prev = NULL.
X */
Xstatic void
Xdelete_arrow(prev,this)
X	struct arrow_def *prev, *this;
X{
X    if (this!=NULL)	{		/* there really is something to delete */
X	   if (prev!=NULL)		/* there is a previous arrow */
X		prev->next = this->next; 
X	   else				/* this = first_arrow so change first_arrow */
X		first_arrow = this->next;
X	   free((char *)this);
X    }
X}
X
X
Xenum PLOT_STYLE			/* not static; used by command.c */
Xget_style()
X{
Xregister enum PLOT_STYLE ps;
X
X	c_token++;
X	if (almost_equals(c_token,"l$ines"))
X		ps = LINES;
X	else if (almost_equals(c_token,"i$mpulses"))
X		ps = IMPULSES;
X	else if (almost_equals(c_token,"p$oints"))
X		ps = POINTS;
X	else if (almost_equals(c_token,"linesp$oints"))
X		ps = LINESPOINTS;
X	else if (almost_equals(c_token,"d$ots"))
X		ps = DOTS;
X	else
X		int_error("expecting 'lines', 'points', 'linespoints', 'dots', or 'impulses'",c_token);
X	c_token++;
X	return(ps);
X}
X
X/* For set [xy]tics... command*/
Xstatic void
Xload_tics(tdef)
X	struct ticdef *tdef;	/* change this ticdef */
X{
X    if (equals(c_token,"(")) { /* set : TIC_USER */
X	   c_token++;
X	   load_tic_user(tdef);
X    } else {				/* series : TIC_SERIES */
X	   load_tic_series(tdef);
X    }
X}
X
X/* load TIC_USER definition */
X/* (tic[,tic]...)
X * where tic is ["string"] value
X * Left paren is already scanned off before entry.
X */
Xstatic void
Xload_tic_user(tdef)
X	struct ticdef *tdef;
X{
X    struct ticmark *list = NULL; /* start of list */
X    struct ticmark *last = NULL; /* end of list */
X    struct ticmark *tic = NULL; /* new ticmark */
X    char temp_string[MAX_LINE_LEN];
X    struct value a;
X
X    while (!END_OF_COMMAND) {
X	   /* parse a new ticmark */
X	   tic = (struct ticmark *)alloc(sizeof(struct ticmark), (char *)NULL);
X	   if (tic == (struct ticmark *)NULL) {
X		  free_marklist(list);
X		  int_error("out of memory for tic mark", c_token);
X	   }
X
X	   /* has a string with it? */
X	   if (isstring(c_token)) {
X		  quote_str(temp_string,c_token);
X		  tic->label = alloc((unsigned int)strlen(temp_string)+1, "tic label");
X		  (void) strcpy(tic->label, temp_string);
X		  c_token++;
X	   } else
X		tic->label = NULL;
X
X	   /* in any case get the value */
X	   tic->position = real(const_express(&a));
X	   tic->next = NULL;
X
X	   /* append to list */
X	   if (list == NULL)
X		last = list = tic;	/* new list */
X	   else {				/* append to list */
X		  last->next = tic;
X		  last = tic;
X	   }
X
X	   /* expect "," or ")" here */
X	   if (!END_OF_COMMAND && equals(c_token, ","))
X		c_token++;		/* loop again */
X	   else
X		break;			/* hopefully ")" */
X    }
X    
X    if (END_OF_COMMAND || !equals(c_token, ")")) {
X	   free_marklist(list);
X	   int_error("expecting right parenthesis )", c_token);
X    }
X    c_token++;
X    
X    /* successful list */
X    if (tdef->type == TIC_USER) {
X	   /* remove old list */
X		/* VAX Optimiser was stuffing up following line. Turn Optimiser OFF */
X	   free_marklist(tdef->def.user);
X	   tdef->def.user = NULL;
X    }
X    tdef->type = TIC_USER;
X    tdef->def.user = list;
X}
X
Xstatic void
Xfree_marklist(list)
X	struct ticmark *list;
X{
X    register struct ticmark *freeable;
X
X    while (list != NULL) {
X	   freeable = list;
X	   list = list->next;
X	   if (freeable->label != NULL)
X		free( (char *)freeable->label );
X	   free( (char *)freeable );
X    }
X}
X
X/* load TIC_SERIES definition */
X/* start,incr[,end] */
Xstatic void
Xload_tic_series(tdef)
X	struct ticdef *tdef;
X{
X    double start, incr, end;
X    struct value a;
X    int incr_token;
X
X    start = real(const_express(&a));
X    if (!equals(c_token, ","))
X	 int_error("expecting comma to separate start,incr", c_token);
X    c_token++;
X
X    incr_token = c_token;
X    incr = real(const_express(&a));
X
X    if (END_OF_COMMAND)
X	 end = VERYLARGE;
X    else {
X	   if (!equals(c_token, ","))
X		int_error("expecting comma to separate incr,end", c_token);
X	   c_token++;
X
X	   end = real(const_express(&a));
X    }
X    if (!END_OF_COMMAND)
X	 int_error("tic series is defined by start,increment[,end]", 
X			 c_token);
X    
X    if (start < end && incr <= 0)
X	 int_error("increment must be positive", incr_token);
X    if (start > end && incr >= 0)
X	 int_error("increment must be negative", incr_token);
X    if (start > end) {
X	   /* put in order */
X		double numtics;
X		numtics = floor( (end*(1+SIGNIF) - start)/incr );
X		end = start;
X		start = end + numtics*incr;
X		incr = -incr;
X/*
X	   double temp = start;
X	   start = end;
X	   end = temp;
X	   incr = -incr;
X */
X    }
X
X    if (tdef->type == TIC_USER) {
X	   /* remove old list */
X		/* VAX Optimiser was stuffing up following line. Turn Optimiser OFF */
X	   free_marklist(tdef->def.user);
X	   tdef->def.user = NULL;
X    }
X    tdef->type = TIC_SERIES;
X    tdef->def.series.start = start;
X    tdef->def.series.incr = incr;
X    tdef->def.series.end = end;
X}
X
Xstatic void
Xload_offsets (a, b, c, d)
Xdouble *a,*b, *c, *d;
X{
Xstruct value t;
X
X	*a = real (const_express(&t));  /* loff value */
X	c_token++;
X	if (equals(c_token,","))
X		c_token++;
X	if (END_OF_COMMAND) 
X	    return;
X
X	*b = real (const_express(&t));  /* roff value */
X	c_token++;
X	if (equals(c_token,","))
X		c_token++;
X	if (END_OF_COMMAND) 
X	    return;
X
X	*c = real (const_express(&t));  /* toff value */
X	c_token++;
X	if (equals(c_token,","))
X		c_token++;
X	if (END_OF_COMMAND) 
X	    return;
X
X	*d = real (const_express(&t));  /* boff value */
X	c_token++;
X}
X
X
XBOOLEAN					/* TRUE if a or b were changed */
Xload_range(a,b)			/* also used by command.c */
Xdouble *a,*b;
X{
Xstruct value t;
XBOOLEAN changed = FALSE;
X
X	if (equals(c_token,"]"))
X		return(FALSE);
X	if (END_OF_COMMAND) {
X	    int_error("starting range value or ':' or 'to' expected",c_token);
X	} else if (!equals(c_token,"to") && !equals(c_token,":"))  {
X		*a = real(const_express(&t));
X		changed = TRUE;
X	}	
X	if (!equals(c_token,"to") && !equals(c_token,":"))
X		int_error("':' or keyword 'to' expected",c_token);
X	c_token++;
X	if (!equals(c_token,"]")) {
X		*b = real(const_express(&t));
X		changed = TRUE;
X	 }
X     return(changed);
X}
X
X
X
X/******* The 'show' command *******/
Xvoid
Xshow_command()
X{
X    c_token++;
X
X	if (almost_equals(c_token,"ac$tion_table") ||
X			 equals(c_token,"at") ) {
X		c_token++; 
X		show_at();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"ar$row")) {
X	    struct value a;
X	    int tag = 0;
X
X	    c_token++;
X	    if (!END_OF_COMMAND) {
X		   tag = (int)real(const_express(&a));
X		   if (tag <= 0)
X			int_error("tag must be > zero", c_token);
X	    }
X
X	    (void) putc('\n',stderr);
X	    show_arrow(tag);
X	}
X	else if (almost_equals(c_token,"au$toscale")) {
X		(void) putc('\n',stderr);
X		show_autoscale();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"c$lip")) {
X		(void) putc('\n',stderr);
X		show_clip();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"d$ata")) {
X		c_token++;
X		if (!almost_equals(c_token,"s$tyle"))
X			int_error("expecting keyword 'style'",c_token);
X		(void) putc('\n',stderr);
X		show_style("data",data_style);
X		c_token++;
X	}
X	else if (almost_equals(c_token,"d$ummy")) {
X		(void) fprintf(stderr,"\n\tdummy variable is %s\n",dummy_var);
X		c_token++;
X	}
X	else if (almost_equals(c_token,"fo$rmat")) {
X		show_format();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"f$unctions")) {
X		c_token++;
X		if (almost_equals(c_token,"s$tyle"))  {
X			(void) putc('\n',stderr);
X			show_style("functions",func_style);
X			c_token++;
X		}
X		else
X			show_functions();
X	}
X	else if (almost_equals(c_token,"lo$gscale")) {
X		(void) putc('\n',stderr);
X		show_logscale();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"of$fsets")) {
X		(void) putc('\n',stderr);
X		show_offsets();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"o$utput")) {
X		(void) putc('\n',stderr);
X		show_output();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"tit$le")) {
X		(void) putc('\n',stderr);
X		show_title();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"xl$abel")) {
X		(void) putc('\n',stderr);
X		show_xlabel();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"yl$abel")) {
X		(void) putc('\n',stderr);
X		show_ylabel();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"la$bel")) {
X	    struct value a;
X	    int tag = 0;
X
X	    c_token++;
X	    if (!END_OF_COMMAND) {
X		   tag = (int)real(const_express(&a));
X		   if (tag <= 0)
X			int_error("tag must be > zero", c_token);
X	    }
X
X	    (void) putc('\n',stderr);
X	    show_label(tag);
X	}
X	else if (almost_equals(c_token,"g$rid")) {
X		(void) putc('\n',stderr);
X		show_grid();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"k$ey")) {
X		(void) putc('\n',stderr);
X		show_key();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"p$lot")) {
X		(void) putc('\n',stderr);
X		show_plot();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"pol$ar")) {
X		(void) putc('\n',stderr);
X		show_polar();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"ti$cs")) {
X		(void) putc('\n',stderr);
X		show_tics(TRUE, TRUE);
X		c_token++;
X	}
X	else if (almost_equals(c_token,"xti$cs")) {
X	    show_tics(TRUE, FALSE);
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"yti$cs")) {
X	    show_tics(FALSE, TRUE);
X	    c_token++;
X	}
X	else if (almost_equals(c_token,"sa$mples")) {
X		(void) putc('\n',stderr);
X		show_samples();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"si$ze")) {
X		(void) putc('\n',stderr);
X		show_size();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"t$erminal")) {
X		(void) putc('\n',stderr);
X		show_term();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"v$ariables")) {
X		show_variables();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"ve$rsion")) {
X		show_version();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"xr$ange")) {
X		(void) putc('\n',stderr);
X		show_range('x',xmin,xmax);
X		c_token++;
X	}
X	else if (almost_equals(c_token,"yr$ange")) {
X		(void) putc('\n',stderr);
X		show_range('y',ymin,ymax);
X		c_token++;
X	}
X	else if (almost_equals(c_token,"z$ero")) {
X		(void) putc('\n',stderr);
X		show_zero();
X		c_token++;
X	}
X	else if (almost_equals(c_token,"a$ll")) {
X		c_token++;
X		show_version();
X		show_autoscale();
X		show_clip();
X		(void) fprintf(stderr,"\tdummy variable is %s\n",dummy_var);
X		show_format();
X		show_style("data",data_style);
X		show_style("functions",func_style);
X		show_grid();
X		show_label(0);
X		show_arrow(0);
X		show_key();
X		show_logscale();
X		show_offsets();
X		show_output();
X		show_polar();
X		show_samples();
X		show_size();
X		show_term();
X		show_tics(TRUE,TRUE);
X		show_range('x',xmin,xmax);
X		show_range('y',ymin,ymax);
X		show_title();
X		show_xlabel();
X		show_ylabel();
X		show_zero();
X		show_plot();
X		show_variables();
X		show_functions();
X		c_token++;
X	}
X	else
X		int_error(
X	"valid show options:  'action_table', 'all', 'arrow', 'autoscale',  \n\
X	'clip', 'data', 'dummy', 'format', 'function', 'grid', 'key', 'label', \n\
X	'logscale', 'offsets', 'output', 'plot', 'polar', 'samples', \n\
X	'size', 'terminal', 'tics', 'title', 'variables', 'version', \n\
X	'xlabel', 'xrange', 'xtics', 'ylabel', 'yrange', 'ytics', 'zero'", c_token);
X	screen_ok = FALSE;
X	(void) putc('\n',stderr);
X}
X
X
X/*********** support functions for 'show'  **********/
Xstatic void
Xshow_style(name,style)
Xchar name[];
Xenum PLOT_STYLE style;
X{
X	fprintf(stderr,"\t%s are plotted with ",name);
X	switch (style) {
X		case LINES: fprintf(stderr,"lines\n"); break;
X		case POINTS: fprintf(stderr,"points\n"); break;
X		case IMPULSES: fprintf(stderr,"impulses\n"); break;
X		case LINESPOINTS: fprintf(stderr,"linespoints\n"); break;
X		case DOTS: fprintf(stderr,"dots\n"); break;
X	}
X}
X
Xstatic void
Xshow_range(name,min,max)
Xchar name;
Xdouble min,max;
X{
X	fprintf(stderr,"\t%crange is [%g : %g]\n",name,min,max);
X}
X
Xstatic void
Xshow_zero()
X{
X	fprintf(stderr,"\tzero is %g\n",zero);
X}
X
Xstatic void
Xshow_offsets()
X{
X	fprintf(stderr,"\toffsets are %g, %g, %g, %g\n",loff,roff,toff,boff);
X}
X
Xstatic void
Xshow_output()
X{
X	fprintf(stderr,"\toutput is sent to %s\n",outstr);
X}
X
Xstatic void
Xshow_samples()
X{
X	fprintf(stderr,"\tsampling rate is %d\n",samples);
X}
X
Xstatic void
Xshow_size()
X{
X	fprintf(stderr,"\tsize is scaled by %g,%g\n",xsize,ysize);
X}
X
Xstatic void
Xshow_title()
X{
X	fprintf(stderr,"\ttitle is \"%s\"\n",title);
X}
X
Xstatic void
Xshow_xlabel()
X{
X	fprintf(stderr,"\txlabel is \"%s\"\n",xlabel);
X}
X
Xstatic void
Xshow_ylabel()
X{
X	fprintf(stderr,"\tylabel is \"%s\"\n",ylabel);
X}
X
Xstatic void
Xshow_label(tag)
X    int tag;				/* 0 means show all */
X{
X    struct text_label *this_label;
X    BOOLEAN showed = FALSE;
X
X    for (this_label = first_label; this_label != NULL;
X	    this_label = this_label->next) {
X	   if (tag == 0 || tag == this_label->tag) {
X		  showed = TRUE;
X		  fprintf(stderr,"\tlabel %d \"%s\" at %g,%g ",
X				this_label->tag, this_label->text, 
X				this_label->x, this_label->y);
X		  switch(this_label->pos) {
X			 case LEFT : {
X				fprintf(stderr,"left");
X				break;
X			 }
X			 case CENTRE : {
X				fprintf(stderr,"centre");
X				break;
X			 }
X			 case RIGHT : {
X				fprintf(stderr,"right");
X				break;
X			 }
X		  }
X		  fputc('\n',stderr);
X	   }
X    }
X    if (tag > 0 && !showed)
X	 int_error("label not found", c_token);
X}
X
Xstatic void
Xshow_arrow(tag)
X    int tag;				/* 0 means show all */
X{
X    struct arrow_def *this_arrow;
X    BOOLEAN showed = FALSE;
X
X    for (this_arrow = first_arrow; this_arrow != NULL;
X	    this_arrow = this_arrow->next) {
X	   if (tag == 0 || tag == this_arrow->tag) {
X		  showed = TRUE;
X		  fprintf(stderr,"\tarrow %d from %g,%g to %g,%g\n",
X				this_arrow->tag, 
X				this_arrow->sx, this_arrow->sy,
X				this_arrow->ex, this_arrow->ey);
X	   }
X    }
X    if (tag > 0 && !showed)
X	 int_error("arrow not found", c_token);
X}
X
Xstatic void
Xshow_grid()
X{
X	fprintf(stderr,"\tgrid is %s\n",(grid)? "ON" : "OFF");
X}
X
Xstatic void
Xshow_key()
X{
X	switch (key) {
X		case -1 : 
X			fprintf(stderr,"\tkey is ON\n");
X			break;
X		case 0 :
X			fprintf(stderr,"\tkey is OFF\n");
X			break;
X		case 1 :
X			fprintf(stderr,"\tkey is at %g,%g\n",key_x,key_y);
X			break;
X	}
X}
X
Xstatic void
Xshow_polar()
X{
X	fprintf(stderr,"\tpolar is %s\n",(polar)? "ON" : "OFF");
X}
X
Xstatic void
Xshow_tics(showx, showy)
X	BOOLEAN showx, showy;
X{
X    fprintf(stderr,"\ttics are %s\n",(tic_in)? "IN" : "OUT");
X
X    if (showx)
X	 show_ticdef(xtics, 'x', &xticdef);
X    if (showy)
X	 show_ticdef(ytics, 'y', &yticdef);
X    screen_ok = FALSE;
X}
X
X/* called by show_tics */
Xstatic void
Xshow_ticdef(tics, axis, tdef)
X	BOOLEAN tics;			/* xtics or ytics */
X	char axis;			/* 'x' or 'y' */
X	struct ticdef *tdef;	/* xticdef or yticdef */
X{
X    register struct ticmark *t;
X
X    fprintf(stderr, "\t%c-axis tic labelling is ", axis);
X    if (!tics) {
X	   fprintf(stderr, "OFF\n");
X	   return;
X    }
X
X    switch(tdef->type) {
X	   case TIC_COMPUTED: {
X		  fprintf(stderr, "computed automatically\n");
X		  break;
X	   }
X	   case TIC_SERIES: {
X		  if (tdef->def.series.end == VERYLARGE)
X		    fprintf(stderr, "series from %g by %g\n", 
X				  tdef->def.series.start, tdef->def.series.incr);
X		  else
X		    fprintf(stderr, "series from %g by %g until %g\n", 
X				  tdef->def.series.start, tdef->def.series.incr, 
X				  tdef->def.series.end);
X		  break;
X	   }
X	   case TIC_USER: {
X		  fprintf(stderr, "list (");
X		  for (t = tdef->def.user; t != NULL; t=t->next) {
X			 if (t->label)
X			   fprintf(stderr, "\"%s\" ", t->label);
X			 if (t->next)
X			   fprintf(stderr, "%g, ", t->position);
X			 else
X			   fprintf(stderr, "%g", t->position);
X		  }
X		  fprintf(stderr, ")\n");
X		  break;
X	   }
X	   default: {
X		  int_error("unknown ticdef type in show_ticdef()", NO_CARET);
X		  /* NOTREACHED */
X	   }
X    }
X}
X
Xstatic void
Xshow_term()
X{
X	fprintf(stderr,"\tterminal type is %s\n",term_tbl[term].name);
X}
X
Xstatic void
Xshow_plot()
X{
X	fprintf(stderr,"\tlast plot command was: %s\n",replot_line);
X}
X
Xstatic void
Xshow_autoscale()
X{
X	fprintf(stderr,"\tx autoscaling is %s\n",(autoscale_x)? "ON" : "OFF");
X	fprintf(stderr,"\ty autoscaling is %s\n",(autoscale_y)? "ON" : "OFF");
X}
X
Xstatic void
Xshow_clip()
X{
X	fprintf(stderr,"\tpoint clip is %s\n",(clip_points)? "ON" : "OFF");
X
X	if (clip_lines1)
X	  fprintf(stderr,
X         "\tdrawing and clipping lines between inrange and outrange points\n");
X	else
X	  fprintf(stderr,
X         "\tnot drawing lines between inrange and outrange points\n");
X
X	if (clip_lines2)
X	  fprintf(stderr,
X         "\tdrawing and clipping lines between two outrange points\n");
X	else
X	  fprintf(stderr,
X         "\tnot drawing lines between two outrange points\n");
X}
X
Xstatic void
Xshow_format()
X{
X	fprintf(stderr, "\tx-axis tic format is \"%s\"\n", xformat);
X	fprintf(stderr, "\ty-axis tic format is \"%s\"\n", yformat);
X}
X
Xstatic void
Xshow_logscale()
X{
X	if (log_x && log_y)
X		fprintf(stderr,"\tlogscaling both x and y axes\n");
X	else if (log_x)
X		fprintf(stderr,"\tlogscaling x axis\n");
X	else if (log_y)
X		fprintf(stderr,"\tlogscaling y axis\n");
X	else
X		fprintf(stderr,"\tno logscaling\n");
X}
X
Xstatic void
Xshow_variables()
X{
Xregister struct udvt_entry *udv = first_udv;
Xint len;
X
X	fprintf(stderr,"\n\tVariables:\n");
X	while (udv) {
X	     len = instring(udv->udv_name, ' ');
X		fprintf(stderr,"\t%-*s ",len,udv->udv_name);
X		if (udv->udv_undef)
X			fputs("is undefined\n",stderr);
X		else {
X			fputs("= ",stderr);
X			disp_value(stderr,&(udv->udv_value));
X			(void) putc('\n',stderr);
X		}
X		udv = udv->next_udv;
X	}
X}
X
Xvoid				/* used by plot.c */
Xshow_version()
X{
Xextern char version[];
Xextern char patchlevel[];
Xextern char date[];
Xextern char bug_email[];
Xstatic char *authors[] = {"Thomas Williams","Colin Kelley"}; /* primary */
Xint x;
Xlong time();
X
X	x = time((long *)NULL) & 1;
X	fprintf(stderr,"\n\t%s\n\t%sversion %s\n",
X		PROGRAM, OS, version); 
X	fprintf(stderr,"\tpatchlevel %s\n",patchlevel);
X     fprintf(stderr, "\tlast modified %s\n", date);
X	fprintf(stderr,"\tCopyright (C) 1986, 1987, 1990  %s, %s\n",
X		authors[x],authors[1-x]);
X#ifdef __TURBOC__
X	fprintf(stderr,"\tCreated using Turbo C, Copyright Borland 1987, 1988\n");
X#endif
X    fprintf(stderr, "\n\tSend bugs and comments to %s\n", bug_email);
X}
END_OF_setshow.c
if test 41480 -ne `wc -c <setshow.c`; then
    echo shar: \"setshow.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test ! -d docs ; then
    echo shar: Creating directory \"docs\"
    mkdir docs
fi
if test -f docs/doc2tex.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"docs/doc2tex.c\"
else
echo shar: Extracting \"docs/doc2tex.c\" \(4694 characters\)
sed "s/^X//" >docs/doc2tex.c <<'END_OF_docs/doc2tex.c'
X/*
X * doc2tex.c  -- program to convert Gnuplot .DOC format to LaTeX document
X * Also will work for VMS .HLP files. 
X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
X * Extended by David Kotz to support quotes ("), backquotes, tables.
X *
X * usage:  doc2tex < file.doc > file.tex
X *
X *   where file.doc is a Gnuplot .DOC file, and file.tex will be an
X *     article document suitable for printing with LaTeX.
X *
X * typical usage for GNUPLOT:
X *
X *   doc2tex < gnuplot.doc > gnuplot.tex 
X *   latex gnuplot.tex ; latex gnuplot.tex
X */
X
Xstatic char rcsid[] = "$Id: doc2tex.c,v 1.1 90/01/11 15:44:06 dfk Exp Locker: dfk $";
X
X#include <stdio.h>
X#include <ctype.h>
X
X#define MAX_NAME_LEN	256
X#define MAX_LINE_LEN	256
X#define TRUE 1
X#define FALSE 0
X
Xtypedef int boolean;
X
Xboolean intable = FALSE;
Xboolean verb = FALSE;
X
Xmain()
X{
X	init(stdout);
X	convert(stdin,stdout);
X	finish(stdout);
X	exit(0);
X}
X
X
Xinit(b)
XFILE *b;
X{
X	(void) fputs("\\input{titlepage.tex}\n",b);
X}
X
X
Xconvert(a,b)
X	FILE *a,*b;
X{
X    static char line[MAX_LINE_LEN];
X
X    while (fgets(line,MAX_LINE_LEN,a)) {
X	   process_line(line, b);
X    }
X}
X
Xprocess_line(line, b)
X	char *line;
X	FILE *b;
X{
X    switch(line[0]) {		/* control character */
X	   case '?': {			/* interactive help entry */
X		  break;			/* ignore */
X	   }
X	   case '@': {			/* start/end table */
X		  if (intable) {
X			 (void) fputs("\\hline\n\\end{tabular}\n", b);
X			 (void) fputs("\\end{center}\n",b);
X			 intable = FALSE;
X		  } else {
X			 if (verb) {
X				(void) fputs("\\end{verbatim}\n",b);
X				verb=FALSE;
X			 } 
X			 (void) fputs("\n\\begin{center}\n", b);
X			 (void) fputs("\\begin{tabular}{|ccl|} \\hline\n", b);
X			 intable = TRUE;
X		  }
X		  /* ignore rest of line */
X		  break;
X	   }
X	   case '#': {			/* latex table entry */
X		  if (intable)
X		    (void) fputs(line+1, b); /* copy directly */
X		  else
X		    fprintf(stderr, "error: # line found outside of table\n");
X		  break;
X	   }
X	   case '%': {			/* troff table entry */
X		  break;			/* ignore */
X	   }
X	   case '\n':			/* empty text line */
X	   case ' ': {			/* normal text line */
X		  if (intable)
X		    break;		/* ignore while in table */
X		  if (line[1] == ' ') {
X			 /* verbatim mode */
X			 if (!verb) {
X				(void) fputs("\\begin{verbatim}\n",b);
X				verb=TRUE;
X			 }
X			 (void) fputs(line+1,b); 
X		  } else {
X			 if (verb) {
X				(void) fputs("\\end{verbatim}\n",b);
X				verb=FALSE;
X			 } 
X			 puttex(line+1,b);
X		  }
X		  break;
X	   }
X	   default: {
X		  if (isdigit(line[0])) { /* start of section */
X			 if (!intable)	/* ignore while in table */
X			   section(line, b);
X		  } else
X		    fprintf(stderr, "unknown control code '%c' in column 1\n", 
X				  line[0]);
X		  break;
X	   }
X    }
X}
X
X/* process a line with a digit control char */
X/* starts a new [sub]section */
X
Xsection(line, b)
X	char *line;
X	FILE *b;
X{
X    static char string[MAX_LINE_LEN];
X    int sh_i;
X
X    if (verb) {
X	   (void) fputs("\\end{verbatim}\n",b);
X	   verb=FALSE;
X    } 
X    (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
X    switch(sh_i)
X	 {
X		case 1: 
X		(void) fprintf(b,"\\section{");
X		break;
X		case 2: 
X		(void) fprintf(b,"\\section{");
X		break;
X		case 3:
X		(void) fprintf(b,"\\subsection{");
X		break;
X		case 4: 
X		(void) fprintf(b,"\\subsubsection{");
X		break;
X		default:
X		case 5: 
X		(void) fprintf(b,"\\paragraph{");
X		break;
X	 }
X    if (islower(string[0]))
X	 string[0] = toupper(string[0]);
X    puttex(string,b);
X    (void) fprintf(b,"}\n");
X}
X
X/* put text in string str to file while buffering special TeX characters */
Xputtex(str,file)
XFILE *file;
Xregister char *str;
X{
Xregister char ch;
Xstatic boolean inquote = FALSE;
X
X	 while( (ch = *str++) != '\0') {
X		 switch(ch) {
X			 case '#':
X			 case '$':
X			 case '%':
X			 case '&':
X			 case '_':
X			 case '{':
X			 case '}':
X				 (void) fputc('\\',file);
X				 (void) fputc(ch,file);
X				 break;
X			 case '\\':
X				 (void) fputs("$\\backslash$",file);
X				 break;
X			 case '~':
X				 (void) fputs("\\~{\\ }",file);
X				 break;
X			 case '^':
X				 (void) fputs("\\verb+^+",file);
X				 break;
X			 case '>':
X			 case '<':
X			 case '|':
X				 (void) fputc('$',file);
X				 (void) fputc(ch,file);
X				 (void) fputc('$',file);
X				 break;
X			 case '"': 
X				 /* peek at next character: if space, end of quote */
X				 if (*str == NULL || isspace(*str) || ispunct(*str))
X				   (void) fputs("''", file);
X				 else
X				   (void) fputs("``", file);
X				 break;
X			 case '`':	/* backquotes mean boldface */
X				 if (inquote) {
X					fputs("}", file);
X					inquote = FALSE;
X				 } else {
X					fputs("{\\bf ", file);
X					inquote = TRUE;
X				 }
X				 break;
X			 default:
X				 (void) fputc(ch,file);
X				 break;
X		 }
X	 }
X}
X
X
Xfinish(b)
XFILE *b;
X{
X	(void) fputs("\\end{document}\n",b);
X}
END_OF_docs/doc2tex.c
if test 4694 -ne `wc -c <docs/doc2tex.c`; then
    echo shar: \"docs/doc2tex.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f docs/titlepage.ms -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"docs/titlepage.ms\"
else
echo shar: Extracting \"docs/titlepage.ms\" \(290 characters\)
sed "s/^X//" >docs/titlepage.ms <<'END_OF_docs/titlepage.ms'
X.nr HM 3.2i
X.TL
XGNUPLOT
X.br
XAn Interactive Plotting Program
X.sp
X.AU
XThomas Williams & Colin Kelley
X.br
XJohn Campbell, David Kotz, and Russell Lang (Version 2.0)
X.AI
Xpixar!info-gnuplot at sun.com
X\*(DY
X.br
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XThis manual is for GNUPLOT version 2.0.
X.AB no
X.AE
X.LP
X.nr HM 1.2i
END_OF_docs/titlepage.ms
if test 290 -ne `wc -c <docs/titlepage.ms`; then
    echo shar: \"docs/titlepage.ms\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f docs/titlepage.tex -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"docs/titlepage.tex\"
else
echo shar: Extracting \"docs/titlepage.tex\" \(760 characters\)
sed "s/^X//" >docs/titlepage.tex <<'END_OF_docs/titlepage.tex'
X\documentstyle{article}
X\setlength{\textwidth}{6.25in}
X\setlength{\oddsidemargin}{0.5cm}
X\setlength{\topmargin}{-0.5in}
X\setlength{\textheight}{9in}
X\setlength{\parskip}{1ex}
X\setlength{\parindent}{0pt}
X\begin{document}
X
X\pagestyle{empty}
X   \rule{0in}{3in}
X   \begin{center}
X   {\huge\bf GNUPLOT}\\
X   \vspace{3ex}
X   {\Large An Interactive Plotting Program}\\
X   \vspace{2ex}
X   \large
X   Thomas Williams \& Colin Kelley\\
X   \vspace{2ex}
X   Version 2.0: \\
X   John Campbell, David Kotz, and Russell Lang\\
X   \vspace{2ex}
X   \verb+pixar!info-gnuplot at sun.com+
X
X   \vfill
X   {\small This manual is for GNUPLOT version 2.0.}
X
X   \end{center}
X\newpage
X
X\tableofcontents
X\newpage
X
X\setcounter{page}{1}
X\pagestyle{myheadings}
X\markboth{GNUPLOT 2.0}{GNUPLOT 2.0}
X
END_OF_docs/titlepage.tex
if test 760 -ne `wc -c <docs/titlepage.tex`; then
    echo shar: \"docs/titlepage.tex\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0



More information about the Comp.sources.misc mailing list