ANNOUNCING GNUPLOT 3.0
What is Gnuplot 3.0?
--------------------
Gnuplot is a command-line driven interactive function plotting utility
for UNIX, MSDOS, and VMS platforms. The software is copyrighted but
freely distributed (i.e., you don't have to pay for it). It was
originally intended as graphical program which would allow scientists
and students to visualize mathematical functions and data. Additions
to this version of the software allow plots of three-dimensional
functions and data files. Gnuplot supports many different types of
terminals, plotters, and printers and is easily extensible to include
new devices. [ The "GNU" in Gnuplot is NOT related to the Free
Software Foundation, the naming is just a coincidence (and a long
story). Thus gnuplot is not covered by the Gnu copyleft, but rather
by its own copyright statement, included in all source code files.]
Highlights (compared to 2.02):
------------------------------
Gnuplot now handles surfaces as well. A new command named 'splot' (for
surface plot) has been added for that purpose. A number of new 'set'
options for surfaces have also been added and include: isosamples,
view, contour, cntrparam, mapping and surface. All tic/label/range
setting for x and y axes were extended for z as well.
The size of data file for both curves and surfaces is now independent
of the samples (and iso_samples) variables. Data structures will
automatically be extended to hold the entire data file.
Command-line editing and history on most platforms.
Other new features:
-------------------
New 'errorbars' plot style.
New 'using x:y{:z}' format (NOT COMPATIBLE WITH GNUPLOT 2.02).
New makefile scheme for unix, that supports lots of flavors.
Adjustable display of plot border ('set border').
Set-commands 'x/y/zlabel' can now position the label.
Set-command 'title' can now position the title.
New time display command ('set time').
A 'gnuplot' mode for emacs in the file gnuplot.el.
SGI device was improved.
New option to 'set arrow' called 'nohead'.
All PostScript devices were rewritten and merged into one (Color
Postscript is supported). Due to this many of the old postscript
terminal driver names are not supported; only 'postscript' is
recognized. Use 'help set terminal postscript' to find out how to get
your old favorite back, and more.
Many small bug fixes.
New terminal drivers:
---------------------
vws, apollo, gpr apollo, dumb, BigFig, Super
VGA, ln03/hplj/hpdj, dxf.
Complete list of device drivers supported:
------------------------------------------
aed amiga apollo bigfig cgi dumb dxf dxy eepic epson fig gpr hp26
hp2648 hpgl hpljii imagen iris4d kyo latex pc post qms regis sun t410x
tek unixpc unixplot v384 vws x11
KNOWN BUGS:
-----------
Some problems with logscale on the y-axis, noticed after release.
Definitely a problem when mixing logscaling and autoscaling on the y
axis. x-axis status unknown. Expect a fix in 3.01.
===================================================================
Where to obtain Gnuplot 3.0:
----------------------------
In general, Gnuplot 3.0 is available as the file gnuplot3.0.tar.Z.
Please obtain gnuplot from the site nearest you. Many of the major ftp
archives world-wide have already picked up the latest version, so if
you found the old version elsewhere, you might check there.
USENET users:
GNUPLOT 3.0 was posted to comp.sources.misc.
NORTH AMERICA:
Anonymous ftp to dartmouth.edu (129.170.16.4)
Fetch
pub/gnuplot/gnuplot3.0.tar.Z
in binary mode.
Users without ftp capability can obtain it through a mail ftp
server. Send a mail message saying 'help' to
BIT...@pucc.princeton.edu for instructions. For a uuencoded
copy of the gnuplot sources (compressed tar file), send this
message to BIT...@pucc.princeton.edu:
FTP DARTMOUTH.EDU UUENCODE
USER ANONYMOUS
CD pub/gnuplot
BINARY
GET gnuplot3.0.tar.Z
QUIT
AUSTRALIA:
Anonymous ftp to monu1.cc.monash.edu.au (130.194.1.101).
Fetch pub/gnuplot3.0.tar.Z in binary mode.
EUROPE:
Anonymous ftp to irisa.irisa.fr (131.254.2.3).
Fetch pub/gnuplot3.0.tar.Z in binary mode.
----
DISCLAIMER - This product is not related in any way to
Pixar or any other commercial venture.
----
CONTACTS:
Please send any questions or comments to
pixar!info-g...@ucbvax.berkeley.edu.
To join the above mailing list (or get yourself off), mail to
pixar!info-gnupl...@ucbvax.berkeley.edu.
Send bug reports and problems to
pixar!bug-g...@ucbvax.berkeley.edu.
-Thomas Williams-
----------------
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 10/15/1991 19:23 UTC by ger...@gr.utah.edu
# Source directory /n/lotus/u/grad/gershon/gp
#
# existing files will NOT be overwritten unless -c is specified
#
# This is part 1 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 279 -rw-r--r-- gnuplot/linkopt.tco
# 889 -rw-rw-rw- gnuplot/Copyright
# 63352 -rw-r--r-- gnuplot/setshow.c
# 2406 -rw-r--r-- gnuplot/README
# 17904 -rw-r--r-- gnuplot/help.c
# 51656 -rw-rw-rw- gnuplot/bitmap.c
# 2726 -rw-rw-rw- gnuplot/bitmap.h
# 918 -rw-r--r-- gnuplot/buildvms.com
# 22387 -rw-r--r-- gnuplot/misc.c
# 41345 -rw-rw-rw- gnuplot/contour.c
# 781 -rw-rw-rw- gnuplot/demo/1.dat
# 781 -rw-rw-rw- gnuplot/demo/2.dat
# 781 -rw-rw-rw- gnuplot/demo/3.dat
# 3088 -rw-r--r-- gnuplot/demo/contours.demo
# 712 -rw-rw-rw- gnuplot/demo/controls.demo
# 2065 -rw-rw-rw- gnuplot/demo/electron.demo
# 8538 -rw-rw-rw- gnuplot/demo/glass.dat
# 909 -rw-rw-rw- gnuplot/demo/param.demo
# 965 -rw-rw-rw- gnuplot/demo/polar.demo
# 1045 -rw-rw-rw- gnuplot/demo/simple.demo
# 3111 -rw-r--r-- gnuplot/demo/surface1.demo
# 1359 -rw-r--r-- gnuplot/demo/surface2.demo
# 5568 -rw-rw-rw- gnuplot/demo/using.dat
# 708 -rw-r--r-- gnuplot/demo/using.demo
# 3329 -rw-r--r-- gnuplot/demo/world.cor
# 16720 -rw-rw-rw- gnuplot/demo/world.dat
# 1349 -rw-r--r-- gnuplot/demo/world.demo
# 418 -rw-r--r-- gnuplot/demo/err.dat
# 491 -rw-r--r-- gnuplot/demo/poldat.demo
# 6538 -rw-r--r-- gnuplot/demo/polar.dat
# 867 -rw-r--r-- gnuplot/demo/errorbar.demo
# 20577 -rw-r--r-- gnuplot/demo/antenna.dat
# 1245 -rw-r--r-- gnuplot/demo/all.demo
# 2915 -rw-r--r-- gnuplot/demo/bivariat.demo
# 2363 -rw-r--r-- gnuplot/docs/Makefile
# 3681 -rw-r--r-- gnuplot/docs/README
# 1377 -rw-rw-rw- gnuplot/docs/checkdoc.c
# 2021 -rw-rw-rw- gnuplot/docs/doc2gih.c
# 1471 -rw-rw-rw- gnuplot/docs/doc2hlp.c
# 90 -rw-rw-rw- gnuplot/docs/doc2hlp.com
# 5125 -rw-r--r-- gnuplot/docs/doc2ms.c
# 3718 -rw-r--r-- gnuplot/docs/gnuplot.1
# 90586 -rw-r--r-- gnuplot/docs/gnuplot.doc
# 1594 -rw-r--r-- gnuplot/docs/lasergnu.1
# 570 -rw-r--r-- gnuplot/docs/latextut/Makefile
# 65 -rw-rw-rw- gnuplot/docs/latextut/eg1.plt
# 219 -rw-rw-rw- gnuplot/docs/latextut/eg2.plt
# 781 -rw-rw-rw- gnuplot/docs/latextut/eg3.dat
# 199 -rw-rw-rw- gnuplot/docs/latextut/eg3.plt
# 227 -rw-rw-rw- gnuplot/docs/latextut/eg4.plt
# 331 -rw-rw-rw- gnuplot/docs/latextut/eg5.plt
# 457 -rw-rw-rw- gnuplot/docs/latextut/eg6.plt
# 1677 -rw-r--r-- gnuplot/docs/latextut/header.tex
# 16623 -rw-r--r-- gnuplot/docs/latextut/tutorial.tex
# 550 -rw-r--r-- gnuplot/docs/latextut/linepoint.plt
# 599 -rw-r--r-- gnuplot/docs/titlepage.ms
# 5029 -rw-r--r-- gnuplot/docs/doc2tex.c
# 1027 -rw-r--r-- gnuplot/docs/titlepage.tex
# 2009 -rw-r--r-- gnuplot/docs/toc_entry.sty
# 2688 -rw-r--r-- gnuplot/docs/Makefile.ami
# 2272 -rw-rw-rw- gnuplot/corgraph.asm
# 1979 -rw-rw-rw- gnuplot/corplot.c
# 3799 -rw-rw-rw- gnuplot/eval.c
# 5487 -rw-rw-rw- gnuplot/gnuplot.el
# 8774 -rw-r--r-- gnuplot/gnuplot_x11.c
# 252 -rw-rw-rw- gnuplot/linkopt.tc
# 3801 -rw-r--r-- gnuplot/lasergnu
# 918 -rw-rw-rw- gnuplot/header.mac
# 12274 -rw-r--r-- gnuplot/readline.c
# 1383 -rw-rw-rw- gnuplot/help.h
# 8192 -rw-rw-rw- gnuplot/hrcgraph.asm
# 16092 -rw-r--r-- gnuplot/internal.c
# 85435 -rw-r--r-- gnuplot/command.c
# 1980 -rw-rw-rw- gnuplot/lineproc.mac
# 159 -rw-r--r-- gnuplot/linkopt.msc
# 4014 -rw-r--r-- gnuplot/makefile.tc
# 26 -rw-rw-rw- gnuplot/linkopt.vms
# 7115 -rw-r--r-- gnuplot/term/README
# 2311 -rw-rw-rw- gnuplot/term/aed.trm
# 3598 -rw-rw-rw- gnuplot/term/bigfig.trm
# 4407 -rw-rw-rw- gnuplot/term/cgi.trm
# 2238 -rw-rw-rw- gnuplot/term/dxy.trm
# 7640 -rw-r--r-- gnuplot/term/eepic.trm
# 11330 -rw-rw-rw- gnuplot/term/epson.trm
# 7494 -rw-r--r-- gnuplot/term/fig.trm
# 2262 -rw-rw-rw- gnuplot/term/hp26.trm
# 2113 -rw-rw-rw- gnuplot/term/hp2648.trm
# 2857 -rw-r--r-- gnuplot/term/hpgl.trm
# 8101 -rw-r--r-- gnuplot/term/hpljii.trm
# 25264 -rw-r--r-- gnuplot/term/pc.trm
# 7396 -rw-rw-rw- gnuplot/term/imagen.trm
# 5305 -rw-r--r-- gnuplot/term/iris4d.trm
# 2313 -rw-rw-rw- gnuplot/term/kyo.trm
# 17764 -rw-r--r-- gnuplot/term/latex.trm
# 5063 -rw-rw-rw- gnuplot/term/object.h
# 9281 -rw-r--r-- gnuplot/term/post.trm
# 9980 -rw-r--r-- gnuplot/term/dxf.trm
# 3785 -rw-rw-rw- gnuplot/term/qms.trm
# 2967 -rw-rw-rw- gnuplot/term/regis.trm
# 6147 -rw-rw-rw- gnuplot/term/sun.trm
# 5056 -rw-rw-rw- gnuplot/term/t410x.trm
# 6716 -rw-r--r-- gnuplot/term/tek.trm
# 14242 -rw-r--r-- gnuplot/term/unixpc.trm
# 1929 -rw-rw-rw- gnuplot/term/unixplot.trm
# 2579 -rw-rw-rw- gnuplot/term/v384.trm
# 8014 -rw-r--r-- gnuplot/term/vws.trm
# 2240 -rw-r--r-- gnuplot/term/x11.trm
# 11637 -rw-r--r-- gnuplot/term/gpr.trm
# 6235 -rw-r--r-- gnuplot/term/dumb.trm
# 10991 -rw-r--r-- gnuplot/term/amiga.trm
# 17013 -rw-r--r-- gnuplot/term/apollo.trm
# 1260 -rw-rw-rw- gnuplot/term/impcodes.h
# 10144 -rw-r--r-- gnuplot/parse.c
# 2572 -rw-r--r-- gnuplot/makefile.msc
# 1114 -rw-r--r-- gnuplot/copyright
# 52166 -rw-r--r-- gnuplot/graph3d.c
# 1998 -rw-r--r-- gnuplot/makefile.vms
# 12714 -rw-r--r-- gnuplot/util.c
# 25357 -rw-r--r-- gnuplot/makefile.unx
# 3925 -rw-rw-rw- gnuplot/pcgraph.asm
# 8795 -rw-r--r-- gnuplot/plot.c
# 11940 -rw-r--r-- gnuplot/plot.h
# 2981 -rw-r--r-- gnuplot/README.amiga
# 8676 -rw-r--r-- gnuplot/scanner.c
# 1368 -rw-r--r-- gnuplot/version.c
# 3968 -rw-r--r-- gnuplot/setshow.h
# 15347 -rw-rw-rw- gnuplot/standard.c
# 50685 -rw-r--r-- gnuplot/term.c
# 475 -rw-r--r-- gnuplot/Intergraph.x11
# 232 -rw-rw-rw- gnuplot/linkopt.amg
# 7729 -rw-r--r-- gnuplot/README.Install
# 10762 -rw-r--r-- gnuplot/History
# 1170 -rw-r--r-- gnuplot/README.gnutex
# 1808 -rw-r--r-- gnuplot/makefile.amg
# 42004 -rw-r--r-- gnuplot/graphics.c
# 2916 -rw-r--r-- gnuplot/makefile.ami
# 3953 -rw-r--r-- gnuplot/term.h
#
if test -r _shar_seq_.tmp; then
echo 'Must unpack archives in sequence!'
echo Please unpack part `cat _shar_seq_.tmp` next
exit 1
fi
# ============= gnuplot/linkopt.tco ==============
if test ! -d 'gnuplot'; then
echo 'x - creating directory gnuplot'
mkdir 'gnuplot'
fi
if test -f 'gnuplot/linkopt.tco' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.tco (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.tco (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.tco' &&
c:\tc\lib\C0l +
/o bitmap command eval graphics graph3d help internal misc parse +
plot scanner setshow standard term util version contour +
/o- egavgaf hercf cgaf attf +
,gnuplot,gnuplot, +
c:\tc\lib\overlay +
c:\tc\lib\emu +
c:\tc\lib\mathl +
c:\tc\lib\cl +
c:\tc\lib\graphics
SHAR_EOF
chmod 0644 gnuplot/linkopt.tco ||
echo 'restore of gnuplot/linkopt.tco failed'
Wc_c="`wc -c < 'gnuplot/linkopt.tco'`"
test 279 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.tco: original size 279, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/Copyright ==============
if test -f 'gnuplot/Copyright' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/Copyright (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/Copyright (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/Copyright' &&
/*
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-g...@sun.com).
X *
X */
SHAR_EOF
chmod 0666 gnuplot/Copyright ||
echo 'restore of gnuplot/Copyright failed'
Wc_c="`wc -c < 'gnuplot/Copyright'`"
test 889 -eq "$Wc_c" ||
echo 'gnuplot/Copyright: original size 889, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/setshow.c ==============
if test -f 'gnuplot/setshow.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/setshow.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/setshow.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/setshow.c' &&
/* GNUPLOT - setshow.c */
/*
X * Copyright (C) 1986, 1987, 1990, 1991 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 * Gnuplot 3.0 additions:
X * Gershon Elber and many others.
X *
X * Send your comments or suggestions to
X * pixar!info-g...@sun.com.
X * This is a mailing list; to join it send a note to
X * pixar!info-gnupl...@sun.com.
X * Send bug reports to
X * pixar!bug-g...@sun.com.
X */
X
#include <stdio.h>
#include <math.h>
#include "plot.h"
#include "setshow.h"
X
#define DEF_FORMAT "%g" /* default format for tic mark labels */
#define SIGNIF (0.01) /* less than one hundredth of a tic mark */
X
/*
X * global variables to hold status of 'set' options
X *
X */
BOOLEAN autoscale_r = TRUE;
BOOLEAN autoscale_t = TRUE;
BOOLEAN autoscale_u = TRUE;
BOOLEAN autoscale_v = TRUE;
BOOLEAN autoscale_x = TRUE;
BOOLEAN autoscale_y = TRUE;
BOOLEAN autoscale_z = TRUE;
BOOLEAN autoscale_lt = TRUE;
BOOLEAN autoscale_lu = TRUE;
BOOLEAN autoscale_lv = TRUE;
BOOLEAN autoscale_lx = TRUE;
BOOLEAN autoscale_ly = TRUE;
BOOLEAN autoscale_lz = TRUE;
BOOLEAN clip_points = FALSE;
BOOLEAN clip_lines1 = TRUE;
BOOLEAN clip_lines2 = FALSE;
BOOLEAN draw_border = TRUE;
BOOLEAN draw_surface = TRUE;
BOOLEAN timedate = FALSE;
char dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1] = { "x", "y" };
char xformat[MAX_ID_LEN+1] = DEF_FORMAT;
char yformat[MAX_ID_LEN+1] = DEF_FORMAT;
char zformat[MAX_ID_LEN+1] = DEF_FORMAT;
enum PLOT_STYLE data_style = POINTS,
X func_style = LINES;
BOOLEAN grid = FALSE;
int key = -1; /* default position */
double key_x, key_y, key_z; /* user specified position for key */
BOOLEAN log_x = FALSE,
X log_y = FALSE,
X log_z = FALSE;
FILE* outfile;
char outstr[MAX_ID_LEN+1] = "STDOUT";
BOOLEAN parametric = FALSE;
BOOLEAN polar = FALSE;
int angles_format = ANGLES_RADIANS;
int mapping3d = MAP3D_CARTESIAN;
int samples = SAMPLES;
int iso_samples = ISO_SAMPLES;
float xsize = 1.0; /* scale factor for size */
float ysize = 1.0; /* scale factor for size */
float zsize = 1.0; /* scale factor for size */
float surface_rot_z = 30.0; /* Default 3d transform. */
float surface_rot_x = 60.0;
float surface_scale = 1.0;
float surface_zscale = 1.0;
int term = 0; /* unknown term is 0 */
char term_options[MAX_ID_LEN+1] = "";
char title[MAX_LINE_LEN+1] = "";
char xlabel[MAX_LINE_LEN+1] = "";
char ylabel[MAX_LINE_LEN+1] = "";
char zlabel[MAX_LINE_LEN+1] = "";
int time_xoffset = 0;
int time_yoffset = 0;
int title_xoffset = 0;
int title_yoffset = 0;
int xlabel_xoffset = 0;
int xlabel_yoffset = 0;
int ylabel_xoffset = 0;
int ylabel_yoffset = 0;
int zlabel_xoffset = 0;
int zlabel_yoffset = 0;
double rmin = -0.0,
X rmax = 10.0,
X tmin = -5.0,
X tmax = 5.0,
X umin = -5.0,
X umax = 5.0,
X vmin = -5.0,
X vmax = 5.0,
X xmin = -10.0,
X xmax = 10.0,
X ymin = -10.0,
X ymax = 10.0,
X zmin = -10.0,
X zmax = 10.0;
double loff = 0.0,
X roff = 0.0,
X toff = 0.0,
X boff = 0.0;
int draw_contour = CONTOUR_NONE;
int contour_pts = 5;
int contour_kind = CONTOUR_KIND_LINEAR;
int contour_order = 4;
int contour_levels = 5;
double zero = ZERO; /* zero threshold, not 0! */
X
BOOLEAN xzeroaxis = TRUE;
BOOLEAN yzeroaxis = TRUE;
X
BOOLEAN xtics = TRUE;
BOOLEAN ytics = TRUE;
BOOLEAN ztics = TRUE;
X
float ticslevel = 0.5;
X
struct ticdef xticdef = {TIC_COMPUTED};
struct ticdef yticdef = {TIC_COMPUTED};
struct ticdef zticdef = {TIC_COMPUTED};
X
BOOLEAN tic_in = TRUE;
X
struct text_label *first_label = NULL;
struct arrow_def *first_arrow = NULL;
X
/*** other things we need *****/
extern char *strcpy(),*strcat();
extern int strlen();
extern FILE *popen();
X
/* input data, parsing variables */
extern struct lexical_unit token[];
extern char input_line[];
extern int num_tokens, c_token;
extern BOOLEAN interactive; /* from plot.c */
X
extern char replot_line[];
extern struct udvt_entry *first_udv;
extern BOOLEAN is_3d_plot;
X
extern double magnitude(),real();
extern struct value *const_express();
X
/******** Local functions ********/
static void set_xyzlabel();
static void set_label();
static void set_nolabel();
static void set_arrow();
static void set_noarrow();
static void load_tics();
static void load_tic_user();
static void free_marklist();
static void load_tic_series();
static void load_offsets();
X
static void show_style(), show_range(), show_zero(), show_border();
static void show_offsets(), show_output(), show_samples(), show_isosamples();
static void show_view(), show_size(), show_title(), show_xlabel();
static void show_angles();
static void show_ylabel(), show_zlabel(), show_xzeroaxis(), show_yzeroaxis();
static void show_label(), show_arrow(), show_grid(), show_key();
static void show_polar(), show_parametric(), show_tics(), show_ticdef();
static void show_time(), show_term(), show_plot(), show_autoscale(), show_clip();
static void show_contour(), show_mapping(), show_format(), show_logscale();
static void show_variables(), show_surface();
static void delete_label();
static int assign_label_tag();
static void delete_arrow();
static int assign_arrow_tag();
static BOOLEAN set_one(), set_two(), set_three();
static BOOLEAN show_one(), show_two();
X
/******** The 'set' command ********/
void
set_command()
{
X c_token++;
X
X if (!set_one() && !set_two() && !set_three())
X int_error(
X "valid set options: 'angles' '{no}arrow', {no}autoscale', \n\
X '{no}border', '{no}clip', 'cntrparam', '{no}contour', 'data style', \n\
X 'dummy', 'format', 'function style', '{no}grid', 'isosamples', \n\
X '{no}key', '{no}label', '{no}logscale', 'mapping', 'offsets', \n\
X 'output', '{no}parametric', '{no}polar', 'rrange', 'samples', \n\
X 'size', '{no}surface', 'terminal', 'tics', 'ticslevel', '{no}time', \n\
X 'title', 'trange', 'urange', 'view', 'vrange', 'xlabel', 'xrange', \n\
X '{no}xtics', '{no}xzeroaxis', 'ylabel', 'yrange', '{no}ytics', \n\
X '{no}yzeroaxis', 'zero', '{no}zeroaxis', 'zlabel', 'zrange', \n\
X '{no}ztics'", c_token);
}
X
/* return TRUE if a command match, FALSE if not */
static BOOLEAN
set_one()
{
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_r=autoscale_t = autoscale_x = autoscale_y = autoscale_z = 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, "r")) {
X autoscale_r = TRUE;
X c_token++;
X } else if (equals(c_token, "t")) {
X autoscale_t = 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 } else if (equals(c_token, "z")) {
X autoscale_z = 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_r=autoscale_t = autoscale_x = autoscale_y = autoscale_z = FALSE;
X } else if (equals(c_token, "xy") || equals(c_token, "tyx")) {
X autoscale_x = autoscale_y = FALSE;
X c_token++;
X } else if (equals(c_token, "r")) {
X autoscale_r = FALSE;
X c_token++;
X } else if (equals(c_token, "t")) {
X autoscale_t = 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 } else if (equals(c_token, "z")) {
X autoscale_z = FALSE;
X c_token++;
X }
X }
X else if (almost_equals(c_token,"bor$der")) {
X draw_border = TRUE;
X c_token++;
X }
X else if (almost_equals(c_token,"nobor$der")) {
X draw_border = FALSE;
X c_token++;
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,"ma$pping3d")) {
X c_token++;
X if (END_OF_COMMAND)
X /* assuming same as points */
X mapping3d = MAP3D_CARTESIAN;
X else if (almost_equals(c_token, "ca$rtesian"))
X mapping3d = MAP3D_CARTESIAN;
X else if (almost_equals(c_token, "s$pherical"))
X mapping3d = MAP3D_SPHERICAL;
X else if (almost_equals(c_token, "cy$lindrical"))
X mapping3d = MAP3D_CYLINDRICAL;
X else
X int_error("expecting 'cartesian', 'spherical', or 'cylindrical'", c_token);
X c_token++;
X }
X else if (almost_equals(c_token,"co$ntour")) {
X c_token++;
X if (END_OF_COMMAND)
X /* assuming same as points */
X draw_contour = CONTOUR_BASE;
X else if (almost_equals(c_token, "ba$se"))
X draw_contour = CONTOUR_BASE;
X else if (almost_equals(c_token, "s$urface"))
X draw_contour = CONTOUR_SRF;
X else if (almost_equals(c_token, "bo$th"))
X draw_contour = CONTOUR_BOTH;
X else
X int_error("expecting 'base', 'surface', or 'both'", c_token);
X c_token++;
X }
X else if (almost_equals(c_token,"noco$ntour")) {
X c_token++;
X draw_contour = CONTOUR_NONE;
X }
X else if (almost_equals(c_token,"cntrp$aram")) {
X struct value a;
X
X c_token++;
X if (END_OF_COMMAND) {
X /* assuming same as defaults */
X contour_pts = 5;
X contour_kind = CONTOUR_KIND_LINEAR;
X contour_order = 4;
X contour_levels = 5;
X }
X else if (almost_equals(c_token, "p$oints")) {
X c_token++;
X contour_pts = (int) real(const_express(&a));
X }
X else if (almost_equals(c_token, "li$near")) {
X c_token++;
X contour_kind = CONTOUR_KIND_LINEAR;
X }
X else if (almost_equals(c_token, "c$ubicspline")) {
X c_token++;
X contour_kind = CONTOUR_KIND_CUBIC_SPL;
X }
X else if (almost_equals(c_token, "b$spline")) {
X c_token++;
X contour_kind = CONTOUR_KIND_BSPLINE;
X }
X else if (almost_equals(c_token, "le$vels")) {
X c_token++;
X contour_levels = (int) real(const_express(&a));
X }
X else if (almost_equals(c_token, "o$rder")) {
X int order;
X c_token++;
X order = (int) real(const_express(&a));
X if ( order < 2 || order > 10 )
X int_error("bspline order must be in [2..10] range.", c_token);
X contour_order = order;
X }
X else
X int_error("expecting 'linear', 'cubicspline', 'bspline', 'points', 'levels' or 'order'", 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 if (END_OF_COMMAND)
X int_error("expecting dummy variable name", c_token);
X else {
X if (!equals(c_token,","))
X copy_str(dummy_var[0],c_token++);
X if (!END_OF_COMMAND && equals(c_token,",")) {
X c_token++;
X if (END_OF_COMMAND)
X int_error("expecting second dummy variable name", c_token);
X copy_str(dummy_var[1],c_token++);
X }
X }
X }
X else if (almost_equals(c_token,"fo$rmat")) {
X BOOLEAN setx, sety, setz;
X c_token++;
X if (equals(c_token,"x")) {
X setx = TRUE; sety = setz = FALSE;
X c_token++;
X }
X else if (equals(c_token,"y")) {
X setx = setz = FALSE; sety = TRUE;
X c_token++;
X }
X else if (equals(c_token,"z")) {
X setx = sety = FALSE; setz = TRUE;
X c_token++;
X }
X else if (equals(c_token,"xy") || equals(c_token,"yx")) {
X setx = sety = TRUE; setz = FALSE;
X c_token++;
X }
X else if (isstring(c_token) || END_OF_COMMAND) {
X /* Assume he wants all */
X setx = sety = setz = 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 if (setz)
X (void) strcpy(zformat,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 if (setz)
X quote_str(zformat,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 = log_z = TRUE;
X } else {
X if (chr_in_str(c_token, 'x'))
X log_x = TRUE;
X if (chr_in_str(c_token, 'y'))
X log_y = TRUE;
X if (chr_in_str(c_token, 'z'))
X log_z = 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 = log_z = FALSE;
X } else {
X if (chr_in_str(c_token, 'x'))
X log_x = FALSE;
X if (chr_in_str(c_token, 'y'))
X log_y = FALSE;
X if (chr_in_str(c_token, 'z'))
X log_z = 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
X return(FALSE); /* no command match */
X return(TRUE);
}
X
X
/* return TRUE if a command match, FALSE if not */
static BOOLEAN
set_two()
{
X char testfile[MAX_LINE_LEN+1];
#ifdef unix
X static BOOLEAN pipe_open = FALSE;
#endif
X
X 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 */
#ifdef unix
X if ( pipe_open ) {
X (void) pclose(outfile);
X pipe_open = FALSE;
X } else
#endif
X (void) fclose(outfile);
X }
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);
#ifdef unix
X if ( *testfile == '|' ) {
X if ((f = popen(testfile+1,"w")) == (FILE *)NULL)
X os_error("cannot create pipe; output not changed",c_token);
X else
X pipe_open = TRUE;
X } else
#endif
X if ((f = fopen(testfile,"w")) == (FILE *)NULL)
X os_error("cannot open file; output not changed",c_token);
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 set_xyzlabel(title,&title_xoffset,&title_yoffset);
X }
X else if (almost_equals(c_token,"xl$abel")) {
X set_xyzlabel(xlabel,&xlabel_xoffset,&xlabel_yoffset);
X }
X else if (almost_equals(c_token,"yl$abel")) {
X set_xyzlabel(ylabel,&ylabel_xoffset,&ylabel_yoffset);
X }
X else if (almost_equals(c_token,"zl$abel")) {
X set_xyzlabel(zlabel,&zlabel_xoffset,&zlabel_yoffset);
X }
X else if (almost_equals(c_token,"xzero$axis")) {
X c_token++;
X xzeroaxis = TRUE;
X }
X else if (almost_equals(c_token,"yzero$axis")) {
X c_token++;
X yzeroaxis = TRUE;
X }
X else if (almost_equals(c_token,"zeroa$xis")) {
X c_token++;
X yzeroaxis = TRUE;
X xzeroaxis = TRUE;
X }
X else if (almost_equals(c_token,"noxzero$axis")) {
X c_token++;
X xzeroaxis = FALSE;
X }
X else if (almost_equals(c_token,"noyzero$axis")) {
X c_token++;
X yzeroaxis = FALSE;
X }
X else if (almost_equals(c_token,"nozero$axis")) {
X c_token++;
X xzeroaxis = FALSE;
X yzeroaxis = FALSE;
X }
X else if (almost_equals(c_token,"par$ametric")) {
X if (!parametric) {
X parametric = TRUE;
X strcpy (dummy_var[0], "t");
X strcpy (dummy_var[1], "y");
X (void) fprintf(stderr,"\n\tdummy variable is t for curves, u/v for surfaces\n");
X }
X c_token++;
X }
X else if (almost_equals(c_token,"nopar$ametric")) {
X if (parametric) {
X parametric = FALSE;
X strcpy (dummy_var[0], "x");
X strcpy (dummy_var[1], "y");
X (void) fprintf(stderr,"\n\tdummy variable is x for curves, x/y for surfaces\n");
X }
X c_token++;
X }
X else if (almost_equals(c_token,"pol$ar")) {
X if (!polar) {
X polar = TRUE;
X if (parametric) {
X tmin = 0.0;
X tmax = 2*Pi;
X } else if (angles_format == ANGLES_DEGREES) {
X xmin = 0.0;
X xmax = 360.0;
X } else {
X xmin = 0.0;
X xmax = 2*Pi;
X }
X }
X c_token++;
X }
X else if (almost_equals(c_token,"nopo$lar")) {
X if (polar) {
X polar = FALSE;
X if (parametric) {
X tmin = -5.0;
X tmax = 5.0;
X } else {
X xmin = -10.0;
X xmax = 10.0;
X }
X }
X c_token++;
X }
X else if (almost_equals(c_token,"an$gles")) {
X c_token++;
X if (END_OF_COMMAND) {
X /* assuming same as defaults */
X angles_format = ANGLES_RADIANS;
X }
X else if (almost_equals(c_token, "r$adians")) {
X angles_format = ANGLES_RADIANS;
X c_token++;
X }
X else if (almost_equals(c_token, "d$egrees")) {
X angles_format = ANGLES_DEGREES;
X c_token++;
X }
X else
X int_error("expecting 'radians' or 'degrees'", 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,"su$rface")) {
X draw_surface = TRUE;
X c_token++;
X }
X else if (almost_equals(c_token,"nosu$rface")) {
X draw_surface = 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 if (equals(c_token,","))
X {
X c_token++;
X key_z = real(const_express(&a));
X }
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,"zt$ics")) {
X ztics = TRUE;
X c_token++;
X if (END_OF_COMMAND) { /* reset to default */
X if (zticdef.type == TIC_USER) {
X free_marklist(zticdef.def.user);
X zticdef.def.user = NULL;
X }
X zticdef.type = TIC_COMPUTED;
X }
X else
X load_tics(&zticdef);
X }
X else if (almost_equals(c_token,"nozt$ics")) {
X ztics = FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"ticsl$evel")) {
X double tlvl;
X struct value a;
X
X c_token++;
X tlvl = real(const_express(&a));
X if (tlvl < 0.0)
X int_error("tics level must be > 0; ticslevel unchanged",
X c_token);
X else {
X ticslevel = tlvl;
X }
X }
X else
X return(FALSE); /* no command match */
X
X return(TRUE);
}
X
X
X
/* return TRUE if a command match, FALSE if not */
static BOOLEAN
set_three()
{
X 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 < 2)
X int_error("sampling rate must be > 1; sampling unchanged",
X c_token);
X else {
X extern struct surface_points *first_3dplot;
X register struct surface_points *f_3dp = first_3dplot;
X
X first_3dplot = NULL;
X sp_free(f_3dp);
X
X samples = tsamp;
X }
X }
X else if (almost_equals(c_token,"isosa$mples")) {
X register int tsamp;
X struct value a;
X
X c_token++;
X tsamp = (int)magnitude(const_express(&a));
X if (tsamp < 2)
X int_error("sampling rate must be > 1; sampling unchanged",
X c_token);
X else {
X extern struct curve_points *first_plot;
X extern struct surface_points *first_3dplot;
X register struct curve_points *f_p = first_plot;
X register struct surface_points *f_3dp = first_3dplot;
X
X first_plot = NULL;
X first_3dplot = NULL;
X cp_free(f_p);
X sp_free(f_3dp);
X
X iso_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 /* get optional mode parameters */
X if (term)
X (*term_tbl[term].options)();
X if (interactive && *term_options)
X fprintf(stderr,"Options are '%s'\n",term_options);
X }
X }
X else if (almost_equals(c_token,"tim$e")) {
X timedate = TRUE;
X c_token++;
X if (!END_OF_COMMAND) {
X struct value a;
X int x, y;
X
X /* We have x,y offsets specified */
X if (!equals(c_token,","))
X time_xoffset = (int)real(const_express(&a));
X if (!END_OF_COMMAND && equals(c_token,",")) {
X c_token++;
X time_yoffset = (int)real(const_express(&a));
X }
X }
X }
X else if (almost_equals(c_token,"not$ime")) {
X timedate = FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"rr$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(&rmin,&rmax);
X if (!equals(c_token,"]"))
X int_error("expecting ']'",c_token);
X c_token++;
X if (changed)
X autoscale_r = FALSE;
X }
X else if (almost_equals(c_token,"tr$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(&tmin,&tmax);
X if (!equals(c_token,"]"))
X int_error("expecting ']'",c_token);
X c_token++;
X if (changed)
X autoscale_t = FALSE;
X }
X else if (almost_equals(c_token,"ur$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(&umin,&umax);
X if (!equals(c_token,"]"))
X int_error("expecting ']'",c_token);
X c_token++;
X if (changed)
X autoscale_u = FALSE;
X }
X else if (almost_equals(c_token,"vi$ew")) {
X int i;
X BOOLEAN was_comma = TRUE;
X double local_vals[4];
X struct value a;
X
X local_vals[0] = surface_rot_x;
X local_vals[1] = surface_rot_z;
X local_vals[2] = surface_scale;
X local_vals[3] = surface_zscale;
X c_token++;
X for (i = 0; i < 4 && !(END_OF_COMMAND);) {
X if (equals(c_token,",")) {
X if (was_comma) i++;
X was_comma = TRUE;
X c_token++;
X }
X else {
X if (!was_comma)
X int_error("',' expected",c_token);
X local_vals[i] = real(const_express(&a));
X i++;
X was_comma = FALSE;
X }
X }
X
X if (local_vals[0] < 0 || local_vals[0] > 180)
X int_error("rot_x must be in [0:180] degrees range; view unchanged",
X c_token);
X if (local_vals[1] < 0 || local_vals[1] > 360)
X int_error("rot_z must be in [0:360] degrees range; view unchanged",
X c_token);
X if (local_vals[2] < 1e-6)
X int_error("scale must be > 0; view unchanged", c_token);
X if (local_vals[3] < 1e-6)
X int_error("zscale must be > 0; view unchanged", c_token);
X
X surface_rot_x = local_vals[0];
X surface_rot_z = local_vals[1];
X surface_scale = local_vals[2];
X surface_zscale = local_vals[3];
X }
X else if (almost_equals(c_token,"vr$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(&vmin,&vmax);
X if (!equals(c_token,"]"))
X int_error("expecting ']'",c_token);
X c_token++;
X if (changed)
X autoscale_v = FALSE;
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,"zr$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(&zmin,&zmax);
X if (!equals(c_token,"]"))
X int_error("expecting ']'",c_token);
X c_token++;
X if (changed)
X autoscale_z = 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 return(FALSE); /* no command match */
X return(TRUE);
}
X
/*********** Support functions for set_command ***********/
X
/* process a 'set {x/y/z}label command */
/* set {x/y/z}label {label_text} {x}{,y} */
static void set_xyzlabel(str,xpos,ypos)
char *str;
int *xpos,*ypos;
{
X c_token++;
X if (END_OF_COMMAND) { /* no label specified */
X str[0] = '\0';
X } else {
X if (isstring(c_token)) {
X /* We have string specified - grab it. */
X quotel_str(str,c_token);
X c_token++;
X }
X if (!END_OF_COMMAND) {
X struct value a;
X int x, y;
X
X /* We have x,y offsets specified */
X if (!equals(c_token,","))
X *xpos = (int)real(const_express(&a));
X if (!END_OF_COMMAND && equals(c_token,",")) {
X c_token++;
X *ypos = (int)real(const_express(&a));
X }
X }
X }
}
X
/* process a 'set label' command */
/* set label {tag} {label_text} {at x,y} {pos} */
static void
set_label()
{
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, z;
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 if (equals(c_token,",")) {
X c_token++;
X z = real(const_express(&a));
X }
X else
X z = 0;
X set_position = TRUE;
X } else {
X x = y = z = 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("extraenous 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 this_label->z = z;
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 new_label->z = z;
X (void) strcpy(new_label->text, text);
X new_label->pos = just;
X }
}
X
/* process 'set nolabel' command */
/* set nolabel {tag} */
static void
set_nolabel()
{
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
/* assign a new label tag */
/* labels are kept sorted by tag number, so this is easy */
static int /* the lowest unassigned tag number */
assign_label_tag()
{
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
/* 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 */
static void
delete_label(prev,this)
X struct text_label *prev, *this;
{
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
/* process a 'set arrow' command */
/* set arrow {tag} {from x,y} {to x,y} {{no}head} */
static void
set_arrow()
{
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, sz;
X double ex, ey, ez;
X int tag;
X BOOLEAN set_start, set_end, head = 1;
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 if (equals(c_token,",")) {
X c_token++;
X sz = real(const_express(&a));
X }
X else
X sz = 0;
X set_start = TRUE;
X } else {
X sx = sy = sz = 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 if (equals(c_token,",")) {
X c_token++;
X ez = real(const_express(&a));
X }
X else
X ez = 0;
X set_end = TRUE;
X } else {
X ex = ey = ez = 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 if (equals(c_token,",")) {
X c_token++;
X sz = real(const_express(&a));
X }
X else
X sz = 0;
X set_start = TRUE;
X }
X
X if (!END_OF_COMMAND && equals(c_token, "nohead")) {
X c_token++;
X head = 0;
X }
X
X if (!END_OF_COMMAND && equals(c_token, "head")) {
X c_token++;
X head = 1;
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 this_arrow->sz = sz;
X }
X if (set_end) {
X this_arrow->ex = ex;
X this_arrow->ey = ey;
X this_arrow->ez = ez;
X }
X this_arrow->head = head;
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->sz = sz;
X new_arrow->ex = ex;
X new_arrow->ey = ey;
X new_arrow->ez = ez;
X new_arrow->head = head;
X }
}
X
/* process 'set noarrow' command */
/* set noarrow {tag} */
static void
set_noarrow()
{
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;
SHAR_EOF
true || echo 'restore of gnuplot/setshow.c failed'
fi
echo 'End of part 1'
echo 'File gnuplot/setshow.c is continued in part 2'
echo 2 > _shar_seq_.tmp
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: ke...@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 ke...@uunet.uu.net.
#!/bin/sh
# this is Part.02 (part 2 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/setshow.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 2; 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/setshow.c'
else
echo 'x - continuing file gnuplot/setshow.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/setshow.c' &&
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
/* assign a new arrow tag */
/* arrows are kept sorted by tag number, so this is easy */
static int /* the lowest unassigned tag number */
assign_arrow_tag()
{
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
/* 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 */
static void
delete_arrow(prev,this)
X struct arrow_def *prev, *this;
{
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
enum PLOT_STYLE /* not static; used by command.c */
get_style()
{
register 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 if (almost_equals(c_token,"e$rrorbars"))
X ps = ERRORBARS;
X else
X int_error("expecting 'lines', 'points', 'linespoints', 'dots', 'impulses', or 'errorbars'",c_token);
X c_token++;
X return(ps);
}
X
/* For set [xy]tics... command*/
static void
load_tics(tdef)
X struct ticdef *tdef; /* change this ticdef */
{
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
/* load TIC_USER definition */
/* (tic[,tic]...)
X * where tic is ["string"] value
X * Left paren is already scanned off before entry.
X */
static void
load_tic_user(tdef)
X struct ticdef *tdef;
{
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
static void
free_marklist(list)
X struct ticmark *list;
{
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
/* load TIC_SERIES definition */
/* start,incr[,end] */
static void
load_tic_series(tdef)
X struct ticdef *tdef;
{
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 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
static void
load_offsets (a, b, c, d)
double *a,*b, *c, *d;
{
struct 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
BOOLEAN /* TRUE if a or b were changed */
load_range(a,b) /* also used by command.c */
double *a,*b;
{
struct value t;
BOOLEAN 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
/******* The 'show' command *******/
void
show_command()
{
X c_token++;
X
X if (!show_one() && !show_two())
X int_error(
X "valid show options: 'action_table', 'all', 'angles', 'arrow', \n\
X 'autoscale', 'border', 'clip', 'contour', 'data', 'dummy', 'format', \n\
X 'function', 'grid', 'key', 'label', 'logscale', 'mapping', 'offsets', \n\
X 'output', 'plot', 'parametric', 'polar', 'rrange', 'samples', \n\
X 'isosamples', 'view', 'size', 'terminal', 'tics', 'ticslevel', \n\
X 'time', 'title', 'trange', 'urange', 'vrange', 'variables', \n\
X 'version', 'xlabel', 'xrange', 'xtics', 'xzeroaxis', 'ylabel', \n\
X 'yrange', 'ytics', 'yzeroaxis', 'zlabel', 'zrange', 'ztics', 'zero', \n\
X 'zeroaxis'", c_token);
X screen_ok = FALSE;
X (void) putc('\n',stderr);
}
X
/* return TRUE if a command match, FALSE if not */
static BOOLEAN
show_one()
{
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,"bor$der")) {
X (void) putc('\n',stderr);
X show_border();
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,"ma$pping")) {
X (void) putc('\n',stderr);
X show_mapping();
X c_token++;
X }
X else if (almost_equals(c_token,"co$ntour")) {
X (void) putc('\n',stderr);
X show_contour();
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 variables are \"%s\" and \"%s\"\n",
X dummy_var[0], dummy_var[1]);
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,"zl$abel")) {
X (void) putc('\n',stderr);
X show_zlabel();
X c_token++;
X }
X else if (almost_equals(c_token,"xzero$axis")) {
X (void) putc('\n',stderr);
X show_xzeroaxis();
X c_token++;
X }
X else if (almost_equals(c_token,"yzero$axis")) {
X (void) putc('\n',stderr);
X show_yzeroaxis();
X c_token++;
X }
X else if (almost_equals(c_token,"zeroa$xis")) {
X (void) putc('\n',stderr);
X show_xzeroaxis();
X show_yzeroaxis();
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
X return (FALSE);
X return TRUE;
}
X
/* return TRUE if a command match, FALSE if not */
static BOOLEAN
show_two()
{
X 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,"par$ametric")) {
X (void) putc('\n',stderr);
X show_parametric();
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,"an$gles")) {
X (void) putc('\n',stderr);
X show_angles();
X c_token++;
X }
X else if (almost_equals(c_token,"ti$cs")) {
X (void) putc('\n',stderr);
X show_tics(TRUE,TRUE,TRUE);
X c_token++;
X }
X else if (almost_equals(c_token,"tim$e")) {
X (void) putc('\n',stderr);
X show_time();
X c_token++;
X }
X else if (almost_equals(c_token,"su$rface")) {
X (void) putc('\n',stderr);
X show_surface();
X c_token++;
X }
X else if (almost_equals(c_token,"xti$cs")) {
X show_tics(TRUE,FALSE,FALSE);
X c_token++;
X }
X else if (almost_equals(c_token,"yti$cs")) {
X show_tics(FALSE,TRUE,FALSE);
X c_token++;
X }
X else if (almost_equals(c_token,"zti$cs")) {
X show_tics(FALSE,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,"isosa$mples")) {
X (void) putc('\n',stderr);
X show_isosamples();
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,"rr$ange")) {
X (void) putc('\n',stderr);
X show_range('r',rmin,rmax);
X c_token++;
X }
X else if (almost_equals(c_token,"tr$ange")) {
X (void) putc('\n',stderr);
X show_range('t',tmin,tmax);
X c_token++;
X }
X else if (almost_equals(c_token,"ur$ange")) {
X (void) putc('\n',stderr);
X show_range('u',umin,umax);
X c_token++;
X }
X else if (almost_equals(c_token,"vi$ew")) {
X (void) putc('\n',stderr);
X show_view();
X c_token++;
X }
X else if (almost_equals(c_token,"vr$ange")) {
X (void) putc('\n',stderr);
X show_range('v',vmin,vmax);
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,"zr$ange")) {
X (void) putc('\n',stderr);
X show_range('z',zmin,zmax);
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_border();
X show_clip();
X show_contour();
X show_mapping();
X (void) fprintf(stderr,"\tdummy variables are \"%s\" and \"%s\"\n",
X dummy_var[0], dummy_var[1]);
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_parametric();
X show_polar();
X show_angles();
X show_samples();
X show_isosamples();
X show_view();
X show_surface();
X show_size();
X show_term();
X show_tics(TRUE,TRUE,TRUE);
X show_time();
X if (parametric)
X if (!is_3d_plot)
X show_range('t',tmin,tmax);
X else {
X show_range('u',umin,umax);
X show_range('v',vmin,vmax);
X }
X if (polar)
X show_range('r',rmin,rmax);
X show_range('x',xmin,xmax);
X show_range('y',ymin,ymax);
X show_range('z',zmin,zmax);
X show_title();
X show_xlabel();
X show_ylabel();
X show_zlabel();
X show_zero();
X show_plot();
X show_variables();
X show_functions();
X c_token++;
X }
X else
X return (FALSE);
X return (TRUE);
}
X
X
/*********** support functions for 'show' **********/
static void
show_style(name,style)
char name[];
enum PLOT_STYLE style;
{
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 case ERRORBARS: fprintf(stderr,"errorbars\n"); break;
X }
}
X
static void
show_range(name,min,max)
char name;
double min,max;
{
X fprintf(stderr,"\t%crange is [%g : %g]\n",name,min,max);
}
X
static void
show_zero()
{
X fprintf(stderr,"\tzero is %g\n",zero);
}
X
static void
show_offsets()
{
X fprintf(stderr,"\toffsets are %g, %g, %g, %g\n",loff,roff,toff,boff);
}
X
static void
show_border()
{
X fprintf(stderr,"\tborder is %sdrawn\n", draw_border ? "" : "not ");
}
X
static void
show_output()
{
X fprintf(stderr,"\toutput is sent to %s\n",outstr);
}
X
static void
show_samples()
{
X fprintf(stderr,"\tsampling rate is %d\n",samples);
}
X
static void
show_isosamples()
{
X fprintf(stderr,"\tiso sampling rate is %d\n",iso_samples);
}
X
static void
show_surface()
{
X fprintf(stderr,"\tsurface is %sdrawn\n", draw_surface ? "" : "not ");
}
X
static void
show_view()
{
X fprintf(stderr,"\tview is %g rot_x, %g rot_z, %g scale, %g scale_z\n",
X surface_rot_x, surface_rot_z, surface_scale, surface_zscale);
}
X
static void
show_size()
{
X fprintf(stderr,"\tsize is scaled by %g,%g\n",xsize,ysize);
}
X
static void
show_title()
{
X fprintf(stderr,"\ttitle is \"%s\", offset at %d, %d\n",
X title,title_xoffset,title_yoffset);
}
X
static void
show_xlabel()
{
X fprintf(stderr,"\txlabel is \"%s\", offset at %d, %d\n",
X xlabel,xlabel_xoffset,xlabel_yoffset);
}
X
static void
show_ylabel()
{
X fprintf(stderr,"\tylabel is \"%s\", offset at %d, %d\n",
X ylabel,ylabel_xoffset,ylabel_yoffset);
}
static void
show_zlabel()
{
X fprintf(stderr,"\tzlabel is \"%s\", offset at %d, %d\n",
X zlabel,zlabel_xoffset,zlabel_yoffset);
}
X
static void
show_xzeroaxis()
{
X fprintf(stderr,"\txzeroaxis is %s\n",(xzeroaxis)? "ON" : "OFF");
}
X
static void
show_yzeroaxis()
{
X fprintf(stderr,"\tyzeroaxis is %s\n",(yzeroaxis)? "ON" : "OFF");
}
X
static void
show_label(tag)
X int tag; /* 0 means show all */
{
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,%g ",
X this_label->tag, this_label->text,
X this_label->x, this_label->y, this_label->z);
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
static void
show_arrow(tag)
X int tag; /* 0 means show all */
{
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,%g to %g,%g,%g%s\n",
X this_arrow->tag,
X this_arrow->sx, this_arrow->sy, this_arrow->sz,
X this_arrow->ex, this_arrow->ey, this_arrow->ez,
X this_arrow->head ? "" : " (nohead)");
X }
X }
X if (tag > 0 && !showed)
X int_error("arrow not found", c_token);
}
X
static void
show_grid()
{
X fprintf(stderr,"\tgrid is %s\n",(grid)? "ON" : "OFF");
}
X
static void
show_key()
{
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,%g\n",key_x,key_y,key_z);
X break;
X }
}
X
static void
show_parametric()
{
X fprintf(stderr,"\tparametric is %s\n",(parametric)? "ON" : "OFF");
}
X
static void
show_polar()
{
X fprintf(stderr,"\tpolar is %s\n",(polar)? "ON" : "OFF");
}
X
static void
show_angles()
{
X fprintf(stderr,"\tAngles are in ");
X switch (angles_format) {
X case ANGLES_RADIANS:
X fprintf(stderr, "radians\n");
X break;
X case ANGLES_DEGREES:
X fprintf(stderr, "degrees\n");
X break;
X }
}
X
X
static void
show_tics(showx, showy, showz)
X BOOLEAN showx, showy, showz;
{
X fprintf(stderr,"\ttics are %s, ",(tic_in)? "IN" : "OUT");
X fprintf(stderr,"\tticslevel is %g\n",ticslevel);
X
X if (showx)
X show_ticdef(xtics, 'x', &xticdef);
X if (showy)
X show_ticdef(ytics, 'y', &yticdef);
X if (showz)
X show_ticdef(ztics, 'z', &zticdef);
X screen_ok = FALSE;
}
X
/* called by show_tics */
static void
show_ticdef(tics, axis, tdef)
X BOOLEAN tics; /* xtics ytics or ztics */
X char axis; /* 'x' 'y' or 'z' */
X struct ticdef *tdef; /* xticdef yticdef or zticdef */
{
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
static void
show_time()
{
X fprintf(stderr,"\ttime is %s, offset at %d, %d\n",
X (timedate)? "ON" : "OFF",
X time_xoffset,time_yoffset);
}
X
static void
show_term()
{
X char *str;
X
X fprintf(stderr,"\tterminal type is %s %s\n",
X term_tbl[term].name, term_options);
}
X
static void
show_plot()
{
X fprintf(stderr,"\tlast plot command was: %s\n",replot_line);
}
X
static void
show_autoscale()
{
X fprintf(stderr,"\tautoscaling is ");
X if (parametric)
X if (is_3d_plot)
X fprintf(stderr,"\tt: %s, ",(autoscale_t)? "ON" : "OFF");
X else
X fprintf(stderr,"\tu: %s, v: %s, ",
X (autoscale_u)? "ON" : "OFF",
X (autoscale_v)? "ON" : "OFF");
X else fprintf(stderr,"\t");
X
X if (polar) fprintf(stderr,"r: %s, ",(autoscale_r)? "ON" : "OFF");
X fprintf(stderr,"x: %s, ",(autoscale_x)? "ON" : "OFF");
X fprintf(stderr,"y: %s, ",(autoscale_y)? "ON" : "OFF");
X fprintf(stderr,"z: %s\n",(autoscale_z)? "ON" : "OFF");
}
X
static void
show_clip()
{
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
static void
show_mapping()
{
X fprintf(stderr,"\tmapping for 3-d data is ");
X
X switch (mapping3d) {
X case MAP3D_CARTESIAN:
X fprintf(stderr,"cartesian\n");
X break;
X case MAP3D_SPHERICAL:
X fprintf(stderr,"spherical\n");
X break;
X case MAP3D_CYLINDRICAL:
X fprintf(stderr,"cylindrical\n");
X break;
X }
}
X
static void
show_contour()
{
X fprintf(stderr,"\tcontour for surfaces are %s",
X (draw_contour)? "drawn" : "not drawn\n");
X
X if (draw_contour) {
X fprintf(stderr, " in %d levels on ", contour_levels);
X switch (draw_contour) {
X case CONTOUR_BASE:
X fprintf(stderr,"grid base\n");
X break;
X case CONTOUR_SRF:
X fprintf(stderr,"surface\n");
X break;
X case CONTOUR_BOTH:
X fprintf(stderr,"grid base and surface\n");
X break;
X }
X switch (contour_kind) {
X case CONTOUR_KIND_LINEAR:
X fprintf(stderr,"\t\tas linear segments\n");
X break;
X case CONTOUR_KIND_CUBIC_SPL:
X fprintf(stderr,"\t\tas cubic spline interpolation segments with %d pts\n",
X contour_pts);
X break;
X case CONTOUR_KIND_BSPLINE:
X fprintf(stderr,"\t\tas bspline approximation segments of order %d with %d pts\n",
X contour_order, contour_pts);
X break;
X }
X }
}
X
static void
show_format()
{
X fprintf(stderr, "\ttic format is x-axis: \"%s\", y-axis: \"%s\", z-axis: \"%s\"\n",
X xformat, yformat, zformat);
}
X
static void
show_logscale()
{
X char *p;
X
X if (log_x && log_y && log_z)
X fprintf(stderr,"\tlogscaling all x, y and z axes\n");
X else {
X p = (log_x && log_y) /* Look for pairs. */
X ? "x and y"
X : (log_x && log_z)
X ? "x and z"
X : (log_y && log_z)
X ? "y and z"
X : NULL;
X if (p != NULL)
X fprintf(stderr,"\tlogscaling both %s axes\n",p);
X else {
X if (log_x)
X fprintf(stderr,"\tlogscaling x axis\n");
X if (log_y)
X fprintf(stderr,"\tlogscaling y axis\n");
X if (log_z)
X fprintf(stderr,"\tlogscaling z axis\n");
X if (!(log_x || log_y || log_z))
X fprintf(stderr,"\tno logscaling\n");
X }
X }
}
X
static void
show_variables()
{
register struct udvt_entry *udv = first_udv;
int 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
void /* used by plot.c */
show_version()
{
extern char version[];
extern char patchlevel[];
extern char date[];
extern char bug_email[];
static char *authors[] = {"Thomas Williams","Colin Kelley"}; /* primary */
int x;
long 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, 1991 %s, %s\n",
X authors[x],authors[1-x]);
X fprintf(stderr, "\n\tSend bugs and comments to %s\n", bug_email);
}
X
X
X
X
X
X
X
X
SHAR_EOF
echo 'File gnuplot/setshow.c is complete' &&
chmod 0644 gnuplot/setshow.c ||
echo 'restore of gnuplot/setshow.c failed'
Wc_c="`wc -c < 'gnuplot/setshow.c'`"
test 63352 -eq "$Wc_c" ||
echo 'gnuplot/setshow.c: original size 63352, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/README ==============
if test -f 'gnuplot/README' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/README (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README' &&
X
X Where to get updates to GNUPLOT
X
Congratulations on getting this version of GNUPLOT! Unfortunately, it
may not be the most recent version ("you never know where this version
has been!"). You can be sure that it IS the most recent version by
checking one of the official distribution sites, guaranteed to be kept
up to date (of course, if you got this file from one of those sites,
you don't need to check!).
X
To hear automatically about future releases (and other GNUPLOT news),
join the mailing list; see below.
X
At the time of this writing, the following are the official
distribution sites and transfer instructions. Note that
prep.ai.mit.edu is NOT an official site, and may not be up to date.
Also, comp.sources.misc is usually a month or so behind us.
X
Date: Wed Sep 18 20:45:52 EDT 1991
Version: 3.0
X
In general, GNUPLOT 3.0 is available as the file gnuplot3.0.tar.Z.
There are no patches that bring GNUPLOT 2.02 up to 3.0, so you must
obtain the whole new release. Please obtain gnuplot from the site
nearest you.
X
USENET users:
X
X GNUPLOT 3.0 was posted to comp.sources.misc.
X
X
NORTH AMERICA:
X
X Anonymous ftp to dartmouth.edu (129.170.16.4)
X Fetch
X pub/gnuplot/gnuplot3.0.tar.Z
X in binary mode.
X
X Users without ftp capability can obtain it through a mail ftp
X server. Send a mail message saying 'help' to
X BIT...@pucc.princeton.edu for instructions. For a uuencoded
X copy of the gnuplot sources (compressed tar file), send this
X message to BIT...@pucc.princeton.edu:
X FTP DARTMOUTH.EDU UUENCODE
X USER ANONYMOUS
X CD pub/gnuplot
X BINARY
X GET gnuplot3.0.tar.Z
X QUIT
X
X
AUSTRALIA:
X
X Anonymous ftp to monu1.cc.monash.edu.au (130.194.1.101).
X Fetch pub/gnuplot3.0.tar.Z in binary mode.
X
X
EUROPE:
X
X Anonymous ftp to irisa.irisa.fr (131.254.2.3).
X Fetch pub/gnuplot3.0.tar.Z in binary mode.
X
----
X
X DISCLAIMER - This product is not related in any way to
X Pixar or any other commercial venture.
X
----
X CONTACTS:
X Please send any questions or comments to
X pixar!info-g...@ucbvax.berkeley.edu.
X To join the above mailing list (or get yourself off), mail to
X pixar!info-gnupl...@ucbvax.berkeley.edu.
X Send bug reports and problems to
X pixar!bug-g...@ucbvax.berkeley.edu.
X
X -Thomas Williams-
SHAR_EOF
chmod 0644 gnuplot/README ||
echo 'restore of gnuplot/README failed'
Wc_c="`wc -c < 'gnuplot/README'`"
test 2406 -eq "$Wc_c" ||
echo 'gnuplot/README: original size 2406, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/help.c ==============
if test -f 'gnuplot/help.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/help.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/help.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/help.c' &&
/* GNUPLOT - help.c */
X
extern int errno;
X
extern int strcmp();
extern int strlen();
extern char *strcpy();
extern char *strncpy();
extern char *strcat();
extern char *strncat();
extern char *getenv();
extern FILE *fopen();
extern char *malloc();
X
extern int instring();
X
#define SAME 0 /* for strcmp() */
X
#include "help.h" /* values passed back */
X
/* help -- help subsystem that understands defined keywords
**
** Looks for the desired keyword in the help file at runtime, so you
** can give extra help or supply local customizations by merely editing
** the help file.
**
** The original (single-file) idea and algorithm is by John D. Johnson,
** Hewlett-Packard Company. Thanx and a tip of the Hatlo hat!
**
** Much extension by David Kotz for use in gnutex, and then in gnuplot.
** Added output paging support, both unix and builtin. Rewrote completely
** to read helpfile into memory, avoiding reread of help file. 12/89.
**
** Modified by Russell Lang to avoid reading completely into memory
** if MSDOS defined. This uses much less memory. 6/91
**
** The help file looks like this (the question marks are really in column 1):
**
** ?topic
** This line is printed when the user wants help on "topic".
** ?keyword
** ?Keyword
** ?KEYWORD
** These lines will be printed on the screen if the user wanted
** help on "keyword", "Keyword", or "KEYWORD". No casefolding is
** done on the keywords.
** ?subject
** ?alias
** This line is printed for help on "subject" and "alias".
** ?
** ??
** Since there is a null keyword for this line, this section
** is printed when the user wants general help (when a help
** keyword isn't given). A command summary is usually here.
** Notice that the null keyword is equivalent to a "?" keyword
** here, because of the '?' and '??' topic lines above.
** If multiple keywords are given, the first is considered the
** 'primary' keyword. This affects a listing of available topics.
** ?last-subject
** Note that help sections are terminated by the start of the next
** '?' entry or by EOF. So you can't have a leading '?' on a line
** of any help section. You can re-define the magic character to
** recognize in column 1, though, if '?' is too useful. (Try ^A.)
*/
X
#define KEYFLAG '?' /* leading char in help file topic lines */
X
/*
** Calling sequence:
** int result; # 0 == success
** char *keyword; # topic to give help on
** char *pathname; # path of help file
** int subtopics; # set to TRUE if only subtopics to be listed
** # returns TRUE if subtopics were found
** result = help(keyword, pathname, &subtopics);
** Sample:
** cmd = "search\n";
** helpfile = "/usr/local/lib/program/program.help";
** subtopics = FALSE;
** if (help(cmd, helpfile, &subtopics) != H_FOUND)
** printf("Sorry, no help for %s", cmd);
**
**
** Speed this up by replacing the stdio calls with open/close/read/write.
*/
#ifdef WDLEN
# define PATHSIZE WDLEN
#else
# define PATHSIZE BUFSIZ
#endif
X
typedef int boolean;
#ifndef TRUE
#define TRUE (1)
#define FALSE (0)
#endif
X
typedef struct line_s LINEBUF;
struct line_s {
X char *line; /* the text of this line */
X LINEBUF *next; /* the next line */
};
X
typedef struct linkey_s LINKEY;
struct linkey_s {
X char *key; /* the name of this key */
X long pos; /* ftell position */
X LINEBUF *text; /* the text for this key */
X boolean primary; /* TRUE -> is a primary name for a text block */
X LINKEY *next; /* the next key in linked list */
};
X
typedef struct key_s KEY;
struct key_s {
X char *key; /* the name of this key */
X long pos; /* ftell position */
X LINEBUF *text; /* the text for this key */
X boolean primary; /* TRUE -> is a primary name for a text block */
};
static LINKEY *keylist = NULL; /* linked list of keys */
static KEY *keys = NULL; /* array of keys */
static int keycount = 0; /* number of keys */
static FILE *helpfp = NULL;
X
static int LoadHelp();
static void sortkeys();
static int keycomp();
static LINEBUF *storeline();
static LINKEY *storekey();
static KEY *FindHelp();
static boolean Ambiguous();
X
/* Help output */
static void PrintHelp();
static void ShowSubtopics();
static void StartOutput();
static void OutLine();
static void EndOutput();
static FILE *outfile; /* for unix pager, if any */
static int pagelines; /* count for builtin pager */
#define SCREENSIZE 24 /* lines on screen (most have at least 24) */
X
/* help:
X * print a help message
X * also print available subtopics, if subtopics is TRUE
X */
help(keyword, path, subtopics)
X char *keyword; /* on this topic */
X char *path; /* from this file */
X boolean *subtopics; /* (in) - subtopics only? */
X /* (out) - are there subtopics? */
{
X static char oldpath[PATHSIZE] = ""; /* previous help file */
X int status; /* result of LoadHelp */
X KEY *key; /* key that matches keyword */
X
X /*
X ** Load the help file if necessary (say, first time we enter this routine,
X ** or if the help file changes from the last time we were called).
X ** Also may occur if in-memory copy was freed.
X ** Calling routine may access errno to determine cause of H_ERROR.
X */
X errno = 0;
X if (strncmp(oldpath, path, PATHSIZE) != SAME)
X FreeHelp();
X if (keys == NULL) {
X status = LoadHelp(path);
X if (status == H_ERROR)
X return(status);
X
X /* save the new path in oldpath */
X if (strlen(path) < PATHSIZE)
X (void) strcpy(oldpath, path);
X else { /* not enough room in oldpath, sigh */
X (void) strncpy(oldpath, path, PATHSIZE - 1);
X oldpath[PATHSIZE - 1] = '\0';
X }
X }
X
X /* look for the keyword in the help file */
X key = FindHelp(keyword);
X if (key != NULL) {
X /* found the keyword: print help and return */
X PrintHelp(key, subtopics);
X status = H_FOUND;
X } else {
X status = H_NOTFOUND;
X }
X
X return(status);
}
X
/* we only read the file once, into memory
X * except for MSDOS when we don't read all the file -
X * just the keys and location of the text
X */
static int
LoadHelp(path)
X char *path;
{
X LINKEY *key; /* this key */
X long pos; /* ftell location within help file */
X char buf[BUFSIZ]; /* line from help file */
X LINEBUF *head; /* head of text list */
X LINEBUF *firsthead = NULL;
X boolean primary; /* first ? line of a set is primary */
X boolean flag;
X
X if ((helpfp = fopen(path, "r")) == NULL) {
X /* can't open help file, so error exit */
X return (H_ERROR);
X }
X
X /*
X ** The help file is open. Look in there for the keyword.
X */
X (void) fgets(buf, BUFSIZ - 1, helpfp);
X while (!feof(helpfp)) {
X /*
X ** Make an entry for each synonym keyword
X */
X primary = TRUE;
X while (buf[0] == KEYFLAG) {
X key = storekey(buf+1); /* store this key */
X key->primary = primary;
X key->text = NULL; /* fill in with real value later */
X key->pos = 0; /* fill in with real value later */
X primary = FALSE;
X pos = ftell(helpfp);
X if (fgets(buf, BUFSIZ - 1, helpfp) == (char *)NULL)
X break;
X }
X /*
X ** Now store the text for this entry.
X ** buf already contains the first line of text.
X */
#ifndef MSDOS
X firsthead = storeline(buf);
X head = firsthead;
#endif
X while ( (fgets(buf, BUFSIZ - 1, helpfp) != (char *)NULL)
X && (buf[0] != KEYFLAG) ){
#ifndef MSDOS
X /* save text line */
X head->next = storeline(buf);
X head = head->next;
#endif
X }
X /* make each synonym key point to the same text */
X do {
X key->pos = pos;
X key->text = firsthead;
X flag = key->primary;
X key = key->next;
X } while ( flag!=TRUE && key!=NULL );
X }
#ifndef MSDOS
X (void) fclose(helpfp);
#endif
X
X /* we sort the keys so we can use binary search later */
X sortkeys();
X return(H_FOUND); /* ok */
}
X
/* make a new line buffer and save this string there */
static LINEBUF *
storeline(text)
X char *text;
{
X LINEBUF *new;
X
X new = (LINEBUF *)malloc(sizeof(LINEBUF));
X if (new == NULL)
X int_error("not enough memory to store help file", -1);
X if (text != NULL) {
X new->line = (char *) malloc((unsigned int)(strlen(text)+1));
X if (new->line == NULL)
X int_error("not enough memory to store help file", -1);
X (void) strcpy(new->line, text);
X } else
X new->line = NULL;
X
X new->next = NULL;
X
X return(new);
}
X
/* Add this keyword to the keys list, with the given text */
static LINKEY *
storekey(key)
X char *key;
{
X LINKEY *new;
X
X key[strlen(key)-1] = '\0'; /* cut off \n */
X
X new = (LINKEY *)malloc(sizeof(LINKEY));
X if (new == NULL)
X int_error("not enough memory to store help file", -1);
X new->key = (char *) malloc((unsigned int)(strlen(key)+1));
X if (new->key == NULL)
X int_error("not enough memory to store help file", -1);
X (void) strcpy(new->key, key);
X
X /* add to front of list */
X new->next = keylist;
X keylist = new;
X keycount++;
X return(new);
}
X
/* we sort the keys so we can use binary search later */
/* We have a linked list of keys and the number.
X * to sort them we need an array, so we reform them into an array,
X * and then throw away the list.
X */
static void
sortkeys()
{
X LINKEY *p,*n; /* pointers to linked list */
X int i; /* index into key array */
X
X /* allocate the array */
X keys = (KEY *)malloc((unsigned int)((keycount+1) * sizeof(KEY)));
X if (keys == NULL)
X int_error("not enough memory to store help file", -1);
X
X /* copy info from list to array, freeing list */
X for (p = keylist, i = 0; p != NULL; p = n, i++) {
X keys[i].key = p->key;
X keys[i].pos = p->pos;
X keys[i].text = p->text;
X keys[i].primary = p->primary;
X n = p->next;
X free( (char *)p );
X }
X
X /* a null entry to terminate subtopic searches */
X keys[keycount].key = NULL;
X keys[keycount].pos = 0;
X keys[keycount].text = NULL;
X
X /* sort the array */
X /* note that it only moves objects of size (two pointers + long + int) */
X /* it moves no strings */
X qsort((char *)keys, keycount, sizeof(KEY), keycomp);
}
X
static int
keycomp(a, b)
X KEY *a,*b;
{
X return (strcmp(a->key, b->key));
}
X
/* Free the help file from memory. */
/* May be called externally if space is needed */
void
FreeHelp()
{
X int i; /* index into keys[] */
X LINEBUF *t, *next;
X
X if (keys == NULL)
X return;
X
X for (i = 0; i < keycount; i++) {
X free( (char *)keys[i].key );
X if (keys[i].primary) /* only try to release text once! */
X for (t = keys[i].text; t != NULL; t = next) {
X free( (char *)t->line );
X next = t->next;
X free( (char *)t );
X }
X }
X free( (char *)keys );
X keys = NULL;
X keycount = 0;
#ifdef MSDOS
X (void) fclose(helpfp);
#endif
}
X
/* FindHelp:
X * Find the key that matches the keyword.
X * The keys[] array is sorted by key.
X * We could use a binary search, but a linear search will aid our
X * attempt to allow abbreviations. We search for the first thing that
X * matches all the text we're given. If not an exact match, then
X * it is an abbreviated match, and there must be no other abbreviated
X * matches -- for if there are, the abbreviation is ambiguous.
X * We print the ambiguous matches in that case, and return not found.
X */
static KEY * /* NULL if not found */
FindHelp(keyword)
X char *keyword; /* string we look for */
{
X KEY *key;
X int len = strlen(keyword);
X int compare;
X
X for (key = keys, compare = 1; key->key != NULL && compare > 0; key++) {
X compare = strncmp(keyword, key->key, len);
X if (compare == 0) /* we have a match! */
X if (!Ambiguous(key, len)) {
X /* non-ambiguous abbreviation */
X (void) strcpy(keyword, key->key); /* give back the full spelling */
X return(key); /* found!! */
X }
X }
X
X /* not found, or ambiguous */
X return(NULL);
}
X
/* Ambiguous:
X * Check the key for ambiguity up to the given length.
X * It is ambiguous if it is not a complete string and there are other
X * keys following it with the same leading substring.
X */
static boolean
Ambiguous(key, len)
X KEY *key;
X int len;
{
X char *first;
X char *prev;
X boolean status = FALSE; /* assume not ambiguous */
X int compare;
X int sublen;
X
X if (key->key[len] == '\0')
X return(FALSE);
X
X for (prev = first = key->key, compare = 0, key++;
X key->key != NULL && compare == 0; key++) {
X compare = strncmp(first, key->key, len);
X if (compare == 0) {
X /* So this key matches the first one, up to len.
X * But is it different enough from the previous one
X * to bother printing it as a separate choice?
X */
X sublen = instring(prev+len, ' ');
X if (strncmp(key->key, prev, len+sublen) != 0) {
X /* yup, this is different up to the next space */
X if (!status) {
X /* first one we have printed is special */
X fprintf(stderr,
X "Ambiguous request '%.*s'; possible matches:\n",
X len, first);
X fprintf(stderr, "\t%s\n", prev);
X status = TRUE;
X }
X fprintf(stderr, "\t%s\n", key->key);
X prev = key->key;
X }
X }
X }
X
X return(status);
}
X
/* PrintHelp:
X * print the text for key
X */
static void
PrintHelp(key, subtopics)
X KEY *key;
X boolean *subtopics; /* (in) - subtopics only? */
X /* (out) - are there subtopics? */
{
X LINEBUF *t;
#ifdef MSDOS
X char buf[BUFSIZ]; /* line from help file */
#endif
X
X StartOutput();
X
X if (subtopics == NULL || !*subtopics) {
#ifdef MSDOS
X fseek(helpfp,key->pos,0);
X while ( (fgets(buf, BUFSIZ - 1, helpfp) != (char *)NULL)
X && (buf[0] != KEYFLAG) ) {
X OutLine(buf);
X }
#else
X for (t = key->text; t != NULL; t = t->next)
X OutLine(t->line); /* print text line */
#endif
X }
X
X ShowSubtopics(key, subtopics);
X OutLine("\n");
X
X EndOutput();
}
X
/* ShowSubtopics:
X * Print a list of subtopic names
X */
#define PER_LINE 4
X
static void
ShowSubtopics(key, subtopics)
X KEY *key; /* the topic */
X boolean *subtopics; /* (out) are there any subtopics */
{
X int subt = 0; /* printed any subtopics yet? */
X KEY *subkey; /* subtopic key */
X int len; /* length of key name */
X char line[BUFSIZ]; /* subtopic output line */
X char *start; /* position of subname in key name */
X int sublen; /* length of subname */
X int pos;
X char *prev = NULL; /* the last thing we put on the list */
X
X *line = '\0';
X len = strlen(key->key);
X
X for (subkey = key+1; subkey->key != NULL; subkey++) {
X if (strncmp(subkey->key, key->key, len) == 0) {
X /* find this subtopic name */
X start = subkey->key + len;
X if (len > 0)
X if (*start == ' ')
X start++; /* skip space */
X else
X break; /* not the same topic after all */
X else /* here we are looking for main topics */
X if (!subkey->primary)
X continue; /* not a main topic */
X sublen = instring(start, ' ');
X if (prev == NULL || strncmp(start, prev, sublen) != 0) {
X if (subt == 0) {
X subt++;
X if (len)
X (void) sprintf(line, "\nSubtopics available for %s:\n",
X key->key);
X else
X (void) sprintf(line, "\nHelp topics available:\n");
X OutLine(line);
X *line = '\0';
X pos = 0;
X }
X if (pos == PER_LINE) {
X (void) strcat(line, "\n");
X OutLine(line);
X *line = '\0';
X pos = 0;
X }
X (void) strcat(line, "\t");
X (void) strncat(line, start, sublen);
X pos++;
X prev = start;
X }
X } else {
X /* new topic */
X break;
X }
X }
X
X /* put out the last line */
X if (subt > 0 && pos > 0) {
X (void) strcat(line, "\n");
X OutLine(line);
X }
X
/*
X if (subt == 0) {
X OutLine("\n");
X OutLine("No subtopics available\n");
X }
*/
X
X if (subtopics)
X *subtopics = (subt != 0);
}
X
X
/* StartOutput:
X * Open a file pointer to a pipe to user's $PAGER, if there is one,
X * otherwise use our own pager.
X */
static void
StartOutput()
{
#ifdef unix
X char *pager_name = getenv("PAGER");
X extern FILE *popen();
X
X if (pager_name != NULL && *pager_name != '\0')
X if ((outfile = popen(pager_name, "w")) != (FILE *)NULL)
X return; /* success */
X outfile = stderr;
X /* fall through to built-in pager */
#endif
X
X /* built-in pager */
X pagelines = 0;
}
X
/* write a line of help output */
/* line should contain only one \n, at the end */
static void
OutLine(line)
X char *line;
{
X int c; /* dummy input char */
#ifdef unix
X if (outfile != stderr) {
X fputs(line, outfile);
X return;
X }
#endif
X
X /* built-in dumb pager */
SHAR_EOF
true || echo 'restore of gnuplot/help.c failed'
fi
echo 'End of part 2'
echo 'File gnuplot/help.c is continued in part 3'
echo 3 > _shar_seq_.tmp
#!/bin/sh
# this is Part.03 (part 3 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/help.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 3; 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/help.c'
else
echo 'x - continuing file gnuplot/help.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/help.c' &&
X /* leave room for prompt line */
X if (pagelines >= SCREENSIZE - 2) {
X printf("Press return for more: ");
X do
X c = getchar();
X while (c != EOF && c != '\n');
X pagelines = 0;
X }
X fputs(line, stderr);
X pagelines++;
}
X
static void
EndOutput()
{
#ifdef unix
X extern int pclose();
X
X if (outfile != stderr)
X (void) pclose(outfile);
#endif
}
X
SHAR_EOF
echo 'File gnuplot/help.c is complete' &&
chmod 0644 gnuplot/help.c ||
echo 'restore of gnuplot/help.c failed'
Wc_c="`wc -c < 'gnuplot/help.c'`"
test 17904 -eq "$Wc_c" ||
echo 'gnuplot/help.c: original size 17904, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/bitmap.c ==============
if test -f 'gnuplot/bitmap.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/bitmap.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/bitmap.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/bitmap.c' &&
/* GNUPLOT - bitmap.c */
/*
X * Copyright (C) 1986, 1987, 1990, 1991 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 * Jyrki Yli-Nokari <j...@intrin.UUCP>
X * Ronald J. Hartranft <rj...@ns.cc.lehigh.edu>
X * Russell Lang <r...@monu1.cc.monash.edu.au>
X *
X * Send your comments or suggestions to
X * pixar!info-g...@sun.com.
X * This is a mailing list; to join it send a note to
X * pixar!info-gnupl...@sun.com.
X * Send bug reports to
X * pixar!bug-g...@sun.com.
X */
X
/*
** General raster plotting routines.
** Raster routines written and copyrighted 1987 by
** Jyrki Yli-Nokari (j...@intrin.UUCP)
** Intrinsic, Ltd.
**
** You may use this code for anything you like as long as
** you are not selling it and the credit is given and
** this message retained.
**
*/
X
/* Bitmap plotting routines derived from above raster plotting routines
X * Russell Lang, 1990
X */
X
#include <stdio.h>
#include "plot.h"
#include "bitmap.h"
X
bitmap *b_p = (bitmap *)NULL; /* global pointer to bitmap */
unsigned int b_currx, b_curry; /* the current coordinates */
unsigned int b_xsize, b_ysize; /* the size of the bitmap */
unsigned int b_planes; /* number of color planes */
unsigned int b_psize; /* size of each plane */
unsigned int b_rastermode; /* raster mode rotates -90deg */
unsigned int b_linemask = 0xffff; /* 16 bit mask for dotted lines */
unsigned int b_value = 1; /* colour of lines */
unsigned int b_hchar; /* width of characters */
unsigned int b_hbits; /* actual bits in char horizontally */
unsigned int b_vchar; /* height of characters */
unsigned int b_vbits; /* actual bits in char vertically */
unsigned int b_angle; /* rotation of text */
char_box b_font[FNT_CHARS]; /* the current font */
unsigned int b_pattern[] = {0xffff, 0x1111,
X 0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
int b_maskcount = 0;
unsigned int b_lastx, b_lasty; /* last pixel set - used by b_line */
X
#define IN(i,size) ((unsigned)i < (unsigned)size)
X
/* 5x9 font, bottom row first, left pixel in lsb */
char_row fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
X /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000},
X /*!*/ {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
X /*"*/ {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
X /*#*/ {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
X /*$*/ {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
X /*%*/ {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
X /*&*/ {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
X /*'*/ {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
X /*(*/ {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
X /*)*/ {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
X /***/ {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
X /*+*/ {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
X /*,*/ {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
X /*-*/ {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
X /*.*/ {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
X /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
X /*0*/ {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
X /*1*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
X /*2*/ {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
X /*3*/ {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
X /*4*/ {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
X /*5*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
X /*6*/ {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
X /*7*/ {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
X /*8*/ {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
X /*9*/ {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
X /*:*/ {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
X /*;*/ {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
X /*<*/ {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
X /*=*/ {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
X /*>*/ {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
X /*?*/ {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
X /*@*/ {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
X /*A*/ {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
X /*B*/ {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
X /*C*/ {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
X /*D*/ {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
X /*E*/ {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
X /*F*/ {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
X /*G*/ {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
X /*H*/ {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
X /*I*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
X /*J*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
X /*K*/ {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
X /*L*/ {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
X /*M*/ {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
X /*N*/ {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
X /*O*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
X /*P*/ {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
X /*Q*/ {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
X /*R*/ {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
X /*S*/ {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
X /*T*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
X /*U*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
X /*V*/ {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
X /*W*/ {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
X /*X*/ {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
X /*Y*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
X /*Z*/ {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
X /*[*/ {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
X /*\*/ {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
X /*]*/ {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
X /*^*/ {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
X /*_*/ {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
X /*`*/ {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
X /*a*/ {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
X /*b*/ {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
X /*c*/ {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
X /*d*/ {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
X /*e*/ {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
X /*f*/ {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
X /*g*/ {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
X /*h*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
X /*i*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
X /*j*/ {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
X /*k*/ {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
X /*l*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
X /*m*/ {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
X /*n*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
X /*o*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
X /*p*/ {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
X /*q*/ {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
X /*r*/ {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
X /*s*/ {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
X /*t*/ {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
X /*u*/ {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
X /*v*/ {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
X /*w*/ {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
X /*x*/ {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
X /*y*/ {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
X /*z*/ {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
X /*{*/ {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
X /*|*/ {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
X /*}*/ {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
X /*~*/ {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
X /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
};
X
/* 9x17 font, bottom row first, left pixel in lsb */
char_row fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
X /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000},
X /*!*/ {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
X 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
X /*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
X /*#*/ {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
X 0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
X /*$*/ {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
X 0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
X /*%*/ {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
X /*&*/ {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
X 0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
X /*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
X /*(*/ {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
X 0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
X /*)*/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
X 0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
X /***/ {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
X 0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
X /*+*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
X 0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
X /*,*/ {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000},
X /*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,0x01ff,000000,000000,000000,000000,000000,000000},
X /*.*/ {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000},
X /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
X /*0*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
X 0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
X /*1*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
X /*2*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
X 0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
X /*3*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
X 0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
X /*4*/ {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
X /*5*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
X 0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
X /*6*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
X 0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
X /*7*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
X /*8*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
X 0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
X /*9*/ {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
X 0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
X /*:*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
X 000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
X /*;*/ {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
X 000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
X /*<*/ {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
X 0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
X /*=*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
X 000000,000000,000000,0x01ff,000000,000000,000000,000000},
X /*>*/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
X 0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
X /*?*/ {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
X 0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
X /*@*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
X 0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
X /*A*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
X 0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
X /*B*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
X 0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
X /*C*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
X /*D*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
X 0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
X /*E*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
X /*F*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
X /*G*/ {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
X 0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
X /*H*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
X /*I*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
X /*J*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
X 0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
X /*K*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
X 0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
X /*L*/ {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
X /*M*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
X /*N*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
X 0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
X /*O*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
X /*P*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
X /*Q*/ {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
X /*R*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
X 0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
X /*S*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
X 0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
X /*T*/ {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
X /*U*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
X /*V*/ {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
X 0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
X /*W*/ {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
X 0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
X /*X*/ {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
X 0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
X /*Y*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
X /*Z*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
X /*[*/ {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
X 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
X /*\*/ {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
X 0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
X /*]*/ {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
X /*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
X /*_*/ {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000},
X /*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
X /*a*/ {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
X 0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
X /*b*/ {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
X /*c*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
X 0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
X /*d*/ {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
X /*e*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
X 0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
X /*f*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
X /*g*/ {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
X /*h*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
X /*i*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
X /*j*/ {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
X 0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
X /*k*/ {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
X 0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
X /*l*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
X 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
X /*m*/ {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
X 0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
X /*n*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
X /*o*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
X /*p*/ {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
X 0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
X /*q*/ {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
X /*r*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
X /*s*/ {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
X 0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
X /*t*/ {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
X 0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
X /*u*/ {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
X /*v*/ {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
X 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
X /*w*/ {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
X 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
X /*x*/ {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
X 0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
X /*y*/ {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
X /*z*/ {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
X 0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
X /*{*/ {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
X 0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
X /*|*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
X 000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
X /*}*/ {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
X 0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
X /*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
X /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
X 000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
};
X
/* 13x25 font, bottom row first, left pixel in lsb */
char_row fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
X /* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000},
X /*!*/ {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
X 000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
X 0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
X /*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
X /*#*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
X 0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
X 0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
X /*$*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
X 0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
X 0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
X /*%*/ {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
X 0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
X 0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
X /*&*/ {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
X 0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
X 0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
X /*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
X 0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
X /*(*/ {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
X 0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
X 0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
X /*)*/ {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
X 0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
X 0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
X /***/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
X 0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
X 0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
X /*+*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
X /*,*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
X 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000},
X /*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000},
X /*.*/ {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
X 0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000},
X /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
X 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
X 0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
X /*0*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
X 0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
X /*1*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
X /*2*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
X 0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
X /*3*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
X 0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
X /*4*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
X 0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
X 0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
X /*5*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
X /*6*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
X 0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
X /*7*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
X 0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
X 0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
X /*8*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*9*/ {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
X 0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*:*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
X 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
X 0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
X /*;*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
X 0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
X 0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
X /*<*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
X 0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
X /*=*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
X 0x1fff,000000,000000,000000,000000,000000,000000},
X /*>*/ {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
X 0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
X 0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
X /*?*/ {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
X 000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
X 0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*@*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
X 0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*A*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
X 0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
X /*B*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
X 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
X 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
X /*C*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
X /*D*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
X 0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
X 0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
X /*E*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
X /*F*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
X /*G*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
X /*H*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
X /*I*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
X /*J*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
X 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
X /*K*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
X 0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
X 0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
X /*L*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
X /*M*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
X 0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
X /*N*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
X 0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
X /*O*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*P*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
X 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
X /*Q*/ {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
X /*R*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
X 0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
X 0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
X /*S*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
X 0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
X /*T*/ {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
X /*U*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
X /*V*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
X 0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
X /*W*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
X 0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
X /*X*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
X 0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
X /*Y*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
X 0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
X /*Z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
X 0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
X 0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
X /*[*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
X 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
X 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
X /*\*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
X 0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
X 0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
X /*]*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
X 0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
X 0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
X /*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
X /*_*/ {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000},
X /*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
X 0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
X /*a*/ {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
X 0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
X 0x03f8,000000,000000,000000,000000,000000,000000},
X /*b*/ {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
X 0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
X /*c*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
X 0x03f8,000000,000000,000000,000000,000000,000000},
X /*d*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
X 0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
X /*e*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
X 0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
X 0x03f8,000000,000000,000000,000000,000000,000000},
X /*f*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
X /*g*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
X 0x13f8,000000,000000,000000,000000,000000,000000},
X /*h*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
X 0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
X /*i*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
X 000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
X /*j*/ {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
X 0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
X 000000,000000,000000,0x0700,0x0700,0x0700,000000},
X /*k*/ {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
X 0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
X 0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
X /*l*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
X /*m*/ {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
X 0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
X 0x0209,000000,000000,000000,000000,000000,000000},
X /*n*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
X 0x03f9,000000,000000,000000,000000,000000,000000},
X /*o*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
X 0x03f8,000000,000000,000000,000000,000000,000000},
X /*p*/ {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
X 0x03f9,000000,000000,000000,000000,000000,000000},
X /*q*/ {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
X 0x13f8,000000,000000,000000,000000,000000,000000},
X /*r*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
X 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
X 0x03f9,000000,000000,000000,000000,000000,000000},
X /*s*/ {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
X 0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
X 0x07f8,000000,000000,000000,000000,000000,000000},
X /*t*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
X 0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
X 0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
X /*u*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
X 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,000000,000000,000000,000000,000000,000000},
X /*v*/ {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
X 0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,000000,000000,000000,000000,000000,000000},
X /*w*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
X 0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,000000,000000,000000,000000,000000,000000},
X /*x*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
X 0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
X 0x1001,000000,000000,000000,000000,000000,000000},
X /*y*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
X 0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
X 0x1001,000000,000000,000000,000000,000000,000000},
X /*z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
X 0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
X 0x1fff,000000,000000,000000,000000,000000,000000},
X /*{*/ {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
X /*|*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
X 0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
X /*}*/ {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
X 0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
X 0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
X /*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 000000,000000,000000,000000,000000,000000,000000,000000,000000,
X 0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
X /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
X 0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
X 0x1249,000000,000000,0x1249,000000,000000,0x1249},
};
X
/*
** The plotting area is defined as a huge bitmap.
** The bitmap is stored in a dynamically allocated pixel array b_p
**
** The bitmap is allocated (and initialized to zero) with
** b_makebitmap(xsize, ysize, planes)
** and freed with b_freebitmap()
** xsize and ysize will be rounded up to a multiple of 8.
**
** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
**
** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
** where the point (x,y) is the target to go from the current point
** To set the color use b_setvalue(value) where value is the value
** (0 or 1 or a color number) to be stored in every pixel.
** To get dotted line styles, use b_setlinetype(linetype).
**
** Internally all plotting goes through b_setpixel(x, y, value).
*/
X
X
/*
** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
*/
void
b_setpixel(x, y, value)
unsigned int x, y, value;
{
X register unsigned int row;
X register unsigned char mask;
X int i;
X if (b_rastermode) {
X /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
X row = x; /* temp storage */
X x = y;
X y = b_ysize-1-row;
X }
X if (IN(x, b_xsize) && IN(y, b_ysize))
X {
X row = y/8;
X mask = 1<<(y%8);
X
X for (i=0; i<b_planes; i++) {
X if (value&1)
X *((*b_p)[row]+x) |= mask;
X else
X *((*b_p)[row]+x) &= ~mask;
X row += b_psize;
X value >>= 1;
X }
X }
#ifdef BITMAPDEBUG
X else
X {
X if (b_rastermode)
X fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
X b_ysize-1-y, x, value);
X else
X fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
X x, y, value);
X }
#endif
}
X
/*
** get pixel (x,y) value----unused
*/
/****************************
unsigned int
b_getpixel(x, y)
unsigned int x, y;
{
X register unsigned int row;
X register unsigned char mask;
X register unsigned char value;
X int i;
X
X if (b_rastermode) {
X row = x;
X x = y;
X y = b_ysize-1-row;
X }
X if (IN(x, b_xsize) && IN(y, b_ysize))
X {
X row = y/8 + (b_planes-1)*b_psize;
X mask = 1<<(y%8);
X
X for (i=0; i<b_planes; i++) {
X if ( *((*b_p)[row]+x) & mask )
X value |= 1;
X row -= b_psize;
X value <<= 1;
X }
X return(value);
X }
X else
X {
#ifdef BITMAPDEBUG
X if (b_rastermode)
X fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
X b_ysize-1-y, x);
X else
X fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
#endif
X return(0);
X }
}
********************************/
X
/*
** allocate the bitmap
SHAR_EOF
true || echo 'restore of gnuplot/bitmap.c failed'
fi
echo 'End of part 3'
echo 'File gnuplot/bitmap.c is continued in part 4'
echo 4 > _shar_seq_.tmp
#!/bin/sh
# this is Part.04 (part 4 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/bitmap.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 4; 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/bitmap.c'
else
echo 'x - continuing file gnuplot/bitmap.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/bitmap.c' &&
*/
void
b_makebitmap(x, y, planes)
unsigned int x, y, planes;
{
X register unsigned j;
X unsigned rows;
X
X x = 8 * (unsigned int)(x/8.0+0.9); /* round up to multiple of 8 */
X y = 8 * (unsigned int)(y/8.0+0.9); /* round up to multiple of 8 */
X b_psize = y/8; /* size of each plane */
X rows = b_psize * planes; /* total number of rows of 8 pixels high */
X b_xsize = x; b_ysize = y;
X b_currx = b_curry = 0;
X b_planes = planes;
X b_value = 1;
X b_angle = 0;
X b_rastermode = 0;
X /* allocate row pointers */
X b_p = (bitmap *)alloc( rows * sizeof(pixels *), "bitmap row buffer");
X bzero(b_p, rows * sizeof(pixels *));
X for (j = 0; j < rows; j++) {
X /* allocate bitmap buffers */
X (*b_p)[j] = (pixels *)alloc(x * sizeof(pixels),(char *)NULL);
X if ((*b_p)[j] == (pixels *)NULL) {
X b_freebitmap(); /* free what we have already allocated */
X int_error("out of memory for bitmap buffer", NO_CARET);
X }
X bzero((*b_p)[j], x * sizeof(pixels));
X }
}
X
/*
** free the allocated bitmap
*/
void
b_freebitmap()
{
X int j;
X unsigned rows;
X
X rows = b_psize * b_planes; /* total number of rows of 8 pixels high */
X for (j = 0; j < rows; j++)
X {
X (void) free((char *)(*b_p)[j]);
X }
X (void) free((char *)b_p);
X b_p = (bitmap *)(NULL);
}
X
/*
** set pixel at (x,y) with color b_value and dotted mask b_linemask.
*/
void
b_setmaskpixel(x,y,value)
unsigned int x,y,value;
{
X /* dotted line generator */
X if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
X b_setpixel(x,y,value);
X }
X b_maskcount= (b_maskcount+1) % 16;
X b_lastx= x; /* last pixel set with mask */
X b_lasty= y;
}
X
/*
** draw a line from (x1,y1) to (x2,y2)
** with color b_value and dotted mask b_linemask.
*/
void
b_line(x1,y1,x2,y2)
unsigned int x1,y1,x2,y2;
{
int runcount;
int dx,dy;
int xinc,yinc;
unsigned int xplot,yplot;
X
X runcount=0;
X dx = abs((int)(x1)-(int)(x2));
X if (x2>x1) xinc= 1;
X if (x2==x1) xinc= 0;
X if (x2<x1) xinc= -1;
X dy = abs((int)(y1)-(int)(y2));
X if (y2>y1) yinc= 1;
X if (y2==y1) yinc= 0;
X if (y2<y1) yinc= -1;
X xplot=x1;
X yplot=y1;
X if (dx>dy) {
X /* iterate x */
X if ( (b_linemask==0xffff) ||
X ((xplot!=b_lastx) && (yplot!=b_lasty)) )
X b_setmaskpixel(xplot,yplot,b_value);
X while (xplot!=x2) {
X xplot+=xinc;
X runcount+=dy;
X if (runcount>=(dx-runcount)) {
X yplot+=yinc;
X runcount-=dx;
X }
X b_setmaskpixel(xplot,yplot,b_value);
X }
X } else {
X /* iterate y */
X if ( (b_linemask==0xffff) ||
X ((xplot!=b_lastx) && (yplot!=b_lasty)) )
X b_setmaskpixel(xplot,yplot,b_value);
X while (yplot!=y2) {
X yplot+=yinc;
X runcount+=dx;
X if (runcount>=(dy-runcount)) {
X xplot+=xinc;
X runcount-=dy;
X }
X b_setmaskpixel(xplot,yplot,b_value);
X }
X }
}
X
/*
** set character size
*/
void
b_charsize(size)
unsigned int size;
{
X int j;
X switch(size) {
X case FNT5X9:
X b_hchar = FNT5X9_HCHAR;
X b_hbits = FNT5X9_HBITS;
X b_vchar = FNT5X9_VCHAR;
X b_vbits = FNT5X9_VBITS;
X for (j = 0; j < FNT_CHARS; j++ )
X b_font[j] = &fnt5x9[j][0];
X break;
X case FNT9X17:
X b_hchar = FNT9X17_HCHAR;
X b_hbits = FNT9X17_HBITS;
X b_vchar = FNT9X17_VCHAR;
X b_vbits = FNT9X17_VBITS;
X for (j = 0; j < FNT_CHARS; j++ )
X b_font[j] = &fnt9x17[j][0];
X break;
X case FNT13X25:
X b_hchar = FNT13X25_HCHAR;
X b_hbits = FNT13X25_HBITS;
X b_vchar = FNT13X25_VCHAR;
X b_vbits = FNT13X25_VBITS;
X for (j = 0; j < FNT_CHARS; j++ )
X b_font[j] = &fnt13x25[j][0];
X break;
X default:
X int_error("Unknown character size",NO_CARET);
X }
}
X
X
/*
** put characater c at (x,y) rotated by angle with color b_value.
*/
void
b_putc(x,y,c,angle)
unsigned int x,y;
char c;
unsigned int angle;
{
X unsigned int i, j, k;
X char_row fc;
X
X j = c - ' ';
X for ( i = 0; i < b_vbits; i++ ) {
X fc = *( b_font[j] + i );
X if ( c == '_' ) { /* treat underline specially */
X if ( fc ) { /* this this the underline row ? *?
X /* draw the under line for the full h_char width */
X for ( k = ( b_hbits - b_hchar )/2;
X k < ( b_hbits + b_hchar )/2; k++ ) {
X switch(angle) {
X case 0 : b_setpixel(x+k+1,y+i,b_value);
X break;
X case 1 : b_setpixel(x-i,y+k+1,b_value);
X break;
X }
X }
X }
X }
X else {
X /* draw character */
X for ( k = 0; k < b_hbits; k++ ) {
X if ( ( fc >> k ) & 1 ) {
X switch(angle) {
X case 0 : b_setpixel(x+k+1,y+i,b_value);
X break;
X case 1 : b_setpixel(x-i,y+k+1,b_value);
X break;
X }
X }
X }
X }
X }
}
X
X
/*
** set b_linemask to b_pattern[linetype]
*/
int
b_setlinetype(linetype)
int linetype;
{
X if (linetype>=7)
X linetype %= 7;
X b_linemask = b_pattern[linetype+2];
X b_maskcount=0;
}
X
/*
** set b_value to value
*/
void
b_setvalue(value)
unsigned int value;
{
X b_value = value;
}
X
/*
** move to (x,y)
*/
int
b_move(x, y)
unsigned int x, y;
{
X b_currx = x;
X b_curry = y;
}
X
/*
** draw to (x,y) with color b_value
*/
int
b_vector(x, y)
unsigned int x, y;
{
X b_line(b_currx, b_curry, x, y);
X b_currx = x;
X b_curry = y;
}
X
X
/*
** put text str at (x,y) with color b_value and rotation b_angle
*/
int
b_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X if (b_angle == 1)
X x += b_vchar/2;
X else
X y -= b_vchar/2;
X switch (b_angle) {
X case 0:
X for (; *str; ++str, x += b_hchar)
X b_putc (x, y, *str, b_angle);
X break;
X case 1:
X for (; *str; ++str, y += b_hchar)
X b_putc (x, y, *str, b_angle);
X break;
X }
}
X
X
int
b_text_angle(ang)
int ang;
{
X b_angle=(unsigned int)ang;
X return TRUE;
}
SHAR_EOF
echo 'File gnuplot/bitmap.c is complete' &&
chmod 0666 gnuplot/bitmap.c ||
echo 'restore of gnuplot/bitmap.c failed'
Wc_c="`wc -c < 'gnuplot/bitmap.c'`"
test 51656 -eq "$Wc_c" ||
echo 'gnuplot/bitmap.c: original size 51656, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/bitmap.h ==============
if test -f 'gnuplot/bitmap.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/bitmap.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/bitmap.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/bitmap.h' &&
/* bitmap.h */
X
/* allow up to 16 bit width for character array */
typedef unsigned int char_row;
typedef char_row * char_box;
X
#define FNT_CHARS 96 /* Number of characters in the font set */
X
#define FNT5X9 0
#define FNT5X9_VCHAR 11 /* vertical spacing between characters */
#define FNT5X9_VBITS 9 /* actual number of rows of bits per char */
#define FNT5X9_HCHAR 7 /* horizontal spacing between characters */
#define FNT5X9_HBITS 5 /* actual number of bits per row per char */
extern char_row fnt5x9[FNT_CHARS][FNT5X9_VBITS];
X
#define FNT9X17 1
#define FNT9X17_VCHAR 21 /* vertical spacing between characters */
#define FNT9X17_VBITS 17 /* actual number of rows of bits per char */
#define FNT9X17_HCHAR 13 /* horizontal spacing between characters */
#define FNT9X17_HBITS 9 /* actual number of bits per row per char */
extern char_row fnt9x17[FNT_CHARS][FNT9X17_VBITS];
X
#define FNT13X25 2
#define FNT13X25_VCHAR 31 /* vertical spacing between characters */
#define FNT13X25_VBITS 25 /* actual number of rows of bits per char */
#define FNT13X25_HCHAR 19 /* horizontal spacing between characters */
#define FNT13X25_HBITS 13 /* actual number of bits per row per char */
extern char_row fnt13x25[FNT_CHARS][FNT13X25_VBITS];
X
X
typedef unsigned char pixels; /* the type of one set of 8 pixels in bitmap */
typedef pixels *bitmap[]; /* the bitmap */
X
extern bitmap *b_p; /* global pointer to bitmap */
extern unsigned int b_currx, b_curry; /* the current coordinates */
extern unsigned int b_xsize, b_ysize; /* the size of the bitmap */
extern unsigned int b_planes; /* number of color planes */
extern unsigned int b_psize; /* size of each plane */
extern unsigned int b_rastermode; /* raster mode rotates -90deg */
extern unsigned int b_linemask; /* 16 bit mask for dotted lines */
extern unsigned int b_value; /* colour of lines */
extern unsigned int b_hchar; /* width of characters */
extern unsigned int b_hbits; /* actual bits in char horizontally */
extern unsigned int b_vchar; /* height of characters */
extern unsigned int b_vbits; /* actual bits in char vertically */
extern unsigned int b_angle; /* rotation of text */
extern char_box b_font[FNT_CHARS]; /* the current font */
extern unsigned int b_pattern[];
extern int b_maskcount;
extern unsigned int b_lastx, b_lasty; /* last pixel set - used by b_line */
X
X
extern void b_makebitmap();
extern void b_freebitmap();
extern void b_setpixel();
extern unsigned int b_getpixel();
extern void b_line();
extern void b_setmaskpixel();
extern void b_putc();
extern void b_charsize();
extern void b_setvalue();
X
extern int b_setlinetype();
extern int b_move();
extern int b_vector();
extern int b_put_text();
extern int b_text_angle();
X
SHAR_EOF
chmod 0666 gnuplot/bitmap.h ||
echo 'restore of gnuplot/bitmap.h failed'
Wc_c="`wc -c < 'gnuplot/bitmap.h'`"
test 2726 -eq "$Wc_c" ||
echo 'gnuplot/bitmap.h: original size 2726, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/buildvms.com ==============
if test -f 'gnuplot/buildvms.com' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/buildvms.com (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/buildvms.com (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/buildvms.com' &&
$ ! buildvms.com (Command file to compile/link gnuplot and doc2hlp)
$ CFLAGS = "/NOOP/define=(NOGAMMA,MEMSET)"
$ !TERMFLAGS = "/define=()"
$ TERMFLAGS = ""
$ set verify
$ cc 'CFLAGS' bitmap.c
$ cc 'CFLAGS' command.c
$ cc 'CFLAGS' contour.c
$ cc 'CFLAGS' eval.c
$ cc 'CFLAGS' graphics.c
$ cc 'CFLAGS' graph3d.c
$ cc 'CFLAGS' internal.c
$ cc 'CFLAGS' misc.c
$ cc 'CFLAGS' parse.c
$ cc 'CFLAGS' plot.c
$ cc 'CFLAGS' scanner.c
$ cc 'CFLAGS' setshow.c
$ cc 'CFLAGS' standard.c
$ cc 'CFLAGS' 'TERMFLAGS' term.c
$ cc 'CFLAGS' util.c
$ cc 'CFLAGS' version.c
$ link /exe=gnuplot -
X bitmap.obj,command.obj,contour.obj,eval.obj,graphics.obj,graph3d.obj, -
X internal.obj,misc.obj,parse.obj,plot.obj,scanner.obj,setshow.obj, -
X standard.obj,term.obj,util.obj,version.obj ,linkopt.vms/opt
$ cc [.docs]doc2hlp.c
$ link doc2hlp,linkopt.vms/opt
$ @[.docs]doc2hlp.com
$ library/create/help gnuplot.hlb gnuplot.hlp
$ set noverify
SHAR_EOF
chmod 0644 gnuplot/buildvms.com ||
echo 'restore of gnuplot/buildvms.com failed'
Wc_c="`wc -c < 'gnuplot/buildvms.com'`"
test 918 -eq "$Wc_c" ||
echo 'gnuplot/buildvms.com: original size 918, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/misc.c ==============
if test -f 'gnuplot/misc.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/misc.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/misc.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/misc.c' &&
/* GNUPLOT - misc.c */
#include "help.h"
#ifdef __TURBOC__
#include <graphics.h>
#endif
X
#ifndef _IBMR2
extern char *malloc();
extern char *realloc();
#endif
X
extern int c_token;
extern char replot_line[];
extern struct at_type at;
extern struct ft_entry ft[];
extern struct udft_entry *first_udf;
extern struct udvt_entry *first_udv;
X
extern struct at_type *temp_at();
X
extern BOOLEAN interactive;
extern char *infile_name;
extern int inline_num;
X
/* State information for load_file(), to recover from errors
X * and properly handle recursive load_file calls
X */
typedef struct lf_state_struct LFS;
struct lf_state_struct {
X FILE *fp; /* file pointer for load file */
X char *name; /* name of file */
X BOOLEAN interactive; /* value of interactive flag on entry */
X int inline_num; /* inline_num on entry */
X LFS *prev; /* defines a stack */
} *lf_head = NULL; /* NULL if not in load_file */
X
static BOOLEAN lf_pop();
static void lf_push();
X
/*
X * instead of <strings.h>
X */
extern int strcmp();
X
/*
X * Turbo C realloc does not do the right thing. Here is what it should do.
X */
#ifdef __TURBOC__
char *realloc(p, new_size)
X void *p;
X size_t new_size;
{
X void *new_p = alloc(new_size, "TC realloc");
X
X /* Note p may have less than new_size bytes but in this unprotected
X * environment this will work.
X */
X memcpy(new_p, p, new_size);
X free(p);
X return new_p;
}
#endif /* __TURBOC__ */
X
/*
X * cp_alloc() allocates a curve_points structure that can hold 'num'
X * points.
X */
struct curve_points *
cp_alloc(num)
X int num;
{
X struct curve_points *cp;
X cp = (struct curve_points *) alloc(sizeof(struct curve_points), "curve");
X cp->p_max = (num >= 0 ? num : 0);
X if (num > 0) {
X cp->points = (struct coordinate *)
X alloc(num * sizeof(struct coordinate), "curve points");
X } else
X cp->points = (struct coordinate *) NULL;
X cp->next_cp = NULL;
X cp->title = NULL;
X return(cp);
}
X
X
/*
X * cp_extend() reallocates a curve_points structure to hold "num"
X * points. This will either expand or shrink the storage.
X */
cp_extend(cp, num)
X struct curve_points *cp;
X int num;
{
X struct coordinate *new;
X
#ifdef PC
X /* Make sure we do not allocate more than 64k (8088 architecture...)
X * in msdos since we can not address more. Leave some bytes for malloc
X * maintainance.
X */
X if (num > 65500L / sizeof(struct coordinate))
X int_error("Can not allocate more than 64k in msdos", NO_CARET);
#endif /* PC */
X
X if (num == cp->p_max) return;
X
X if (num > 0) {
X if (cp->points == NULL) {
X cp->points = (struct coordinate *)
X alloc(num * sizeof(struct coordinate), "curve points");
X } else {
X new = (struct coordinate *)
X realloc(cp->points, num * sizeof(struct coordinate));
X if (new == (struct coordinate *) NULL) {
X int_error("No memory available for expanding curve points",
X NO_CARET);
X /* NOTREACHED */
X }
X cp->points = new;
X }
X cp->p_max = num;
X } else {
X if (cp->points != (struct coordinate *) NULL)
X free(cp->points);
X cp->points = (struct coordinate *) NULL;
X cp->p_max = 0;
X }
}
X
/*
X * cp_free() releases any memory which was previously malloc()'d to hold
X * curve points (and recursively down the linked list).
X */
cp_free(cp)
struct curve_points *cp;
{
X if (cp) {
X cp_free(cp->next_cp);
X if (cp->title)
X free((char *)cp->title);
X if (cp->points)
X free((char *)cp->points);
X free((char *)cp);
X }
}
X
/*
X * iso_alloc() allocates a iso_curve structure that can hold 'num'
X * points.
X */
struct iso_curve *
iso_alloc(num)
X int num;
{
X struct iso_curve *ip;
X ip = (struct iso_curve *) alloc(sizeof(struct iso_curve), "iso curve");
X ip->p_max = (num >= 0 ? num : 0);
X if (num > 0) {
X ip->points = (struct coordinate *)
X alloc(num * sizeof(struct coordinate), "iso curve points");
X } else
X ip->points = (struct coordinate *) NULL;
X ip->next = NULL;
X return(ip);
}
X
/*
X * iso_extend() reallocates a iso_curve structure to hold "num"
X * points. This will either expand or shrink the storage.
X */
iso_extend(ip, num)
X struct iso_curve *ip;
X int num;
{
X struct coordinate *new;
X
X if (num == ip->p_max) return;
X
#ifdef PC
X /* Make sure we do not allocate more than 64k (8088 architecture...)
X * in msdos since we can not address more. Leave some bytes for malloc
X * maintainance.
X */
X if (num > 65500L / sizeof(struct coordinate))
X int_error("Can not allocate more than 64k in msdos", NO_CARET);
#endif /* PC */
X
X if (num > 0) {
X if (ip->points == NULL) {
X ip->points = (struct coordinate *)
X alloc(num * sizeof(struct coordinate), "iso curve points");
X } else {
X new = (struct coordinate *)
X realloc(ip->points, num * sizeof(struct coordinate));
X if (new == (struct coordinate *) NULL) {
X int_error("No memory available for expanding curve points",
X NO_CARET);
X /* NOTREACHED */
X }
X ip->points = new;
X }
X ip->p_max = num;
X } else {
X if (ip->points != (struct coordinate *) NULL)
X free(ip->points);
X ip->points = (struct coordinate *) NULL;
X ip->p_max = 0;
X }
}
X
/*
X * iso_free() releases any memory which was previously malloc()'d to hold
X * iso curve points.
X */
iso_free(ip)
struct iso_curve *ip;
{
X if (ip) {
X if (ip->points)
X free((char *)ip->points);
X free((char *)ip);
X }
}
X
/*
X * sp_alloc() allocates a surface_points structure that can hold 'num_iso'
X * iso-curves, each of which 'num_samp' samples.
X * if, however num_iso or num_samp is zero no iso curves are allocated.
X */
struct surface_points *
sp_alloc(num_samp,num_iso)
X int num_samp,num_iso;
{
X struct surface_points *sp;
X
X sp = (struct surface_points *) alloc(sizeof(struct surface_points), "surface");
X sp->next_sp = NULL;
X sp->title = NULL;
X sp->contours = NULL;
X sp->iso_crvs = NULL;
X sp->num_iso_read = 0;
X
X if (num_iso > 0 && num_samp > 0) {
X int i;
X struct iso_curve *icrv;
X
X for (i = 0; i < num_iso; i++) {
X icrv = iso_alloc(num_samp);
X icrv->next = sp->iso_crvs;
X sp->iso_crvs = icrv;
X }
X } else
X sp->iso_crvs = (struct iso_curve *) NULL;
X
X return(sp);
}
X
/*
X * sp_replace() updates a surface_points structure so it can hold 'num_iso'
X * iso-curves, each of which 'num_samp' samples.
X * if, however num_iso or num_samp is zero no iso curves are allocated.
X */
sp_replace(sp,num_samp,num_iso)
X struct surface_points *sp;
X int num_samp,num_iso;
{
X int i;
X struct iso_curve *icrv, *icrvs = sp->iso_crvs;
X
X while ( icrvs ) {
X icrv = icrvs;
X icrvs = icrvs->next;
X iso_free( icrv );
X }
X sp->iso_crvs = NULL;
X
X if (num_iso > 0 && num_samp > 0) {
X for (i = 0; i < num_iso; i++) {
X icrv = iso_alloc(num_samp);
X icrv->next = sp->iso_crvs;
X sp->iso_crvs = icrv;
X }
X } else
X sp->iso_crvs = (struct iso_curve *) NULL;
}
X
/*
X * sp_free() releases any memory which was previously malloc()'d to hold
X * surface points.
X */
sp_free(sp)
struct surface_points *sp;
{
X if (sp) {
X sp_free(sp->next_sp);
X if (sp->title)
X free((char *)sp->title);
X if (sp->contours) {
X struct gnuplot_contours *cntr, *cntrs = sp->contours;
X
X while (cntrs) {
X cntr = cntrs;
X cntrs = cntrs->next;
X free(cntr->coords);
X free(cntr);
X }
X }
X if (sp->iso_crvs) {
X struct iso_curve *icrv, *icrvs = sp->iso_crvs;
X
X while (icrvs) {
X icrv = icrvs;
X icrvs = icrvs->next;
X iso_free(icrv);
X }
X }
X free((char *)sp);
X }
}
X
X
X
save_functions(fp)
FILE *fp;
{
register struct udft_entry *udf = first_udf;
X
X if (fp) {
X while (udf) {
X if (udf->definition)
X fprintf(fp,"%s\n",udf->definition);
X udf = udf->next_udf;
X }
X (void) fclose(fp);
X } else
X os_error("Cannot open save file",c_token);
}
X
X
save_variables(fp)
FILE *fp;
{
register struct udvt_entry *udv = first_udv->next_udv; /* skip pi */
X
X if (fp) {
X while (udv) {
X if (!udv->udv_undef) {
X fprintf(fp,"%s = ",udv->udv_name);
X disp_value(fp,&(udv->udv_value));
X (void) putc('\n',fp);
X }
X udv = udv->next_udv;
X }
X (void) fclose(fp);
X } else
X os_error("Cannot open save file",c_token);
}
X
X
save_all(fp)
FILE *fp;
{
register struct udft_entry *udf = first_udf;
register struct udvt_entry *udv = first_udv->next_udv; /* skip pi */
X
X if (fp) {
X save_set_all(fp);
X while (udf) {
X if (udf->definition)
X fprintf(fp,"%s\n",udf->definition);
X udf = udf->next_udf;
X }
X while (udv) {
X if (!udv->udv_undef) {
X fprintf(fp,"%s = ",udv->udv_name);
X disp_value(fp,&(udv->udv_value));
X (void) putc('\n',fp);
X }
X udv = udv->next_udv;
X }
X fprintf(fp,"%s\n",replot_line);
X (void) fclose(fp);
X } else
X os_error("Cannot open save file",c_token);
}
X
X
save_set(fp)
FILE *fp;
{
X if (fp) {
X save_set_all(fp);
X (void) fclose(fp);
X } else
X os_error("Cannot open save file",c_token);
}
X
X
save_set_all(fp)
FILE *fp;
{
struct text_label *this_label;
struct arrow_def *this_arrow;
X fprintf(fp,"set terminal %s %s\n", term_tbl[term].name, term_options);
X fprintf(fp,"set output %s\n",strcmp(outstr,"STDOUT")? outstr : "" );
X fprintf(fp,"set %sclip points\n", (clip_points)? "" : "no");
X fprintf(fp,"set %sclip one\n", (clip_lines1)? "" : "no");
X fprintf(fp,"set %sclip two\n", (clip_lines2)? "" : "no");
X fprintf(fp,"set %sborder\n",draw_border ? "" : "no");
X fprintf(fp,"set dummy %s,%s\n",dummy_var[0], dummy_var[1]);
X fprintf(fp,"set format x \"%s\"\n", xformat);
X fprintf(fp,"set format y \"%s\"\n", yformat);
X fprintf(fp,"set format z \"%s\"\n", zformat);
X fprintf(fp,"set %sgrid\n", (grid)? "" : "no");
X switch (key) {
X case -1 :
X fprintf(fp,"set key\n");
X break;
X case 0 :
X fprintf(fp,"set nokey\n");
X break;
X case 1 :
X fprintf(fp,"set key %g,%g,%g\n",key_x,key_y,key_z);
X break;
X }
X fprintf(fp,"set nolabel\n");
X for (this_label = first_label; this_label != NULL;
X this_label = this_label->next) {
X fprintf(fp,"set label %d \"%s\" at %g,%g,%g ",
X this_label->tag,
X this_label->text, this_label->x,
X this_label->y,
X this_label->z);
X switch(this_label->pos) {
X case LEFT :
X fprintf(fp,"left");
X break;
X case CENTRE :
X fprintf(fp,"centre");
X break;
X case RIGHT :
X fprintf(fp,"right");
X break;
X }
X fputc('\n',fp);
X }
X fprintf(fp,"set noarrow\n");
X for (this_arrow = first_arrow; this_arrow != NULL;
X this_arrow = this_arrow->next) {
X fprintf(fp,"set arrow %d from %g,%g,%g to %g,%g,%g%s\n",
X this_arrow->tag,
X this_arrow->sx, this_arrow->sy, this_arrow->sz,
X this_arrow->ex, this_arrow->ey, this_arrow->ez,
X this_arrow->head ? "" : " nohead");
X }
X fprintf(fp,"set nologscale\n");
X if (log_x||log_y)
X fprintf(fp,"set logscale %c%c\n",
X log_x ? 'x' : ' ', log_y ? 'y' : ' ');
X if (log_z) fprintf(fp,"set logscale z\n");
X fprintf(fp,"set offsets %g, %g, %g, %g\n",loff,roff,toff,boff);
X fprintf(fp,"set %spolar\n", (polar)? "" : "no");
X fprintf(fp,"set angles %s\n", (angles_format == ANGLES_RADIANS)?
X "radians" : "degrees");
X fprintf(fp,"set %sparametric\n", (parametric)? "" : "no");
X fprintf(fp,"set view %g, %g, %g, %g\n",
X surface_rot_x, surface_rot_z, surface_scale, surface_zscale);
X fprintf(fp,"set samples %d\n",samples);
X fprintf(fp,"set isosamples %d\n",iso_samples);
X fprintf(fp,"set %ssurface\n",(draw_surface) ? "" : "no");
X fprintf(fp,"set %scontour",(draw_contour) ? "" : "no");
X switch (draw_contour) {
X case CONTOUR_NONE: fprintf(fp, "\n"); break;
X case CONTOUR_BASE: fprintf(fp, " base\n"); break;
X case CONTOUR_SRF: fprintf(fp, " surface\n"); break;
X case CONTOUR_BOTH: fprintf(fp, " both\n"); break;
X }
X fprintf(fp,"set cntrparam order %d\n", contour_order);
X fprintf(fp,"set cntrparam ");
X switch (contour_kind) {
X case CONTOUR_KIND_LINEAR: fprintf(fp, "linear\n"); break;
X case CONTOUR_KIND_CUBIC_SPL: fprintf(fp, "cubicspline\n"); break;
X case CONTOUR_KIND_BSPLINE: fprintf(fp, "bspline\n"); break;
X }
X fprintf(fp,"set cntrparam points %d\n", contour_pts);
X fprintf(fp,"set size %g,%g\n",xsize,ysize);
X fprintf(fp,"set data style ");
X switch (data_style) {
X case LINES: fprintf(fp,"lines\n"); break;
X case POINTS: fprintf(fp,"points\n"); break;
X case IMPULSES: fprintf(fp,"impulses\n"); break;
X case LINESPOINTS: fprintf(fp,"linespoints\n"); break;
X case DOTS: fprintf(fp,"dots\n"); break;
X case ERRORBARS: fprintf(fp,"errorbars\n"); break;
X }
X fprintf(fp,"set function style ");
X switch (func_style) {
X case LINES: fprintf(fp,"lines\n"); break;
X case POINTS: fprintf(fp,"points\n"); break;
X case IMPULSES: fprintf(fp,"impulses\n"); break;
X case LINESPOINTS: fprintf(fp,"linespoints\n"); break;
X case DOTS: fprintf(fp,"dots\n"); break;
X case ERRORBARS: fprintf(fp,"errorbars\n"); break;
X }
X fprintf(fp,"set tics %s\n", (tic_in)? "in" : "out");
X fprintf(fp,"set ticslevel %g\n", ticslevel);
X save_tics(fp, xtics, 'x', &xticdef);
X save_tics(fp, ytics, 'y', &yticdef);
X save_tics(fp, ztics, 'z', &zticdef);
X fprintf(fp,"set title \"%s\" %d,%d\n",title,title_xoffset,title_yoffset);
X if (timedate)
X fprintf(fp,"set time %d,%d\n",time_xoffset,time_yoffset);
X else
X fprintf(fp,"set notime\n");
X fprintf(fp,"set rrange [%g : %g]\n",rmin,rmax);
X fprintf(fp,"set trange [%g : %g]\n",tmin,tmax);
X fprintf(fp,"set xlabel \"%s\" %d,%d\n",xlabel,xlabel_xoffset,xlabel_yoffset);
X fprintf(fp,"set xrange [%g : %g]\n",xmin,xmax);
X fprintf(fp,"set ylabel \"%s\" %d,%d\n",ylabel,ylabel_xoffset,ylabel_yoffset);
X fprintf(fp,"set yrange [%g : %g]\n",ymin,ymax);
X fprintf(fp,"set zlabel \"%s\" %d,%d\n",zlabel,zlabel_xoffset,zlabel_yoffset);
X fprintf(fp,"set zrange [%g : %g]\n",zmin,zmax);
X fprintf(fp,"set %s %c\n",
X autoscale_r ? "autoscale" : "noautoscale", 'r');
X fprintf(fp,"set %s %c\n",
X autoscale_t ? "autoscale" : "noautoscale", 't');
X fprintf(fp,"set %s %c%c\n",
X (autoscale_y||autoscale_x) ? "autoscale" : "noautoscale",
X autoscale_x ? 'x' : ' ', autoscale_y ? 'y' : ' ');
X fprintf(fp,"set %s %c\n",
X autoscale_z ? "autoscale" : "noautoscale", 'z');
X fprintf(fp,"set zero %g\n",zero);
}
X
save_tics(fp, onoff, axis, tdef)
X FILE *fp;
X BOOLEAN onoff;
X char axis;
X struct ticdef *tdef;
{
X if (onoff) {
X fprintf(fp,"set %ctics", axis);
X switch(tdef->type) {
X case TIC_COMPUTED: {
X break;
X }
X case TIC_SERIES: {
X if (tdef->def.series.end >= VERYLARGE)
X fprintf(fp, " %g,%g", tdef->def.series.start,
X tdef->def.series.incr);
X else
X fprintf(fp, " %g,%g,%g", tdef->def.series.start,
X tdef->def.series.incr, tdef->def.series.end);
X break;
X }
X case TIC_USER: {
X register struct ticmark *t;
X fprintf(fp, " (");
X for (t = tdef->def.user; t != NULL; t=t->next) {
X if (t->label)
X fprintf(fp, "\"%s\" ", t->label);
X if (t->next)
X fprintf(fp, "%g, ", t->position);
X else
X fprintf(fp, "%g", t->position);
X }
X fprintf(fp, ")");
X break;
X }
X }
X fprintf(fp, "\n");
X } else {
X fprintf(fp,"set no%ctics\n", axis);
X }
}
X
load_file(fp, name)
X FILE *fp;
X char *name;
{
X register int len;
X extern char input_line[];
X
X int start, left;
X int more;
X int stop = FALSE;
X
X lf_push(fp); /* save state for errors and recursion */
X
X if (fp == (FILE *)NULL) {
X char errbuf[BUFSIZ];
X (void) sprintf(errbuf, "Cannot open load file '%s'", name);
X os_error(errbuf, c_token);
X } else {
X /* go into non-interactive mode during load */
X /* will be undone below, or in load_file_error */
X interactive = FALSE;
X inline_num = 0;
X infile_name = name;
X
X while (!stop) { /* read all commands in file */
X /* read one command */
X left = MAX_LINE_LEN;
X start = 0;
X more = TRUE;
X
X while (more) {
X if (fgets(&(input_line[start]), left, fp) == NULL) {
X stop = TRUE; /* EOF in file */
X input_line[start] = '\0';
X more = FALSE;
X } else {
X inline_num++;
X len = strlen(input_line) - 1;
X if (input_line[len] == '\n') { /* remove any newline */
X input_line[len] = '\0';
X /* Look, len was 1-1 = 0 before, take care here! */
X if (len > 0) --len;
X } else if (len+1 >= left)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[len] == '\\') { /* line continuation */
X start = len;
X left = MAX_LINE_LEN - start; /* left -=len;*/
X } else
X more = FALSE;
X }
X }
X
X if (strlen(input_line) > 0) {
X screen_ok = FALSE; /* make sure command line is
X echoed on error */
X do_line();
X }
X }
X }
X
X /* pop state */
X (void) lf_pop(); /* also closes file fp */
}
X
/* pop from load_file state stack */
static BOOLEAN /* FALSE if stack was empty */
lf_pop() /* called by load_file and load_file_error */
{
X LFS *lf;
X
X if (lf_head == NULL)
X return(FALSE);
X else {
X lf = lf_head;
X if (lf->fp != (FILE *)NULL)
X (void) fclose(lf->fp);
X interactive = lf->interactive;
X inline_num = lf->inline_num;
X infile_name = lf->name;
X lf_head = lf->prev;
X free((char *)lf);
X return(TRUE);
X }
}
X
/* push onto load_file state stack */
/* essentially, we save information needed to undo the load_file changes */
static void
lf_push(fp) /* called by load_file */
X FILE *fp;
{
X LFS *lf;
X
X lf = (LFS *)alloc(sizeof(LFS), (char *)NULL);
X if (lf == (LFS *)NULL) {
X if (fp != (FILE *)NULL)
X (void) fclose(fp); /* it won't be otherwise */
X int_error("not enough memory to load file", c_token);
X }
X
X lf->fp = fp; /* save this file pointer */
X lf->name = infile_name; /* save current name */
X lf->interactive = interactive; /* save current state */
X lf->inline_num = inline_num; /* save current line number */
X lf->prev = lf_head; /* link to stack */
X lf_head = lf;
}
X
load_file_error() /* called from main */
{
X /* clean up from error in load_file */
X /* pop off everything on stack */
X while(lf_pop())
X ;
}
X
/* find char c in string str; return p such that str[p]==c;
X * if c not in str then p=strlen(str)
X */
int
instring(str, c)
X char *str;
X char c;
{
X int pos = 0;
X
X while (str != NULL && *str != '\0' && c != *str) {
X str++;
X pos++;
X }
X return (pos);
}
X
show_functions()
{
register struct udft_entry *udf = first_udf;
X
X fprintf(stderr,"\n\tUser-Defined Functions:\n");
X
X while (udf) {
X if (udf->definition)
X fprintf(stderr,"\t%s\n",udf->definition);
X else
X fprintf(stderr,"\t%s is undefined\n",udf->udf_name);
X udf = udf->next_udf;
X }
}
X
X
show_at()
{
X (void) putc('\n',stderr);
X disp_at(temp_at(),0);
}
X
X
disp_at(curr_at, level)
struct at_type *curr_at;
int level;
{
register int i, j;
register union argument *arg;
X
X for (i = 0; i < curr_at->a_count; i++) {
X (void) putc('\t',stderr);
X for (j = 0; j < level; j++)
X (void) putc(' ',stderr); /* indent */
X
X /* print name of instruction */
X
X fputs(ft[(int)(curr_at->actions[i].index)].f_name,stderr);
X arg = &(curr_at->actions[i].arg);
X
X /* now print optional argument */
X
X switch(curr_at->actions[i].index) {
X case PUSH: fprintf(stderr," %s\n", arg->udv_arg->udv_name);
X break;
X case PUSHC: (void) putc(' ',stderr);
X disp_value(stderr,&(arg->v_arg));
X (void) putc('\n',stderr);
X break;
X case PUSHD1: fprintf(stderr," %c dummy\n",
X arg->udf_arg->udf_name[0]);
X break;
X case PUSHD2: fprintf(stderr," %c dummy\n",
X arg->udf_arg->udf_name[1]);
X break;
X case CALL: fprintf(stderr," %s", arg->udf_arg->udf_name);
X if(level < 6) {
X if (arg->udf_arg->at) {
X (void) putc('\n',stderr);
X disp_at(arg->udf_arg->at,level+2); /* recurse! */
X } else
X fputs(" (undefined)\n",stderr);
X }
X break;
X case CALL2: fprintf(stderr," %s", arg->udf_arg->udf_name);
X if(level < 6) {
X if (arg->udf_arg->at) {
X (void) putc('\n',stderr);
X disp_at(arg->udf_arg->at,level+2); /* recurse! */
X } else
X fputs(" (undefined)\n",stderr);
X }
X break;
X case JUMP:
X case JUMPZ:
X case JUMPNZ:
X case JTERN:
X fprintf(stderr," +%d\n",arg->j_arg);
X break;
X default:
X (void) putc('\n',stderr);
X }
X }
}
X
X
/* alloc:
X * allocate memory
X * This is a protected version of malloc. It causes an int_error
X * if there is not enough memory, but first it tries FreeHelp()
X * to make some room, and tries again. If message is NULL, we
X * allow NULL return. Otherwise, we handle the error, using the
X * message to create the int_error string. Note cp/sp_extend uses realloc,
X * so it depends on this using malloc().
X */
X
char *
alloc(size, message)
X unsigned int size; /* # of bytes */
X char *message; /* description of what is being allocated */
{
X char *p; /* the new allocation */
X char errbuf[100]; /* error message string */
X
X p = malloc(size);
X if (p == (char *)NULL) {
#ifndef vms
X FreeHelp(); /* out of memory, try to make some room */
#endif
X
X p = malloc(size); /* try again */
X if (p == (char *)NULL) {
X /* really out of memory */
X if (message != NULL) {
X (void) sprintf(errbuf, "out of memory for %s", message);
X int_error(errbuf, NO_CARET);
X /* NOTREACHED */
X }
X /* else we return NULL */
X }
X }
X
X return(p);
}
SHAR_EOF
chmod 0644 gnuplot/misc.c ||
echo 'restore of gnuplot/misc.c failed'
Wc_c="`wc -c < 'gnuplot/misc.c'`"
test 22387 -eq "$Wc_c" ||
echo 'gnuplot/misc.c: original size 22387, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/contour.c ==============
if test -f 'gnuplot/contour.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/contour.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/contour.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/contour.c' &&
/* GNUPLOT - contour.c */
/*
X * Copyright (C) 1986, 1987, 1990, 1991 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 * Gershon Elber
X *
X * Send your comments or suggestions to
X * pixar!info-g...@sun.com.
X * This is a mailing list; to join it send a note to
X * pixar!info-gnupl...@sun.com.
X * Send bug reports to
X * pixar!bug-g...@sun.com.
X */
X
#include <stdio.h>
#include "plot.h"
X
#define DEFAULT_NUM_OF_ZLEVELS 10 /* Some dflt values (setable via flags). */
#define DEFAULT_NUM_APPROX_PTS 5
#define DEFAULT_BSPLINE_ORDER 3
#define MAX_NUM_OF_ZLEVELS 100 /* Some max. values (setable via flags). */
#define MAX_NUM_APPROX_PTS 100
#define MAX_BSPLINE_ORDER 10
X
#define INTERP_NOTHING 0 /* Kind of interpolations on contours. */
#define INTERP_CUBIC 1 /* Cubic spline interp. */
#define APPROX_BSPLINE 2 /* Bspline interpolation. */
X
#define ACTIVE 1 /* Status of edges at certain Z level. */
#define INACTIVE 2
X
#define OPEN_CONTOUR 1 /* Contour kinds. */
#define CLOSED_CONTOUR 2
X
#define EPSILON 1e-5 /* Used to decide if two float are equal. */
#define INFINITY 1e10
X
#ifndef TRUE
#define TRUE -1
#define FALSE 0
#endif
X
#define DEFAULT_NUM_CONTOURS 10
#define MAX_POINTS_PER_CNTR 100
#define SHIFT_Z_EPSILON 0.000301060 /* Dec. change of poly bndry hit.*/
X
#define abs(x) ((x) > 0 ? (x) : (-(x)))
#define sqr(x) ((x) * (x))
X
typedef double tri_diag[3]; /* Used to allocate the tri-diag matrix. */
typedef double table_entry[4]; /* Cubic spline interpolation 4 coef. */
X
struct vrtx_struct {
X double X, Y, Z; /* The coordinates of this vertex. */
X struct vrtx_struct *next; /* To chain lists. */
};
X
struct edge_struct {
X struct poly_struct *poly[2]; /* Each edge belongs to up to 2 polygons. */
X struct vrtx_struct *vertex[2]; /* The two extreme points of this vertex. */
X struct edge_struct *next; /* To chain lists. */
X int status, /* Status flag to mark edges in scanning at certain Z level. */
X boundary; /* True if this edge is on the boundary. */
};
X
struct poly_struct {
X struct edge_struct *edge[3]; /* As we do triangolation here... */
X struct poly_struct *next; /* To chain lists. */
};
X
struct cntr_struct { /* Contours are saved using this struct list. */
X double X, Y; /* The coordinates of this vertex. */
X struct cntr_struct *next; /* To chain lists. */
};
X
static int test_boundary; /* If TRUE look for contours on boundary first. */
static struct gnuplot_contours *contour_list = NULL;
static double crnt_cntr[MAX_POINTS_PER_CNTR * 2];
static int crnt_cntr_pt_index = 0;
static double contour_level = 0.0;
static table_entry *hermit_table = NULL; /* Hold hermite table constants. */
static int num_of_z_levels = DEFAULT_NUM_OF_ZLEVELS; /* # Z contour levels. */
static int num_approx_pts = DEFAULT_NUM_APPROX_PTS;/* # pts per approx/inter.*/
static int bspline_order = DEFAULT_BSPLINE_ORDER; /* Bspline order to use. */
static int interp_kind = INTERP_NOTHING; /* Linear, Cubic interp., Bspline. */
X
static void gen_contours();
static int update_all_edges();
static struct cntr_struct *gen_one_contour();
static struct cntr_struct *trace_contour();
static struct cntr_struct *update_cntr_pt();
static int fuzzy_equal();
static void gen_triangle();
static struct vrtx_struct *gen_vertices();
static struct edge_struct *gen_edges_middle();
static struct edge_struct *gen_edges();
static struct poly_struct *gen_polys();
static void free_contour();
static void put_contour();
static put_contour_nothing();
static put_contour_cubic();
static put_contour_bspline();
static calc_tangent();
static int count_contour();
static complete_spline_interp();
static calc_hermit_table();
static hermit_interp();
static prepare_spline_interp();
static int solve_tri_diag();
static gen_bspline_approx();
static double fetch_knot();
static eval_bspline();
X
/*
X * Entry routine to this whole set of contouring module.
X */
struct gnuplot_contours *contour(num_isolines, iso_lines,
X ZLevels, approx_pts, kind, order1)
int num_isolines;
struct iso_curve *iso_lines;
int ZLevels, approx_pts, kind, order1;
{
X int i;
X struct poly_struct *p_polys, *p_poly;
X struct edge_struct *p_edges, *p_edge;
X struct vrtx_struct *p_vrts, *p_vrtx;
X double x_min, y_min, z_min, x_max, y_max, z_max, z, dz, z_scale = 1.0;
X
X num_of_z_levels = ZLevels;
X num_approx_pts = approx_pts;
X bspline_order = order1 - 1;
X interp_kind = kind;
X
X contour_list = NULL;
X
X if (interp_kind == INTERP_CUBIC) calc_hermit_table();
X
X gen_triangle(num_isolines, iso_lines, &p_polys, &p_edges, &p_vrts,
X &x_min, &y_min, &z_min, &x_max, &y_max, &z_max);
X dz = (z_max - z_min) / (num_of_z_levels+1);
X /* Step from z_min+dz upto z_max-dz in num_of_z_levels times. */
X z = z_min + dz;
X crnt_cntr_pt_index = 0;
X
X for (i=0; i<num_of_z_levels; i++, z += dz) {
X contour_level = z;
X gen_contours(p_edges, z + dz * SHIFT_Z_EPSILON, x_min, x_max,
X y_min, y_max);
X }
X
X /* Free all contouring related temporary data. */
X while (p_polys) {
X p_poly = p_polys -> next;
X free (p_polys);
X p_polys = p_poly;
X }
X while (p_edges) {
X p_edge = p_edges -> next;
X free (p_edges);
X p_edges = p_edge;
X }
X while (p_vrts) {
X p_vrtx = p_vrts -> next;
X free (p_vrts);
X p_vrts = p_vrtx;
X }
X
X if (interp_kind == INTERP_CUBIC) free(hermit_table);
X
X return contour_list;
}
X
/*
X * Adds another point to the currently build contour.
X */
add_cntr_point(x, y)
double x, y;
{
X int index;
X
X if (crnt_cntr_pt_index >= MAX_POINTS_PER_CNTR-1) {
X index = crnt_cntr_pt_index - 1;
X end_crnt_cntr();
X crnt_cntr[0] = crnt_cntr[index * 2];
X crnt_cntr[1] = crnt_cntr[index * 2 + 1];
X crnt_cntr_pt_index = 1; /* Keep the last point as first of this one. */
X }
X crnt_cntr[crnt_cntr_pt_index * 2] = x;
X crnt_cntr[crnt_cntr_pt_index * 2 + 1] = y;
X crnt_cntr_pt_index++;
}
X
/*
X * Done with current contour - create gnuplot data structure for it.
X */
end_crnt_cntr()
{
X int i;
X struct gnuplot_contours *cntr = (struct gnuplot_contours *)
X alloc(sizeof(struct gnuplot_contours),
X "gnuplot_contour");
X
X cntr->coords = (struct coordinate *) alloc(sizeof(struct coordinate) *
X crnt_cntr_pt_index,
X "contour coords");
X for (i=0; i<crnt_cntr_pt_index; i++) {
X cntr->coords[i].x = crnt_cntr[i * 2];
X cntr->coords[i].y = crnt_cntr[i * 2 + 1];
X cntr->coords[i].z = contour_level;
X }
X cntr->num_pts = crnt_cntr_pt_index;
X
X cntr->next = contour_list;
X contour_list = cntr;
X
X crnt_cntr_pt_index = 0;
}
X
/*
X * Generates all contours by tracing the intersecting triangles.
X */
static void gen_contours(p_edges, z_level, x_min, x_max, y_min, y_max)
struct edge_struct *p_edges;
double z_level, x_min, x_max, y_min, y_max;
{
X int num_active, /* Number of edges marked ACTIVE. */
X contour_kind; /* One of OPEN_CONTOUR, CLOSED_CONTOUR. */
X struct cntr_struct *p_cntr;
X
X num_active = update_all_edges(p_edges, z_level); /* Do pass 1. */
X
X test_boundary = TRUE; /* Start to look for contour on boundaries. */
X
X while (num_active > 0) { /* Do Pass 2. */
X /* Generate One contour (and update MumActive as needed): */
X p_cntr = gen_one_contour(p_edges, z_level, &contour_kind, &num_active);
X put_contour(p_cntr, z_level, x_min, x_max, y_min, y_max,
X contour_kind); /* Emit it in requested format. */
X }
}
X
/*
X * Does pass 1, or marks the edges which are active (crosses this z_level)
X * as ACTIVE, and the others as INACTIVE:
X * Returns number of active edges (marked ACTIVE).
X */
static int update_all_edges(p_edges, z_level)
struct edge_struct *p_edges;
double z_level;
{
X int count = 0;
X
X while (p_edges) {
X if (((p_edges -> vertex[0] -> Z >= z_level) &&
X (p_edges -> vertex[1] -> Z <= z_level)) ||
X ((p_edges -> vertex[1] -> Z >= z_level) &&
X (p_edges -> vertex[0] -> Z <= z_level))) {
X p_edges -> status = ACTIVE;
X count++;
X }
X else p_edges -> status = INACTIVE;
X p_edges = p_edges -> next;
X }
X
X return count;
}
X
/*
X * Does pass 2, or find one complete contour out of the triangolation data base:
X * Returns a pointer to the contour (as linked list), contour_kind is set to
X * one of OPEN_CONTOUR, CLOSED_CONTOUR, and num_active is updated.
X */
static struct cntr_struct *gen_one_contour(p_edges, z_level, contour_kind,
X num_active)
struct edge_struct *p_edges;
double z_level;
int *contour_kind, *num_active;
{
X struct edge_struct *pe_temp;
X
X if (test_boundary) { /* Look for something to start with on boundary: */
X pe_temp = p_edges;
X while (pe_temp) {
X if ((pe_temp -> status == ACTIVE) && (pe_temp -> boundary)) break;
X pe_temp = pe_temp -> next;
X }
X if (!pe_temp) test_boundary = FALSE;/* No more contours on boundary. */
X else {
X *contour_kind = OPEN_CONTOUR;
X return trace_contour(pe_temp, z_level, num_active, *contour_kind);
X }
X }
X
X if (!test_boundary) { /* Look for something to start with inside: */
X pe_temp = p_edges;
X while (pe_temp) {
X if ((pe_temp -> status == ACTIVE) && (!(pe_temp -> boundary)))
X break;
X pe_temp = pe_temp -> next;
X }
X if (!pe_temp) {
X *num_active = 0;
X return NULL;
X }
X else {
X *contour_kind = CLOSED_CONTOUR;
X return trace_contour(pe_temp, z_level, num_active, *contour_kind);
X }
X }
X return NULL; /* We should never be here, but lint... */
}
X
/*
X * Search the data base along a contour starts at the edge pe_start until
X * a boundary edge is detected or until we close the loop back to pe_start.
X * Returns a linked list of all the points on the contour
X * Also decreases num_active by the number of points on contour.
X */
static struct cntr_struct *trace_contour(pe_start, z_level, num_active,
X contour_kind)
struct edge_struct *pe_start;
double z_level;
int *num_active, contour_kind;
{
X int i, in_middle; /* If TRUE the z_level is in the middle of edge. */
X struct cntr_struct *p_cntr, *pc_tail;
X struct edge_struct *p_edge = pe_start, *p_next_edge;
X struct poly_struct *p_poly, *PLastpoly = NULL;
X
X /* Generate the header of the contour - the point on pe_start. */
X if (contour_kind == OPEN_CONTOUR) pe_start -> status = INACTIVE;
X (*num_active)--;
X p_cntr = pc_tail = update_cntr_pt(pe_start, z_level, &in_middle);
X if (!in_middle) {
X return NULL;
X }
X
X do {
X /* Find polygon to continue (Not where we came from - PLastpoly): */
X if (p_edge -> poly[0] == PLastpoly) p_poly = p_edge -> poly[1];
X else p_poly = p_edge -> poly[0];
X p_next_edge = NULL; /* In case of error, remains NULL. */
X for (i=0; i<3; i++) /* Test the 3 edges of the polygon: */
X if (p_poly -> edge[i] != p_edge)
X if (p_poly -> edge[i] -> status == ACTIVE)
X p_next_edge = p_poly -> edge[i];
X if (!p_next_edge) {
X pc_tail -> next = NULL;
X free_contour(p_cntr);
X return NULL;
X }
X p_edge = p_next_edge;
X PLastpoly = p_poly;
X p_edge -> status = INACTIVE;
X (*num_active)--;
X pc_tail -> next = update_cntr_pt(p_edge, z_level, &in_middle);
X if (!in_middle) {
X pc_tail -> next = NULL;
X free_contour(p_cntr);
X return NULL;
X }
X pc_tail = pc_tail -> next;
X }
X while ((pe_start != p_edge) && (!p_edge -> boundary));
X pc_tail -> next = NULL;
X
X return p_cntr;
}
X
/*
X * Allocates one contour location and update it to to correct position
X * according to z_level and edge p_edge. if z_level is found to be at
X * one of the extreme points nothing is allocated (NULL is returned)
X * and in_middle is set to FALSE.
X */
static struct cntr_struct *update_cntr_pt(p_edge, z_level, in_middle)
struct edge_struct *p_edge;
double z_level;
int *in_middle;
{
X double t;
X struct cntr_struct *p_cntr;
X
X t = (z_level - p_edge -> vertex[0] -> Z) /
X (p_edge -> vertex[1] -> Z - p_edge -> vertex[0] -> Z);
X
X if (fuzzy_equal(t, 1.0) || fuzzy_equal(t, 0.0)) {
X *in_middle = FALSE;
X return NULL;
X }
X else {
X *in_middle = TRUE;
X p_cntr = (struct cntr_struct *) alloc(sizeof(struct cntr_struct),
SHAR_EOF
true || echo 'restore of gnuplot/contour.c failed'
fi
echo 'End of part 4'
echo 'File gnuplot/contour.c is continued in part 5'
echo 5 > _shar_seq_.tmp
#!/bin/sh
# this is Part.05 (part 5 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/contour.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 5; 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/contour.c'
else
echo 'x - continuing file gnuplot/contour.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/contour.c' &&
X "contour cntr_struct");
X p_cntr -> X = p_edge -> vertex[1] -> X * t +
X p_edge -> vertex[0] -> X * (1-t);
X p_cntr -> Y = p_edge -> vertex[1] -> Y * t +
X p_edge -> vertex[0] -> Y * (1-t);
X return p_cntr;
X }
}
X
/*
X * Simple routine to decide if two real values are equal by simply
X * calculating the relative/absolute error between them (< EPSILON).
X */
static int fuzzy_equal(x, y)
double x, y;
{
X if (abs(x) > EPSILON) /* Calculate relative error: */
X return (abs((x - y) / x) < EPSILON);
X else /* Calculate absolute error: */
X return (abs(x - y) < EPSILON);
}
X
/*
X * Generate the triangles.
X * Returns the lists (vrtxs edges & polys) via pointers to their heads.
X */
static void gen_triangle(num_isolines, iso_lines, p_polys, p_edges,
X p_vrts, x_min, y_min, z_min, x_max, y_max, z_max)
int num_isolines;
struct iso_curve *iso_lines;
struct poly_struct **p_polys;
struct edge_struct **p_edges;
struct vrtx_struct **p_vrts;
double *x_min, *y_min, *z_min, *x_max, *y_max, *z_max;
{
X int i, grid_x_max = iso_lines->p_count;
X struct vrtx_struct *p_vrtx1, *p_vrtx2, *pv_temp;
X struct edge_struct *p_edge1, *p_edge2, *pe_tail1, *pe_tail2, *pe_temp,
X *p_edge_middle, *pe_m_tail;
X struct poly_struct *p_poly, *pp_tail;
X
X *p_polys = NULL;
X *p_edges = NULL;
X *p_vrts = NULL;
X *z_min = INFINITY;
X *y_min = INFINITY;
X *x_min = INFINITY;
X *z_max = -INFINITY;
X *y_max = -INFINITY;
X *x_max = -INFINITY;
X
X /* Read 1st row. */
X p_vrtx1 = gen_vertices(grid_x_max, iso_lines->points,
X x_min, y_min, z_min, x_max, y_max, z_max);
X *p_vrts = p_vrtx1;
X /* Gen. its edges.*/
X pe_temp = p_edge1 = gen_edges(grid_x_max, p_vrtx1, &pe_tail1);
X for (i = 1; i < grid_x_max; i++) {/* Mark one side of edges as boundary. */
X pe_temp -> poly[1] = NULL;
X pe_temp = pe_temp -> next;
X }
X for (i = 1; i < num_isolines; i++) { /* Read next column and gen. polys. */
X iso_lines = iso_lines->next;
X /* Get row into list. */
X p_vrtx2 = gen_vertices(grid_x_max, iso_lines->points,
X x_min, y_min, z_min, x_max, y_max, z_max);
X /* Generate its edges. */
X p_edge2 = gen_edges(grid_x_max, p_vrtx2, &pe_tail2);
X /* Generate edges from one vertex list to the other one: */
X p_edge_middle = gen_edges_middle(grid_x_max, p_vrtx1, p_vrtx2,
X &pe_m_tail);
X
X /* Now we can generate the polygons themselves (triangles). */
X p_poly = gen_polys(grid_x_max, p_edge1, p_edge_middle, p_edge2,
X &pp_tail);
X pe_tail1 -> next = (*p_edges); /* Chain new edges to main list. */
X pe_m_tail -> next = p_edge1;
X *p_edges = p_edge_middle;
X pe_tail1 = pe_tail2;
X p_edge1 = p_edge2;
X
X pv_temp = p_vrtx2;
X while (pv_temp -> next) pv_temp = pv_temp -> next;
X pv_temp -> next = *p_vrts;
X *p_vrts = p_vrtx1 = p_vrtx2;
X
X pp_tail -> next = (*p_polys); /* Chain new polys to main list. */
X *p_polys = p_poly;
X }
X
X pe_temp = p_edge1;
X for (i = 1; i < grid_x_max; i++) {/* Mark one side of edges as boundary. */
X pe_temp -> poly[0] = NULL;
X pe_temp = pe_temp -> next;
X }
X
X pe_tail1 -> next = (*p_edges); /* Chain last edges list to main list. */
X *p_edges = p_edge1;
X
X /* Update the boundary flag, saved in each edge, and update indexes: */
X pe_temp = (*p_edges);
X i = 1;
X
X while (pe_temp) {
X pe_temp -> boundary = (!(pe_temp -> poly[0])) ||
X (!(pe_temp -> poly[1]));
X pe_temp = pe_temp -> next;
X }
}
X
/*
X * Handles grid_x_max 3D points (One row) and generate linked list for them.
X */
static struct vrtx_struct *gen_vertices(grid_x_max, points,
X x_min, y_min, z_min, x_max, y_max, z_max)
int grid_x_max;
struct coordinate *points;
double *x_min, *y_min, *z_min, *x_max, *y_max, *z_max;
{
X int i;
X struct vrtx_struct *p_vrtx, *pv_tail, *pv_temp;
X
X for (i=0; i<grid_x_max; i++) {/* Get a point and generate the structure. */
X pv_temp = (struct vrtx_struct *) alloc(sizeof(struct vrtx_struct),
X "contour vertex");
X pv_temp -> X = points[i].x;
X pv_temp -> Y = points[i].y;
X pv_temp -> Z = points[i].z;
X
X if (pv_temp -> X > *x_max) *x_max = pv_temp -> X; /* Update min/max. */
X if (pv_temp -> Y > *y_max) *y_max = pv_temp -> Y;
X if (pv_temp -> Z > *z_max) *z_max = pv_temp -> Z;
X if (pv_temp -> X < *x_min) *x_min = pv_temp -> X;
X if (pv_temp -> Y < *y_min) *y_min = pv_temp -> Y;
X if (pv_temp -> Z < *z_min) *z_min = pv_temp -> Z;
X
X if (i == 0) /* First vertex in row: */
X p_vrtx = pv_tail = pv_temp;
X else {
X pv_tail -> next = pv_temp; /* Stick new record as last one. */
X pv_tail = pv_tail -> next; /* And continue to last record. */
X }
X }
X pv_tail -> next = NULL;
X
X return p_vrtx;
}
X
/*
X * Combines N vertices in pair to form N-1 edges.
X * Returns pointer to the edge list (pe_tail will point on last edge in list).
X */
static struct edge_struct *gen_edges(grid_x_max, p_vrtx, pe_tail)
int grid_x_max;
struct vrtx_struct *p_vrtx;
struct edge_struct **pe_tail;
{
X int i;
X struct edge_struct *p_edge, *pe_temp;
X
X for (i=0; i<grid_x_max-1; i++) { /* Generate grid_x_max-1 edges: */
X pe_temp = (struct edge_struct *) alloc(sizeof(struct edge_struct),
X "contour edge");
X pe_temp -> vertex[0] = p_vrtx; /* First vertex of edge. */
X p_vrtx = p_vrtx -> next; /* Skip to next vertex. */
X pe_temp -> vertex[1] = p_vrtx; /* Second vertex of edge. */
X if (i == 0) /* First edge in row: */
X p_edge = (*pe_tail) = pe_temp;
X else {
X (*pe_tail) -> next = pe_temp; /* Stick new record as last one. */
X *pe_tail = (*pe_tail) -> next; /* And continue to last record. */
X }
X }
X (*pe_tail) -> next = NULL;
X
X return p_edge;
}
X
/*
X * Combines 2 lists of N vertices each into edge list:
X * The dots (.) are the vertices list, and the . . . .
X * edges generated are alternations of vertical edges |\ |\ |\ |
X * (|) and diagonal ones (\). | \| \| \|
X * A pointer to edge list (alternate | , \) is returned . . . .
X * Note this list will have (2*grid_x_max-1) edges (pe_tail points on last
X * record).
X */
static struct edge_struct *gen_edges_middle(grid_x_max, p_vrtx1, p_vrtx2,
X pe_tail)
int grid_x_max;
struct vrtx_struct *p_vrtx1, *p_vrtx2;
struct edge_struct **pe_tail;
{
X int i;
X struct edge_struct *p_edge, *pe_temp;
X
X /* Gen first (|). */
X pe_temp = (struct edge_struct *) alloc(sizeof(struct edge_struct),
X "contour edge");
X pe_temp -> vertex[0] = p_vrtx2; /* First vertex of edge. */
X pe_temp -> vertex[1] = p_vrtx1; /* Second vertex of edge. */
X p_edge = (*pe_tail) = pe_temp;
X
X /* Advance in vrtx list grid_x_max-1 times, and gen. 2 edges /| for each.*/
X for (i=0; i<grid_x_max-1; i++) {
X /* The / edge. */
X pe_temp = (struct edge_struct *) alloc(sizeof(struct edge_struct),
X "contour edge");
X pe_temp -> vertex[0] = p_vrtx1; /* First vertex of edge. */
X pe_temp -> vertex[1] = p_vrtx2 -> next; /* Second vertex of edge. */
X (*pe_tail) -> next = pe_temp; /* Stick new record as last one. */
X *pe_tail = (*pe_tail) -> next; /* And continue to last record. */
X
X /* The | edge. */
X pe_temp = (struct edge_struct *) alloc(sizeof(struct edge_struct),
X "contour edge");
X pe_temp -> vertex[0] = p_vrtx2 -> next; /* First vertex of edge. */
X pe_temp -> vertex[1] = p_vrtx1 -> next; /* Second vertex of edge. */
X (*pe_tail) -> next = pe_temp; /* Stick new record as last one. */
X *pe_tail = (*pe_tail) -> next; /* And continue to last record. */
X
X p_vrtx1 = p_vrtx1 -> next; /* Skip to next vertices in both lists. */
X p_vrtx2 = p_vrtx2 -> next;
X }
X (*pe_tail) -> next = NULL;
X
X return p_edge;
}
X
/*
X * Combines 3 lists of edges into triangles:
X * 1. p_edge1: Top horizontal edge list: -----------------------
X * 2. p_edge_middge: middle edge list: |\ |\ |\ |\ |\ |\ |
X * | \| \| \| \| \| \|
X * 3. p_edge2: Bottom horizontal edge list: -----------------------
X * Note that p_edge1/2 lists has grid_x_max-1 edges, while p_edge_middle has
X * (2*grid_x_max-1) edges.
X * The routine simple scans the two list Upper 1 Lower
X * and generate two triangle upper one ---- | \
X * and lower one from the lists: 0\ |2 0| \1
X * (Nums. are edges order in polys) \ | ----
X * The routine returns a pointer to a 2
X * polygon list (pp_tail points on last polygon). 1
X * -----------
X * In addition, the edge lists are updated - | \ 0 |
X * each edge has two pointers on the two | \ |
X * (one active if boundary) polygons which 0|1 0\1 0|1
X * uses it. These two pointer to polygons | \ |
X * are named: poly[0], poly[1]. The diagram | 1 \ |
X * on the right show how they are used for the -----------
X * upper and lower polygons. 0
X */
static struct poly_struct *gen_polys(grid_x_max, p_edge1, p_edge_middle,
X p_edge2, pp_tail)
int grid_x_max;
struct edge_struct *p_edge1, *p_edge_middle, *p_edge2;
struct poly_struct **pp_tail;
{
X int i;
X struct poly_struct *p_poly, *pp_temp;
X
X p_edge_middle -> poly[0] = NULL; /* Its boundary! */
X
X /* Advance in vrtx list grid_x_max-1 times, and gen. 2 polys for each. */
X for (i=0; i<grid_x_max-1; i++) {
X /* The Upper. */
X pp_temp = (struct poly_struct *) alloc(sizeof(struct poly_struct),
X "contour poly");
X /* Now update polys about its edges, and edges about the polygon. */
X pp_temp -> edge[0] = p_edge_middle -> next;
X p_edge_middle -> next -> poly[1] = pp_temp;
X pp_temp -> edge[1] = p_edge1;
X p_edge1 -> poly[0] = pp_temp;
X pp_temp -> edge[2] = p_edge_middle -> next -> next;
X p_edge_middle -> next -> next -> poly[0] = pp_temp;
X if (i == 0) /* Its first one in list: */
X p_poly = (*pp_tail) = pp_temp;
X else {
X (*pp_tail) -> next = pp_temp;
X *pp_tail = (*pp_tail) -> next;
X }
X
X /* The Lower. */
X pp_temp = (struct poly_struct *) alloc(sizeof(struct poly_struct),
X "contour poly");
X /* Now update polys about its edges, and edges about the polygon. */
X pp_temp -> edge[0] = p_edge_middle;
X p_edge_middle -> poly[1] = pp_temp;
X pp_temp -> edge[1] = p_edge_middle -> next;
X p_edge_middle -> next -> poly[0] = pp_temp;
X pp_temp -> edge[2] = p_edge2;
X p_edge2 -> poly[1] = pp_temp;
X (*pp_tail) -> next = pp_temp;
X *pp_tail = (*pp_tail) -> next;
X
X p_edge1 = p_edge1 -> next;
X p_edge2 = p_edge2 -> next;
X p_edge_middle = p_edge_middle -> next -> next;
X }
X p_edge_middle -> poly[1] = NULL; /* Its boundary! */
X (*pp_tail) -> next = NULL;
X
X return p_poly;
}
X
/*
X * Calls the (hopefully) desired interpolation/approximation routine.
X */
static void put_contour(p_cntr, z_level, x_min, x_max, y_min, y_max, contr_kind)
struct cntr_struct *p_cntr;
double z_level, x_min, x_max, y_min, y_max;
int contr_kind;
{
X if (!p_cntr) return; /* Nothing to do if it is empty contour. */
X
X switch (interp_kind) {
X case INTERP_NOTHING: /* No interpolation/approximation. */
X put_contour_nothing(p_cntr);
X break;
X case INTERP_CUBIC: /* Cubic spline interpolation. */
X put_contour_cubic(p_cntr, z_level, x_min, x_max, y_min, y_max,
X contr_kind);
X break;
X case APPROX_BSPLINE: /* Bspline approximation. */
X put_contour_bspline(p_cntr, z_level, x_min, x_max, y_min, y_max,
X contr_kind);
X break;
X }
X
X free_contour(p_cntr);
}
X
/*
X * Simply puts contour coordinates in order with no interpolation or
X * approximation.
X */
static put_contour_nothing(p_cntr)
struct cntr_struct *p_cntr;
{
X while (p_cntr) {
X add_cntr_point(p_cntr -> X, p_cntr -> Y);
X p_cntr = p_cntr -> next;
X }
X end_crnt_cntr();
}
X
/*
X * Find Complete Cubic Spline Interpolation.
X */
static put_contour_cubic(p_cntr, z_level, x_min, x_max, y_min, y_max,
X contr_kind)
struct cntr_struct *p_cntr;
double z_level, x_min, x_max, y_min, y_max;
int contr_kind;
{
X int num_pts, i;
X double tx1, ty1, tx2, ty2; /* Tangents at end points. */
X struct cntr_struct *pc_temp;
X
X num_pts = count_contour(p_cntr); /* Number of points in contour. */
X
X if (num_pts > 2) { /* Take into account 3 points in tangent estimation. */
X calc_tangent(3, p_cntr -> X, p_cntr -> next -> X,
X p_cntr -> next -> next -> X,
X p_cntr -> Y, p_cntr -> next -> Y,
X p_cntr -> next -> next -> Y, &tx1, &ty1);
X pc_temp = p_cntr;
X for (i=3; i<num_pts; i++) pc_temp = pc_temp -> next;/* Go to the end.*/
X calc_tangent(3, pc_temp -> next -> next -> X,
X pc_temp -> next -> X, pc_temp -> X,
X pc_temp -> next -> next -> Y,
X pc_temp -> next -> Y, pc_temp -> Y, &tx2, &ty2);
X tx2 = (-tx2); /* Inverse the vector as we need opposite direction. */
X ty2 = (-ty2);
X }
X /* If following (num_pts > 1) is TRUE then exactly 2 points in contour. */
X else if (num_pts > 1) {/* Take into account 2 points in tangent estimat. */
X calc_tangent(2, p_cntr -> X, p_cntr -> next -> X, 0.0,
X p_cntr -> Y, p_cntr -> next -> Y, 0.0, &tx1, &ty1);
X calc_tangent(2, p_cntr -> next -> X, p_cntr -> X, 0.0,
X p_cntr -> next -> Y, p_cntr -> Y, 0.0, &tx2, &ty2);
X tx2 = (-tx2); /* Inverse the vector as we need opposite direction. */
X ty2 = (-ty2);
X }
X else return; /* Only one point (???) - ignore it. */
X
X switch (contr_kind) {
X case OPEN_CONTOUR:
X break;
X case CLOSED_CONTOUR:
X tx1 = tx2 = (tx1 + tx2) / 2.0; /* Make tangents equal. */
X ty1 = ty2 = (ty1 + ty2) / 2.0;
X break;
X }
X complete_spline_interp(p_cntr, num_pts, 0.0, 1.0, tx1, ty1, tx2, ty2);
X end_crnt_cntr();
}
X
/*
X * Find Bspline approximation for this data set.
X * Uses global variable num_approx_pts to determine number of samples per
X * interval, where the knot vector intervals are assumed to be uniform, and
X * Global variable bspline_order for the order of Bspline to use.
X */
static put_contour_bspline(p_cntr, z_level, x_min, x_max, y_min, y_max,
X contr_kind)
struct cntr_struct *p_cntr;
double z_level, x_min, x_max, y_min, y_max;
int contr_kind;
{
X int num_pts, i, order = bspline_order;
X struct cntr_struct *pc_temp;
X
X num_pts = count_contour(p_cntr); /* Number of points in contour. */
X if (num_pts < 2) return; /* Cannt do nothing if empty or one points! */
X /* Order must be less than number of points in curve - fix it if needed. */
X if (order > num_pts - 1) order = num_pts - 1;
X
X gen_bspline_approx(p_cntr, num_pts, order, contr_kind);
X end_crnt_cntr();
}
X
/*
X * Estimate the tangents according to the n last points where n might be
X * 2 or 3 (if 2 onlt x1, x2).
X */
static calc_tangent(n, x1, x2, x3, y1, y2, y3, tx, ty)
int n;
double x1, x2, x3, y1, y2, y3, *tx, *ty;
{
X double v1[2], v2[2], v1_magnitude, v2_magnitude;
X
X switch (n) {
X case 2:
X *tx = (x2 - x1) * 0.3;
X *ty = (y2 - y1) * 0.3;
X break;
X case 3:
X v1[0] = x2 - x1; v1[1] = y2 - y1;
X v2[0] = x3 - x2; v2[1] = y3 - y2;
X v1_magnitude = sqrt(sqr(v1[0]) + sqr(v1[1]));
X v2_magnitude = sqrt(sqr(v2[0]) + sqr(v2[1]));
X *tx = (v1[0] / v1_magnitude) - (v2[0] / v2_magnitude) * 0.1;
X *tx *= v1_magnitude * 0.1; /* Make tangent less than magnitude. */
X *ty = (v1[1] / v1_magnitude) - (v2[1] / v2_magnitude) * 0.1;
X *ty *= v1_magnitude * 0.1; /* Make tangent less than magnitude. */
X break;
X default: /* Should not happen! */
X (*ty) = 0.1;
X *tx = 0.1;
X break;
X }
}
X
/*
X * Free all elements in the contour list.
X */
static void free_contour(p_cntr)
struct cntr_struct *p_cntr;
{
X struct cntr_struct *pc_temp;
X
X while (p_cntr) {
X pc_temp = p_cntr;
X p_cntr = p_cntr -> next;
X free((char *) pc_temp);
X }
}
X
/*
X * Counts number of points in contour.
X */
static int count_contour(p_cntr)
struct cntr_struct *p_cntr;
{
X int count = 0;
X
X while (p_cntr) {
X count++;
X p_cntr = p_cntr -> next;
X }
X return count;
}
X
/*
X * Interpolate given point list (defined via p_cntr) using Complete
X * Spline interpolation.
X */
static complete_spline_interp(p_cntr, n, t_min, t_max, tx1, ty1, tx2, ty2)
struct cntr_struct *p_cntr;
int n;
double t_min, t_max, tx1, ty1, tx2, ty2;
{
X double dt, *tangents_x, *tangents_y;
X int i;
X
X tangents_x = (double *) alloc((unsigned) (sizeof(double) * n),
X "contour c_s_intr");
X tangents_y = (double *) alloc((unsigned) (sizeof(double) * n),
X "contour c_s_intr");
X
X if (n > 1) prepare_spline_interp(tangents_x, tangents_y, p_cntr, n,
X t_min, t_max, tx1, ty1, tx2, ty2);
X else {
X free((char *) tangents_x);
X free((char *) tangents_y);
X return;
X }
X
X dt = (t_max-t_min)/(n-1);
X
X add_cntr_point(p_cntr -> X, p_cntr -> Y); /* First point. */
X
X for (i=0; i<n-1; i++) {
X hermit_interp(p_cntr -> X, p_cntr -> Y,
X tangents_x[i], tangents_y[i],
X p_cntr -> next -> X, p_cntr -> next -> Y,
X tangents_x[i+1], tangents_y[i+1], dt);
X
X p_cntr = p_cntr -> next;
X }
X
X free((char *) tangents_x);
X free((char *) tangents_y);
}
X
/*
X * Routine to calculate intermidiate value of the Hermit Blending function:
X * This routine should be called only ONCE at the beginning of the program.
X */
static calc_hermit_table()
{
X int i;
X double t, dt;
X
X hermit_table = (table_entry *) alloc ((unsigned) (sizeof(table_entry) *
X (num_approx_pts + 1)),
X "contour hermit table");
X t = 0;
X dt = 1.0/num_approx_pts;
X for (i=0; i<=num_approx_pts; i++) {
X hermit_table[i][0] = (t-1)*(t-1)*(2*t+1); /* h00. */
X hermit_table[i][1] = t*t*(-2*t+3); /* h10. */
X hermit_table[i][2] = t*(t-1)*(t-1); /* h01. */
X hermit_table[i][3] = t*t*(t-1); /* h11. */
X t = t + dt;
X }
}
X
/*
X * Routine to generate an hermit interpolation between two points given as
X * two InterpStruct structures. Assume hermit_table is already calculated.
X * Currently the points generated are printed to stdout as two reals (X, Y).
X */
static hermit_interp(x1, y1, tx1, ty1, x2, y2, tx2, ty2, dt)
double x1, y1, tx1, ty1, x2, y2, tx2, ty2, dt;
{
X int i;
X double x, y, vec_size, tang_size;
X
X tx1 *= dt; ty1 *= dt; /* Normalize the tangents according to param. t. */
X tx2 *= dt; ty2 *= dt;
X
X /* Normalize the tangents so that their magnitude will be 1/3 of the */
X /* segment length. This tumb rule guaranteed no cusps or loops! */
X /* Note that this normalization keeps continuity to be G1 (but not C1). */
X vec_size = sqrt(sqr(x1 - x2) + sqr(y2 - y1));
X tang_size = sqrt(sqr(tx1) + sqr(ty1)); /* Normalize T1. */
X if (tang_size * 3 > vec_size) {
X tx1 *= vec_size / (tang_size * 3);
X ty1 *= vec_size / (tang_size * 3);
X }
X tang_size = sqrt(sqr(tx2) + sqr(ty2)); /* Normalize T2. */
X if (tang_size * 3 > vec_size) {
X tx2 *= vec_size / (tang_size * 3);
X ty2 *= vec_size / (tang_size * 3);
X }
X
X for (i=1; i<=num_approx_pts; i++) { /* Note we start from 1 - first */
X x = hermit_table[i][0] * x1 + /* point is not printed as it is */
X hermit_table[i][1] * x2 + /* redundent (last on last section). */
X hermit_table[i][2] * tx1 +
X hermit_table[i][3] * tx2;
X y = hermit_table[i][0] * y1 +
X hermit_table[i][1] * y2 +
X hermit_table[i][2] * ty1 +
X hermit_table[i][3] * ty2;
X add_cntr_point(x, y);
X }
}
X
/*
X * Routine to Set up the 3*N mat for solve_tri_diag routine used in the
X * Complete Spline Interpolation. Returns TRUE of calc O.K.
X * Gets the points list in p_cntr (Of length n) and with tangent vectors tx1,
X * ty1 at starting point and tx2, ty2 and end point.
X */
static prepare_spline_interp(tangents_x, tangents_y, p_cntr, n, t_min, t_max,
X tx1, ty1, tx2, ty2)
double tangents_x[], tangents_y[];
struct cntr_struct *p_cntr;
int n;
double t_min, t_max, tx1, ty1, tx2, ty2;
{
X int i;
X double *r, t, dt;
X tri_diag *m; /* The tri-diagonal matrix is saved here. */
X struct cntr_struct *p;
X
X m = (tri_diag *) alloc((unsigned) (sizeof(tri_diag) * n),
X "contour tri_diag");
X r = (double *) alloc((unsigned) (sizeof(double) * n),
X "contour tri_diag2");
X n--;
X
X p = p_cntr;
X m[0][0] = 0.0; m[0][1] = 1.0; m[0][2] = 0.0;
X m[n][0] = 0.0; m[n][1] = 1.0; m[n][2] = 0.0;
X r[0] = tx1; /* Set start tangent. */
X r[n] = tx2; /* Set end tangent. */
X t = t_min;
X dt = (t_max-t_min)/n;
X for (i=1; i<n; i++) {
X t = t + dt;
X m[i][0] = dt;
X m[i][2] = dt;
X m[i][1] = 2 * (m[i][0] + m[i][2]);
X r[i] = m[i][0] * ((p -> next -> X) - (p -> X)) / m[i][2]
X + m[i][2] * ((p -> next -> next -> X) -
X (p -> next -> X)) / m[i][0];
X r[i] *= 3.0;
X p = p -> next;
X }
X
X if (!solve_tri_diag(m, r, tangents_x, n+1)) { /* Find the X(t) tangents. */
X free((char *) m);
X free((char *) r);
X int_error("Cannt interpolate X using complete splines", NO_CARET);
X }
X
X p = p_cntr;
X m[0][0] = 0.0; m[0][1] = 1.0; m[0][2] = 0.0;
X m[n][0] = 0.0; m[n][1] = 1.0; m[n][2] = 0.0;
X r[0] = ty1; /* Set start tangent. */
X r[n] = ty2; /* Set end tangent. */
X t = t_min;
X dt = (t_max-t_min)/n;
X for (i=1; i<n; i++) {
X t = t + dt;
X m[i][0] = dt;
X m[i][2] = dt;
X m[i][1] = 2 * (m[i][0] + m[i][2]);
X r[i] = m[i][0] * ((p -> next -> Y) - (p -> Y)) / m[i][2]
X + m[i][2] * ((p -> next -> next -> Y) -
X (p -> next -> Y)) / m[i][0];
X r[i] *= 3.0;
X p = p -> next;
X }
X
X if (!solve_tri_diag(m, r, tangents_y, n+1)) { /* Find the Y(t) tangents. */
X free((char *) m);
X free((char *) r);
X int_error("Cannt interpolate Y using complete splines", NO_CARET);
X }
X free((char *) m);
X free((char *) r);
}
X
/*
X * Solve tri diagonal linear system equation. The tri diagonal matrix is
X * defined via matrix M, right side is r, and solution X i.e. M * X = R.
X * Size of system given in n. Return TRUE if solution exist.
X */
static int solve_tri_diag(m, r, x, n)
tri_diag m[];
double r[], x[];
int n;
{
X int i;
X double t;
X
X for (i=1; i<n; i++) { /* Eliminate element m[i][i-1] (lower diagonal). */
X if (m[i-1][1] == 0) return FALSE;
X t = m[i][0] / m[i-1][1]; /* Find ratio between the two lines. */
X m[i][0] = m[i][0] - m[i-1][1] * t;
X m[i][1] = m[i][1] - m[i-1][2] * t;
X r[i] = r[i] - r[i-1] * t;
X }
X /* Now do back subtitution - update the solution vector X: */
X if (m[n-1][1] == 0) return FALSE;
X x[n-1] = r[n-1] / m[n-1][1]; /* Find last element. */
X for (i=n-2; i>=0; i--) {
X if (m[i][1] == 0) return FALSE;
X x[i] = (r[i] - x[i+1] * m[i][2]) / m[i][1];
X }
X return TRUE;
}
X
/*
X * Generate a Bspline curve defined by all the points given in linked list p:
X * Algorithm: using deBoor algorithm
X * Note: if Curvekind is OPEN_CONTOUR than Open end knot vector is assumed,
X * else (CLOSED_CONTOUR) Float end knot vector is assumed.
X * It is assumed that num_of_points is at list 2, and order of Bspline is less
X * than num_of_points!
X */
static gen_bspline_approx(p_cntr, num_of_points, order, contour_kind)
struct cntr_struct *p_cntr;
int num_of_points, order, contour_kind;
{
X int i, knot_index = 0, pts_count = 1;
X double dt, t, next_t, t_min, t_max, x, y;
X struct cntr_struct *pc_temp = p_cntr, *pc_tail;
X
X /* If the contour is Closed one we must update few things: */
X /* 1. Make the list temporary circular, so we can close the contour. */
X /* 2. Update num_of_points - increase it by "order-1" so contour will be */
X /* closed. This will evaluate order more sections to close it! */
X if (contour_kind == CLOSED_CONTOUR) {
X pc_tail = p_cntr;
X while (pc_tail -> next) pc_tail = pc_tail -> next;/* Find last point.*/
X pc_tail -> next = p_cntr; /* Close contour list - make it circular.*/
X num_of_points += order;
X }
X
X /* Find first (t_min) and last (t_max) t value to eval: */
X t = t_min = fetch_knot(contour_kind, num_of_points, order, order);
X t_max = fetch_knot(contour_kind, num_of_points, order, num_of_points);
X next_t = t_min + 1.0;
X knot_index = order;
X dt = 1.0/num_approx_pts; /* Number of points per one section. */
X
X
X while (t<t_max) {
X if (t > next_t) {
X pc_temp = pc_temp -> next; /* Next order ctrl. pt. to blend. */
X knot_index++;
X next_t += 1.0;
X }
X eval_bspline(t, pc_temp, num_of_points, order, knot_index,
X contour_kind, &x, &y); /* Next pt. */
X add_cntr_point(x, y);
X pts_count++;
X /* As we might have some real number round off problems we must */
X /* test if we dont produce too many points here... */
X if (pts_count + 1 == num_approx_pts * (num_of_points - order) + 1)
X break;
X t += dt;
X }
X
X eval_bspline(t_max - EPSILON, pc_temp, num_of_points, order, knot_index,
X contour_kind, &x, &y);
X /* If from round off errors we need more than one last point: */
X for (i=pts_count; i<num_approx_pts * (num_of_points - order) + 1; i++)
X add_cntr_point(x, y); /* Complete the contour. */
X
X if (contour_kind == CLOSED_CONTOUR) /* Update list - un-circular it. */
X pc_tail -> next = NULL;
}
X
/*
X * The recursive routine to evaluate the B-spline value at point t using
X * knot vector PKList, and the control points Pdtemp. Returns x, y after the
X * division by the weight w. Note that Pdtemp points on the first control
X * point to blend with. The B-spline is of order order.
X */
static eval_bspline(t, p_cntr, num_of_points, order, j, contour_kind, x, y)
double t;
struct cntr_struct *p_cntr;
int num_of_points, order, j, contour_kind;
double *x, *y;
{
X int i, p;
X double ti, tikp, *dx, *dy; /* Copy p_cntr into it to make it faster. */
X
X dx = (double *) alloc((unsigned) (sizeof(double) * (order + j)),
X "contour b_spline");
X dy = (double *) alloc((unsigned) (sizeof(double) * (order + j)),
X "contour b_spline");
X /* Set the dx/dy - [0] iteration step, control points (p==0 iterat.): */
X for (i=j-order; i<=j; i++) {
X dx[i] = p_cntr -> X;
X dy[i] = p_cntr -> Y;
X p_cntr = p_cntr -> next;
X }
X
X for (p=1; p<=order; p++) { /* Iteration (b-spline level) counter. */
X for (i=j; i>=j-order+p; i--) { /* Control points indexing. */
X ti = fetch_knot(contour_kind, num_of_points, order, i);
X tikp = fetch_knot(contour_kind, num_of_points, order, i+order+1-p);
X if (ti == tikp) { /* Should not be a problems but how knows... */
X }
X else {
X dx[i] = dx[i] * (t - ti)/(tikp-ti) + /* Calculate x. */
X dx[i-1] * (tikp-t)/(tikp-ti);
X dy[i] = dy[i] * (t - ti)/(tikp-ti) + /* Calculate y. */
X dy[i-1] * (tikp-t)/(tikp-ti);
X }
X }
X }
X *x = dx[j]; *y = dy[j];
X free((char *) dx);
X free((char *) dy);
}
X
/*
X * Routine to get the i knot from uniform knot vector. The knot vector
X * might be float (Knot(i) = i) or open (where the first and last "order"
X * knots are equal). contour_kind determines knot kind - OPEN_CONTOUR means
X * open knot vector, and CLOSED_CONTOUR selects float knot vector.
X * Note the knot vector is not exist and this routine simulates it existance
X * Also note the indexes for the knot vector starts from 0.
X */
static double fetch_knot(contour_kind, num_of_points, order, i)
int contour_kind, num_of_points, order, i;
{
X switch (contour_kind) {
X case OPEN_CONTOUR:
X if (i <= order) return 0.0;
X else if (i <= num_of_points) return (double) (i - order);
X else return (double) (num_of_points - order);
X case CLOSED_CONTOUR:
X return (double) i;
X default: /* Should never happen */
X return 1.0;
X }
}
SHAR_EOF
echo 'File gnuplot/contour.c is complete' &&
chmod 0666 gnuplot/contour.c ||
echo 'restore of gnuplot/contour.c failed'
Wc_c="`wc -c < 'gnuplot/contour.c'`"
test 41345 -eq "$Wc_c" ||
echo 'gnuplot/contour.c: original size 41345, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/1.dat ==============
if test ! -d 'gnuplot/demo'; then
echo 'x - creating directory gnuplot/demo'
mkdir 'gnuplot/demo'
fi
if test -f 'gnuplot/demo/1.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/1.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/1.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/1.dat' &&
-20.000000 -3.041676
-19.000000 -3.036427
-18.000000 -3.030596
-17.000000 -3.024081
-16.000000 -3.016755
-15.000000 -3.008456
-14.000000 -2.998978
-13.000000 -2.988049
-12.000000 -2.975310
-11.000000 -2.960273
-10.000000 -2.942255
-9.000000 -2.920278
-8.000000 -2.892883
-7.000000 -2.857799
-6.000000 -2.811295
-5.000000 -2.746802
-4.000000 -2.651635
-3.000000 -2.498092
-2.000000 -2.214297
-1.000000 -1.570796
0.000000 0.000000
1.000000 1.570796
2.000000 2.214297
3.000000 2.498092
4.000000 2.651635
5.000000 2.746802
6.000000 2.811295
7.000000 2.857799
8.000000 2.892883
9.000000 2.920278
10.000000 2.942255
11.000000 2.960273
12.000000 2.975310
13.000000 2.988049
14.000000 2.998978
15.000000 3.008456
16.000000 3.016755
17.000000 3.024081
18.000000 3.030596
19.000000 3.036427
SHAR_EOF
chmod 0666 gnuplot/demo/1.dat ||
echo 'restore of gnuplot/demo/1.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/1.dat'`"
test 781 -eq "$Wc_c" ||
echo 'gnuplot/demo/1.dat: original size 781, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/2.dat ==============
if test -f 'gnuplot/demo/2.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/2.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/2.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/2.dat' &&
-20.000000 -6.083352
-19.000000 -6.072853
-18.000000 -6.061191
-17.000000 -6.048162
-16.000000 -6.033510
-15.000000 -6.016913
-14.000000 -5.997955
-13.000000 -5.976098
-12.000000 -5.950620
-11.000000 -5.920546
-10.000000 -5.884511
-9.000000 -5.840556
-8.000000 -5.785765
-7.000000 -5.715597
-6.000000 -5.622591
-5.000000 -5.493603
-4.000000 -5.303271
-3.000000 -4.996183
-2.000000 -4.428595
-1.000000 -3.141593
0.000000 0.000000
1.000000 3.141593
2.000000 4.428595
3.000000 4.996183
4.000000 5.303271
5.000000 5.493603
6.000000 5.622591
7.000000 5.715597
8.000000 5.785765
9.000000 5.840556
10.000000 5.884511
11.000000 5.920546
12.000000 5.950620
13.000000 5.976098
14.000000 5.997955
15.000000 6.016913
16.000000 6.033510
17.000000 6.048162
18.000000 6.061191
19.000000 6.072853
SHAR_EOF
chmod 0666 gnuplot/demo/2.dat ||
echo 'restore of gnuplot/demo/2.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/2.dat'`"
test 781 -eq "$Wc_c" ||
echo 'gnuplot/demo/2.dat: original size 781, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/3.dat ==============
if test -f 'gnuplot/demo/3.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/3.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/3.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/3.dat' &&
-20.000000 -9.125028
-19.000000 -9.109280
-18.000000 -9.091787
-17.000000 -9.072243
-16.000000 -9.050265
-15.000000 -9.025369
-14.000000 -8.996933
-13.000000 -8.964147
-12.000000 -8.925931
-11.000000 -8.880819
-10.000000 -8.826766
-9.000000 -8.760835
-8.000000 -8.678648
-7.000000 -8.573396
-6.000000 -8.433886
-5.000000 -8.240405
-4.000000 -7.954906
-3.000000 -7.494275
-2.000000 -6.642892
-1.000000 -4.712389
0.000000 0.000000
1.000000 4.712389
2.000000 6.642892
3.000000 7.494275
4.000000 7.954906
5.000000 8.240405
6.000000 8.433886
7.000000 8.573396
8.000000 8.678648
9.000000 8.760835
10.000000 8.826766
11.000000 8.880819
12.000000 8.925931
13.000000 8.964147
14.000000 8.996933
15.000000 9.025369
16.000000 9.050265
17.000000 9.072243
18.000000 9.091787
19.000000 9.109280
SHAR_EOF
chmod 0666 gnuplot/demo/3.dat ||
echo 'restore of gnuplot/demo/3.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/3.dat'`"
test 781 -eq "$Wc_c" ||
echo 'gnuplot/demo/3.dat: original size 781, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/contours.demo ==============
if test -f 'gnuplot/demo/contours.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/contours.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/contours.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/contours.demo' &&
set samples 20
set isosamples 21
set xlabel "X axis" -5,-2
set ylabel "Y axis" 4,-1
set zlabel "Z axis"
set title "3D gnu plot demo - contour plot"
set contour
splot x*y
pause -1 "Hit return to continue (1)"
set cntrparam levels 20
set title "3D gnu plot demo - contour plot (more contours)"
replot
pause -1 "Hit return to continue (2)"
set cntrparam levels 40
set title "3D gnu plot demo - contour plot (and again more contours)"
replot
pause -1 "Hit return to continue (3)"
set cntrparam levels 10
set title "3D gnu plot demo - contour plot on base grid"
set contour base
splot x**2-y**2
pause -1 "Hit return to continue (4)"
set title "3D gnu plot demo - contour plot on surface"
set contour surface
replot
pause -1 "Hit return to continue (5)"
set title "3D gnu plot demo - contour plot on both"
set contour both
replot
pause -1 "Hit return to continue (6)"
set contour base
set title "3D gnu plot demo - 2 surfaces
splot x**2*y**3, x**3*y**2
pause -1 "Hit return to continue (7)"
set title "3D gnu plot demo - some more interesting contours"
splot x*y / (x**2 + y**2 + 0.1)
pause -1 "Hit return to continue (8)"
splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
pause -1 "Hit return to continue (9)"
set zrange [-0.5:0.5]
replot
pause -1 "Hit return to continue (10)"
set samples 6
set isosamples 6
set cntrparam levels 5
set title "3D gnu plot demo - low resolution (6x6)"
replot
pause -1 "Hit return to continue (11)"
set cntrparam bspline
set title "3D gnu plot demo - low resolution (6x6) using bspline approx."
replot
pause -1 "Hit return to continue (12)"
set cntrparam order 8
set title "3D gnu plot demo - low resolution (6x6) raise bspline order."
replot
pause -1 "Hit return to continue (13)"
set cntrparam linear
set auto
set title "3D gnu plot demo - low resolution (6x6) using linear contours."
splot x*y
pause -1 "Hit return to continue (14)"
set cntrparam order 4
set cntrparam bspline
set title "3D gnu plot demo - low resolution (6x6) using bspline approx."
replot
pause -1 "Hit return to continue (15)"
set samples 25
set isosamples 26
set title "3D gnu plot demo - contour of Sinc function"
splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
pause -1 "Hit return to continue (16)"
splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
pause -1 "Hit return to continue (17)"
set cntrparam levels 10
set xrange [0:15]
set yrange [0:15]
set auto
set zrange [-0.6:0.6]
set data style lines
set title "3D gnu plot demo - contour of data grid plotting"
set parametric
splot "glass.dat"
pause -1 "Hit return to continue (18)"
set zrange [-1.2:1.2]
set noparametric
splot "glass.dat" using 1
pause -1 "Hit return to continue (19)"
set view 0,0,1
set nosurface
set title "3D gnu plot demo - 2D contour projection of last plot"
replot
pause -1 "Hit return to continue (20)"
X
X
#
# Clean up:
#
set surface
set nocontour
set cntrparam levels 5
set cntrparam linear
set samples 100
set isosamples 10
set view 60,30,1,1
set xrange [-10:10]
set yrange [-10:10]
set zrange [-10:10]
set auto
set title "" 0,0
set xlabel "" 0,0
set ylabel "" 0,0
set zlabel "" 0,0
SHAR_EOF
chmod 0644 gnuplot/demo/contours.demo ||
echo 'restore of gnuplot/demo/contours.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/contours.demo'`"
test 3088 -eq "$Wc_c" ||
echo 'gnuplot/demo/contours.demo: original size 3088, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/controls.demo ==============
if test -f 'gnuplot/demo/controls.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/controls.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/controls.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/controls.demo' &&
#
# warning: this demo is SLOW on PCs without math coprocessors!
#
# From _Automatic_Control_Systems_, fourth ed., figure 6-14
# transient response of a second-order system to a unit step input function
#
damp(t) = exp(-s*wn*t)/sqrt(1.0-s*s)
per(t) = sin(wn*sqrt(1.0-s**2)*t - atan(-sqrt(1.0-s**2)/s))
c(t) = 1-damp(t)*per(t)
#
# wn is natural undamped frequency
# s is damping factor
#
wn = 1.0
set xrange [0:13]
set samples 50
set dummy t
#
# plot c(t) for several different damping factors s
#
plot s=.1,c(t),s=.3,c(t),s=.5,c(t),s=.7,c(t),s=.9,c(t),s=1.0,c(t),s=1.5,c(t),s=2.0,c(t)
pause -1 "Hit return to continue"
X
# undo what we have done
set xrange [-10:10]
set autoscale xy
set samples 160
set dummy x
X
SHAR_EOF
chmod 0666 gnuplot/demo/controls.demo ||
echo 'restore of gnuplot/demo/controls.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/controls.demo'`"
test 712 -eq "$Wc_c" ||
echo 'gnuplot/demo/controls.demo: original size 712, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/electron.demo ==============
if test -f 'gnuplot/demo/electron.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/electron.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/electron.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/electron.demo' &&
# Electronics demo
#
# Bipolar Transistor (NPN) Mutual Characteristic
Ie(Vbe)=Ies*exp(Vbe/kT_q)
Ic(Vbe)=alpha*Ie(Vbe)+Ico
alpha = 0.99
Ies = 4e-14
Ico = 1e-09
kT_q = 0.025
set dummy Vbe
set grid
set offsets
set nolog
set nopolar
set samples 160
set title "Mutual Characteristic of a Transistor"
set xlabel "Vbe (base emmitter voltage)"
set xrange [0 : 0.75]
set ylabel "Ic (collector current)"
set yrange [0 : 0.005]
set key .2,.0045
set format y "%.4f"
plot Ic(Vbe)
set format "%g"
X
pause -1 "Hit return to continue"
X
# Junction Field Effect Transistor (JFET) Mutual Characteristic
# drain current above pinch off
Ida(Vd)=Ido*(1-Vg/Vp)**2
# drain current below pinch off
Idb(Vd)=Ido*(2*Vd*(Vg-Vp)-Vd*Vd)/(Vp*Vp)
# drain current
Id(Vd)= (Vd>Vg-Vp) ? Ida(Vd) : Idb(Vd)
# drain current at zero gate voltage
Ido = 2.5
# pinch off voltage
Vp = -1.25
# gate voltage
Vg = 0
set dummy Vd
set nogrid
set nokey
set offsets 0, 1, 0, 0
set title "JFET Mutual Characteristic"
set xlabel "Drain voltage Vd (V)"
set xrange [0 : 4]
set ylabel "Drain current Id (mA)"
set yrange [0 : 5]
set label "-0.5 Vp" at 4.1,0.625
set label "-0.25 Vp" at 4.1,1.4
set label "0" at 4.1,2.5
set label "Vg = 0.5 Vp" at 4.1,3.9
plot Vg=0.5*Vp,Id(Vd),Vg=0.25*Vp,Id(Vd),Vg=0,Id(Vd),Vg=-0.25*Vp,Id(Vd)
set nolabel
X
pause -1 "Hit return to continue"
X
# amplitude frequency response
A(jw) = ({0,1}*jw/({0,1}*jw+p1)) * (1/(1+{0,1}*jw/p2))
p1 = 10
p2 = 10000
set dummy jw
set grid
set key
set logscale xy
set offsets 0, 0, 0, 0
set title "Amplitude Frequency Response"
set xlabel "jw (radians)"
set xrange [1.1 : 90000.0]
set ylabel "magnitude of A(jw)"
set autoscale y
plot abs(A(jw))
X
pause -1 "Hit return to continue"
X
# phase frequency response
set nolog y
set logscale x
set title "Phase Frequency Response"
set ylabel "Phase of A(jw) (degrees)"
plot 180/pi*arg(A(jw))
X
pause -1 "Hit return to continue"
X
# undo what we've done
set dummy x
set nogrid
set offsets 0,0,0,0
set title ""
set ylabel ""
set xlabel ""
set xrange [-10:10]
set autoscale xy
set key
set format xy "%g"
set nolabel
set nolog
SHAR_EOF
chmod 0666 gnuplot/demo/electron.demo ||
echo 'restore of gnuplot/demo/electron.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/electron.demo'`"
test 2065 -eq "$Wc_c" ||
echo 'gnuplot/demo/electron.demo: original size 2065, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/glass.dat ==============
if test -f 'gnuplot/demo/glass.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/glass.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/glass.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/glass.dat' &&
#
# 16x16 grid Glass shape. Created Using DRAWFN3D, Gershon Elber 1990.
#
X 0.568000 0.000000 -0.911000
X 0.518894 0.231026 -0.911000
X 0.380066 0.422106 -0.911000
X 0.175522 0.540200 -0.911000
X -0.059372 0.564888 -0.911000
X -0.284000 0.491902 -0.911000
X -0.459522 0.333862 -0.911000
X -0.555588 0.118094 -0.911000
X -0.555588 -0.118094 -0.911000
X -0.459522 -0.333862 -0.911000
X -0.284000 -0.491902 -0.911000
X -0.059372 -0.564888 -0.911000
X 0.175522 -0.540200 -0.911000
X 0.380066 -0.422106 -0.911000
X 0.518894 -0.231027 -0.911000
X 0.568000 -0.000000 -0.911000
X
X 0.341741 0.000000 -0.905215
X 0.312196 0.138999 -0.905215
X 0.228669 0.253963 -0.905215
X 0.105604 0.325015 -0.905215
X -0.035722 0.339869 -0.905215
X -0.170870 0.295956 -0.905215
X -0.276474 0.200870 -0.905215
X -0.334273 0.071052 -0.905215
X -0.334273 -0.071052 -0.905215
X -0.276474 -0.200870 -0.905215
X -0.170871 -0.295956 -0.905215
X -0.035722 -0.339869 -0.905215
X 0.105604 -0.325015 -0.905215
X 0.228669 -0.253963 -0.905215
X 0.312196 -0.138999 -0.905215
X 0.341741 -0.000000 -0.905215
X
X 0.212153 0.000000 -0.863178
X 0.193812 0.086290 -0.863178
X 0.141958 0.157661 -0.863178
X 0.065559 0.201770 -0.863178
X -0.022176 0.210991 -0.863178
X -0.106077 0.183730 -0.863178
X -0.171636 0.124701 -0.863178
X -0.207517 0.044109 -0.863178
X -0.207517 -0.044109 -0.863178
X -0.171636 -0.124701 -0.863178
X -0.106077 -0.183730 -0.863178
X -0.022176 -0.210991 -0.863178
X 0.065559 -0.201770 -0.863178
X 0.141958 -0.157661 -0.863178
X 0.193812 -0.086291 -0.863178
X 0.212153 -0.000000 -0.863178
X
X 0.138097 0.000000 -0.764660
X 0.126157 0.056169 -0.764660
X 0.092405 0.102626 -0.764660
X 0.042674 0.131338 -0.764660
X -0.014435 0.137340 -0.764660
X -0.069048 0.119595 -0.764660
X -0.111722 0.081171 -0.764660
X -0.135079 0.028712 -0.764660
X -0.135079 -0.028712 -0.764660
X -0.111722 -0.081171 -0.764660
X -0.069048 -0.119595 -0.764660
X -0.014435 -0.137340 -0.764660
X 0.042674 -0.131338 -0.764660
X 0.092405 -0.102626 -0.764660
X 0.126157 -0.056169 -0.764660
X 0.138097 -0.000000 -0.764660
X
X 0.098588 0.000000 -0.618872
X 0.090065 0.040099 -0.618872
X 0.065968 0.073265 -0.618872
X 0.030465 0.093763 -0.618872
X -0.010305 0.098048 -0.618872
X -0.049294 0.085380 -0.618872
X -0.079760 0.057949 -0.618872
X -0.096434 0.020498 -0.618872
X -0.096434 -0.020498 -0.618872
X -0.079760 -0.057949 -0.618872
X -0.049294 -0.085380 -0.618872
X -0.010305 -0.098048 -0.618872
X 0.030465 -0.093763 -0.618872
X 0.065968 -0.073265 -0.618872
X 0.090065 -0.040099 -0.618872
X 0.098588 -0.000000 -0.618872
X
X 0.084164 0.000000 -0.452254
X 0.076887 0.034232 -0.452254
X 0.056317 0.062546 -0.452254
X 0.026008 0.080044 -0.452254
X -0.008798 0.083703 -0.452254
X -0.042082 0.072888 -0.452254
X -0.068090 0.049470 -0.452254
X -0.082325 0.017499 -0.452254
X -0.082325 -0.017499 -0.452254
X -0.068090 -0.049470 -0.452254
X -0.042082 -0.072888 -0.452254
X -0.008798 -0.083703 -0.452254
X 0.026008 -0.080045 -0.452254
X 0.056317 -0.062546 -0.452254
X 0.076887 -0.034233 -0.452254
X 0.084164 -0.000000 -0.452254
X
X 0.092386 0.000000 -0.291706
X 0.084399 0.037577 -0.291706
X 0.061819 0.068656 -0.291706
X 0.028549 0.087865 -0.291706
X -0.009657 0.091880 -0.291706
X -0.046193 0.080009 -0.291706
X -0.074742 0.054303 -0.291706
X -0.090368 0.019208 -0.291706
X -0.090368 -0.019208 -0.291706
X -0.074742 -0.054303 -0.291706
X -0.046193 -0.080009 -0.291706
X -0.009657 -0.091880 -0.291706
X 0.028549 -0.087865 -0.291706
X 0.061819 -0.068656 -0.291706
X 0.084399 -0.037577 -0.291706
X 0.092386 -0.000000 -0.291706
X
X 0.124988 0.000000 -0.153861
X 0.114183 0.050837 -0.153861
X 0.083634 0.092885 -0.153861
X 0.038624 0.118871 -0.153861
X -0.013065 0.124304 -0.153861
X -0.062494 0.108243 -0.153861
X -0.101118 0.073466 -0.153861
X -0.122257 0.025987 -0.153861
X -0.122257 -0.025987 -0.153861
X -0.101118 -0.073466 -0.153861
X -0.062494 -0.108243 -0.153861
X -0.013065 -0.124304 -0.153861
X 0.038624 -0.118871 -0.153861
X 0.083634 -0.092885 -0.153861
X 0.114183 -0.050837 -0.153861
X 0.124988 -0.000000 -0.153861
X
X 0.185015 0.000000 -0.041791
X 0.169020 0.075253 -0.041791
X 0.123799 0.137493 -0.041791
X 0.057173 0.175960 -0.041791
X -0.019339 0.184002 -0.041791
X -0.092508 0.160228 -0.041791
X -0.149681 0.108749 -0.041791
X -0.180972 0.038467 -0.041791
X -0.180972 -0.038467 -0.041791
X -0.149681 -0.108749 -0.041791
X -0.092508 -0.160228 -0.041791
X -0.019339 -0.184002 -0.041791
X 0.057173 -0.175960 -0.041791
X 0.123799 -0.137493 -0.041791
X 0.169020 -0.075253 -0.041791
X 0.185015 -0.000000 -0.041791
X
X 0.273264 0.000000 0.053395
X 0.249639 0.111146 0.053395
X 0.182849 0.203075 0.053395
X 0.084443 0.259889 0.053395
X -0.028564 0.271767 0.053395
X -0.136632 0.236653 0.053395
X -0.221075 0.160620 0.053395
X -0.267292 0.056815 0.053395
X -0.267292 -0.056815 0.053395
X -0.221075 -0.160620 0.053395
X -0.136632 -0.236653 0.053395
X -0.028564 -0.271767 0.053395
X 0.084443 -0.259889 0.053395
X 0.182849 -0.203075 0.053395
X 0.249639 -0.111146 0.053395
X 0.273264 -0.000000 0.053395
X
X 0.384384 0.000000 0.149114
X 0.351152 0.156343 0.149114
X 0.257203 0.285653 0.149114
X 0.118781 0.365570 0.149114
X -0.040179 0.382278 0.149114
X -0.192192 0.332886 0.149114
X -0.310973 0.225935 0.149114
X -0.375984 0.079918 0.149114
X -0.375984 -0.079918 0.149114
X -0.310973 -0.225935 0.149114
X -0.192192 -0.332886 0.149114
X -0.040179 -0.382278 0.149114
X 0.118781 -0.365571 0.149114
X 0.257203 -0.285653 0.149114
X 0.351152 -0.156343 0.149114
X 0.384384 -0.000000 0.149114
X
X 0.504089 0.000000 0.267473
X 0.460508 0.205031 0.267473
X 0.337301 0.374611 0.267473
X 0.155772 0.479417 0.267473
X -0.052692 0.501327 0.267473
X -0.252044 0.436554 0.267473
X -0.407816 0.296296 0.267473
X -0.493073 0.104806 0.267473
X -0.493073 -0.104806 0.267473
X -0.407816 -0.296296 0.267473
X -0.252044 -0.436554 0.267473
SHAR_EOF
true || echo 'restore of gnuplot/demo/glass.dat failed'
fi
echo 'End of part 5'
echo 'File gnuplot/demo/glass.dat is continued in part 6'
echo 6 > _shar_seq_.tmp
#!/bin/sh
# this is Part.06 (part 6 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/demo/glass.dat continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 6; 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/demo/glass.dat'
else
echo 'x - continuing file gnuplot/demo/glass.dat'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/demo/glass.dat' &&
X -0.052692 -0.501327 0.267473
X 0.155772 -0.479417 0.267473
X 0.337301 -0.374611 0.267473
X 0.460508 -0.205031 0.267473
X 0.504089 -0.000000 0.267473
X
X 0.609609 0.000000 0.430046
X 0.556906 0.247950 0.430046
X 0.407908 0.453028 0.430046
X 0.188380 0.579773 0.430046
X -0.063721 0.606270 0.430046
X -0.304805 0.527937 0.430046
X -0.493184 0.358319 0.430046
X -0.596288 0.126745 0.430046
X -0.596288 -0.126745 0.430046
X -0.493184 -0.358319 0.430046
X -0.304805 -0.527937 0.430046
X -0.063722 -0.606270 0.430046
X 0.188380 -0.579773 0.430046
X 0.407908 -0.453028 0.430046
X 0.556906 -0.247951 0.430046
X 0.609609 -0.000000 0.430046
X
X 0.675154 0.000000 0.647779
X 0.616784 0.274610 0.647779
X 0.451766 0.501737 0.647779
X 0.208634 0.642110 0.647779
X -0.070573 0.671455 0.647779
X -0.337577 0.584700 0.647779
X -0.546211 0.396846 0.647779
X -0.660400 0.140372 0.647779
X -0.660400 -0.140372 0.647779
X -0.546211 -0.396845 0.647779
X -0.337577 -0.584700 0.647779
X -0.070573 -0.671455 0.647779
X 0.208634 -0.642110 0.647779
X 0.451766 -0.501737 0.647779
X 0.616784 -0.274610 0.647779
X 0.675154 -0.000000 0.647779
X
X 0.681825 0.000000 0.900691
X 0.622878 0.277323 0.900691
X 0.456230 0.506695 0.900691
X 0.210696 0.648454 0.900691
X -0.071270 0.678090 0.900691
X -0.340913 0.590478 0.900691
X -0.551608 0.400767 0.900691
X -0.666926 0.141760 0.900691
X -0.666926 -0.141759 0.900691
X -0.551608 -0.400767 0.900691
X -0.340913 -0.590478 0.900691
X -0.071270 -0.678090 0.900691
X 0.210695 -0.648454 0.900691
X 0.456230 -0.506695 0.900691
X 0.622878 -0.277324 0.900691
X 0.681825 -0.000000 0.900691
X
X 0.626000 0.000000 1.101000
X 0.571879 0.254617 1.101000
X 0.418876 0.465209 1.101000
X 0.193445 0.595361 1.101000
X -0.065435 0.622571 1.101000
X -0.313000 0.542132 1.101000
X -0.506445 0.367954 1.101000
X -0.612320 0.130153 1.101000
X -0.612320 -0.130153 1.101000
X -0.506445 -0.367953 1.101000
X -0.313000 -0.542132 1.101000
X -0.065435 -0.622571 1.101000
X 0.193444 -0.595361 1.101000
X 0.418876 -0.465209 1.101000
X 0.571879 -0.254617 1.101000
X 0.626000 -0.000000 1.101000
X
SHAR_EOF
echo 'File gnuplot/demo/glass.dat is complete' &&
chmod 0666 gnuplot/demo/glass.dat ||
echo 'restore of gnuplot/demo/glass.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/glass.dat'`"
test 8538 -eq "$Wc_c" ||
echo 'gnuplot/demo/glass.dat: original size 8538, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/param.demo ==============
if test -f 'gnuplot/demo/param.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/param.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/param.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/param.demo' &&
#
# Show some of the new parametric capabilities.
#
set parametric
set dummy t
set autoscale
set samples 160
set title ""
plot t,sin(t)/t title "t,sin(t)/t or sin(x)/x"
pause -1 "Hit return to continue"
X
plot sin(t)/t,t
pause -1 "Hit return to continue"
X
plot sin(t),cos(t)
pause -1 "Hit return to continue"
X
set xrange [-3:3]
set yrange [-3:3]
set title "Parametric Conic Sections"
plot -t,t,cos(t),cos(2*t),2*cos(t),sin(t),-cosh(t),sinh(t)
set title ""
pause -1 "Hit return to continue"
X
set xrange [-5:5]
set yrange [-5:5]
plot tan(t),t,t,tan(t)
pause -1 "Hit return to continue"
X
set trange [-3:3]
plot t,log(t),-t,log(t),sin(t),t**2
pause -1 "Hit return to continue"
X
set autoscale x
set yrange [-1.5:1.5]
set trange [0:10*pi]
plot sin(t)/t,cos(t)/t
pause -1 "Hit return to continue"
X
# undo what we've done above
set noparametric
set samples 160
set autoscale xy
set title ""
set offset 0,0,0,0
set key
SHAR_EOF
chmod 0666 gnuplot/demo/param.demo ||
echo 'restore of gnuplot/demo/param.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/param.demo'`"
test 909 -eq "$Wc_c" ||
echo 'gnuplot/demo/param.demo: original size 909, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/polar.demo ==============
if test -f 'gnuplot/demo/polar.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/polar.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/polar.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/polar.demo' &&
#
# Show some of the new polar capabilities.
#
set polar
set dummy x
set samples 160
set xrange [0:2*pi]
set title "Three circles (with aspect ratio distortion)"
plot .5,1,1.5
pause -1 "Hit return to continue"
set title ""
X
plot cos(2*x)
pause -1 "Hit return to continue"
X
plot 2*sqrt(cos(x)),-2*sqrt(cos(x))
pause -1 "Hit return to continue"
X
set offset pi/4,pi/4,0,0
plot sin(4*x),cos(4*x)
set offset 0,0,0,0
pause -1 "Hit return to continue"
X
set yrange [-5:5]
plot x/cos(3*x)
pause -1 "Hit return to continue"
set autoscale
X
plot 1-sin(x)
pause -1 "Hit return to continue"
X
set xrange [0:12*pi]
plot 2*x
pause -1 "Hit return to continue"
X
butterfly(x)=exp(cos(x))-2*cos(4*x)+sin(x/12)**5
set samples 800
pause 0 "This is a big one (many samples), be patient..."
set title "Butterfly"
set nokey
plot butterfly(x)
pause -1 "Hit return to continue"
X
# undo what we've done above
set nopolar
set samples 160
set autoscale xy
set title ""
set offset 0,0,0,0
set key
SHAR_EOF
chmod 0666 gnuplot/demo/polar.demo ||
echo 'restore of gnuplot/demo/polar.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/polar.demo'`"
test 965 -eq "$Wc_c" ||
echo 'gnuplot/demo/polar.demo: original size 965, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/simple.demo ==============
if test -f 'gnuplot/demo/simple.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/simple.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/simple.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/simple.demo' &&
#
# Requires data files "[123].dat" from this directory,
# so change current working directory to this directory before running.
# gnuplot> set term <term-type>
# gnuplot> load 'simple.demo'
#
set samples 50
plot [-10:10] sin(x),atan(x),cos(atan(x))
pause -1 "Hit return to continue"
X
set samples 100
plot [-pi/2:pi] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1))
pause -1 "Hit return to continue"
X
set samples 200
plot [-3:5] asin(x),acos(x)
pause -1 "Hit return to continue"
X
plot [-30:20] besj0(x)*0.12e1 with impulses, (x**besj0(x))-2.5 with points
pause -1 "Hit return to continue"
X
set samples 400
plot [-10:10] real(sin(x)**besj0(x))
pause -1 "Hit return to continue"
X
plot [-5*pi:5*pi] [-5:5] real(tan(x)/atan(x)), 1/x
pause -1 "Hit return to continue"
X
set autoscale
set samples 800
plot [-30:20] sin(x*20)*atan(x)
pause -1 "Hit return to continue"
X
plot [-19:19] '1.dat'with impulses ,'2.dat' ,'3.dat' with lines
pause -1 "Hit return to continue"
X
# undo what we have done above
set samples 160
set xrange [-10:10]
set autoscale xy
SHAR_EOF
chmod 0666 gnuplot/demo/simple.demo ||
echo 'restore of gnuplot/demo/simple.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/simple.demo'`"
test 1045 -eq "$Wc_c" ||
echo 'gnuplot/demo/simple.demo: original size 1045, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/surface1.demo ==============
if test -f 'gnuplot/demo/surface1.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/surface1.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/surface1.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/surface1.demo' &&
set samples 21
set isosample 11
set xlabel "X axis" -3,-2
set ylabel "Y axis" 3,-2
set zlabel "Z axis" -5
set title "3D gnu plot demo"
set label 1 "This is the surface boundary" at -20,-5,210
set arrow 1 from -10,-5,220 to -10,0,0 nohead
set arrow 2 from -10,-5,220 to 10,0,0 nohead
set arrow 3 from -10,-5,220 to 0,10,0 nohead
set arrow 4 from -10,-5,220 to 0,-10,0 nohead
splot x*y
pause -1 "Hit return to continue (1)"
set noarrow
set nolabel
set grid
splot x**2+y**2, x**2-y**2
pause -1 "Hit return to continue (2)"
rep x*y
pause -1 "Hit return to continue (3)"
rep (x**3+y**3)/10
pause -1 "Hit return to continue (4)"
set ticslevel 0.0
set title "3D gnu plot demo ( ticslevel = 0.0 )"
rep
pause -1 "Hit return to continue (5)"
set ticslevel 2.0
set title "3D gnu plot demo ( ticslevel = 2.0 )"
rep
pause -1 "Hit return to continue (6)"
set ticslevel 0.5
set title "3D gnu plot demo ( ticslevel = 0.5 )"
rep
pause -1 "Hit return to continue (7)"
set title "3D gnu plot demo"
set nogrid
splot x*y with points
pause -1 "Hit return to continue (8)"
set noxtics
set noytics
set xrange [-1:1]
set yrange [-1:1]
set title "Surfaces with no grid or tics"
splot x*y with lines, x**2*y**3 with dots, x**3*y*2 with points
pause -1 "Hit return to continue (9)"
set xtics ("low" -3, "mid" 0, "high" 3)
set ytics -2,0.5,2
set xrange [-3:3]
set yrange [-3:3]
set log z
set title "Surfaces with z log scale"
splot x**2*y**2 + 2, x**2*y**4 + 2, x**4*y**2 + 2
pause -1 "Hit return to continue (10)"
set nolog z
set xtics
set ytics
set xrange [-1:1]
set yrange [-1:1]
set samples 51
set isosample 21
set dummy u,v
set title "3D gnu plot demo"
splot u*v / (u**2 + v**2 + 0.1)
pause -1 "Hit return to continue (11)"
splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
pause -1 "Hit return to continue (12)"
set zrange [-0.35:0.35]
replot
pause -1 "Hit return to continue (13)"
set title "Sinc function"
set label 1 "This is equal to 1" at -5,-2,0.75 right
set arrow 1 from -5,-2.1,0.75 to 0,0,1
sinc(u,v) = sin(sqrt(u**2+v**2)) / sqrt(u**2+v**2)
splot [-5:5.01] [-5:5.01] sinc(u,v)
pause -1 "Hit return to continue (14)"
set view 70,20,1
set zrange [-0.5:1.0]
set ztics -1,0.25,1
set label 1 "This is equal to 1" at -5,-2,1.5 centre
set arrow 1 from -5,-2.1,1.4 to 0,0,1
splot [-12:12.01] [-12:12.01] sinc(u,v)
pause -1 "Hit return to continue (15)"
set noarrow
set ztics
set nolabel
set log
set auto
set title "This has logarithmic scale"
splot [x=1:15] [y=1:15] x**2+y**2
pause -1 "Hit return to continue (16)"
set nolog
set xrange [0:15]
set yrange [0:15]
set auto
set zrange [-0.6:0.6]
set data style lines
set title "Data grid plotting"
set parametric
splot "glass.dat"
pause -1 "Hit return to continue (17)"
splot "glass.dat" using 3:2:1
pause -1 "Hit return to continue (18)"
set zrange [-1.2:1.2]
set noparametric
splot "glass.dat" using 1, "glass.dat" using 2, "glass.dat" using 3
pause -1 "Hit return to continue (19)"
X
#
# Clean up:
#
set samples 100
set isosamples 10
set view 60,30,1,1
set xrange [-10:10]
set yrange [-10:10]
set zrange [-10:10]
set auto
set title "" 0,0
set xlabel "" 0,0
set ylabel "" 0,0
set zlabel "" 0,0
SHAR_EOF
chmod 0644 gnuplot/demo/surface1.demo ||
echo 'restore of gnuplot/demo/surface1.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/surface1.demo'`"
test 3111 -eq "$Wc_c" ||
echo 'gnuplot/demo/surface1.demo: original size 3111, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/surface2.demo ==============
if test -f 'gnuplot/demo/surface2.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/surface2.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/surface2.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/surface2.demo' &&
set parametric
set samples 50
X
set title "Parametric Sphere"
set urange [-pi/2:pi/2]
set vrange [0:2*pi]
set zrange [-1:1]
set ztics -1.0,0.25,1.0
set view ,,,2.5
splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
pause -1 "Hit return to continue (1)"
X
set view ,,,0.8
replot
pause -1 "Hit return to continue (2)"
X
set view ,,,1.6
replot
pause -1 "Hit return to continue (3)"
X
set view ,,,1.0
X
set title "Parametric Torus"
set urange [0:2*pi]
set vrange [0:2*pi]
splot (1-0.2*cos(v))*cos(u),(1-0.2*cos(v))*sin(u),0.2*sin(v)
pause -1 "Hit return to continue (4)"
X
set title "Parametric Hexagon"
set urange [-1.3:1.3]
set vrange [0:2*pi]
set zrange [-0.6:0.6]
set ztics
splot cos(v)**3*cos(u)**3,sin(v)**3*cos(u)**3,sin(u)**3
pause -1 "Hit return to continue (5)"
X
set title "Parametric Helix"
set samples 100
set urange [0:10*pi]
set vrange [0:2*pi]
set zrange [-0.6:0.6]
splot (1-0.1*cos(v))*cos(u),(1-0.1*cos(v))*sin(u),0.1*(sin(v)+u/1.7-10)
pause -1 "Hit return to continue (6)"
X
set title "Parametric Shell"
set samples 40
set view 50,30,1.0
set urange [0:2*pi]
set vrange [0:2*pi]
set zrange [-3:1.5]
splot cos(u)*u*(1+cos(v)/2),sin(v)*u/2,sin(u)*u*(1+cos(v)/2)
pause -1 "Hit return to continue (7)"
X
#
# Clean up:
#
set noparametric
set dummy x,y
set samples 100
set view 60,30,1,1
set urange [-5:5]
set vrange [-5:5]
set zrange [-10:10]
set auto
set title "" 0,0
SHAR_EOF
chmod 0644 gnuplot/demo/surface2.demo ||
echo 'restore of gnuplot/demo/surface2.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/surface2.demo'`"
test 1359 -eq "$Wc_c" ||
echo 'gnuplot/demo/surface2.demo: original size 1359, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/using.dat ==============
if test -f 'gnuplot/demo/using.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/using.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/using.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/using.dat' &&
891101 00 1.00 14 8.6 94.0
891101 01 1.04 10 17.5 94.4
891101 02 1.08 9 9.7 97.1
891101 03 1.13 9 10.1 94.3
891101 04 1.17 9 5.7 98.3
891101 05 1.21 8 8.1 99.7
891101 06 1.25 7 3.2 99.6
891101 07 1.29 6 2.5 99.8
891101 08 1.33 20 2.3 99.4
891101 09 1.38 30 3.5 96.1
891101 10 1.42 37 7.7 96.4
891101 11 1.46 36 9.8 97.4
891101 12 1.50 30 8.8 97.4
891101 13 1.54 32 9.1 96.5
891101 14 1.58 37 6.3 97.0
891101 15 1.63 35 6.1 97.3
891101 16 1.67 41 8.6 97.2
891101 17 1.71 28 7.6 97.3
891101 18 1.75 16 4.3 97.6
891101 19 1.79 21 4.2 97.5
891101 20 1.83 20 5.6 96.9
891101 21 1.88 24 6.6 96.2
891101 22 1.92 19 5.8 97.1
891101 23 1.96 16 7.4 97.1
891102 00 2.00 13 7.4 96.4
891102 01 2.04 8 6.6 95.6
891102 02 2.08 6 7.4 94.1
891102 03 2.13 6 6.4 95.9
891102 04 2.17 7 6.4 95.5
891102 05 2.21 6 6.7 95.5
891102 06 2.25 6 6.3 94.6
891102 07 2.29 7 6.5 93.1
891102 08 2.33 15 6.5 92.8
891102 09 2.38 22 7.2 93.2
891102 10 2.42 31 9.1 93.9
891102 11 2.46 37 11.0 95.6
891102 12 2.50 40 9.8 98.7
891102 13 2.54 45 9.5 97.3
891102 14 2.58 46 11.4 98.5
891102 15 2.63 46 11.9 99.1
891102 16 2.67 43 13.0 98.8
891102 17 2.71 28 14.5 99.1
891102 18 2.75 25 13.4 99.1
891102 19 2.79 24 9.9 99.7
891102 20 2.83 25 8.1 99.5
891102 21 2.88 24 10.3 99.4
891102 22 2.92 24 12.0 98.7
891102 23 2.96 23 18.2 98.7
891103 00 3.00 20 16.8 99.0
891103 01 3.04 16 14.8 99.2
891103 02 3.08 17 15.5 98.0
891103 03 3.13 17 14.4 99.4
891103 04 3.17 16 14.4 99.4
891103 05 3.21 14 11.3 99.4
891103 06 3.25 13 8.0 99.7
891103 07 3.29 13 6.1 99.9
891103 08 3.33 18 6.4 99.8
891103 09 3.38 31 6.5 98.9
891103 10 3.42 39 7.5 99.0
891103 11 3.46 37 9.1 98.8
891103 12 3.50 33 9.0 99.2
891103 13 3.54 40 10.4 98.7
891103 14 3.58 45 12.9 98.3
891103 15 3.63 45 13.8 98.5
891103 16 3.67 37 16.1 98.9
891103 17 3.71 29 16.0 99.3 57
891103 18 3.75 21 17.4 97.9 55
891103 19 3.79 14 14.6 97.7
891103 20 3.83 11 14.3 97.8 57
891103 21 3.88 15 14.7 96.2 59
891103 22 3.92 10 12.8 95.1 57
891103 23 3.96 8 10.2 97.6
891104 00 4.00 6 7.3 98.6
891104 01 4.04 4 4.7 99.8
891104 02 4.08 3 3.4 98.0
891104 03 4.13 4 2.9 99.6
891104 04 4.17 4 2.1 99.8
891104 05 4.21 4 11.7 99.9
891104 06 4.25 4 4.5 99.9
891104 07 4.29 4 1.6 88.4
891104 08 4.33 4 1.3 65.2
891104 09 4.38 7 1.4 71.4
891104 10 4.42 9 1.3 70.7
891104 11 4.46 14 8.1 99.5
891104 12 4.50 12 4.2 75.3
891104 13 4.54 18 10.9 95.3
891104 14 4.58 16 7.1 87.6
891104 15 4.63 18 3.3 98.9
891104 16 4.67 15 3.4 99.6
891104 17 4.71 8 2.4 99.9
891104 18 4.75 8 2.2 99.8
891104 19 4.79 11 2.2 99.7
891104 20 4.83 14 2.3 99.7
891104 21 4.88 13 2.5 99.7
891104 22 4.92 10 3.1 99.8
891104 23 4.96 12 4.5 99.7
891105 00 5.00 9 4.8 99.7
891105 01 5.04 8 4.9 99.8
891105 02 5.08 5 5.7 97.5
891105 03 5.13 5 5.2 97.6
891105 04 5.17 4 3.3 85.9
891105 05 5.21 5 1.2 71.4
891105 06 5.25 5 1.1 61.8
891105 07 5.29 5 1.0 71.8
891105 08 5.33 5 1.0 55.7
891105 09 5.38 6 1.0 62.2
891105 10 5.42 7 1.1 61.9
891105 11 5.46 9 1.4 65.6
891105 12 5.50 14 2.8 99.6
891105 13 5.54 16 2.1 94.0
891105 14 5.58 16 2.2 85.1
891105 15 5.63 17 2.5 99.7
891105 16 5.67 19 2.2 90.8
891105 17 5.71 16 1.5 61.3
891105 18 5.75 12 1.6 71.8
891105 19 5.79 16 2.8 98.3
891105 20 5.83 17 3.3 88.8
891105 21 5.88 18 1.3 56.5
891105 22 5.92 20 0.9 38.8
891105 23 5.96 12 1.1 50.8
891106 00 6.00 10 2.2 68.4
891106 01 6.04 8 1.2 54.4
891106 02 6.08 8 1.6 58.4
891106 03 6.13 7 1.1 52.2
891106 04 6.17 6 1.1 56.4
891106 05 6.21 6 1.2 55.7
891106 06 6.25 6 1.0 46.2
891106 07 6.29 7 0.5 7.2
891106 08 6.33 17 0.7 13.8
891106 09 6.38 31 1.1 41.5
891106 10 6.42 37 1.5 52.7
891106 11 6.46 36 3.1 83.7
891106 12 6.50 29 2.0 70.0
891106 13 6.54 28 1.6 71.4
891106 14 6.58 38 3.1 99.1
891106 15 6.63 39 5.6 98.2
891106 16 6.67 43 5.7 98.7 59
891106 17 6.71 27 5.7 99.4
891106 18 6.75 15 4.3 99.8
891106 19 6.79 17 4.1 99.7
891106 20 6.83 20 2.9 99.3
891106 21 6.88 16 3.1 96.3
891106 22 6.92 16 2.8 86.1
891106 23 6.96 16 3.3 96.5
891107 00 7.00 12 3.2 98.2
891107 01 7.04 12 1.6 77.7
891107 02 7.08 10 3.0 98.7
891107 03 7.13 8 1.7 71.1
891107 04 7.17 8 2.8 81.4
891107 05 7.21 8 5.4 92.4
891107 06 7.25 9 5.3 87.7
891107 07 7.29 11 5.6 94.0
891107 08 7.33 15 2.0 74.0
891107 09 7.38 25 2.7 84.3
891107 10 7.42 32 3.0 92.9
891107 11 7.46 41 5.5 97.4
891107 12 7.50 39 6.5 97.5
891107 13 7.54 31 4.4 95.9
891107 14 7.58 35 7.3 98.6
891107 15 7.63 37 8.3 96.3
891107 16 7.67 34 9.2 97.6
891107 17 7.71 20 7.5 99.3
891107 18 7.75 14 7.1 99.5
891107 19 7.79 15 7.1 99.7
891107 20 7.83 16 4.9 99.7
891107 21 7.88 18 4.3 99.7
891107 22 7.92 15 3.1 99.7
891107 23 7.96 11 3.3 99.6
SHAR_EOF
chmod 0666 gnuplot/demo/using.dat ||
echo 'restore of gnuplot/demo/using.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/using.dat'`"
test 5568 -eq "$Wc_c" ||
echo 'gnuplot/demo/using.dat: original size 5568, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/using.demo ==============
if test -f 'gnuplot/demo/using.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/using.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/using.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/using.demo' &&
#
# Requires data file "using.dat" from this directory,
# so change current working directory to this directory before running.
#
set title "Convex November 1-7 1989"
set label "(Weekend)" at 5,25 center
plot 'using.dat' using 3:4 title "Logged in" with impulses,\
X 'using.dat' using 3:5 t "Load average" with points,\
X 'using.dat' using 3:6 t "%CPU used" with lines
set nolabel
pause -1 "Hit return to continue"
X
set title "Convex November 1-7 1989 Circadian"
set xrange[-1:24]
plot 'using.dat' using 2:4 title "Logged in" with impulses,\
X 'using.dat' using 2:4 title "Logged in" with points
pause -1 "Hit return to continue"
X
# undo what we have done above
set title
set autoscale x
SHAR_EOF
chmod 0644 gnuplot/demo/using.demo ||
echo 'restore of gnuplot/demo/using.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/using.demo'`"
test 708 -eq "$Wc_c" ||
echo 'gnuplot/demo/using.demo: original size 708, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/world.cor ==============
if test -f 'gnuplot/demo/world.cor' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/world.cor (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/world.cor (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/world.cor' &&
# Gnuplot world correspondences. Feel free to check for and update
# your site; especially if it represents a new location or you
# know more precise coordinates for a site. A (?) indicates
# the site may not be correct. Currently coordinates are generally
# rounded to the nearest latitude and longitude. It's fine, however,
# to give as many decimal places with each as you like.
X
# USA
# Carnegie Mellon University
# Univ. of Calif. at Irvine
# University of Maryland
-110 35 # Northern Arizona University, Flagstaff, Arizona
-111 32 # Univ. of Arizona, Tucson, Arizona
-110 43 # University of Utah, Salt Lake City, Utah
-118 34 # California Institute of Technology (CALTECH), L.A., Calif.
-118 34 # Claremont, California
-118 34 # Univ. of Calif. at Los Angeles (UCLA), California
-120 34.5 # Univ. of Calif. at Santa Barbara, California
-122 37.5 # Stanford, California
-122 38 # Berkeley, California
-122 38 # Richmond, California
-122 47.5 # University of Washington, Washington
-71 42.5 # MIT, Cambridge, Massachusetts
-74.5 40.5 # New Brunswick, New Jersey
-75 41 # Bethlehem, Pennsylvania
-76 42 # Cornell College, Ithica, New York
-78.5 38 # Univ of Virginia, Charlottesville, Virginia
-79 36 # N.C. State University, Chapel Hill, North Carolina
-80 35 # Duke University, Durham, North Carolina
-81 28 # Melbourne, Florida
-83 40 # Ohio State, Columbus, Ohio
-83 42 # Detroit, Michigan
-84 34 # Alpharetta, Georgia
-84 34 # Atlanta, Georgia
-84 42 # Univ. of Michigan, Ann Arbor, Michigan
-86 39 # UCS Indiana (?)
-88 42 # Arlington Heights, Illinois
-88 42 # Northwestern University, Evanston, Illinois
-90 43 # UIUCS, Urabana, Illinois (?)
-92 30 # Lafayette, Louisiana
-93 45 # Eagan, Minnesota
-95 30 # Houston, Texas
-95 39 # Kansas State University
-96 31 # Texas A&M, College Station, Texas
-98 30 # Univ of Texas, Austin, Texas
# Canada
-123 49 # BC Hydro, Vancover, British Columbia (?)
-63 45 # Dartmouth, Nova Scotia, Canada
-75 45 # Ecole Polytechnique de Montreal, Canada
# United Kingdom
-8 54.5 # Bangor, United Kingdom
-80.5 43.5 # Waterloo, Ontario, Canada
0 52 # Cambridge, U. K.
# Italy
14 46 # Trieste, Italy
# Australia
138.5666 -35.01666 # Flinders University, Adelaide, South Australia
138.6333 -34.8 # South Australian Institute, Adelaide, South AUS
145.1333 -37.9167 # Monash University, Melbourne, Victoria
144.9833 -37.8167 # Melbourne University, Melbourne, Victoria
# Namibia
17 -23 # Windhoek, Namibia
# Sweden
18 60 # Stockholm, Sweden
# France
2 49 # Valbonne, CEDEX, France (?)
# Finland
24 60 # Espoo, Finland
24 62 # Wassau, Finland (?)
# Belgium
4.5 51 # Brussels, Belgium
# The Netherlands
4.5 52 # Delft, The Netherlands
# Germany
7 51 # University of Cologne, Federal Republic of Germany
7 51.5 # Fraunhofer Institut, Duisburg, Germany
8 48 # Freiburg im Br. (Federal Republic of Germany)
8 52 # Univesity of Dortmund, Federal Republic of Germany
SHAR_EOF
chmod 0644 gnuplot/demo/world.cor ||
echo 'restore of gnuplot/demo/world.cor failed'
Wc_c="`wc -c < 'gnuplot/demo/world.cor'`"
test 3329 -eq "$Wc_c" ||
echo 'gnuplot/demo/world.cor: original size 3329, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/world.dat ==============
if test -f 'gnuplot/demo/world.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/world.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/world.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/world.dat' &&
-140.37 60.25
-132.08 57.20
-131.46 55.98
-133.84 57.12
-136.01 59.12
-137.12 58.28
-139.98 59.73
-146.54 60.36
-149.90 59.50
-149.18 60.81
-153.53 59.32
-156.52 57.11
-162.34 55.06
-157.85 58.12
-162.06 58.36
-164.58 60.06
-165.29 62.57
-161.12 64.49
-168.23 65.49
-162.99 65.97
-161.56 66.55
-166.64 68.25
-159.53 70.38
-154.37 70.96
-148.09 70.26
-142.49 69.83
-141.21 69.56
X
-152.62 58.41
-152.60 58.40
X
-153.30 57.80
-152.40 57.48
-153.32 57.79
X
-166.96 53.96
-167.01 53.95
X
-168.36 53.50
-168.19 53.36
X
-170.73 52.68
-170.60 52.55
X
-174.47 51.94
-174.47 51.92
X
-176.58 51.71
-176.64 51.73
X
-177.55 51.76
-177.41 51.63
X
-178.27 51.75
X
177.35 51.80
177.33 51.76
X
172.44 53.00
172.55 53.03
X
-141.21 60.16
-133.38 58.93
-130.88 54.83
-128.86 53.90
-126.58 52.12
-127.08 50.80
-124.42 49.66
-122.56 48.91
X
-92.32 48.24
-88.13 48.92
-83.11 46.27
-81.66 44.76
-82.09 42.29
-77.10 44.00
-69.95 46.92
-65.92 45.32
-66.37 44.25
-61.22 45.43
-64.94 47.34
-64.12 48.52
-70.68 47.02
-67.24 49.33
-59.82 50.48
-56.14 52.46
-59.07 53.58
-58.26 54.21
-60.69 55.33
-61.97 57.41
-64.35 59.49
-67.29 58.15
-69.89 59.91
-71.31 61.45
-78.22 61.97
-77.28 59.53
-77.09 55.88
-79.06 51.68
-82.23 52.70
-86.75 55.72
-92.17 56.86
-95.61 58.82
-92.66 62.02
-90.65 63.24
-95.96 64.12
-89.88 63.98
-89.30 65.22
-86.86 66.12
-84.54 66.88
-82.30 67.76
-83.10 69.68
-86.05 67.98
-88.18 68.20
-91.00 68.82
-91.72 69.69
-93.15 71.09
-96.58 71.05
-93.35 69.52
-94.23 68.25
-95.96 66.73
-98.83 68.27
-102.45 67.69
-108.34 68.43
-105.83 68.05
-108.15 66.60
-111.15 67.63
-114.10 68.23
-120.92 69.44
-124.32 69.26
-128.76 70.50
-131.86 69.19
-131.15 69.79
-135.81 69.13
-140.19 69.37
-141.20 69.58
X
-123.40 48.33
-128.00 50.84
-123.50 48.34
X
-132.49 52.88
-132.44 52.91
X
-132.64 53.02
-131.97 53.71
-132.63 53.02
X
-55.36 51.56
-54.66 49.52
-53.65 47.48
-52.98 46.31
-56.12 46.84
-58.47 47.57
-57.61 50.38
-55.39 51.53
X
-61.37 49.01
-61.80 49.29
-61.38 49.03
X
-63.01 46.71
-64.42 46.61
-63.04 46.68
X
-60.14 46.48
-60.14 46.50
X
-122.44 48.92
-124.42 47.18
-124.52 42.48
-123.09 38.45
-121.73 36.62
-117.60 33.34
-117.28 32.64
X
-97.62 25.82
-95.62 28.84
-90.77 29.03
-87.33 30.22
-82.69 28.15
-80.16 26.66
-80.74 32.31
-76.89 35.43
-76.47 38.21
-75.66 37.67
-71.31 41.76
-69.44 44.17
-67.69 47.03
-73.18 45.14
-79.26 43.28
-82.84 42.59
-83.49 45.32
-86.36 43.65
-87.75 43.42
-86.01 45.96
-87.00 46.59
-91.39 46.79
-90.05 47.96
X
-71.97 41.11
-71.97 41.15
X
-80.79 27.03
-81.01 26.99
X
-113.01 42.09
-113.10 42.01
X
-155.74 20.02
-155.73 19.98
X
-156.51 20.78
-156.51 20.78
X
-157.12 21.21
-157.08 20.95
X
-157.87 21.42
X
-159.53 22.07
X
-117.44 66.46
-119.59 65.24
-123.95 65.03
-123.69 66.44
-119.21 66.22
-117.44 66.44
X
-120.71 64.03
-114.91 62.30
-109.07 62.72
-112.62 61.19
-118.68 61.19
-117.01 61.17
-115.97 62.56
-119.46 64.00
-120.59 63.94
X
-112.31 58.46
-108.90 59.44
-104.14 58.90
-102.56 56.72
-101.82 58.73
-104.65 58.91
-111.00 58.51
-112.35 58.62
X
-98.74 50.09
-99.75 52.24
-99.62 51.47
-98.82 50.39
X
-97.02 50.21
-97.50 54.02
-98.69 52.93
-97.19 51.09
-96.98 50.20
X
-95.34 49.04
-92.32 50.34
-94.14 49.47
-95.36 48.82
X
-80.39 56.16
-79.22 55.94
-80.34 56.08
X
-103.56 58.60
-103.60 58.58
X
-101.82 58.03
-102.33 58.10
-101.77 58.06
X
-101.88 55.79
-97.92 57.15
-101.22 55.85
-101.88 55.74
X
-117.29 32.48
-114.75 27.80
-112.53 24.80
-110.55 24.07
-114.23 29.59
-112.58 29.99
-109.57 25.94
-105.61 21.94
-102.09 17.87
-95.75 15.94
-92.21 14.97
X
-88.45 17.42
-87.01 21.33
-91.65 18.72
-96.96 20.37
-97.65 25.67
X
-92.22 14.71
-86.74 12.06
-83.03 8.65
-79.93 8.74
-77.17 7.94
-81.99 8.97
-83.92 12.70
-86.33 15.80
-88.40 15.92
X
-77.61 6.80
-78.70 0.97
-80.75 -4.47
-76.19 -14.57
-70.44 -18.75
-70.68 -26.15
-71.44 -32.03
-73.38 -37.27
-73.06 -42.11
-73.17 -46.09
-73.52 -48.05
-73.67 -51.56
-71.06 -53.88
-69.14 -50.77
-67.51 -46.59
-63.49 -42.80
-62.14 -40.16
-57.12 -36.71
-53.17 -34.15
-51.26 -32.02
-48.16 -25.48
-40.73 -22.32
-38.88 -15.24
-34.60 -7.81
-41.95 -3.42
-48.02 -1.84
-48.44 -1.57
-50.81 0.00
-54.47 5.39
-60.59 8.32
-64.19 9.88
-70.78 10.64
-70.97 11.89
-76.26 8.76
-77.61 6.80
X
-69.14 -52.79
-66.16 -55.08
-70.01 -54.88
-70.55 -53.85
-69.31 -52.81
X
-59.29 -51.58
-59.35 -51.54
X
-58.65 -51.55
-58.55 -51.56
X
-84.39 21.44
-73.90 19.73
-79.27 21.18
-83.74 21.80
-84.32 21.42
X
-66.96 17.95
-67.05 17.89
X
-77.88 17.22
-78.06 16.98
X
-74.47 18.08
-69.88 18.99
-71.10 17.76
-74.45 17.86
X
-85.28 73.74
-85.79 70.96
-85.13 71.94
-84.74 72.96
-80.61 73.10
-78.45 72.20
-75.44 72.55
-73.89 71.98
-72.56 71.04
-71.49 70.57
-69.78 70.29
-68.12 69.71
-65.91 69.19
-66.92 68.39
-64.08 67.68
-62.50 66.68
-63.07 65.33
-66.11 66.08
-67.48 65.41
-64.05 63.15
-66.58 63.26
-69.04 62.33
-72.22 63.77
-76.88 64.17
-73.25 65.54
-70.09 66.64
-72.05 67.44
-76.32 68.36
-78.34 70.17
-82.12 69.71
-87.64 70.12
-89.68 71.43
-85.28 73.74
X
-80.90 76.10
-84.21 76.28
-88.94 76.38
-85.47 77.40
-85.43 77.93
-87.01 78.54
-83.17 78.94
-84.87 79.93
-81.33 79.82
-76.27 80.92
-82.88 80.62
-82.58 81.16
-86.51 81.05
-89.36 81.21
-90.45 81.38
-89.28 81.86
-87.21 82.30
-80.51 82.05
-80.16 82.55
-77.83 82.86
-75.51 83.05
-71.18 82.90
-65.10 82.78
-63.34 81.80
-68.26 81.26
-69.46 80.34
-71.05 79.82
-74.40 79.46
-75.42 79.03
-75.48 78.92
-76.01 78.20
-80.66 77.28
-78.07 76.98
-80.90 76.13
X
-92.86 74.13
-92.50 72.70
-94.89 73.16
-92.96 74.14
X
-94.80 76.95
-89.68 76.04
-88.52 75.40
-82.36 75.67
-79.39 74.65
-86.15 74.22
-91.70 74.94
-95.60 76.91
-94.87 76.96
X
-99.96 73.74
-97.89 72.90
-98.28 71.13
-102.04 72.92
-101.34 73.14
-99.69 73.59
X
-107.58 73.25
-104.59 71.02
-101.71 69.56
-104.07 68.62
-106.61 69.12
-114.09 69.05
-113.89 70.12
-115.88 70.32
-116.10 71.32
-117.45 72.48
-113.53 72.44
-109.84 72.24
-106.62 71.71
-107.43 73.04
X
-120.96 74.29
-118.37 72.53
-123.06 71.18
-123.40 73.77
-120.93 74.27
X
-108.83 76.74
-106.25 75.54
-107.08 74.78
-112.99 74.16
-112.28 74.99
-116.04 75.33
-115.27 76.20
-110.95 75.56
-109.77 76.31
-108.82 76.70
X
-115.70 77.46
-118.10 76.30
-121.13 76.37
-116.04 77.28
X
-110.01 77.86
-112.36 77.68
-109.96 77.86
X
-109.60 78.48
-112.20 78.01
-109.60 78.48
X
-97.87 76.61
-99.21 75.31
-100.86 75.60
-99.40 76.26
-97.79 76.60
X
-94.72 75.53
-94.66 75.52
X
-104.10 79.01
-99.19 77.54
-103.22 78.08
-104.30 78.95
X
-93.74 77.52
-93.74 77.52
X
-96.88 78.50
-96.91 77.77
-96.94 78.48
X
-84.69 65.84
-81.58 63.87
-85.00 62.96
-84.63 65.71
X
-81.84 62.75
-82.01 62.63
X
-79.88 62.12
-79.88 62.12
X
-43.53 59.89
-45.29 60.67
-47.91 60.83
-49.90 62.41
-50.71 64.42
-51.39 64.94
-52.96 66.09
-53.62 67.19
-53.51 67.51
-51.84 68.65
-52.19 70.00
-51.85 71.03
-55.41 71.41
-54.63 72.97
-56.98 74.70
-61.95 76.09
-66.38 75.83
-71.13 77.00
-66.81 77.60
-70.78 77.78
-64.96 79.70
-63.38 81.16
-56.89 82.17
-48.18 82.15
-42.08 82.74
-38.02 83.54
-23.96 82.94
-25.97 81.97
-25.99 80.64
-13.57 80.97
-16.60 80.16
-19.82 78.82
-18.80 77.54
-21.98 76.46
-20.69 75.12
-21.78 74.40
-24.10 73.69
-26.54 73.08
-24.63 72.69
-21.84 71.69
-24.62 71.24
-27.16 70.89
-27.21 70.00
-24.10 69.35
-28.35 68.43
-32.48 68.56
-35.26 66.26
-37.90 65.90
-40.04 65.00
-40.49 64.04
-42.01 63.14
-42.88 61.15
-43.09 60.07
-43.56 59.90
X
-16.26 66.41
-15.32 64.29
-20.14 63.47
-21.76 64.21
-21.33 64.97
-23.04 65.62
-21.76 66.26
-18.77 66.12
-16.23 66.35
X
X 0.56 51.47
X -1.71 54.94
X -3.41 57.52
X -5.42 58.14
X -5.77 55.59
X -3.48 54.82
X -4.68 52.88
X -2.68 51.58
X -3.80 50.08
X 1.26 51.14
X 0.65 51.41
X
X -7.17 54.91
X -9.97 53.47
X -8.52 51.76
X -5.69 54.79
X -7.34 55.25
X
X -1.33 60.66
X -1.17 60.38
X
X -6.18 58.44
X -6.09 58.36
X
X -6.47 57.58
X -6.33 57.54
X
X -7.30 57.54
X
X -7.46 57.05
X
X -6.54 56.94
X
X -6.00 55.94
X
X -5.09 55.55
X
X -4.44 54.38
X -4.30 54.19
X
X -8.08 71.02
X -8.21 70.86
X
X 16.92 79.52
X 22.26 78.46
X 16.86 76.41
X 16.00 77.39
X 16.03 77.92
X 16.81 79.50
X
X 14.71 79.40
X 16.05 79.12
X 14.02 77.80
X 13.56 78.46
X 12.63 79.26
X 14.68 79.40
X
X 22.01 78.24
X 21.86 78.23
X
X 21.54 77.75
X 23.88 77.26
X 21.53 77.67
X 22.79 77.79
X
X 23.50 79.97
X 28.24 79.54
X 20.85 78.94
X 19.00 79.34
X 21.05 79.88
X 23.41 79.96
X
X 46.98 80.23
X 43.13 79.97
X 47.18 80.22
X
X 50.43 80.19
X 50.55 79.88
X 47.77 79.86
X 50.45 80.14
X
X 61.79 80.18
X 61.79 80.18
X
X 65.08 80.69
X 64.27 80.59
X 65.13 80.68
X
X -5.13 35.66
X 4.06 36.63
X 10.40 37.12
X 11.36 33.61
X 20.10 30.10
X 23.49 32.17
X 31.65 30.80
X 35.76 23.74
X 39.75 14.82
X 42.93 11.34
X 51.52 11.45
X 49.82 6.99
X 43.13 -0.62
X 39.15 -7.58
X 40.37 -13.20
X 37.74 -18.17
X 35.33 -22.71
X 32.84 -28.15
X 26.50 -34.39
X 19.55 -35.51
X 17.50 -30.88
X 12.24 -18.75
X 13.89 -12.81
X 12.05 -5.55
X 9.67 0.14
X 7.19 3.79
X 1.74 5.39
X -4.77 4.59
-12.00 6.75
-15.54 10.98
-16.33 15.50
-16.10 22.29
-12.90 27.12
X -9.52 31.09
X -5.41 35.58
X
X 33.71 0.00
X 33.48 -3.42
X 33.34 -0.20
X 33.71 0.00
X
X 49.30 -12.50
X 49.28 -18.79
X 43.95 -25.50
X 44.37 -20.08
X 46.34 -16.31
X 47.91 -14.08
X 49.30 -12.50
X
X 32.18 30.58
X 36.08 35.03
X 32.53 36.17
X 27.77 36.94
X 26.51 39.18
X 31.54 40.82
X 38.53 40.48
X 40.35 43.17
X 39.88 46.45
X 35.18 44.99
X 33.50 44.96
X 30.24 45.14
X 28.70 41.48
X 26.55 39.84
X 23.62 39.67
X 23.80 37.34
X 21.90 36.92
X 18.79 42.02
X 14.52 44.31
X 14.58 42.25
X 18.32 39.57
X 16.05 39.35
X 11.52 42.36
X 6.87 43.08
X 2.80 41.09
X -1.11 37.14
X -6.24 36.70
X -8.67 39.57
X -6.51 43.13
X -0.84 45.55
X -3.93 48.40
X 0.48 49.09
X 4.20 51.29
X 6.44 52.92
X 8.42 55.94
X 11.72 55.49
X 11.73 53.66
X 16.78 54.14
X 21.40 56.32
X 24.67 57.20
X 28.94 59.18
X 24.16 59.52
X 22.07 62.66
X 23.76 65.35
X 18.70 62.54
X 19.11 59.67
X 18.40 58.54
X 15.34 55.73
X 11.74 58.08
X 8.37 57.68
X 5.80 59.20
X 7.38 60.86
X 7.51 61.86
X 9.62 62.99
X 13.37 65.46
X 15.46 67.12
X 18.54 68.62
X 22.32 69.64
X 24.77 70.17
X 25.93 69.79
X 28.56 70.46
X 29.75 69.76
X 33.83 69.11
X 41.90 66.85
X 35.14 66.25
X 33.30 66.07
X 35.46 64.15
X 37.68 64.03
X 41.71 64.09
X 44.80 65.58
X 44.87 68.16
X 45.92 66.83
X 51.79 67.85
X 53.70 67.89
X 59.68 68.09
X 65.07 69.08
X 68.56 69.19
X 68.38 70.97
X 73.03 71.62
X 73.80 68.29
X 69.42 66.45
X 73.43 66.36
X 77.51 68.36
X 80.74 66.74
X 75.27 68.67
X 75.11 71.80
X 78.62 70.56
X 78.43 71.90
X 82.72 71.23
X 84.25 70.03
X 81.40 72.76
X 86.50 74.01
X 87.68 74.78
X 90.25 75.23
X
X 68.33 76.71
X 66.03 75.62
X 59.10 74.11
X 54.92 73.03
X 56.67 74.10
X 58.56 75.09
X 63.86 75.87
X 68.19 76.70
X
X 53.04 72.57
X 58.29 70.39
X 55.03 70.78
X 53.44 72.26
X 53.63 72.61
X
X 90.06 21.03
X 82.06 15.95
X 80.05 11.72
X 76.41 8.60
X 72.79 17.43
X 72.02 20.00
X 68.98 21.99
X 64.62 24.41
X 57.83 24.77
X 53.11 26.20
X 49.67 29.41
X 50.96 25.15
X 54.33 23.44
X 59.03 22.57
X 57.87 18.86
X 52.95 15.74
X 47.26 12.96
X 42.75 14.68
X 39.93 19.61
X 36.92 25.78
X 33.30 28.46
X 32.60 30.63
X
X 52.22 46.50
X 51.73 44.73
X 52.56 41.80
X 53.43 40.40
X 54.22 37.86
X 49.04 38.45
X 48.17 42.76
X 49.33 45.64
X 52.22 46.50
X
X 62.32 46.32
X 60.32 43.06
X 59.57 45.58
X 61.94 46.33
X
X 79.55 46.12
X 74.30 44.44
X 78.62 45.79
X 79.66 46.07
X
X 76.81 41.96
X 76.73 41.86
X
X 35.15 35.15
X 34.61 34.84
X 35.18 35.17
X
X 23.84 35.33
X 24.30 34.91
X 24.09 35.39
X
X 15.54 37.89
X 13.47 37.89
X 15.54 37.89
X
X 9.56 40.95
X 8.46 39.99
X 9.12 40.69
X
X 9.72 42.60
X 9.54 42.35
X
X 80.60 8.95
X 79.73 5.96
X 80.10 8.30
X
X 11.04 57.44
X 10.67 57.25
X
-77.92 24.67
-77.98 24.22
X
-77.61 23.62
-77.18 23.64
X
-75.55 24.13
-75.41 24.31
X
-91.40 -0.17
-91.52 -0.26
X
-60.25 46.68
-60.71 46.33
X
-63.89 49.47
-63.45 49.43
X
142.53 -10.60
145.62 -16.34
149.79 -22.09
153.21 -26.82
150.52 -35.19
145.60 -38.53
140.13 -37.69
137.34 -34.77
135.76 -34.56
131.50 -31.34
121.72 -33.65
115.62 -33.25
114.09 -26.01
114.88 -21.27
122.34 -18.13
125.32 -14.53
128.39 -14.90
132.35 -11.42
136.16 -12.43
138.07 -16.45
142.25 -10.78
X
144.72 -40.68
148.32 -42.14
145.57 -42.77
146.47 -41.19
X
172.86 -34.23
176.10 -37.52
177.06 -39.49
174.77 -38.03
172.83 -34.27
X
172.36 -40.53
172.92 -43.81
168.41 -46.13
170.26 -43.21
173.69 -40.94
X
150.74 -10.18
143.04 -8.26
138.48 -6.97
131.95 -2.94
130.91 -1.35
134.38 -2.64
141.24 -2.62
148.19 -8.15
150.75 -10.27
X
117.24 7.01
117.90 0.76
113.89 -3.50
109.44 -0.82
113.13 3.38
117.24 7.01
X
X 95.31 5.75
102.32 1.40
106.03 -2.98
101.46 -2.81
X 95.20 5.73
X
140.91 41.53
140.79 35.75
136.82 34.56
133.56 34.72
132.49 35.41
136.73 37.20
139.82 40.00
140.68 41.43
X
133.71 34.30
131.41 31.58
129.38 33.10
133.90 34.37
X
141.89 45.50
144.12 42.92
140.30 41.64
141.53 45.30
141.89 45.53
X
142.57 54.36
143.64 49.19
141.99 45.88
141.92 50.85
142.60 54.34
X
121.92 25.48
120.53 24.70
121.70 25.51
X
110.81 20.07
109.20 19.66
110.81 20.07
X
106.51 -6.16
114.15 -7.72
108.71 -7.89
106.51 -6.16
X
164.27 -20.01
164.16 -20.27
X
178.61 -17.04
178.61 -17.04
X
179.45 -16.43
179.35 -16.43
X
-172.55 -13.39
-172.61 -13.78
X
122.26 18.67
123.05 13.86
120.73 13.80
120.43 16.43
121.72 18.40
X
125.34 9.79
125.56 6.28
122.38 7.00
125.10 9.38
X
119.64 11.35
118.81 10.16
119.59 10.86
X
X 90.05 21.74
X 94.21 17.79
X 97.66 15.36
X 98.21 9.17
103.22 1.56
100.26 8.30
100.01 13.52
104.39 10.37
107.32 10.45
107.55 16.34
108.53 21.73
112.69 21.81
118.83 24.93
121.28 30.25
120.73 32.65
121.77 36.90
117.58 38.21
121.62 40.15
125.12 39.08
126.15 35.18
128.33 38.46
129.92 42.04
138.77 47.30
140.72 52.43
137.10 54.07
140.77 58.39
148.57 59.46
153.83 59.10
156.81 61.68
159.90 60.73
163.79 61.73
156.40 57.76
156.42 51.09
161.82 54.88
162.92 57.34
164.48 59.89
170.42 60.17
177.46 62.62
178.20 64.29
179.48 64.88
X
-179.87 65.14
-177.13 65.63
-173.46 64.74
-171.13 66.38
-176.48 67.78
-178.80 68.42
X
178.88 69.10
170.20 69.99
167.68 69.63
159.92 70.14
150.77 71.28
146.92 72.21
146.04 72.39
139.60 72.23
135.49 71.51
130.53 70.86
126.10 72.24
128.94 73.02
123.10 73.28
113.34 73.37
110.43 73.71
107.88 73.72
112.99 75.60
106.34 76.40
104.10 77.52
X 99.69 76.09
X 95.12 75.95
X 89.68 75.57
X
101.96 79.08
101.31 77.86
101.22 79.04
X
X 94.29 79.29
100.02 79.43
X 95.31 78.68
X 95.44 79.65
X 97.26 79.62
X
X 95.46 80.62
X 92.39 79.66
X 95.07 80.54
X
X 91.39 79.62
X 91.33 79.62
X
138.54 76.05
144.93 75.45
140.30 74.99
137.27 75.44
138.29 75.98
X
146.08 75.29
147.75 74.73
145.85 75.06
X
141.44 73.88
141.48 73.84
X
X 0.01 -71.68
X 6.57 -70.57
X 15.04 -70.44
X 25.10 -70.75
X 33.37 -69.10
X 38.46 -69.77
X 42.85 -68.16
X 46.59 -67.23
X 49.35 -66.96
X 52.90 -65.97
X 58.46 -67.20
X 63.60 -67.58
X 70.63 -68.41
X 69.24 -70.36
X 76.20 -69.44
X 88.08 -66.64
X 94.98 -66.52
101.53 -66.09
111.31 -65.91
118.64 -66.87
126.24 -66.24
133.09 -66.18
139.85 -66.72
146.86 -67.96
153.65 -68.82
159.94 -69.57
164.10 -70.67
170.19 -71.94
165.68 -74.64
163.82 -77.60
162.10 -78.95
166.72 -82.84
175.58 -83.86
X
-178.56 -84.37
-147.96 -85.40
-152.96 -81.12
-153.95 -79.50
-151.24 -77.48
-146.74 -76.44
-137.68 -75.16
-131.63 -74.63
-123.05 -74.41
-114.76 -73.97
-111.91 -75.41
-105.05 -74.77
-100.90 -74.21
-101.04 -73.18
-100.28 -73.06
-93.06 -73.33
-85.40 -73.18
-79.82 -73.04
-78.21 -72.52
-71.90 -73.41
-67.51 -71.10
-67.57 -68.92
-66.65 -66.83
-64.30 -65.28
-59.14 -63.74
-59.58 -64.37
-62.50 -65.94
-62.48 -66.66
-65.64 -68.02
-63.85 -69.07
-61.69 -70.87
-60.89 -72.71
-61.07 -74.30
-63.33 -75.88
-76.05 -77.06
-83.04 -77.12
-74.30 -80.83
-56.40 -82.14
-42.46 -81.65
-31.60 -80.17
-34.01 -79.20
-32.48 -77.28
-26.28 -76.18
-17.18 -73.45
-11.20 -72.01
X -8.67 -71.98
X -5.45 -71.45
X -0.82 -71.74
X 0.07 -71.68
X
164.65 -77.89
170.95 -77.37
179.67 -78.25
X
-178.74 -78.24
-165.76 -78.47
-158.42 -77.73
X
-58.98 -64.63
-60.99 -68.62
-61.02 -71.70
X
-62.01 -74.94
-52.00 -77.07
-42.23 -77.80
-36.22 -78.03
X
-35.03 -77.81
-26.13 -75.54
-19.35 -73.04
-12.16 -71.86
X -6.15 -70.65
X -0.57 -69.14
X 4.93 -70.25
X 10.91 -69.99
X 16.52 -69.87
X 25.41 -70.22
X 32.13 -69.29
X 33.62 -69.58
X
X 70.56 -68.53
X 73.91 -69.51
X
X 81.42 -67.87
X 84.67 -66.41
X 89.07 -66.73
X
-135.79 -74.67
-124.34 -73.22
-116.65 -74.08
-109.93 -74.64
-105.36 -74.56
-105.83 -74.77
X
-69.30 -70.06
-71.33 -72.68
-71.42 -71.85
-75.10 -71.46
-71.79 -70.55
-70.34 -69.26
-69.34 -70.13
X
-49.20 -77.83
-44.59 -78.79
-44.14 -80.13
-59.04 -79.95
-49.28 -77.84
-48.24 -77.81
X
-58.13 -80.12
-63.25 -80.20
-58.32 -80.12
X
-163.64 -78.74
-161.20 -79.93
-163.62 -78.74
X
X 66.82 66.82
X 66.82 66.82
X
SHAR_EOF
chmod 0666 gnuplot/demo/world.dat ||
echo 'restore of gnuplot/demo/world.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/world.dat'`"
test 16720 -eq "$Wc_c" ||
echo 'gnuplot/demo/world.dat: original size 16720, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/world.demo ==============
if test -f 'gnuplot/demo/world.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/world.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/world.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/world.demo' &&
set title "Gnuplot Correspondences"
set nokey
set noborder
set noyzeroaxis
set noxtics
set noytics
#
# plot world map and correspondent locations as a +
plot 'world.dat' with lines 3 4, 'world.cor' with points 1 2
set title ""
set key
set border
set yzeroaxis
set xtics
set ytics
pause -1 "Hit return to continue"
#
# plot a '3D version using spherical coordinate system' of the world.
set angles degrees
set title "3D version using spherical coordinate system"
set view 70,40,,2.0
set mapping spherical
set parametric
set samples 32
set isosamples 9
set urange [-pi/2:pi/2]
set vrange [0:2*pi]
splot 'world.dat' with lines 3 4, 'world.cor' with points 1 2, cos(u)*cos(v),cos(u)*sin(v),sin(u) with lines 5 6
pause -1 "Hit return to continue"
#
# plot a '3D version using cylindrical coordinate system' of the world.
set title "3D version using cylindrical coordinate system"
set view 70,40,,2.0
set mapping cylindrical
set parametric
set samples 32
set isosamples 9
set urange [-pi:pi]
set vrange [-90:90]
splot 'world.dat' with lines 3 4, 'world.cor' with points 1 2, cos(u),sin(u),v with lines 5 6
pause -1 "Hit return to continue"
X
X
#
# Clean up:
#
set noparametric
set mapping cartesian
set angles radians
set samples 100
set isosamples 10
set view 60,30,1,1
set xrange [-10:10]
set yrange [-10:10]
set zrange [-10:10]
set auto
set title "" 0,0
SHAR_EOF
chmod 0644 gnuplot/demo/world.demo ||
echo 'restore of gnuplot/demo/world.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/world.demo'`"
test 1349 -eq "$Wc_c" ||
echo 'gnuplot/demo/world.demo: original size 1349, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/err.dat ==============
if test -f 'gnuplot/demo/err.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/err.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/err.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/err.dat' &&
0 11.062 9.757 12.667 2.345
2 9.212 8.0908 10.932 1.725
5 8.55 7.6612 9.0388 2.846
10 8.122 7.327 8.617 0.957
15 8.156 7.6101 8.9019 1.577
20 8.122 7.5431 8.8009 3.141
25 7.988 6.3007 9.2753 1.57
27 8.096 6.665 10.555 2.172
29 7.936 6.9395 8.325 0.582
30 7.854 6.4909 9.8171 0.603
35 8.01 7.1556 8.644 1.063
40 8.02 7.0301 9.7099 2.152
45 8.092 6.9164 9.7676 1.44
50 8.072 7.2993 8.4447 1.96
60 8.286 7.7265 8.755 1.0
SHAR_EOF
chmod 0644 gnuplot/demo/err.dat ||
echo 'restore of gnuplot/demo/err.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/err.dat'`"
test 418 -eq "$Wc_c" ||
echo 'gnuplot/demo/err.dat: original size 418, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/poldat.demo ==============
if test -f 'gnuplot/demo/poldat.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/poldat.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/poldat.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/poldat.demo' &&
set samples 361
set size .757,1.0
set time
set title "Antenna Pattern"
set xlabel "Azimuth"
set ylabel "dBSM"
set data style line
set angles degrees
set polar
set yrange [-220:220]
set rrange [-200:60]
plot "polar.dat" using 1:5,"antenna.dat",-150,-100,-50,0
pause -1 "Hit return to continue"
X
set samples 100
set size 1.0,1.0
set notime
set title "" 0,0
set xlabel "" 0,0
set ylabel "" 0,0
set data style points
set angles radians
set nopolar
set yrange [-10:10]
set rrange [0:10]
set auto
SHAR_EOF
chmod 0644 gnuplot/demo/poldat.demo ||
echo 'restore of gnuplot/demo/poldat.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/poldat.demo'`"
test 491 -eq "$Wc_c" ||
echo 'gnuplot/demo/poldat.demo: original size 491, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/polar.dat ==============
if test -f 'gnuplot/demo/polar.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/polar.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/polar.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/polar.dat' &&
# Input data ncmain.d4 generated by genpat2.f:Tx antenna pattern
# x,y,z of center point B in coord 3
# -5.12000 0.00000 -1.50000
# euler matrix
# 0.00000 -1.00000 0.00000
# 0.70710 0.00000 0.70710
# -0.70710 0.00000 0.70710
# theta(deg) phi(deg) E-theta(dB) phase E-phi(dB) phase
X 0.000 0.000 -200.000 0.000 18.992 0.000
X 2.000 0.000 -200.000 0.000 18.898 0.000
X 4.000 0.000 -200.000 0.000 18.619 0.000
X 6.000 0.000 -200.000 0.000 18.152 0.000
X 8.000 0.000 -200.000 0.000 17.497 0.000
X 10.000 0.000 -200.000 0.000 16.651 0.000
X 12.000 0.000 -200.000 0.000 15.614 0.000
X 14.000 0.000 -200.000 0.000 14.382 0.000
X 16.000 0.000 -200.000 0.000 12.952 0.000
X 18.000 0.000 -200.000 0.000 11.320 0.000
X 20.000 0.000 -200.000 0.000 9.483 0.000
X 22.000 0.000 -200.000 0.000 7.434 0.000
SHAR_EOF
true || echo 'restore of gnuplot/demo/polar.dat failed'
fi
echo 'End of part 6'
echo 'File gnuplot/demo/polar.dat is continued in part 7'
echo 7 > _shar_seq_.tmp
#!/bin/sh
# this is Part.07 (part 7 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/demo/polar.dat continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 7; 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/demo/polar.dat'
else
echo 'x - continuing file gnuplot/demo/polar.dat'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/demo/polar.dat' &&
X 24.000 0.000 -200.000 0.000 5.169 0.000
X 26.000 0.000 -200.000 0.000 2.680 0.000
X 28.000 0.000 -200.000 0.000 -0.039 0.000
X 30.000 0.000 -200.000 0.000 -2.998 0.000
X 32.000 0.000 -200.000 0.000 -6.204 0.000
X 34.000 0.000 -200.000 0.000 -9.670 0.000
X 36.000 0.000 -200.000 0.000 -13.407 0.000
X 38.000 0.000 -200.000 0.000 -17.429 0.000
X 40.000 0.000 -200.000 0.000 -21.751 0.000
X 42.000 0.000 -200.000 0.000 -26.391 0.000
X 44.000 0.000 -200.000 0.000 -31.368 0.000
X 46.000 0.000 -200.000 0.000 -36.705 0.000
X 48.000 0.000 -200.000 0.000 -42.429 0.000
X 50.000 0.000 -200.000 0.000 -48.569 0.000
X 52.000 0.000 -200.000 0.000 -55.160 0.000
X 54.000 0.000 -200.000 0.000 -62.243 0.000
X 56.000 0.000 -200.000 0.000 -69.867 0.000
X 58.000 0.000 -200.000 0.000 -78.087 0.000
X 60.000 0.000 -200.000 0.000 -86.971 0.000
X 62.000 0.000 -200.000 0.000 -96.602 0.000
X 64.000 0.000 -200.000 0.000 -107.080 0.000
X 66.000 0.000 -200.000 0.000 -118.530 0.000
X 68.000 0.000 -200.000 0.000 -131.110 0.000
X 70.000 0.000 -200.000 0.000 -145.022 0.000
X 72.000 0.000 -200.000 0.000 -160.534 0.000
X 74.000 0.000 -200.000 0.000 -177.982 0.000
X 76.000 0.000 -200.000 0.000 -195.848 0.000
X 78.000 0.000 -200.000 0.000 -199.967 0.000
X 80.000 0.000 -200.000 0.000 -200.000 0.000
X 82.000 0.000 -200.000 0.000 -200.000 0.000
X 84.000 0.000 -200.000 0.000 -200.000 0.000
X 86.000 0.000 -200.000 0.000 -200.000 0.000
X 88.000 0.000 -200.000 0.000 -200.000 0.000
X 90.000 0.000 -200.000 0.000 -200.000 0.000
X 92.000 0.000 -200.000 0.000 -200.000 0.000
X 94.000 0.000 -200.000 0.000 -200.000 0.000
X 96.000 0.000 -200.000 0.000 -200.000 0.000
X 98.000 0.000 -200.000 0.000 -200.000 0.000
X 100.000 0.000 -200.000 0.000 -200.000 0.000
X 102.000 0.000 -200.000 0.000 -200.000 0.000
X 104.000 0.000 -200.000 0.000 -200.000 0.000
X 106.000 0.000 -200.000 0.000 -200.000 0.000
X 108.000 0.000 -200.000 0.000 -200.000 0.000
X 110.000 0.000 -200.000 0.000 -200.000 0.000
X 112.000 0.000 -200.000 0.000 -200.000 0.000
X 114.000 0.000 -200.000 0.000 -200.000 0.000
X 116.000 0.000 -200.000 0.000 -200.000 0.000
X 118.000 0.000 -200.000 0.000 -200.000 0.000
X 120.000 0.000 -200.000 0.000 -200.000 0.000
X 122.000 0.000 -200.000 0.000 -200.000 0.000
X 124.000 0.000 -200.000 0.000 -200.000 0.000
X 126.000 0.000 -200.000 0.000 -200.000 0.000
X 128.000 0.000 -200.000 0.000 -200.000 0.000
X 130.000 0.000 -200.000 0.000 -200.000 0.000
X 132.000 0.000 -200.000 0.000 -200.000 0.000
X 134.000 0.000 -200.000 0.000 -200.000 0.000
X 136.000 0.000 -200.000 0.000 -200.000 0.000
X 138.000 0.000 -200.000 0.000 -200.000 0.000
X 140.000 0.000 -200.000 0.000 -200.000 0.000
X 142.000 0.000 -200.000 0.000 -200.000 0.000
X 144.000 0.000 -200.000 0.000 -200.000 0.000
X 146.000 0.000 -200.000 0.000 -200.000 0.000
X 148.000 0.000 -200.000 0.000 -200.000 0.000
X 150.000 0.000 -200.000 0.000 -200.000 0.000
X 152.000 0.000 -200.000 0.000 -200.000 0.000
X 154.000 0.000 -200.000 0.000 -200.000 0.000
X 156.000 0.000 -200.000 0.000 -200.000 0.000
X 158.000 0.000 -200.000 0.000 -200.000 0.000
X 160.000 0.000 -200.000 0.000 -200.000 0.000
X 162.000 0.000 -200.000 0.000 -200.000 0.000
X 164.000 0.000 -200.000 0.000 -200.000 0.000
X 166.000 0.000 -200.000 0.000 -200.000 0.000
X 168.000 0.000 -200.000 0.000 -200.000 0.000
X 170.000 0.000 -200.000 0.000 -200.000 0.000
X 172.000 0.000 -200.000 0.000 -200.000 0.000
X 174.000 0.000 -200.000 0.000 -200.000 0.000
X 176.000 0.000 -200.000 0.000 -200.000 0.000
X 178.000 0.000 -200.000 0.000 -200.000 0.000
X 180.000 0.000 -200.000 0.000 -200.000 0.000
SHAR_EOF
echo 'File gnuplot/demo/polar.dat is complete' &&
chmod 0644 gnuplot/demo/polar.dat ||
echo 'restore of gnuplot/demo/polar.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/polar.dat'`"
test 6538 -eq "$Wc_c" ||
echo 'gnuplot/demo/polar.dat: original size 6538, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/errorbar.demo ==============
if test -f 'gnuplot/demo/errorbar.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/errorbar.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/errorbar.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/errorbar.demo' &&
#
# Requires data file "err.dat" from this directory,
# so change current working directory to this directory before running.
# gnuplot> set term <term-type>
# gnuplot> load 'errorbar.demo'
#
X
set title "Demonstration of error bars (both ylow and yhigh, default format)"
plot [-3:65] "err.dat" with errorbars
X
pause -1 "Hit return to continue"
X
# this should look the same
set title "Demonstration of error bars (both ylow and yhigh)"
plot [-3:65] "err.dat" using 1:2:3:4 with errorbars
X
pause -1 "Hit return to continue"
X
set title "Demonstration of error bars (only ydelta)"
plot [-3:65] "err.dat" using 1:2:5 with errorbars
X
pause -1 "Hit return to continue"
X
set title "Plot data file twice to get lines and errorbars"
plot [-3:65] [6:14] "err.dat" with lines, "err.dat" using 1:2:4:3 with errorbars
X
set title ""
set autoscale
X
pause -1 "Hit return to continue"
SHAR_EOF
chmod 0644 gnuplot/demo/errorbar.demo ||
echo 'restore of gnuplot/demo/errorbar.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/errorbar.demo'`"
test 867 -eq "$Wc_c" ||
echo 'gnuplot/demo/errorbar.demo: original size 867, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/antenna.dat ==============
if test -f 'gnuplot/demo/antenna.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/antenna.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/antenna.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/antenna.dat' &&
X 0.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 2.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 4.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 6.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 8.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 10.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 12.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 14.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 16.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 18.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 20.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 22.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 24.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 26.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 28.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 30.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 32.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 34.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 36.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 38.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 40.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 42.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 44.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 46.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 48.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 50.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 52.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 54.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 56.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 58.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 60.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 62.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 64.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 66.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 68.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 70.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 72.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
X 74.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 76.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 78.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 80.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 82.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 84.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 86.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 88.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 90.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 92.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 94.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 96.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 98.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 100.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 102.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 104.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 106.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 108.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 110.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 112.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 114.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 116.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 118.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 120.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 122.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 124.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 126.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 128.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 130.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 132.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 134.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 136.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 138.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 140.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 142.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 144.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 146.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 148.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 150.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 152.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 154.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 156.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 158.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 160.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 162.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 164.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 166.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 168.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 170.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 172.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 174.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 176.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 178.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 180.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 182.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 184.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 186.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 188.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 190.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 192.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 194.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 196.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 198.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 200.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 202.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 204.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 206.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 208.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 210.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 212.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 214.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 216.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 218.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 220.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 222.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 224.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 226.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 228.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 230.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 232.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 234.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 236.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 238.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 240.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 242.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 244.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 246.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 248.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 250.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 252.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
X 254.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 256.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 258.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 260.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 262.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 264.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 266.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 268.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 270.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 272.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 274.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 276.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 278.000 13.099E-02 42.554E-01 -25.105E+00 59.101E-01
X 280.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 282.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 284.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 286.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 288.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 290.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 292.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 294.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 296.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 298.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 300.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 302.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 304.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 306.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 308.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 310.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 312.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 314.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 316.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 318.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 320.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 322.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 324.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 326.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 328.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 330.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 332.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 334.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 336.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 338.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 340.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 342.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 344.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 346.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 348.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 350.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 352.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 354.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 356.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 358.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 360.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 2.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 4.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 6.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 8.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 10.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 12.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 14.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 16.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 18.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 20.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 22.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 24.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 26.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 28.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 30.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 32.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 34.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 36.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 38.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 40.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 42.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 44.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 46.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 48.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 50.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 52.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 54.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 56.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 58.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 60.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 62.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 64.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 66.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 68.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 70.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 72.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
X 74.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 76.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 78.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 80.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 82.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 84.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 86.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 88.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 90.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 92.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 94.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 96.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 98.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 100.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 102.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 104.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 106.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 108.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 110.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 112.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 114.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 116.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 118.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 120.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 122.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 124.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 126.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 128.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 130.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 132.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 134.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 136.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 138.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 140.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 142.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 144.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 146.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 148.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 150.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 152.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 154.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 156.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 158.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 160.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 162.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 164.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 166.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 168.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 170.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 172.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 174.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 176.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 178.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 180.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 182.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 184.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 186.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 188.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 190.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 192.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 194.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 196.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 198.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 200.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 202.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 204.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 206.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 208.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 210.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 212.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 214.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 216.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 218.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 220.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 222.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 224.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 226.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 228.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 230.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 232.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 234.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 236.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 238.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 240.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 242.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 244.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 246.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 248.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 250.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 252.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
X 254.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 256.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 258.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 260.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 262.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 264.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 266.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 268.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 270.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
X 272.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 274.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 276.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 278.000 13.099E-02 42.554E-01 -25.105E+00 59.101E-01
X 280.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 282.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 284.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 286.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 288.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 290.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 292.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 294.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 296.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 298.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 300.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 302.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 304.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 306.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 308.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 310.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 312.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 314.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 316.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
X 318.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
X 320.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
X 322.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
X 324.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
X 326.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
X 328.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
X 330.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
X 332.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
X 334.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
X 336.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
X 338.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
X 340.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
X 342.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
X 344.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
X 346.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
X 348.000 -76.407E-01 15.917E-02 -25.211E+00 82.257E-02
X 350.000 -34.589E-01 26.769E-01 -24.794E+00 38.084E-01
X 352.000 13.100E-02 42.554E-01 -25.105E+00 59.101E-01
X 354.000 33.053E-01 48.742E-01 -26.062E+00 73.795E-01
X 356.000 60.696E-01 40.782E-01 -28.040E+00 83.501E-01
X 358.000 81.667E-01 13.355E-02 -32.735E+00 89.007E-01
X 360.000 90.007E-01 -35.926E+00 -71.297E+00 90.783E-01
SHAR_EOF
chmod 0644 gnuplot/demo/antenna.dat ||
echo 'restore of gnuplot/demo/antenna.dat failed'
Wc_c="`wc -c < 'gnuplot/demo/antenna.dat'`"
test 20577 -eq "$Wc_c" ||
echo 'gnuplot/demo/antenna.dat: original size 20577, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/all.demo ==============
if test -f 'gnuplot/demo/all.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/all.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/all.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/all.demo' &&
#
# Executes ALL demos in this directory, in functionality order.
#
X
pause 0 "******************** file simple.demo ********************"
load "simple.demo"
X
pause 0 "******************** file controls.demo ********************"
load "controls.demo"
X
pause 0 "******************** file electron.demo ********************"
load "electron.demo"
X
pause 0 "******************** file using.demo ********************"
load "using.demo"
X
pause 0 "******************** file errorbar.demo ********************"
load "errorbar.demo"
X
pause 0 "******************** file param.demo ********************"
load "param.demo"
X
pause 0 "******************** file polar.demo ********************"
load "polar.demo"
X
pause 0 "******************** file poldat.demo ********************"
load "poldat.demo"
X
pause 0 "******************** file surface1.demo ********************"
load "surface1.demo"
X
pause 0 "******************** file surface2.demo ********************"
load "surface2.demo"
X
pause 0 "******************** file contours.demo ********************"
load "contours.demo"
X
pause 0 "******************** file world.demo ********************"
load "world.demo"
X
pause 0 "******************** file bivariat.demo ********************"
load "bivariat.demo"
SHAR_EOF
chmod 0644 gnuplot/demo/all.demo ||
echo 'restore of gnuplot/demo/all.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/all.demo'`"
test 1245 -eq "$Wc_c" ||
echo 'gnuplot/demo/all.demo: original size 1245, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/demo/bivariat.demo ==============
if test -f 'gnuplot/demo/bivariat.demo' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/demo/bivariat.demo (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/demo/bivariat.demo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/demo/bivariat.demo' &&
#
# This demo is very slow and requires unusually large stack size.
# Do not attempt to run this demo under MSDOS.
#
X
# the function integral_f(x) approximates the integral of f(x) from 0 to x.
# integral2_f(x,y) approximates the integral from x to y.
# define f(x) to be any single variable function
#
# the integral is calculated as the sum of f(x_n)*delta
# do this x/delta times (from x down to 0)
#
f(x) = exp(-x**2)
delta = 0.025
#
# integral_f(x) takes one variable, the upper limit. 0 is the lower limit.
# calculate the integral of function f(t) from 0 to x
integral_f(x) = (x>0)?integral1a(x):-integral1b(x)
integral1a(x) = (x<=0)?0:(integral1a(x-delta)+delta*f(x))
integral1b(x) = (x>=0)?0:(integral1b(x+delta)+delta*f(x))
#
# integral2_f(x,y) takes two variables; x is the lower limit, and y the upper.
# claculate the integral of function f(t) from x to y
integral2_f(x,y) = (x<y)?integral2(x,y):-integral2(y,x)
integral2(x,y) = (x>y)?0:(integral2(x+delta,y)+delta*f(x))
X
set title "approximate the integral of functions"
set samples 50
X
plot [-5:5] f(x) title "f(x)=exp(-x**2)", 2/sqrt(pi)*integral_f(x) title "erf(x)=2/sqrt(pi)*integral_f(x)"
X
pause -1 "Hit return to continue"
X
f(x)=sin(x)
X
plot [-5:5] f(x) title "f(x)=sin(x)", integral_f(x)
X
pause -1 "Hit return to continue"
X
set title "approximate the integral of functions (upper and lower limits)"
X
f(x)=(x-2)**2-20
X
plot [-10:10] f(x) title "f(x)=(x-2)**2-20", integral2_f(-5,x)
X
pause -1 "Hit return to continue"
X
f(x)=sin(x-1)-.75*sin(2*x-1)+(x**2)/8-5
X
plot [-10:10] f(x) title "f(x)=sin(x-1)-0.75*sin(2*x-1)+(x**2)/8-5", integral2_f(x,1)
X
pause -1 "Hit return to continue"
X
#
# This definition computes the ackermann. Do not attempt to compute its
# values for non integral values. In addition, do not attempt to compute
# its beyond m = 3, unless you want to wait really long time.
X
ack(m,n) = (m == 0) ? n + 1 : (n == 0) ? ack(m-1,1) : ack(m-1,ack(m,n-1))
X
set xrange [0:3]
set yrange [0:3]
X
set isosamples 4
set samples 4
X
set title "Plot of the ackermann function"
X
splot ack(x, y)
X
pause -1 "Hit return to continue"
X
set xrange [-5:5]
set yrange [-10:10]
set isosamples 10
set samples 100
set key 4,-3
set title "Min(x,y) and Max(x,y)"
X
#
min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y
X
plot sin(x), x**2, x**3, max(sin(x), min(x**2, x**3))+0.5
X
pause -1 "Hit return to continue"
X
#
# gcd(x,y) finds the greatest common divisor of x and y,
# using Euclid's algorithm
# as this is defined only for integers, first round to the nearest integer
gcd(x,y) = gcd1(rnd(max(x,y)),rnd(min(x,y)))
gcd1(x,y) = (y == 0) ? x : gcd1(y, x - x/y * y)
rnd(x) = int(x+0.5)
X
set samples 59
set xrange [1:59]
set auto
set key
X
set title "Greatest Common Divisor (for integers only)"
X
plot gcd(x, 60)
pause -1 "Hit return to continue"
X
set xrange [-10:10]
set yrange [-10:10]
set auto
set isosamples 10
set samples 100
set title ""
X
SHAR_EOF
chmod 0644 gnuplot/demo/bivariat.demo ||
echo 'restore of gnuplot/demo/bivariat.demo failed'
Wc_c="`wc -c < 'gnuplot/demo/bivariat.demo'`"
test 2915 -eq "$Wc_c" ||
echo 'gnuplot/demo/bivariat.demo: original size 2915, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/Makefile ==============
if test ! -d 'gnuplot/docs'; then
echo 'x - creating directory gnuplot/docs'
mkdir 'gnuplot/docs'
fi
if test -f 'gnuplot/docs/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/Makefile (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/Makefile' &&
# Makefile for GNUPLOT documentation
#
# Note that the top-level file for documentation is gnuplot.doc.
# See README.
#
# To print manual:
# make gnuplot.dvi (for latex)
# (print or view gnuplot.dvi)
# OR
# make gnuplot.nroff (for nroff)
# (print or view gnuplot.nroff)
# or
# make "TROFF=itroff" troff (for troff; use your troff here)
#
# $Id: Makefile,v 1.1 90/01/11 15:43:03 dfk Exp Locker: dfk $
X
# usually overridden by ../Makefile
HELPDEST = /usr/local/lib/
X
# substitute your troff command (and any flags) for this one
TROFF=troff
X
# substitute cp if you do not have the install program
INSTALL=install
X
# Compiler flags
# -DSYSV if att sys V
# -DMSDOS if MSDOS PS
# -traditional -g -O if gcc (set 'CC = gcc')
# no extra flags for BSD
CFLAGS = -s
CC = cc
X
# default is what is needed for interactive gnuplot
default: gnuplot.hlp gnuplot.gih
X
### [tn]roff documentation
troff: gnuplot.ms titlepage.ms
X tbl gnuplot.ms | eqn | $(TROFF) -ms
X
nroff gnuplot.nroff: gnuplot.ms titlepage.ms
X tbl gnuplot.ms | neqn | nroff -ms | col > gnuplot.nroff
X
ms gnuplot.ms: doc2ms gnuplot.doc
X ./doc2ms < gnuplot.doc > gnuplot.ms
X
doc2ms: doc2ms.c
X $(CC) $(CFLAGS) -o doc2ms doc2ms.c
X
### LaTeX documentation
tex gnuplot.tex: doc2tex gnuplot.doc
X ./doc2tex < gnuplot.doc > gnuplot.tex
X
dvi gnuplot.dvi: gnuplot.tex titlepage.tex
X (latex gnuplot.tex ; latex gnuplot.tex)
X
doc2tex: doc2tex.c
X $(CC) $(CFLAGS) -o doc2tex doc2tex.c
X
# this is how to make gnuplot.hlp
hlp gnuplot.hlp: doc2hlp gnuplot.doc
X ./doc2hlp < gnuplot.doc > gnuplot.hlp
X
doc2hlp: doc2hlp.c
X $(CC) $(CFLAGS) -o doc2hlp doc2hlp.c
X
# this is how to make gnuplot.gih
gih gnuplot.gih: doc2gih gnuplot.doc
X ./doc2gih < gnuplot.doc > gnuplot.gih
X
doc2gih: doc2gih.c
X $(CC) $(CFLAGS) -o doc2gih doc2gih.c
X
# this is how to check the gnuplot.doc file
check: checkdoc gnuplot.doc
X ./checkdoc < gnuplot.doc
X
checkdoc: checkdoc.c
X $(CC) $(CFLAGS) -o checkdoc checkdoc.c
X
# For Unix and MSDOS only
install-unix: gnuplot.gih
X $(INSTALL) gnuplot.gih $(HELPDEST)
X
# for VMS only
install-vms: gnuplot.hlp
X $(INSTALL) gnuplot.hlp $(HELPDEST)
X
# remove all derived files
clean:
X rm -f doc2ms gnuplot.nroff gnuplot.ms
X rm -f doc2tex gnuplot.tex gnuplot.dvi gnuplot.aux gnuplot.log gnuplot.toc
X rm -f doc2hlp gnuplot.hlp
X rm -f doc2gih gnuplot.gih
X rm -f checkdoc *~ *.o core a.out
SHAR_EOF
chmod 0644 gnuplot/docs/Makefile ||
echo 'restore of gnuplot/docs/Makefile failed'
Wc_c="`wc -c < 'gnuplot/docs/Makefile'`"
test 2363 -eq "$Wc_c" ||
echo 'gnuplot/docs/Makefile: original size 2363, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/README ==============
if test -f 'gnuplot/docs/README' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/README (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/README' &&
Notes on the gnuplot help files and documentation.
X
Gnuplot documentation is available in three ways:
X
1 - interactively, within gnuplot
2 - as a printed document.
3 - as a manual page, through the Unix man(1) facility
X
The first two forms describe the inner workings, and contain
equivalent information, while the third form tells how to run gnuplot.
X
The two first forms above derive their information from the file
gnuplot.doc, which is the MASTER copy of gnuplot help information. All
other forms, except for gnuplot.1, the man page, are derived from it.
X
gnuplot.doc -> gnuplot.hlp
X -> gnuplot.gih
X -> gnuplot.tex
X -> gnuplot.ms
X
On VMS the interactive help is supplied by the system help facility,
using the gnuplot.hlp file. This is made with ('make hlp'). On Unix,
AmigaDOS, and MSDOS the interactive help is built in to the program,
and uses the gnuplot.gih file ('make gih').
X
The printed document is available in either latex or troff/nroff (ms)
format, using gnuplot.tex or gnuplot.ms, derived from gnuplot.doc with
either doc2tex or doc2ms. Type 'make dvi' or 'make nroff'. For troff,
type 'make ms' and then troff -ms gnuplot.ms in whatever way you use
troff.
X
If VMS users prefer the gnuplot interactive help facility to the
system facility, this can be easily changed in command.c.
X
X
Description of the gnuplot.doc format:
--------------------------------------
X
Here is an example of the DOC master help format:
X
?
1 gnuplot
X GNUPLOT is a command-driven interactive function plotting program. It
X ...
?exit
2 exit
X 'exit', 'quit' and ...
?expressions
2 expressions
X In general, any mathematical expression accepted by C, ...
X
X Topics:
X functions operators
?expressions functions
?functions
3 functions
X The functions in GNUPLOT are ...
X
X Topics:
X abs acos arg ...
?expressions functions abs
?functions abs
?abs
4 abs
X This function returns the absolute value of its argument. The
X returned value is of the same type as the argument.
?expressions functions acos
?functions acos
?acos
4 acos
X This function returns the arc cosine (inverse cosine) of its
X argument. 'acos' returns its argument in radians.
X
X
Some notes about the format:
----------------------------
Remember that all text must be able to be processed by gnuplot, VMS,
X nroff, troff, and latex, and always do something reasonable.
The first column is reserved for control characters.
Text does not start in the first column.
Lines that start in column 2 may be typeset by LaTeX.
Lines that have a space in column 2 are to be printed in a verbatim
X environment by LaTeX.
Do NOT use tabs in the help file.
Conversion from this format to vax .hlp file involves removal of
X lines starting with [?@#$%] (see doc2hlp). VMS uses the numbers
X to represent a tree.
Conversion from this format to gnuplot .gih file involves removal of
X lines starting with [0-9@#$%] (see doc2gih). Gnuplot matches your
X help query against the ? lines to find the help information.
X Multiple ? lines for one text block constitute synonyms. The most
X specific should be first, eg 'expressions functions' before 'functions'.
X Spaces are allowed here, but should be single.
Backquote pairs are converted by the doc2tex program into boldface;
X that is, `some text` is converted to {\bf some text}. Be sure to pair
X the backquotes, or the whole document will be boldface!
X
Control characters in first column:
? used by .gih format, for builtin interactive help - keyword
0-9 used by VMS help and by doc2{tex,ms} formatters to define level,keyword
@ used by doc2{tex,ms} to define table start/end
# used by doc2tex: table entry
% used by doc2ms: table entry
SHAR_EOF
chmod 0644 gnuplot/docs/README ||
echo 'restore of gnuplot/docs/README failed'
Wc_c="`wc -c < 'gnuplot/docs/README'`"
test 3681 -eq "$Wc_c" ||
echo 'gnuplot/docs/README: original size 3681, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/checkdoc.c ==============
if test -f 'gnuplot/docs/checkdoc.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/checkdoc.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/checkdoc.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/checkdoc.c' &&
/*
X * checkdoc -- check a doc file for correctness of first column.
X *
X * Prints out lines that have an illegal first character.
X * First character must be space, digit, or ?, @, #, %,
X * or line must be empty.
X *
X * usage: checkdoc < docfile
X * Modified by Russell Lang from hlp2ms.c by Thomas Williams
X *
X * Original version by David Kotz used the following one line script!
X * sed -e '/^$/d' -e '/^[ 0-9?@#%]/d' gnuplot.doc
X *
X */
X
#include <stdio.h>
#include <ctype.h>
X
#define MAX_LINE_LEN 256
#define TRUE 1
#define FALSE 0
X
main()
{
X convert(stdin,stdout);
X exit(0);
}
X
convert(a,b)
X FILE *a,*b;
{
X static char line[MAX_LINE_LEN];
X
X while (fgets(line,MAX_LINE_LEN,a)) {
X process_line(line, b);
X }
}
X
process_line(line, b)
X char *line;
X FILE *b;
{
X switch(line[0]) { /* control character */
X case '?': { /* interactive help entry */
X break; /* ignore */
X }
X case '@': { /* start/end table */
X break; /* ignore */
X }
X case '#': { /* latex table entry */
X break; /* ignore */
X }
X case '%': { /* troff table entry */
X break; /* ignore */
X }
X case '\n': /* empty text line */
X case ' ': { /* normal text line */
X break;
X }
X default: {
X if (isdigit(line[0])) { /* start of section */
X /* ignore */
X } else
X fputs(line,b); /* output bad line */
X break;
X }
X }
}
X
SHAR_EOF
chmod 0666 gnuplot/docs/checkdoc.c ||
echo 'restore of gnuplot/docs/checkdoc.c failed'
Wc_c="`wc -c < 'gnuplot/docs/checkdoc.c'`"
test 1377 -eq "$Wc_c" ||
echo 'gnuplot/docs/checkdoc.c: original size 1377, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/doc2gih.c ==============
if test -f 'gnuplot/docs/doc2gih.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/doc2gih.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/doc2gih.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2gih.c' &&
/*
X * doc2gih.c -- program to convert Gnuplot .DOC format to gnuplot
X * interactive help (.GIH) format.
X *
X * This involves stripping all lines with a leading digit or
X * a leading @, #, or %.
X * Modified by Russell Lang from hlp2ms.c by Thomas Williams
X *
X * usage: doc2gih < file.doc > file.gih
X *
X * Original version by David Kotz used the following one line script!
X * sed '/^[0-9@#%]/d' file.doc > file.gih
X */
X
#include <stdio.h>
#include <ctype.h>
X
#define MAX_LINE_LEN 256
#define TRUE 1
#define FALSE 0
X
main(argc,argv)
int argc;
char **argv;
{
FILE * infile;
FILE * outfile;
X infile = stdin;
X outfile = stdout;
X if (argc > 3) {
X fprintf(stderr,"Usage: %s infile outfile\n", argv[0]);
X exit(1);
X }
X if (argc >= 2)
X if ( (infile = fopen(argv[1],"r")) == (FILE *)NULL) {
X fprintf(stderr,"%s: Can't open %s for reading\n",
X argv[0], argv[1]);
X exit(1);
X }
X if (argc == 3)
X if ( (outfile = fopen(argv[2],"w")) == (FILE *)NULL) {
X fprintf(stderr,"%s: Can't open %s for writing\n",
X argv[0], argv[2]);
X }
X
X convert(infile,outfile);
X exit(0);
}
X
X
convert(a,b)
X FILE *a,*b;
{
X static char line[MAX_LINE_LEN];
X
X while (fgets(line,MAX_LINE_LEN,a)) {
X process_line(line, b);
X }
}
X
process_line(line, b)
X char *line;
X FILE *b;
{
X static int line_count = 0;
X
X line_count++;
X
X switch(line[0]) { /* control character */
X case '?': { /* interactive help entry */
X (void) fputs(line,b);
X break;
X }
X case '@': { /* start/end table */
X break; /* ignore */
X }
X case '#': { /* latex table entry */
X break; /* ignore */
X }
X case '%': { /* troff table entry */
X break; /* ignore */
X }
X case '\n': /* empty text line */
X case ' ': { /* normal text line */
X (void) fputs(line,b);
X break;
X }
X default: {
X if (isdigit(line[0])) { /* start of section */
X /* ignore */
X } else
X fprintf(stderr, "unknown control code '%c' in column 1, line %d\n",
X line[0], line_count);
X break;
X }
X }
}
X
SHAR_EOF
chmod 0666 gnuplot/docs/doc2gih.c ||
echo 'restore of gnuplot/docs/doc2gih.c failed'
Wc_c="`wc -c < 'gnuplot/docs/doc2gih.c'`"
test 2021 -eq "$Wc_c" ||
echo 'gnuplot/docs/doc2gih.c: original size 2021, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/doc2hlp.c ==============
if test -f 'gnuplot/docs/doc2hlp.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/doc2hlp.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/doc2hlp.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2hlp.c' &&
/*
X * doc2hlp.c -- program to convert Gnuplot .DOC format to
X * VMS help (.HLP) format.
X *
X * This involves stripping all lines with a leading ?,
X * @, #, or %.
X * Modified by Russell Lang from hlp2ms.c by Thomas Williams
X *
X * usage: doc2hlp < file.doc > file.hlp
X *
X * Original version by David Kotz used the following one line script!
X * sed '/^[?@#%]/d' file.doc > file.hlp
X */
X
#include <stdio.h>
#include <ctype.h>
X
#define MAX_LINE_LEN 256
#define TRUE 1
#define FALSE 0
X
main()
{
X convert(stdin,stdout);
X exit(0);
}
X
X
convert(a,b)
X FILE *a,*b;
{
X static char line[MAX_LINE_LEN];
X
X while (fgets(line,MAX_LINE_LEN,a)) {
X process_line(line, b);
X }
}
X
process_line(line, b)
X char *line;
X FILE *b;
{
X static int line_count = 0;
X
X line_count++;
X
X switch(line[0]) { /* control character */
X case '?': { /* interactive help entry */
X break; /* ignore */
X }
X case '@': { /* start/end table */
X break; /* ignore */
X }
X case '#': { /* latex table entry */
X break; /* ignore */
X }
X case '%': { /* troff table entry */
X break; /* ignore */
X }
X case '\n': /* empty text line */
X case ' ': { /* normal text line */
SHAR_EOF
true || echo 'restore of gnuplot/docs/doc2hlp.c failed'
fi
echo 'End of part 7'
echo 'File gnuplot/docs/doc2hlp.c is continued in part 8'
echo 8 > _shar_seq_.tmp
#!/bin/sh
# this is Part.08 (part 8 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/docs/doc2hlp.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 8; 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/docs/doc2hlp.c'
else
echo 'x - continuing file gnuplot/docs/doc2hlp.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/doc2hlp.c' &&
X (void) fputs(line,b);
X break;
X }
X default: {
X if (isdigit(line[0])) { /* start of section */
X (void) fputs(line,b);
X } else
X fprintf(stderr, "unknown control code '%c' in column 1, line %d\n",
X line[0], line_count);
X break;
X }
X }
}
SHAR_EOF
echo 'File gnuplot/docs/doc2hlp.c is complete' &&
chmod 0666 gnuplot/docs/doc2hlp.c ||
echo 'restore of gnuplot/docs/doc2hlp.c failed'
Wc_c="`wc -c < 'gnuplot/docs/doc2hlp.c'`"
test 1471 -eq "$Wc_c" ||
echo 'gnuplot/docs/doc2hlp.c: original size 1471, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/doc2hlp.com ==============
if test -f 'gnuplot/docs/doc2hlp.com' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/doc2hlp.com (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/doc2hlp.com (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2hlp.com' &&
$ def/user sys$input [.docs]gnuplot.doc
$ def/user sys$output []gnuplot.hlp
$ run doc2hlp
SHAR_EOF
chmod 0666 gnuplot/docs/doc2hlp.com ||
echo 'restore of gnuplot/docs/doc2hlp.com failed'
Wc_c="`wc -c < 'gnuplot/docs/doc2hlp.com'`"
test 90 -eq "$Wc_c" ||
echo 'gnuplot/docs/doc2hlp.com: original size 90, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/doc2ms.c ==============
if test -f 'gnuplot/docs/doc2ms.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/doc2ms.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/doc2ms.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2ms.c' &&
/*
X * doc2ms.c -- program to convert Gnuplot .DOC format to *roff -ms document
X * From hlp2ms by Thomas Williams
X *
X * Modified by Russell Lang, 2nd October 1989
X * to make vms help level 1 and 2 create the same ms section level.
X *
X * Modified to become doc2ms by David Kotz (David...@Dartmouth.edu) 12/89
X * Added table and backquote support.
X *
X * usage: doc2ms < file.doc > file.ms
X *
X * where file.doc is a VMS .DOC file, and file.ms will be a [nt]roff
X * document suitable for printing with nroff -ms or troff -ms
X *
X * typical usage for GNUPLOT:
X *
X * doc2ms < gnuplot.doc | troff -ms
X */
X
static char rcsid[] = "$Id: doc2ms.c,v 1.1 90/01/11 15:43:54 dfk Exp Locker: dfk $";
X
#include <stdio.h>
#include <ctype.h>
#ifdef AMIGA_LC_5_1
#include <string.h>
#endif
X
#define MAX_NAME_LEN 256
#define MAX_LINE_LEN 256
#define LINE_SKIP 3
X
#define TRUE 1
#define FALSE 0
X
typedef int boolean;
X
static boolean intable = FALSE;
X
main()
{
X init(stdout);
X convert(stdin,stdout);
X finish(stdout);
X exit(0);
}
X
X
init(b)
FILE *b;
{
X /* in nroff, increase line length by 8 and don't adjust lines */
X (void) fputs(".if n \\{.nr LL +8m\n.na \\}\n",b);
X (void) fputs(".nr PO +0.3i\n",b);
X (void) fputs(".so titlepage.ms\n",b);
X (void) fputs(".pn 1\n",b);
X (void) fputs(".bp\n",b);
X (void) fputs(".ta 1.5i 3.0i 4.5i 6.0i 7.5i\n",b);
X (void) fputs("\\&\n.sp 3\n.PP\n",b);
X /* following line commented out by rjl
X (void) fputs(".so intro\n",b);
X */
}
X
X
convert(a,b)
X FILE *a,*b;
{
X static char line[MAX_LINE_LEN];
X
X while (fgets(line,MAX_LINE_LEN,a)) {
X process_line(line, b);
X }
}
X
process_line(line, b)
X char *line;
X FILE *b;
{
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(".TE\n", b);
X (void) fputs(".EQ\ndelim off\n.EN\n\n",b);
X intable = FALSE;
X } else {
X (void) fputs("\n.EQ\ndelim $$\n.EN\n",b);
X (void) fputs(".TS\ncenter box tab (@) ;\n", b);
X (void) fputs("c c l .\n", b);
X intable = TRUE;
X }
X /* ignore rest of line */
X break;
X }
X case '#': { /* latex table entry */
X break; /* ignore */
X }
X case '%': { /* troff 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 '\n': /* empty text line */
X case ' ': { /* normal text line */
X if (intable)
X break; /* ignore while in table */
X switch(line[1]) {
X case ' ': {
X /* verbatim mode */
X fputs(".br\n",b);
X fputs(line+1,b);
X fputs(".br\n",b);
X break;
X }
X case '\'': {
X fputs("\\&",b);
X putms(line+1,b);
X break;
X }
X default: {
X if (line[0] == '\n')
X putms(line,b); /* handle totally blank line */
X else
X putms(line+1,b);
X break;
X }
X break;
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
/* process a line with a digit control char */
/* starts a new [sub]section */
X
section(line, b)
X char *line;
X FILE *b;
{
X static char string[MAX_LINE_LEN];
X int sh_i;
X static int old = 1;
X
X
#ifdef AMIGA_LC_5_1
X (void) sscanf(line,"%d",&sh_i);
X strcpy(string,strchr(line,' ')+1);
X {
X char *p;
X p = strchr(string,'\n');
X if (p != NULL) *p = '\0';
X }
#else
X (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
#endif
X
X (void) fprintf(b,".sp %d\n",(sh_i == 1) ? LINE_SKIP : LINE_SKIP-1);
X
X if (sh_i > old) {
X do
X if (old!=1) /* this line added by rjl */
X (void) fputs(".RS\n.IP\n",b);
X while (++old < sh_i);
X }
X else if (sh_i < old) {
X do
X if (sh_i!=1) /* this line added by rjl */
X (void) fputs(".RE\n.br\n",b);
X while (--old > sh_i);
X }
X
X /* added by dfk to capitalize section headers */
X if (islower(string[0]))
X string[0] = toupper(string[0]);
X
X /* next 3 lines added by rjl */
X if (sh_i!=1)
X (void) fprintf(b,".NH %d\n%s\n.sp 1\n.LP\n",sh_i-1,string);
X else
X (void) fprintf(b,".NH %d\n%s\n.sp 1\n.LP\n",sh_i,string);
X old = sh_i;
X
X (void) fputs(".XS\n",b);
X (void) fputs(string,b);
X (void) fputs("\n.XE\n",b);
}
X
putms(s, file)
X char *s;
X FILE *file;
{
X static boolean inquote = FALSE;
X
X while (*s != '\0') {
X switch (*s) {
X case '`': { /* backquote -> boldface */
X if (inquote) {
X fputs("\\fR", file);
X inquote = FALSE;
X } else {
X fputs("\\fB", file);
X inquote = TRUE;
X }
X break;
X }
X case '\\': { /* backslash */
X fputs("\\\\", file);
X break;
X }
X default: {
X fputc(*s, file);
X break;
X }
X }
X s++;
X }
}
X
finish(b) /* spit out table of contents */
FILE *b;
{
X (void) fputs(".pn 1\n",b);
X (void) fputs(".ds RH %\n",b);
X (void) fputs(".af % i\n",b);
X (void) fputs(".bp\n.PX\n",b);
}
SHAR_EOF
chmod 0644 gnuplot/docs/doc2ms.c ||
echo 'restore of gnuplot/docs/doc2ms.c failed'
Wc_c="`wc -c < 'gnuplot/docs/doc2ms.c'`"
test 5125 -eq "$Wc_c" ||
echo 'gnuplot/docs/doc2ms.c: original size 5125, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/gnuplot.1 ==============
if test -f 'gnuplot/docs/gnuplot.1' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/gnuplot.1 (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/gnuplot.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/gnuplot.1' &&
.\" dummy line
.TH GNUPLOT 1 "31 August 1990"
.UC 4
.SH NAME
gnuplot \- an interactive plotting program
.SH SYNOPSIS
.B gnuplot
[ X11 options ] [file ...]
.br
.SH DESCRIPTION
.I Gnuplot
is a command-driven interactive function plotting program.
.PP
If files are given,
.I gnuplot
loads each file with the
.I load
command, in the order specified.
.I Gnuplot
exits after the last file is processed.
.PP
Here are some of its features:
.PP
Plots any number of functions, built up of C operators, C library
functions, and some things C doesn't have like **, sgn(), etc. Also
support for plotting data files, to compare actual
data to theoretical curves.
.PP
User-defined X and Y ranges (optional auto-ranging), smart axes scaling,
smart tic marks.
.PP
Labelling of X and Y axes.
.PP
User-defined constants and functions.
.PP
Support through a generalized graphics driver for
AED 512,
AED 767,
BBN BitGraph,
Commodore Amiga,
Roland DXY800A,
EEPIC,
EmTeX,
Epson 60dpi printers,
Epson LX-800,
Fig,
HP2623,
HP2648,
HP75xx,
HPGL,
HP LaserJet II,
Imagen,
Iris 4D,
Kermit-MS,
Kyocera laser printer,
LaTeX,
NEC CP6 pinwriter,
PostScript,
QMS QUIC,
ReGis (VT125 and VT2xx),
SCO Xenix CGI,
Selanar,
Star color printer,
Tandy DMP-130 printer,
Tek 401x,
Tek 410x,
Vectrix 384,
VT like tekronix emulator,
Unix PC (ATT 3b1 or ATT 7300),
unixplot,
and X11.
The PC version compiled by Microsoft C
supports IBM CGA, EGA, VGA, Hercules, ATT 6300,
and Corona 325 graphics.
The PC version compiled by Turbo C
supports IBM CGA, EGA, MCGA, VGA, Hercules and ATT 6300 graphics.
Other devices can be added simply, but will require recompiling.
.PP
Shell escapes and command line substitution.
.PP
Load and save capability.
.PP
Output redirection.
.PP
All computations performed in the complex domain. Just the real part is
plotted by default, but functions like imag() and abs() and arg() are
available to override this.
.SH X11 OPTIONS
.I Gnuplot
provides two terminal types (\fIx11\fP and \fIX11\fP) for use
with X servers. The \fIX11\fP terminal type provides differing colors as well
as shapes for the \fIpoints\fP plotting style. The two types are otherwise
identical. When used with either of these terminal types, \fIgnuplot\fP
honors all the standard X Toolkit options and resources such as geometry, font,
foreground and background. See the X(1) man page for a description of
the options. For color or grayscale displays \fIgnuplot\fP also honors
the following resources (shown here with default values):
.sp
.B "gnuplot*textColor: black"
.br
.B "gnuplot*borderColor: black"
.br
.B "gnuplot*axisColor: black"
.br
.B "gnuplot*line1Color: red"
.br
.B "gnuplot*line2Color: green"
.br
.B "gnuplot*line3Color: blue"
.br
.B "gnuplot*line4Color: magenta"
.br
.B "gnuplot*line5Color: cyan"
.br
.B "gnuplot*line6Color: sienna"
.br
.B "gnuplot*line7Color: orange"
.br
.B "gnuplot*line8Color: coral"
.br
.PP
The size or aspect ratio of a plot may be changed by resizing the
.I gnuplot
window.
.SH AUTHORS
Thomas Williams, Pixar Corporation,
.br
(pixar!info-g...@sun.com)
.br
and Colin Kelley.
.PP
Additions for labelling by Russell Lang, Monash University, Australia.
.br
(r...@monu1.cc.monash.edu.au)
.br
Further additions by David Kotz, Dartmouth College, New Hampshire, USA
(formerly of Duke University, North Carolina, USA).
.br
(David...@Dartmouth.edu)
.br
XX11 support by Ed Kubaitis, University of Illinois, USA.
.SH BUGS
The atan() function does not work correctly for complex arguments.
.br
The bessel functions do not work for complex arguments.
.br
See the
.I help bugs
command in gnuplot.
.SH SEE ALSO
See the printed manual or the on-line help for details on specific commands.
.br
XX(1).
SHAR_EOF
chmod 0644 gnuplot/docs/gnuplot.1 ||
echo 'restore of gnuplot/docs/gnuplot.1 failed'
Wc_c="`wc -c < 'gnuplot/docs/gnuplot.1'`"
test 3718 -eq "$Wc_c" ||
echo 'gnuplot/docs/gnuplot.1: original size 3718, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/gnuplot.doc ==============
if test -f 'gnuplot/docs/gnuplot.doc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/gnuplot.doc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/gnuplot.doc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/gnuplot.doc' &&
1 gnuplot
?
X GNUPLOT is a command-driven interactive function plotting program. It
X is case sensitive (commands and function names written in lowercase
X are not the same as those written in CAPS). All command names may be
X abbreviated, as long as the abbreviation is not ambiguous. Any number
X of commands may appear on a line, separated by semicolons (;).
X Strings are indicated with quotes. They may be either single or double
X quotation marks, e.g.,
X
X load "filename"
X cd 'dir'
X
X Any command-line arguments are assumed to be names of files containing
X GNUPLOT commands, with the exception of standard X11 arguments, which
X are processed first. Each file is loaded with the `load` command, in the
X order specified. GNUPLOT exits after the last file is processed. When
X no load files are named, gnuplot enters into an interactive mode.
X
X Commands may extend over several input lines, by ending each
X line but the last with a backslash (\). The backslash must be the LAST
X character on each line. The effect is as if the backslash and newline
X were not there. That is, no white space is implied, nor is a comment
X terminated. Therefore, commenting out a continued line comments out
X the entire command (see `comment`).
X
X In this documentation, curly braces ({}) denote optional arguments to
X many commands, and a vertical bar (|) separates mutually exclusive
X choices. GNUPLOT keywords or help topics are indicated by backquotes
X or `boldface` (where available). Angle brackets (<>) are used to mark
X replaceable tokens.
X
X For help on any topic, type `help` followed by the name of the topic.
X
X The new GNUPLOT user should begin by reading about the `plot`
X command (type `help plot`).
2 cd
?cd
X The `cd` command changes the working directory.
X
X Syntax:
X cd "<directory-name>"
X
X The directory name must be enclosed in quotes.
X
X Examples:
X cd 'subdir'
X cd ".."
2 clear
?clear
X The `clear` command erases the current screen or output device as
X specified by `set output`. This usually generates a formfeed on
X hardcopy devices. Use `set terminal` to set the device type.
2 command-line editing
?line-editing
?editing
?history
X The Unix and IBM PC versions of GNUPLOT support command-line editing.
X Also, a history mechanism allows previous commands to be edited, and
X re-executed. After the command line has been edited, a newline or
X carriage return will enter the entire line regardless of where the
X cursor is positioned.
X
X The editing commands are as follows:
X
@start table - first is interactive cleartext form
X `Line editing`:
X
X ^B moves back a single character.
X ^F moves forward a single character.
X ^A moves to the beginning of the line.
X ^E moves to the end of the line.
X ^H and DEL delete the previous character.
X ^D deletes the current character.
X ^K deletes from current position to the end of line.
X ^L,^R redraws line in case it gets trashed.
X ^U deletes the entire line.
X ^W deletes the last word.
X
X `History`:
X
X ^P moves back through history.
X ^N moves forward through history.
#Character && Function \\ \hline
#\multicolumn{3}{|c|}{Line Editing}\\
#\verb~^B~ && move back a single character.\\
#\verb~^F~ && move forward a single character.\\
#\verb~^A~ && move to the beginning of the line.\\
#\verb~^E~ && move to the end of the line.\\
#\verb~^H, DEL~ && delete the previous character.\\
#\verb~^D~ && delete the current character.\\
#\verb~^K~ && delete from current position to the end of line.\\
#\verb~^L, ^R~ && redraw line in case it gets trashed.\\
#\verb~^U~ && delete the entire line. \\
#\verb~^W~ && delete from the current word to the end of line. \\ \hline
#\multicolumn{3}{|c|}{History} \\
#\verb~^P~ && move back through history.\\
#\verb~^N~ && move forward through history.\\
%Character@@Function
%_
%@@Line Editing
%^B@@move back a single character.
%^F@@move forward a single character.
%^A@@move to the beginning of the line.
%^E@@move to the end of the line.
%^H, DEL@@delete the previous character.
%^D@@delete the current character.
%^K@@delete from current position to the end of line.
%^L, ^R@@redraw line in case it gets trashed.
%^U@@delete the entire line.
%^W@@delete from the current word to the end of line.
%_
%@@History
%^P@@move back through history.
%^N@@move forward through history.
@end table
X
X On the IBM PC the use of a TSR program such as DOSEDIT or CED may be
X desired for line editing. For such a case GNUPLOT may be compiled with
X no line editing capability (default makefile setup). Set READLINE in the
X makefile and add readline.obj to the link file if GNUPLOT line editing
X is to be used for the IBM PC. The following arrow keys may be used
X on the IBM PC version if readline is used:
X
@start table - first is interactive cleartext form
X Left Arrow - same as ^B.
X Right Arrow - same as ^F.
X Ctl Left Arrow - same as ^A.
X Ctl Right Arrow - same as ^E.
X Up Arrow - same as ^P.
X Down Arrow - same as ^N.
#Arrow key & Function & \\ \hline
#Left & same as \verb~^B~. & \\
#Right & same as \verb~^F~. & \\
#Ctl Left & same as \verb~^A~. & \\
#Ctl Right & same as \verb~^E~. & \\
#Up & same as \verb~^P~. & \\
#Down & same as \verb~^N~. & \\
%Arrow key@@Function
%_
%Left Arrow@@same as ^B.
%Right Arrow@@same as ^F.
%Ctl Left Arrow@@same as ^A.
%Ctl Right Arrow@@same as ^E.
%Up Arrow@@same as ^P.
%Down Arrow@@same as ^N.
%_
@end table
2 comment
?comments
X Comments are supported as follows: a # may appear in most places in a line
X and GNUPLOT will ignore the rest of the line. It will not have this
X effect inside quotes, inside numbers (including complex numbers), inside
X command substitutions, etc. In short, it works anywhere it makes sense
X to work.
2 environment
?environment
X A number of shell environment variables are understood by GNUPLOT.
X None of these are required, but may be useful.
X
X If GNUTERM is defined, it is used as the name of the terminal type to
X be used. This overrides any terminal type sensed by GNUPLOT on start
X up, but is itself overridden by the .gnuplot (or equivalent) start-up
X file (see `start-up`), and of course by later explicit changes.
X
X On Unix, AmigaDOS, and MS-DOS, GNUHELP may be defined to be the pathname
X of the HELP file (gnuplot.gih).
X
X On VMS, the symbol GNUPLOT$HELP should be defined as the name of
X the help library for GNUPLOT.
X
X On Unix, HOME is used as the name of a directory to search for
X a .gnuplot file if none is found in the current directory.
X On AmigaDOS and MS-DOS, GNUPLOT is used. On VMS, SYS$LOGIN: is used.
X See help start-up.
X
X On Unix, PAGER is used as an output filter for help messages.
X
X On Unix and AmigaDOS, SHELL is used for the `shell` command. On MS-DOS,
X COMSPEC is used for the `shell` command.
X
X On AmigaDOS, GNUFONT is used for the screen font. For example:
X "setenv GNUFONT sapphire/14".
X
X On MS-DOS, if the BGI interface is used, the variable `BGI` is used to point
X to the full path to the BGI drivers directory. Furthermore SVGA is used to
X name the Super VGA BGI driver in 800x600 res., and its mode of operation
X as 'Name.Mode'.
X For example, if the Super VGA driver is C:\TC\BGI\SVGADRV.BGI and mode 3 is
X used for 800x600 res., then: 'set BGI=C:\TC\BGI' and 'set SVGA=SVGADRV.3'.
2 exit
?exit
?quit
X The commands `exit` and `quit` and the END-OF-FILE character
X will exit GNUPLOT. All these commands will clear the output device
X (as the `clear` command does) before exiting.
2 expressions
?expressions
X In general, any mathematical expression accepted by C, FORTRAN,
X Pascal, or BASIC is valid. The precedence of these operators is
X determined by the specifications of the C programming language.
X White space (spaces and tabs) is ignored inside expressions.
X
X Complex constants may be expressed as the {<real>,<imag>}, where <real>
X and <imag> must be numerical constants. For example, {3,2}
X represents 3 + 2i; {0,1} represents `i` itself. The curly braces
X are explicitly required here.
3 functions
?expressions functions
?functions
X The functions in GNUPLOT are the same as the corresponding functions
X in the Unix math library, except that all functions accept integer,
X real, and complex arguments, unless otherwise noted. The `sgn`
X function is also supported, as in BASIC.
@start table
#Function & Arguments & Returns \\ \hline
%Function@Arguments@Returns
%_
4 abs
?expressions functions abs
?functions abs
?abs
#abs(x) & any & absolute value of {\tt x}, $|x|$; same type \\
#abs(x) & complex & length of {\tt x}, $\sqrt{{\mbox{real}(x)^{2} +
#\mbox{imag}(x)^{2}}}$ \\
%abs(x)@any@absolute value of x, $|x|$; same type
%abs(x)@complex@length of x, $sqrt{roman real (x) sup 2 + roman imag (x) sup 2}$
X The `abs` function returns the absolute value of its argument. The
X returned value is of the same type as the argument.
X
X For complex arguments, abs(x) is defined as the length of x in the
X complex plane [i.e., sqrt(real(x)**2 + imag(x)**2) ].
4 acos
?expressions functions acos
?functions acos
?acos
#acos(x) & any & $\cos^{-1} x$ (inverse cosine) in radians \\
%acos(x)@any@$cos sup -1 x$ (inverse cosine) in radians
X The `acos` function returns the arc cosine (inverse cosine) of its
X argument. `acos` returns its argument in radians.
4 arg
?expressions functions arg
?functions arg
?arg
#arg(x) & complex & the phase of $x$ in radians\\
%arg(x)@complex@the phase of $x$ in radians
X The `arg` function returns the phase of a complex number, in radians.
4 asin
?expressions functions asin
?functions asin
?asin
#asin(x) & any & $\sin^{-1} x$ (inverse sin) in radians \\
%asin(x)@any@$sin sup -1 x$ (inverse sin) in radians
X The `asin` function returns the arc sin (inverse sin) of its argument.
X `asin` returns its argument in radians.
4 atan
?expressions functions atan
?functions atan
?atan
#atan(x) & any & $\tan^{-1} x$ (inverse tangent) in radians \\
%atan(x)@any@$tan sup -1 x$ (inverse tangent) in radians
X The `atan` function returns the arc tangent (inverse tangent) of its
X argument. `atan` returns its argument in radians.
4 besj0
?expressions functions besj0
?functions besj0
?besj0
#besj0(x) & radians & $j_{0}$ Bessel function of $x$ \\
%besj0(x)@radians@$j sub 0$ Bessel function of $x$
X The `besj0` function returns the j0th Bessel function of its argument.
X `besj0` expects its argument to be in radians.
4 besj1
?expressions functions besj1
?functions besj1
?besj1
#besj1(x) & radians & $j_{1}$ Bessel function of $x$ \\
%besj1(x)@radians@$j sub 1$ Bessel function of $x$
X The `besj1` function returns the j1st Bessel function of its argument.
X `besj1` expects its argument to be in radians.
4 besy0
?expressions functions besy0
?functions besy0
?besy0
#besy0(x) & radians & $y_{0}$ Bessel function of $x$ \\
%besy0(x)@radians@$y sub 0$ Bessel function of $x$
X The `besy0` function returns the y0th Bessel function of its argument.
X `besy0` expects its argument to be in radians.
4 besy1
?expressions functions besy1
?functions besy1
?besy1
#besy1(x) & radians & $y_{1}$ Bessel function of $x$ \\
%besy1(x)@radians@$y sub 1$ Bessel function of $x$
X The `besy1` function returns the y1st Bessel function of its argument.
X `besy1` expects its argument to be in radians.
4 ceil
?expressions functions ceil
?functions ceil
?ceil
#ceil(x) & any & $\lceil x \rceil$, smallest integer not less than $x$
#(real part) \\
%ceil(x)@any@$left ceiling x right ceiling$, smallest integer not less than $x$ (real part)
X The `ceil` function returns the smallest integer that is not less than its
X argument. For complex numbers, `ceil` returns the smallest integer
X not less than the real part of its argument.
4 cos
?expressions functions cos
?functions cos
?cos
#cos(x) & radians & $\cos x$, cosine of $x$ \\
%cos(x)@radians@$cos~x$, cosine of $x$
X The `cos` function returns the cosine of its argument. `cos` expects its
X argument to be in radians.
4 cosh
?expressions functions cosh
?functions cosh
?cosh
#cosh(x) & radians & $\cosh x$, hyperbolic cosine of $x$ \\
%cosh(x)@radians@$cosh~x$, hyperbolic cosine of $x$
X The `cosh` function returns the hyperbolic cosine of its argument.
X `cosh` expects its argument to be in radians.
4 exp
?expressions functions exp
?functions exp
?exp
#exp(x) & any & $e^{x}$, exponential function of $x$ \\
%exp(x)@any@$e sup x$, exponential function of $x$
X The `exp` function returns the exponential function of its argument
X (`e` raised to the power of its argument).
4 floor
?expressions functions floor
?functions floor
?floor
#floor(x) & any & $\lfloor x \rfloor$, largest integer not greater
#than $x$ (real part) \\
%floor(x)@any@$left floor x right floor$, largest integer not greater than $x$ (real part)
X The `floor` function returns the largest integer not greater than its
X argument. For complex numbers, `floor` returns the largest
X integer not greater than the real part of its argument.
4 gamma
?expressions functions gamma
?functions gamma
?gamma
#gamma(x) & any & $\Gamma(\mbox{real}(x))$, gamma function of real($x$) \\
%gamma(x)@any@$GAMMA ( roman real (x))$, gamma function of real ($x$)
X The `gamma` function returns the gamma function of the real part of
X its argument. For integer n, gamma(n+1) = n! .
X If the argument is a complex value, the imaginary component is ignored.
4 imag
?expressions functions imag
?functions imag
?imag
#imag(x) & complex & imaginary part of $x$ as a real number \\
%imag(x)@complex@imaginary part of $x$ as a real number
X The `imag` function returns the imaginary part of its argument as a
X real number.
4 int
?expressions functions int
?functions int
?int
#int(x) & real & integer part of $x$, truncated toward zero \\
%int(x)@real@integer part of $x,$ truncated toward zero
X The `int` function returns the integer part of its argument, truncated
X toward zero.
4 log
?expressions functions log
?functions log
?log
#log(x) & any & $\log_{e} x$, natural logarithm (base $e$) of $x$ \\
%log(x)@any@$ln~x$, natural logarithm (base $e$) of $x$
X The `log` function returns the natural logarithm (base `e`) of its
X argument.
4 log10
?expressions functions log10
?functions log10
?log10
#log10(x) & any & $\log_{10} x$, logarithm (base $10$) of $x$ \\
%log10(x)@any@${log sub 10}~x$, logarithm (base $10$) of $x$
X The `log10` function returns the logarithm (base 10) of its argument.
4 real
?expressions functions real
?functions real
?real
#real(x) & any & real part of $x$ \\
%real(x)@any@real part of $x$
X The `real` function returns the real part of its argument.
4 sgn
?expressions functions sgn
?functions sgn
?sgn
#sgn(x) & any & 1 if $x>0$, -1 if $x<0$, 0 if $x=0$. imag($x$) ignored \\
%sgn(x)@any@1 if $x > 0$, -1 if $x < 0$, 0 if $x = 0$. $roman imag (x)$ ignored
X The `sgn` function returns 1 if its argument is positive, -1 if its
X argument is negative, and 0 if its argument is 0. If the argument
X is a complex value, the imaginary component is ignored.
4 sin
?expressions functions sin
?functions sin
?sin
#sin(x) & radians & $\sin x$, sine of $x$ \\
%sin(x)@radians@$sin~x$, sine of $x$
X The `sin` function returns the sine of its argument. `sin` expects its
X argument to be in radians.
4 sinh
?expressions functions sinh
?functions sinh
?sinh
#sinh(x) & radians & $\sinh x$, hyperbolic sine $x$ \\
%sinh(x)@radians@$sinh~x$, hyperbolic sine $x$
X The `sinh` function returns the hyperbolic sine of its argument. `sinh`
X expects its argument to be in radians.
4 sqrt
?expressions functions sqrt
?functions sqrt
?sqrt
#sqrt(x) & any & $\sqrt{x}$, square root of $x$ \\
%sqrt(x)@any@$sqrt x $, square root of $x$
X The `sqrt` function returns the square root of its argument.
4 tan
?expressions functions tan
?functions tan
?tan
#tan(x) & radians & $\tan x$, tangent of $x$ \\
%tan(x)@radians@$tan~x$, tangent of $x$
X The `tan` function returns the tangent of its argument. `tan` expects
X its argument to be in radians.
4 tanh
?expressions functions tanh
?functions tanh
?tanh
#tanh(x) & radians & $\tanh x$, hyperbolic tangent of $x$\\
%tanh(x)@radians@$tanh~x$, hyperbolic tangent of $x$
X The `tanh` function returns the hyperbolic tangent of its argument.
X `tanh` expects its argument to be in radians.
@end table
3 operators
?expressions operators
?operators
X The operators in GNUPLOT are the same as the corresponding operators
X in the C programming language, except that all operators accept
X integer, real, and complex arguments, unless otherwise noted.
X The ** operator (exponentiation) is supported, as in FORTRAN.
X
X Parentheses may be used to change order of evaluation.
4 binary
?expressions operators binary
?operators binary
?binary
X The following is a list of all the binary operators and their
X usages:
X
@start table - first is interactive cleartext form
X Symbol Example Explanation
X ** a**b exponentiation
X * a*b multiplication
X / a/b division
X % a%b * modulo
X + a+b addition
X - a-b subtraction
X == a==b equality
X != a!=b inequality
X & a&b * bitwise AND
X ^ a^b * bitwise exclusive OR
X | a|b * bitwise inclusive OR
X && a&&b * logical AND
X || a||b * logical OR
X ?: a?b:c * ternary operation
#\multicolumn{3}{|c|}{Binary Operators} \\
#Symbol & Example & Explanation \\ \hline
#\verb~**~ & \verb~a**b~ & exponentiation\\
#\verb~*~ & \verb~a*b~ & multiplication\\
#\verb~/~ & \verb~a/b~ & division\\
#\verb~%~ & \verb~a%b~ & * modulo\\
#\verb~+~ & \verb~a+b~ & addition\\
#\verb~-~ & \verb~a-b~ & subtraction\\
#\verb~==~ & \verb~a==b~ & equality\\
#\verb~!=~ & \verb~a!=b~ & inequality\\
#\verb~&~ & \verb~a&b~ & * bitwise AND\\
#\verb~^~ & \verb~a^b~ & * bitwise exclusive OR\\
#\verb~|~ & \verb~a|b~ & * bitwise inclusive OR\\
#\verb~&&~ & \verb~a&&b~ & * logical AND\\
#\verb~||~ & \verb~a||b~ & * logical OR\\
#\verb~?:~ & \verb~a?b:c~ & * ternary operation\\
%Symbol@Example@Explanation
%_
%**@a**b@exponentiation
%*@a*b@multiplication
%/@a/b@division
%%@a%b@* modulo
%+@a+b@addition
%-@a-b@subtraction
%==@a==b@equality
%!=@a!=b@inequality
%&@a&b@* bitwise AND
%^@a^b@* bitwise exclusive OR
%|@a|b@* bitwise inclusive OR
%&&@a&&b@* logical AND
%||@a||b@* logical OR
%?:@a?b:c@* ternary operation
X
@end table
X (*) Starred explanations indicate that the operator requires
X integer arguments.
X
X Logical AND (&&) and OR (||) short-circuit the way they do in C.
X That is, the second && operand is not evaluated if the first is
X false; the second || operand is not evaluated if the first is true.
X
X The ternary operator evaluates its first argument (a). If it is
X true (non-zero) the second argument (b) is evaluated and returned,
X otherwise the third argument (c) is evaluated and returned.
4 unary
?expressions operators unary
?operators unary
?unary
X The following is a list of all the unary operators and their
X usages:
X
@start table - first is interactive cleartext form
X Symbol Example Explanation
X - -a unary minus
X ~ ~a * one's complement
X ! !a * logical negation
X ! a! * factorial
#\multicolumn{3}{|c|}{Unary Operators}\\
#Symbol & Example & Explanation \\ \hline
#\verb@-@ & \verb@-a@ & unary minus \\
#\verb@~@ & \verb@~a@ & * one's complement \\
#\verb@!@ & \verb@!a@ & * logical negation \\
#\verb@!@ & \verb@a!@ & * factorial \\
%-@-a@unary minus
%~@~a@* one's complement
%!@!a@* logical negation
%!@a!@* factorial
X
@end table
X (*) Starred explanations indicate that the operator requires an
X integer argument.
X
X The factorial operator returns a real number to allow a greater range.
2 help
?help
X The `help` command displays on-line help. To specify information on a
X particular topic use the syntax:
X
X help {<topic>}
X
X If <topic> is not specified, a short message is printed about
X GNUPLOT. After help for the requested topic is given, help for a
X subtopic may be requested by typing its name, extending the help
X request. After that subtopic has been printed, the request may be
X extended again, or simply pressing return goes back one level to the
X previous topic. Eventually, the GNUPLOT command line will return.
2 load
?load
X The `load` command executes each line of the specified input file as
X if it had been typed in interactively. Files created by the `save`
X command can later be `load`ed. Any text file containing valid
X commands can be created and then executed by the `load` command.
X Files being `load`ed may themselves contain `load` commands. See
X `comment` for information about comments in commands.
X
X The `load` command must be the last command on the line.
X
X Syntax:
X load "<input-file>"
X
X The name of the input file must be enclosed in quotes.
X
X Examples:
X
X load 'work.gnu'
X load "func.dat"
X
X The `load` command is performed implicitly on any file names given as
X arguments to GNUPLOT. These are loaded in the order specified, and
X then GNUPLOT exits.
2 pause
?pause
X The `pause` command displays any text associated with the command and
X then waits a specified amount of time or until the carriage return is
X pressed. `pause` is especially useful in conjunction with `load` files.
X
X Syntax:
X pause <time> {"<string>"}
X
X <time> may be any integer constant or expression. Choosing -1 will
X wait until a carriage return is hit, zero (0) won't pause at all, and
X a positive integer will wait the specified number of seconds.
X
X Note: Since `pause` is not part of the plot it may interact with
X different device drivers differently (depending upon how text and
X graphics are mixed).
X
X Examples:
X pause -1 # Wait until a carriage return is hit
X pause 3 # Wait three seconds
X pause -1 "Hit return to continue"
X pause 10 "Isn't this pretty? It's a cubic-spline."
X
2 plot
?plot
?splot
X `plot` and `splot` are the primary commands of the program. They plot
X functions and data in many, many ways. `plot` is used to plot 2-d
X functions and data, while `splot` plots 3-d surfaces and data.
X
X Syntax:
X
X plot {ranges} <function> {title} {style}
X {, <function> {title} {style}...}
X
X splot {ranges} <function> {title} {style}
X {, <function> {title} {style}...}
X
X where <function> is either a mathematical expression, the name of a
X data file enclosed in quotes, or a pair (`plot`) or triple (`splot`)
X of mathematical expressions in the case of parametric functions.
X User-defined functions and variables may also be defined here.
X
X `plot` and `splot` commands can be as simple as
X
X plot sin(x)
X
X and
X
X splot x * y
X
X or as complex as (!)
X
X plot [t=1:10] [-pi:pi*2] tan(t),"data.1" with lines,t**2 with points
3 data-file
?plot datafile
?plot data-file
?splot datafile
?splot data-file
?datafile
?data-file
?data
X Discrete data contained in a file can displayed by specifying the
X name of the data file (enclosed in quotes) on the `plot` or `splot`
X command line. Data files should contain one data point per line.
X Lines beginning with # (or ! on VMS) will be treated as comments
X and ignored. For `plot`s, each data point represents an (x,y)
X pair. For `splot`s, each point is an (x,y,z) triple. For `plot`s with
X error bars (see `plot errorbars`), each data point is either
X (x,y,ydelta) or (x,y,ylow,yhigh). In all cases, the numbers on each
X line of a data file must be separated by blank space. This blank
X space divides each line into columns.
X
X For `plot`s the x value may be omitted, and for `splot`s the x
X and y values may be omitted. In either case the omitted values are
X assigned the current coordinate number. Coordinate numbers start at 0
X and are incremented for each data point read.
X
X To specify other formats, see `plot datafile using`.
X
X In the `plot` command, blank lines in the data file cause a break in
X the plot. There will be no line drawn between the preceding and
X following points if the plot style is `lines` or `linespoints` (see
X `plot style`). This does not change the plot style, as would plotting
X the data as separate curves.
X
X This example compares the data in the file population.dat to a
X theoretical curve:
X
X pop(x) = 103*exp((1965-x)/10)
X plot [1960:1990] 'population.dat', pop(x)
X
X The file population.dat might contain:
X
X # Gnu population in Antarctica since 1965
X 1965 103
X 1970 55
X 1975 34
X 1980 24
X 1985 10
X
X When a data file is plotted, `samples` and `iso_samples` are ignored.
X Curves plotted using the `plot` command are automatically extended to
X hold the entire curve. Similarly grid data plotted using the `splot`
X command is automatically extended, using the assumption that isolines
X are separated by blank lines (a line with only a CR/LF in it).
X
X Implicitly, there are two types of 3-d datafiles. If all the isolines
X are of the same length, the data is assumed to be a grid data, i.e.,
X the data has a grid topology. Cross isolines in the other parametric
X direction (the ith cross isoline passes thru the ith point of all the
X provided isolines) will also be drawn for grid data. (Note contouring
X is available for grid data only.) If all the isolines are not of the
X same length, no cross isolines will be drawn and contouring that data
X is impossible.
X
X For splot if 3-d datafile and using format (see `splot datafile using`)
X specify only z (height field), a non parametric mode must be specified.
X If, on the other hand, x, y, and z are all specified, a parametric
X mode should be selected (see `set parametric`) since data is defining a
X parametric surface.
X
X A simple example of plotting a 3-d data file is
X
X splot 'glass.dat'
X
X For more information about 3-d plotting, see `splot`.
4 using
?plot datafile using
?plot data-file using
?splot datafile using
?splot data-file using
?using
X The format of data within a file can be selected with the `using`
X option. An explicit scanf string can be used, or simpler column
X choices can be made.
X
X Syntax:
X
X plot "datafile" { using { <ycol> |
X <xcol>:<ycol> |
X <xcol>:<ycol>:<ydelta> |
X <xcol>:<ycol>:<ylow>:<yhigh> }
X {"<scanf string>"} } ...
X
X and
X
X splot "datafile" { using { <xcol>:<ycol>:<zcol> | <zcol> }
X {"<scanf string>"} } ...
X
X <xcol>, <ycol>, and <zcol> explicitly select the columns to plot from
X a space or tab separated multicolumn data file. If only <ycol> is
X selected for `plot`, <xcol> defaults to 1. If only <zcol> is selected
X for `splot`, then only that column is read from the file. An <xcol> of
X 0 forces <ycol> to be plotted versus its coordinate number. <xcol>,
X <ycol>, and <zcol> can be entered as constants or expressions.
X
X If errorbars (see also `plot errorbars`) are used for `plot`s,
X ydelta (for example, a +/- error) should be provided as the third
X column, or ylow and yhigh as third and fourth columns. These columns
X must follow the x and y columns.
X
X Scanf strings override any <xcol>:<ycol>(:<zcol>) choices, except for
X ordering of input, e.g.,
X plot "datafile" using 2:1 "%f%*f%f"
X causes the first column to be y and the third column to be x.
X
X If the scanf string is omitted, the default is generated based on the
X <xcol>:<ycol>(:<zcol>) choices. If the `using` option is omitted, "%f%f"
X is used for `plot` ("%f%f%f%f" for `errorbar` `plot`s) and "%f%f%f" is
X used for `splot`.
X
X Examples:
X
X plot "MyData" using "%*f%f%*20[^\n]%f" with lines
X
X Data are read from the file "MyData" using the format
X "%*f%f%*20[^\n]%f". The meaning of this format is: "%*f" ignore the
X first number, "%f" then read in the second and assign to x,
X "%*20[^\n]" then ignore 20 non-newline characters, "%f" then read in
X the y value.
X
X n=3;
X plot "MyData", "MyData" using n
X
X causes GNUPLOT to plot the second and third columns of MyData versus
X the first column. The command 'n=4; replot' would then plot the second
X and fourth columns of MyData versus the first column.
X
X splot "glass.dat" using 1
X
X causes GNUPLOT to plot the first coordinate of the points of glass.dat
X as the z coordinate while ignoring the other two coordinates.
X
X Note: GNUPLOT first reads a line of the data file into a buffer and
X then does a
X sscanf(input_buffer, scanf_string, &x, &y{, &z});
X where 'x', 'y', and 'z' are of type 'float'. Any scanf string that
X specifies two (three for `splot`, three or four for `errorbars`) float
X numbers may be used.
3 errorbars
?plot errorbars
?errorbars
X Error bars are supported for 2-d data file plots by reading one or
X two additional columns specifying ydelta or ylow and yhigh
X respectively. No support exists for x error bars or any error bars
X for `splot`s.
X
X In the default situation, GNUPLOT expects to see three or four
X numbers on each line of the data file, either (x, y, ydelta) or
X (x, y, ylow, yhigh). The x coordinate must be specified. The order
X of the numbers must be exactly as given above. Data files in this
X format can easily be plotted with error bars:
X
X plot "data.dat" with errorbars
X
X The error bar is a vertical line plotted from (x, ylow) to (x,
X yhigh). If ydelta is specified instead of ylow and yhigh,
X ylow=y-ydelta and yhigh=y+ydelta are derived. If there
X are only two numbers on the line, yhigh and ylow are both set to
X y. To get lines plotted between the data points, `plot` the
X data file twice, once with errorbars and once with lines.
X
X If y autoscaling is on, the y range will be adjusted to fit the
X error bars.
X
X The `using` option may be used to specify how columns of the data file
X are to be assigned to x, y, ydelta, ylow, and yhigh. The x column must
X be provided and both the x and y columns must appear before the
X errorbar columns. If three column numbers are given, they are x, y,
X and ydelta. If four columns are given, they are x, y, ylow, and
X yhigh.
X
X Examples:
X
X plot "data.dat" using 1:2:3:4 with errorbars
X plot "data.dat" using 3:2:6 with errorbars
X plot "data.dat" using 3:4:8:7 with errorbars
X
X The first example reads, x, y, ylow, and yhigh, from columns 1, 2, 3,
X and 4. This is equivalent to the default. The second example reads x
X from the third column, y from second and ydelta from the sixth column.
X The third example reads x from the third column, y from the fourth,
X ylow from the eighth, and yhigh from seventh columns.
X
X See also `plot using` and `plot style`.
3 parametric
?plot parametric
?splot parametric
?parametric
X When in parametric mode (`set parametric`) mathematical expressions must
X be given in pairs for `plot` and in triplets for `splot`:
X plot sin(t),t**2
X or
X splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
X
X Data files are plotted as before, except any preceding parametric
X function must be fully specified before a data file is given as a
X plot. In other words, the x parametric function (sin(t) above) and
X the y parametric function (t**2 above) must not be interrupted with
X any modifiers or data functions; doing so will generate a syntax error
X stating that the parametric function is not fully specified.
X
X Ranges take on a different meaning when in parametric mode. The first
X range on the `plot` command is the `trange`, the next is the `xrange`,
X and the last is the `yrange`. For `splot` the order is `urange`,
X `vrange`, `xrange`, `yrange`, and finally `zrange`. The following
X `plot` command shows setting the `trange` to [-pi:pi], the `xrange` to
X [-1.3:1.3] and the `yrange` to [-1:1] for the duration of the plot:
X plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2
X
X Other modifiers, such as `with` and `title`, may be specified only
X after the parametric function has been completed:
X plot sin(t),t**2 title 'Parametric example' with linespoints
3 ranges
?splot ranges
?plot ranges
?ranges
X The optional range specifies the region of the plot that will be
X displayed.
X
X Ranges may be provided on the `plot` and `splot` command line and
X affect only that plot, or in the `set xrange`, `set yrange`, etc.,
X commands, to change the default ranges for future plots.
X
X Syntax:
X [{<dummy-var> =} {<xmin> : <xmax>}] { [{<ymin> : <ymax>}] }
X
X where <dummy-var> is the independent variable (the defaults are x and
X y, but this may be changed with `set dummy`) and the min and max
X terms can be constant expressions.
X
X Both the min and max terms are optional. The ':' is also optional
X if neither a min nor a max term is specified. This allows '[ ]' to
X be used as a null range specification.
X
X Specifying a range in the `plot` command line turns autoscaling for
X that axis off for that plot. Using one of the `set` range commands
X turns autoscaling off for that axis for future plots, unless changed
X later. (See `set autoscale`).
X
X Examples:
X
X This uses the current ranges:
X plot cos(x)
X
X This sets the x range only:
X plot [-10:30] sin(pi*x)/(pi*x)
X
X This is the same, but uses t as the dummy-variable:
X plot [t = -10 :30] sin(pi*t)/(pi*t)
X
X This sets both the x and y ranges:
X plot [-pi:pi] [-3:3] tan(x), 1/x
X
X This sets only the y range, and turns off autoscaling on both axes:
X plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)
X
X This sets xmax and ymin only:
X plot [:200] [-pi:] exp(sin(x))
X
X This sets the x, y, and z ranges:
X splot [0:3] [1:4] [-1:1] x*y
3 style
?plot style
?splot style
?style
?plot with
?with
X Plots may be displayed in one of six styles: `lines`, `points`,
X `linespoints`, `impulses`, `dots`, or `errorbars`. The `lines` style
X connects adjacent points with lines. The `points` style displays a
X small symbol at each point. The `linespoints` style does both
X `lines` and `points`. The `impulses` style displays a vertical line
X from the x axis (or from the grid base for `splot`) to each point. The
X `dots` style plots a tiny dot at each point; this is useful for
X scatter plots with many points.
X
X The `errorbars` style is only relevant to 2-d data file plotting. It
X is treated like `points` for `splot`s and function `plot`s. For data
X `plot`s, `errorbars` is like `points`, except that a vertical error
X bar is also drawn: for each point (x,y), a line is drawn from
X (x,ylow) to (x,yhigh). A tic mark is placed at the ends of the error
X bar. The ylow and yhigh values are read from the data file's columns,
X as specified with the `using` option to plot. See `plot errorbars` for
X more information.
X
X Default styles are chosen with the `set function style` and
X `set data style` commands.
X
X By default, each function and data file will use a different
X line type and point type, up to the maximum number of available
X types. All terminal drivers support at least six different point
X types, and re-use them, in order, if more than six are required.
X The LaTeX driver supplies an additional six point types (all variants
X of a circle), and thus will only repeat after twelve curves are
X plotted with points.
X
X If desired, the style and (optionally) the line type and point type
X used for a curve can be specified.
X
X Syntax:
X
X with <style> {<linetype> {<pointtype>}}
X
X where <style> is either `lines`, `points`, `linespoints`, `impulses`,
SHAR_EOF
true || echo 'restore of gnuplot/docs/gnuplot.doc failed'
fi
echo 'End of part 8'
echo 'File gnuplot/docs/gnuplot.doc is continued in part 9'
echo 9 > _shar_seq_.tmp
#!/bin/sh
# this is Part.09 (part 9 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/docs/gnuplot.doc continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 9; 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/docs/gnuplot.doc'
else
echo 'x - continuing file gnuplot/docs/gnuplot.doc'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/gnuplot.doc' &&
X `dots`, or `errorbars`. The <linetype> and <pointtype> are positive
X integer constants or expressions and specify the line type and point
X type to be used for the plot. Line type 1 is the first line type used
X by default, line type 2 is the second line type used by default, etc.
X
X Examples:
X
X This plots sin(x) with impulses:
X plot sin(x) with impulses
X
X This plots x*y with points, x**2 + y**2 default:
X splot x*y w points, x**2 + y**2
X
X This plots tan(x) with the default function style, "data.1" with lines:
X plot [ ] [-2:5] tan(x), "data.1" with l
X
X This plots "leastsq.dat" with impulses:
X plot 'leastsq.dat' w i
X
X This plots "exper.dat" with errorbars and lines connecting the points:
X plot 'exper.dat' w lines, 'exper.dat' w errorbars
X Here 'exper.dat' should have three or four data columns.
X
X This plots x**2 + y**2 and x**2 - y**2 with the same line type:
X splot x**2 + y**2 with line 1, x**2 - y**2 with line 1
X
X This plots sin(x) and cos(x) with linespoints, using the
X same line type but different point types:
X plot sin(x) with linesp 1 3, cos(x) with linesp 1 4
X
X This plots file "data" with points style 3:
X plot "data" with points 1 3
X Note that the line style must be specified when specifying the point
X style, even when it is irrelevant. Here the line style is 1 and the
X point style is 3, and the line style is irrelevant.
X
X See `set style` to change the default styles.
3 title
?plot title
?splot title
X A title of each plot appears in the key. By default the title is
X the function or file name as it appears on the plot command line.
X The title can be changed by using the `title` option. This option
X should precede any `with` option.
X
X Syntax:
X title "<title>"
X
X where <title> is the new title of the plot and must be enclosed in
X quotes. The quotes will not be shown in the key.
X
X Examples:
X
X This plots y=x with the title 'x':
X plot x
X
X This plots the "glass.dat" file with the title 'surface of revolution':
X splot "glass.dat" title 'surface of revolution'
X
X This plots x squared with title "x^2" and "data.1" with title
X 'measured data':
X plot x**2 title "x^2", "data.1" t 'measured data'
2 print
?print
X The `print` command prints the value of <expression> to the screen.
X
X Syntax:
X print <expression>
X
X See `expressions`.
2 pwd
?pwd
X The `pwd` command prints the name of the working directory to the screen.
X
X Syntax:
X pwd
2 quit
?quit
X The `exit` and `quit` commands and END-OF-FILE character will exit
X GNUPLOT. All these commands will clear the output device (as the
X `clear` command does) before exiting.
2 replot
?replot
X The `replot` command without arguments repeats the last `plot` or `splot`
X command. This can be useful for viewing a plot with different `set`
X options, or when generating the same plot for several devices.
X
X Arguments specified after a `replot` command will be added onto the last
X `plot` (`splot`) command (with an implied ',' separator) before it is
X repeated. `replot` accepts the same arguments as the `plot` (`splot`)
X commands except that ranges cannot be specified. See `command-line
X editing` for ways to edit the last `plot` (`splot`) command.
2 save
?save
X The `save` command saves user-defined functions, variables, set
X options or all three plus the last `plot` (`splot`) command to the
X specified file.
X
X Syntax:
X save {<option>} "<filename>"
X
X where <option> is `functions`, `variables` or `set`. If no option is
X used, GNUPLOT saves functions, variables, set options and the last `plot`
X (`splot`) command.
X
X `save`d files are written in text format and may be read by the `load`
X command.
X
X The filename must be enclosed in quotes.
X
X Examples:
X
X save "work.gnu"
X save functions 'func.dat'
X save var 'var.dat'
X save set "options.dat"
2 set-show
?set
?show
X The `set` command sets LOTS of options.
X
X The `show` command shows their settings. `show all` shows all the
X settings.
3 angles
?set angles
?show angles
?angles
X By default, GNUPLOT assumes the independent variable in polar plots
X is in units of radians. If `set angles degrees` is specified before
X `set polar` then the default range is [0:360] and the independent
X variable has units of degrees. This is particularly useful for
X plots of data files. The angle setting also hold for the 3-d
X mapping as set via the `set mapping` command.
X
X Syntax:
X set angles { degrees | radians }
X show angles
3 arrow
?set arrow
?set noarrow
?show arrow
?arrow
?noarrow
X Arbitrary arrows can be placed on a plot using the `set arrow`
X command.
X
X Syntax:
X
X set arrow {<tag>} {from <sx>,<sy>{,<sz>}}
X {to <ex>,<ey>{,<ez>}} {{no}head}
X set noarrow {<tag>}
X show arrow
X
X
X Unspecified coordinates default to 0. The x, y, and z values are in
X the graph's coordinate system. The z coordinate is only used in
X `splot` commands. <tag> is an integer that identifies the arrow. If no
X tag is given, the lowest unused tag value is assigned automatically.
X The tag can be used to delete or change a specific arrow. To change
X any attribute of an existing arrow, use the `set arrow` command with
X the appropriate tag, and specify the parts of the arrow to be
X changed. Specifying nohead requests the arrow be drawn without a head
X (yielding a line segment). By default, arrows have heads.
X
X Arrows outside the plotted boundaries are permitted but may cause
X device errors.
X
X Examples:
X
X To set an arrow pointing from the origin to (1,2), use:
X set arrow to 1,2
X To set an arrow from (-10,4,2) to (-5,5,3), and tag the arrow number
X 3, use:
X set arrow 3 from -10,4,2 to -5,5,3
X To change the preceding arrow begin at 1,1,1, without an arrow head,
X use:
X set arrow 3 from 1,1,1 nohead
X To delete arrow number 2 use:
X set noarrow 2
X To delete all arrows use:
X set noarrow
X To show all arrows (in tag order) use:
X show arrow
3 autoscale
?set autoscale
?set noautoscale
?show autoscale
?autoscale
?noautoscale
X Auto scaling may be set individually on the x, y or z axis
X or globally on all axes. The default is to autoscale all axes.
X
X When autoscaling, the plot range is automatically computed and the
X dependent axis (y for a `plot` and z for `splot`) is scaled to
X include the range of the function or data being plotted.
X
X If autoscaling of the dependent axis (y or z) is not set, the
X current y or z range is used.
X
X See `set yrange` or `set zrange`.
X
X Autoscaling the independent variables (x for `plot` and x,y for
X `splot`) is a request to set the domain to match any data file being
X plotted. If there are no data files then autoscaling an independent
X variable has no effect. In other words, in the absence of a data
X file, functions alone do not affect the x range (or the y range if
X plotting z = f(x,y)).
X
X See `set xrange`, or `set yrange`.
X
X The behavior of autoscaling remains consistent in parametric mode,
X however, there are more dependent variables and hence more control
X over x, y, and z plot scales. In parametric mode, the independent or
X dummy variable is t for `plot`s and u,v for `splot`s. Autoscale in
X parametric mode, then, controls all ranges (t, u, v, x, y, and z) and
X allows x, y, and z to be fully autoscaled.
X
X See `set parametric`.
X
X Syntax:
X set autoscale <axes>
X set noautoscale <axes>
X show autoscale
X
X where <axes> is either `x`, `y`, `z` or `xy`. If <axes> is not given
X then all axes are assumed.
X
X Examples:
X
X This sets autoscaling of the y axis. x axis autoscaling is not
X affected.
X set autoscale y
X
X This sets autoscaling of the x and y axes.
X set autoscale xy
X
X This sets autoscaling of the x, y and z axes.
X set autoscale
X
X This disables autoscaling of the x, y and z axes.
X set noautoscale
X
X This disables autoscaling of the z axis only.
X set noautoscale z
4 parametric mode
?autoscale parametric
?set autoscale t
X When in parametric mode (`set parametric`) the xrange is as
X fully scalable as the yrange. In other words, in parametric
X mode the x axis can be automatically scaled to fit the range
X of the parametric function that is being plotted. Of course,
X the y axis can also be automatically scaled just as in the
X non-parametric case. If autoscaling on the x axis is not set,
X the current x range is used.
X
X When there is a mix of data files and functions, the xrange of
X the functions is selected as that of the data files if autoscale
X is true for x. While this keeps the behavior compatible with
X non-parametric plotting, it may not be retained in the future.
X The problem is that, in parametric mode, the x and y ranges are
X not as distinguishable as in the non-parametric mode and this
X behavior may not be the most useful.
X
X For completeness a last command `set autoscale t` is accepted.
X However, the effect of this "scaling" is very minor. When
X GNUPLOT determines that the t range would be empty it makes a
X small adjustment if autoscaling is true. Otherwise, GNUPLOT
X gives an error. Such behavior may, in fact, not be very useful
X and the command `set autoscale t` is certainly questionable.
X
X `splot` extends the above idea similarly. If autoscaling is set then
X x, y, and z ranges are computed and each axis scaled to fit the
X resulting data.
3 border
?set border
?set noborder
?show border
?border
?noborder
X The `set border` and `set noborder` commands controls the display of
X the plot borders for the `plot` and `splot` commands.
X
X Syntax:
X set border
X set noborder
X show border
3 clip
?set clip
?set noclip
?show clip
?clip
?noclip
X GNUPLOT can clip data points and lines that are near the boundaries
X of a plot.
X
X Syntax:
X set clip <clip-type>
X set noclip <clip-type>
X show clip
X
X Three clip types are supported by GNUPLOT: `points`, `one`, and `two`.
X One, two, or all three clip types may be active for a single plot.
X
X The `points` clip type forces GNUPLOT to clip (actually, not plot at
X all) data points that fall within but too close to the boundaries
X (this is so the large symbols used for points will not extend outside
X the boundary lines). Without clipping points near the boundaries may
X look bad; try adjusting the x and y ranges.
X
X Setting the `one` clip type causes GNUPLOT to plot the line segments
X which have only one of the two endpoints with the plotting region.
X Only the in-range portion of the line is drawn. The alternative is to
X not draw any portion of the line segment.
X
X Some lines may have both endpoints out of range, but pass through the
X plotting area. Setting the `two` clip-type allows the visible portion
X of these lines to be drawn.
X
X In no case is a line drawn outside the plotting area.
X
X The defaults are `noclip points`, `clip one`, and `noclip two`.
X
X To check the state of all forms of clipping, use
X show clip
X
X For backward compatibility with older versions, the following forms
X are also permitted.
X set clip
X set noclip
X `set clip` is synonymous with `set clip points`. `set noclip` turns
X off all three types of clipping.
3 Cntrparam
?set cntrparam
?show cntrparam
?cntrparam
X Sets the different parameters for the contouring plot (see also `contour`).
X
X Syntax:
X set cntrparam { { linear | cubicspline | bspline } |
X points <n> |
X levels <n> |
X order <n> }
X
X This command controls the way contours are plotted. <n> should be an
X integral constant expression. The parameters are:
X
X `linear`, `cubicspline`, `bspline` - Controls type of approximation or
X interpolation. If `linear`, then the contours are drawn piecewise
X linear, as extracted from the surface directly. If `cubicspline`, then
X piecewise linear contours are interpolated to form a somewhat smoother
X contours, but which may undulate. The third option is the uniform
X `bspline`, which only approximates the piecewise linear data but is
X guaranteed to be smoother.
X
X `points` - Eventually all drawings are done with piecewise linear
X strokes. This number controls the number of points used to
X approximate a curve. Relevant for `cubicspline` and `bspline` modes
X only.
X
X `levels` - Number of contour levels. If the surface is bounded by zmin
X and zmax then contours will be generated from zmin+dz to zmax-dz
X in steps of size dz, where dz = (zmax - zmin) / (levels + 1).
X
X `order` - Order of the bspline approximation to be used. The bigger this
X order is, the smoother the resulting contour. (Of course, higher order
X bspline curves will move further away from the original peicewise linear
X data.) This option is relevant for `bspline` mode only. Allowed values are
X integers in the range from 2 (linear) to 10.
3 contour
?set contour
?show contour
?contour
X Enable contour drawing for surfaces. This option is available for `splot`
X only.
X
X Syntax:
X set contour { base | surface | both }
X set nocontour
X
X If no option is provided to `set contour`, the default is `base`.
X The three options specify where to draw the contours: `base` draws
X the contours on the grid base where the x/ytics are placed, `surface`
X draws the contours on the surfaces themselves, and `both` draws the
X contours on both the base and the surface.
X
X See also `set cntrparam` for the parameters that affect the drawing of
X contours.
3 data style
?set data style
?show data style
?data style
X The `set data style` command changes the default plotting style
X for data plots.
X
X Syntax:
X set data style
X show data style
X set data style <style-choice>
X
X In the first case, `set data style` returns the possible style
X choices: `lines`, `points`, `linespoints`, `dots`, `impulses`,
X or `errorbars`. `show data style` shows the current default
X plotting style for data. `set data style dots` would actually
X change the default plotting style. See also `plot`.
3 dummy
?set dummy
?show dummy
?dummy
X By default, GNUPLOT assumes that the independent variable for the
X `plot` command is x, and the independent variables for the `splot`
X command are x and y. They are called the dummy variables because it
X is just a notation to indicate the independent variables. The `set
X dummy` command changes these default dummy variable names. For
X example, it may be more convenient to call the dummy variable t
X when plotting time functions:
X
X set dummy t
X plot sin(t), cos(t)
X
X Syntax:
X set dummy <dummy-var>{,<dummy-var>}
X show dummy
X
X Examples:
X set dummy u,v
X set dummy ,s
X
X to set both dummy variables to u and v or set only the second
X variable to s.
X
X The `set parametric` command also changes the dummy variables (to t
X for `plot` and u,v for `splot`s).
X
3 format
?set format
?show format
?format
X The format of the tic-mark labels can be set with the `set format`
X command. The default format for both axes is "%g", but other formats
X such as "%.2f" or "%3.0fm" are often desirable. Anything accepted by
X printf when given a double precision number, and then accepted by the
X terminal, will work. In particular, the formats f, e, and g will work,
X and the d, o, x, c, s, and u formats will not work.
X
X Syntax:
X set format {<axes>} {"<format-string>"}
X show format
X
X where <axes> is either `x`, `y`, `z`, `xy`, or nothing (which is the
X same as `xy`). The length of the string representing a ticmark (after
X formatting with printf) is restricted to 100 characters. If the
X format string is omitted, the format will be returned to the default
X "%g". For LaTeX users, the format "$%g$" is often desirable. If the
X empty string "" is used, no label will be plotted with each tic,
X though the tic mark will still be plotted. To eliminate all tic marks,
X use `set noxtics` or `set noytics`.
X
X See also `set xtics` and `set ytics` for more control over tic labels.
3 function style
?set function style
?show function style
?function style
X The `set function style` command changes the default plotting style
X for functions.
X
X Syntax:
X set function style
X show function style
X set function style <style-choice>
X
X In the first case, `set function style` returns the possible style
X choices: `lines`, `points`, `linespoints`, `dots`, `impulses`,
X or `errorbars`. `show function style` shows the current default
X plotting style for functions. `set function style linespoints`
X would actually change the default plotting style. See also `plot`.
3 functions
?show functions
X The `show functions` command lists all user-defined functions and
X their definitions.
X
X Syntax:
X show functions
3 grid
?set grid
?show grid
?grid
X The optional `set grid` draws a grid at the tic marks with the axis
X linetype.
X
X Syntax:
X set grid
X set nogrid
X show grid
3 isosamples
?set isosamples
?show isosamples
?isosamples
X An isoline is a curve parametrized by one of the surface parameters
X while the other surface parameter is fixed. Isolines are a simple
X means to display a surface. By fixing the u parameter of surface
X s(u,v), the iso-u lines of the form c(v) = s(u0,v) are produced, and
X by fixing the v parameter, the iso-v lines of the form c(u) = s(u,v0)
X are produced.
X
X The isoline density of surfaces may be changed by the `set isosamples`
X command. By default, sampling is set to 10 isolines per u or v axis.
X A higher sampling rate will produce more accurate plots, but will take
X longer. This parameter has no effect on data file plotting.
X
X Syntax:
X set isosamples <expression>
X show isosamples
3 key
?set key
?show key
?key
X The `set key` enables a key describing curves on a plot. By default
X the key is placed in the upper right corner of the plot.
X
X Syntax:
X set key
X set key <x>,<y>{,<z>}
X set nokey
X show key
X
X The coordinates <x>, <y> (and <z> for `splot`s) specify the location
X of the key on the plot. The key is drawn as a sequence of lines, with
X one plot described on each line. On the right hand side of each line
X is a representation that attempts to mimic the way the curve is
X plotted. On the left side of each line is the text description,
X obtained from the `plot` command. See `plot title` to change this
X description. The lines are vertically arranged so an imaginary
X straight line divides the left- and right-hand sides of the key. It is
X the coordinates of this line that are specified with the `set key`
X command. In a `plot`, only the x and y coordinates are used to specify
X the line position. For a `splot`, x, y and z are all being used as a
X 3-d location mapped using the same mapping as the plot itself to form
X the required 2-d screen position of the imaginary line.
X
X Some or all of the key may be outside of the plot boundary, although
X this may interfere with other labels and may cause an error on some
X devices.
X
X Examples:
X
X This places the key at the default location:
X set key
X This disables the key:
X set nokey
X This places a key at coordinates 2,3.5,2
X set key 2,3.5,2
3 label
?set label
?set nolabel
?show label
?label
?nolabel
X Arbitrary labels can be placed on the plot using the `set label`
X command. If the z coordinate is given on a `plot` it is ignored; if
X it is missing on a `splot` it is assumed to be 0.
X
X Syntax:
X
X set label {<tag>} {"<label_text>"} {at <x>,<y>{,<z>}}
X {<justification>}
X set nolabel {<tag>}
X show label
X
X
X The text defaults to "", and the position to 0,0,0. The <x>, <y>, and
X <z> values are in the graph's coordinate system. The tag is an
X integer that is used to identify the label. If no <tag> is given, the
X lowest unused tag value is assigned automatically. The tag can be used
X to delete or change a specific label. To change any attribute of an
X existing label, use the `set label` command with the appropriate tag,
X and specify the parts of the label to be changed.
X
X By default, the text is placed flush left against the point x,y,z.
X To adjust the way the label is positioned with respect to the point
X x,y,z, add the parameter <justification>, which may be `left`, `right`
X or `center`, indicating that the point is to be at the left, right or
X center of the text. Labels outside the plotted boundaries are
X permitted but may interfere with axes labels or other text.
X
X Examples:
X
X To set a label at (1,2) to "y=x" use:
X set label "y=x" at 1,2
X To set a label "y=x^2" with the right of the text at (2,3,4), and tag
X the label number 3, use:
X set label 3 "y=x^2" at 2,3,4 right
X To change the preceding label to center justification, use:
X set label 3 center
X To delete label number 2 use:
X set nolabel 2
X To delete all labels use:
X set nolabel
X To show all labels (in tag order) use:
X show label
X
X (The Latex, EEPIC, and Imagen drivers allow \\ in a string to specify
X a newline.)
3 logscale
?set logscale
?set nologscale
?show logscale
?logscale
?nologscale
X Log scaling may be set on the x, y, and z axes.
X
X Syntax:
X set logscale <axes>
X set nologscale <axes>
X show logscale
X
X where <axes> may be any combinations of `x`, `y`, and `z`, in any
X order. If <axes> is not given then all three axes are assumed. The
X command `set logscale` turns on log scaling on the specified axes,
X while `set nologscale` turns off log scaling.
X
X Examples:
X
X To enable log scaling in both x and z axes:
X set logscale xz
X To disable z axis log scaling:
X set nologscale z
3 mapping
?set mapping
?show mapping
?mapping
X
X Syntax:
X set mapping { cartesian | spherical | cylindrical }
X
X Data for `splot`s are usually in regular Euclidean space and are
X provided in Cartesian coordinates. Such 3-d data require three
X coordinates (x, y and z) or one coordinate (only z) in each line in
X the data file. In order to be able to use spherical or cylindrical
X coordinate systems, use the `set mapping` command. In both cases two
X coordinates are expected in each line of the data. For a spherical
X coordinate system, these are theta and phi (in units as specified by
X `set angles`) and the mapping is:
X
X x = cos( theta ) * cos( phi )
X y = sin( theta ) * cos( phi )
X z = sin( phi )
X
X For a cylindrical coordinate system, the mapping uses two variables,
X theta (in units as specified by `set angles`) and z:
X
X x = cos( theta )
X y = sin( theta )
X z = z
X
X Again, note that mapping will affect data file `splot`s only.
3 offsets
?set offsets
?show offsets
?offsets
X The amount of the graph that the plot takes up may be controlled to
X some extent with the `set offsets` command. This command takes four
X offset arguments: <left>, <right>, <top> and <bottom>. By default,
X each offset is 0. Each offset may be a constant or an expression. Left
X and right offsets are given in units of the x axis, while top and
X bottom offsets are given in units of the y axis. The plot of sin(x),
X displayed with offsets of 0, 0, 2, 2 will take up 1/3 of the
X displayed y axis. Offsets are particularly useful with polar
X coordinates as a means of compensating for aspect ratio distortion.
X Offsets are ignored in `splot`s.
X
X Syntax:
X set offsets <left>, <right>, <top>, <bottom>
X show offsets
3 output
?set output
?show output
?output
X By default, plots are displayed to the standard output. The `set
X output` command redirects the display to the specified file or
X device.
X
X Syntax:
X set output {"<filename>"}
X show output
X
X The filename must be enclosed in quotes. If the filename is
X omitted, output will be sent to the standard output.
3 parametric
?set parametric
?set noparametric
?show parametric
?parametric
?noparametric
X The `set parametric` command changes the meaning of `plot` (`splot`)
X from normal functions to parametric functions. The command
X `set noparametric` changes the plotting style back to normal,
X single-valued expression plotting.
X
X In 2-d plotting, a parametric function is determined by a pair
X of parametric functions operating on a parameter. An example
X of a 2-d parametric function would be plot sin(t),cos(t) (which
X defines a circle).
X
X For 3-d plotting, the surface is described as x=f(u,v), y=g(u,v),
X z=h(u,v). Therefore a triplet of functions are required. An example of
X 3-d parametric function would be cos(u)*cos(v),cos(u)*sin(v),sin(u)
X (which defines a sphere). It takes three parametric function
X specifications in terms of the parametric dummy arguments to describe
X a single graph.
X
X The total set of possible plots is a superset of the simple f(x)
X style plots, since the two (three) functions can describe the
X x and y (and z) values to be computed separately. In fact,
X plots of the type t,f(t) (u,v,f(u,v)) are equivalent to those
X produced with f(x) when the x values are computed using the
X identity function as the first function.
X
X Note that the order the parametric functions are specified is
X xfunction, yfunction (and zfunction) and that each operates over the
X common parametric domain.
X
X Also, the `set parametric` function implies a new range of values.
X Whereas the normal f(x) and f(x,y) style plotting assume an xrange
X and yrange (and zrange), the parametric mode additionally specifies a
X trange, urange, and vrange. These ranges may be set
X directly with `set trange`, `set urange` and `set vrange`, or by
X specifying the range on the `plot` or `splot` commands. Currently
X the default range for these parametric variables is [-5:5].
X Setting the ranges to something more meaningful is expected.
3 polar
?set polar
?set nopolar
?show polar
?polar
?nopolar
X The `set polar` command changes the meaning of the plot from
X rectangular coordinates to polar coordinates. In polar coordinates,
X the dummy variable (x) is an angle. The range of this angle is changed
X from whatever it was to [0:2*pi], or, if degree unit has been selected,
X to [0:360] (see `set angles`).
X
X The command `set nopolar` changes the meaning of the plot back to the
X default rectangular coordinate system. The range of x is changed from
X whatever it was to [-10:10].
X
X The `set polar` command is not supported for `splot`s. See the
X `set mapping` command for similar functionality for `splot`s.
X
X While in polar coordinates the meaning of an expression in x is really
X r = f(x), where x is an angle of rotation. The xrange controls the
X domain (the angle) of the function, and the yrange controls the range
X (the radius). The plot is plotted in a rectangular box, and the x and
X y axes are both in units of the radius. Thus, the yrange controls both
X dimensions of the plot output. The tics and units are written along
X the axes rather than at the left and bottom. These unit are offset by
X <rmin> specified by the `rrange` (See `set rrange`). It is not
X possible to specify different output dimensions in the x or y
X directions. The yrange can be used to shift the plot diagonally to
X display only the first or third quadrants.
X
X Syntax:
X set polar
X set nopolar
X show polar
X Example:
X set polar
X plot x*sin(x)
X plot [-2*pi:2*pi] [-3:3] x*sin(x)
X The first plot uses the default polar angular domain of 0 to 2*pi.
X The radius (and the size of the plot) is scaled automatically. The
X second plot expands the domain, and restricts the range of the radius
X (and the size of the plot) to [-3:3].
3 rrange
?set rrange
?show rrange
?rrange
X The `set rrange` command sets the radial range used to compute x and y
X values when in polar mode. If not in polar mode (see `set polar`) then
X this range is not used. Use of this command offsets the polar
X singularity to the <rmin> value and shifts the units on the axes tic
X marks. For instance, `set rrange [-40:40]` would set the origin to -40
X and would plot values of radial values between -40 to 40. Thus, if
X 360 degrees of data were plotted, then the plot would extend 80 units
X in radially from the origin. To view the entire plot, a
X `set yrange [-80:80]` command would create a square viewport with
X a circular plot tangent at the axes. Because `xrange` is used
X specify the angular extent, only a square viewport can be specified
X by `yrange`. For instance, `set yrange [0:80]` would display the
X first quadrant and `set yrange [-80:0]` would display the third
X quadrant. Any square viewport of any size can be specified but it
X is constrained to be centered on a 45 degree line.
X
X This range may also be specified on the `plot` command line when in
X polar mode.
X
X Syntax:
X set rrange [{<rmin> : <rmax>}]
X
X where <rmin> and <rmax> terms are constants or expressions.
X
X Both the <rmin> and <rmax> terms are optional. Anything omitted will
X not be changed, so
X set rrange [:10]
X changes rmax to 10 without affecting rmin.
3 samples
?set samples
?show samples
?samples
X The sampling rate of functions may be changed by the `set samples`
X command. By default, sampling is set to 100 points. A higher sampling
X rate will produce more accurate plots, but will take longer. This
X parameter no longer has any effect on data-file plotting.
X
X Syntax:
X set samples <expression>
X show samples
3 size
?set size
?show size
?size
X The `set size` command scales the displayed size of the plot. On some
X terminals, changing the size of the plot will result in text being
X misplaced. Increasing the size of the plot may produce strange
X results. Decreasing is safer.
X
X Syntax:
X
X set size {<xscale>,<yscale>}
X show size
X
X The <xscale> and <yscale> values are the scaling factors for the size.
X The defaults (1,1) are selected if the scaling factors are omitted.
X
X Examples:
X
X To set the size to normal size use:
X set size
X To make the plot half size use:
X set size 0.5,0.5
X To show the size use:
X show size
X
X For the LaTeX and Fig terminals the default size (scale factor 1,1)
X is 5 inches wide by 3 inches high. The big Fig terminal (`bfig`) is 7
X inches wide by 5 inches high. The postscript default is landscape mode
X 10 inches wide and 7 inches high.
X Note that the size of the plot includes the space used by the labels;
X the plotting area itself is smaller.
3 style
?set style
?show style
?style
X Plots may be displayed in one of six styles: `lines`, `points`,
X `linespoints`, `impulses`, `dots`, or `errorbars`. The `lines` style
X connects adjacent points with lines. The `points` style displays a
X small symbol at each point. The `linespoints` style does both
X `lines` and `points`. The `impulses` style displays a vertical line
X from the x axis to each point. The `dots` style plots a tiny dot at
X each data point; this is useful for scatter plots with many points.
X
X The `errorbars` style is relevant only for to data file `plot`s. It is
X treated like `points` for function `plot`s and `splot`s. For data file
X `plot`s, `errorbars` is like `points`, except that a vertical error
X bar is also drawn: for each point (x,y), a line is drawn from (x,ylow)
X to (x,yhigh). A tic mark is placed at the ends of the error bar. The
X ylow and yhigh values are read from the data file's third and fourth
X columns, or as specified with the `using` option to plot. See `plot
X errorbars` for more information.
X
X Default styles are chosen with the `set function style` and `set
X data style` commands. See `plot style` for information about how
X to override the default plotting style for individual functions.
X
X Syntax:
X set function style <style>
X set data style <style>
X show function style
X show data style
X
X where <style> is `lines`, `points`, `linespoints`, `impulses`,
X `dots`, or `errorbars`.
3 surface
?set surface
?set nosurface
?show surface
?surface
X `set surface` controls the display of surfaces. It is useful if
X contours are to be displayed by themselves. Whenever `set nosurface`
X is issued, no surface isolines/mesh will be drawn. See also `set
X contour`.
X
X Syntax:
X set surface
X set nosurface
X show surface
3 terminal
?set terminal
?show terminal
?terminal
X GNUPLOT supports many different graphics devices. Use the `set
X terminal` command to select the type of device for which GNUPLOT
X will produce output.
X
X Syntax:
X set terminal {<terminal-type>}
X show terminal
X
X If <terminal-type> is omitted, GNUPLOT will list the available
X terminal types. <terminal-type> may be abbreviated.
X
X Use `set output` to redirect this output to a file or device.
X
X Several terminals have additional options. For example, see `dumb`,
X `iris4d`, `hpljii` or `postscript`.
4 dumb
?set terminal dumb
?dumb
X The dumb terminal driver has an optional size specification.
X
X Syntax:
X set terminal dumb {<xsize> <ysize>}
X
X where <xsize> and <ysize> set the size of the dumb terminals. Default
X is 79 by 24.
X
X Examples:
X set term dumb
X set term dumb 79 49 #(VGA screen - why would anyone want to do that!?)
X
4 hpljii
?set terminal hpljii
?hpljii
X The HP LaserJet II and HP DeskJet drivers have a single option.
X
X Syntax:
X set terminal hpljii {<resolution>}
X set terminal hpdj {<resolution>}
X
X where <resolution> is the resolution of the output in dots per inch.
X It must be `75`, `100`, `150` or `300`.
X
X Example:
X set terminal hpljii 150
X
4 iris4d
?set terminal iris4d
?iris4d
X The iris4d driver can operate in two modes.
X
X Syntax:
X set terminal iris4d {24}
X
X If the hardware supports only 8 bits, use the default `set terminal
X iris4d`. If, however, the hardware supports 24 bits (8 per
X red/green/blue), use `set terminal iris4d 24`.
X
X When using 24-bit mode, the colors can be directly specified via the
X file .gnuplot_iris4d that is searched in the current directory and
X then in the home directory specified by the HOME environment variable.
X This file holds RGB values for the background, border, labels and nine
X plotting colors, in that order. For example, here is a file containing
X the default colors:
X
X 85 85 85 /* Back Ground */
X 0 0 0 /* Boundary */
X 170 0 170 /* Labeling */
X 85 255 255 /* Plot Color 1 */
X 170 0 0 /* Plot Color 2 */
X 0 170 0 /* Plot Color 3 */
X 255 85 255 /* Plot Color 4 */
X 255 255 85 /* Plot Color 5 */
X 255 85 85 /* Plot Color 6 */
X 85 255 85 /* Plot Color 7 */
X 0 170 170 /* Plot Color 8 */
X 170 170 0 /* Plot Color 9 */
X
X This file has exactly 12 lines of RGB triples. No empty lines are
X allowed and anything after the third number in line is ignored.
X
4 postscript
?set terminal postscript
?postscript
X Several options may be set in the PostScript driver.
X
X Syntax:
X set terminal postscript {<mode>} {<color>}
X {"<fontname>"} {<fontsize>}
X
X where <mode> is `landscape`, `portrait` or `default`. Selecting default
X sets all options to their defaults.
X <color> is either `color` or `monochrome`.
X "<fontname>" is the name of a valid PostScript font.
X <fontsize> is the size of the font in PostScript points, before
X scaling by the `set size` command.
X Defaults are `landscape`, `monochrome`, "Courier", and 14pt.
X Default size of PostScript plot is landscape mode 10 inches wide
X and 7 inches high.
X
X Examples:
X
X set size 1,1
X set term postscript default # old postscript
X set term postscript landscape 22 # old psbig
X set size 0.5,0.5
X set term postscript portrait 14 # old epsf1
X set term postscript portrait 22 # old epsf2
X set size 1,1; set term post landscape color "Times-Roman" 14
X
3 tics
?set tics
?show tics
?tics
X By default, tics are drawn inwards from the border on all four sides.
X The `set tics` command can be used to change the tics to be
X drawn outwards on the left and bottom borders only.
X This is useful when doing impulse plots.
X
X Syntax:
X set tics {<direction>}
X show tics
X
X where <direction> may be `in` or `out`. `set tics` defaults to `in`.
X
X See also the `set xtics`, `set ytics`, and `set ztics` command for more
X control of tic marks.
?set ticslevel
?show ticslevel
?ticslevel
X Using splot, in 3-d plots, one can adjust the relative height of the
X vertical (Z) axis using `set ticslevel`. The numeric argument provided
X specifies the location of the bottom of the scale. a zero will put it
X on the bottom grid and any positive number somewhere along the z axis.
X
X Syntax:
X set ticslevel {<level>}
X show tics
X
X where <level> is a non negative numeric argument. For example,
X
X set ticslevel 0.5
X
X sets the tics level to the default value.
X
X See also the `set view`.
3 time
?set time
?show time
?time
X The optional `set time` places the time and date of the plot either
X at the top or bottom of the left margin. The exact location is
X device dependent.
X
X Syntax:
X set time {<xoff>}{,<yoff>}
X set notime
X show time
X
X Specifying constants <xoff> or <yoff> as optional offsets for the time
X will move the time <xoff> or <yoff> character screen coordinates. For
X example,
X
X set time ,-3
X
X will change only the y offset of the time, moving the title down by
X roughly the height of three characters.
X
3 title
?set title
?show title
?title
X The `set title` command produces a plot title that is centered at the
X top of the plot. Using the optional x,y screen offsets, the title
X can be placed anywhere on the plot. `set title` with no parameters
X clears the title.
X
X Syntax:
X set title {"<title-text>"} {<xoff>}{,<yoff>}
X show title
X
X Specifying constants <xoff> or <yoff> as optional offsets for the
X title will move the title <xoff> or <yoff> character screen
X coordinates. Note these are screen coordinates and not plot
X coordinates. For example,
X
X set title ,-1
X
X will change only the y offset of the title, moving the title down by
X roughly the height of one character.
X
X (The Latex, EEPIC, and Imagen drivers allow \\ in a string to specify
X a newline.)
3 trange
?set trange
?show trange
?trange
X The `set trange` command sets the parametric range used to compute
X x and y values when in parametric mode. If not in parametric mode
X (see `set parametric`) then this range is not used. This command
X does not affect x/y autoscaling or x/y ranges.
X
X This range may also be specified on the `plot` command line when
X in parametric mode.
X
X Syntax:
X set trange [{<tmin> : <tmax>}]
X
X where <tmin> and <tmax> terms are constants or expressions.
X
X Both the <tmin> and <tmax> terms are optional. Anything omitted will
X not be changed, so
X set trange [:10]
X changes tmax to 10 without affecting tmin. See also `set urange` and
X `set parametric`.
3 urange
?set urange
?show urange
?urange
X The `set urange` and `set vrange` commands sets the parametric ranges used
X to compute x, y, and z values when in `splot` parametric mode. If not in
X parametric mode (see `set parametric`) then these ranges are not used. This
X command does not affect x/y autoscaling or x/y ranges.
X
X This range may also be specified on the `splot` command line when
X in parametric mode. See `plot` for more information
X
X Syntax:
X set urange [{<umin> : <umax>}]
X
X where <umin> and <umax> terms are constants or expressions.
X
X Both the <umin> and <umax> terms are optional. Anything omitted will
X not be changed, so
X set urange [:10]
X changes umax to 10 without affecting umin. See also `set trange`.
3 variables
?show variables
X The `show variables` command lists all user-defined variables and
X their values.
X
X Syntax:
X show variables
3 view
?set view
?show view
?view
X The `set view` command sets the view point for `splot`s. This
X command controls the way the 3-d coordinates of the plot are mapped
X into the 2-d screen space. This command provides controls to both
X rotation and scaling of the plotted data but supports orthographic
X projections only.
X
X Syntax:
X set view <rot_x> {,{<rot_z>}{,{<scale>}{,<scale_z>}}}
X show view
X
X where <rot_x> and <rot_z> control the rotation angles (in degrees)
X along a virtual 3-d coordinate system aligned with the screen such
X that the screen horizontal axis is x, screen vertical axis is y, and
X the axis perpendicular to the screen is z. <rot_x> is bounded to the
X [0:180] range with a default of 60 degrees, while <rot_z> is bounded
X to the [0:360] range with a default of 30 degrees. <scale> controls
X the scaling of the entire `splot`, while <scale_z> scales the z axis
X only. Both scales default to 1.0.
X
X Examples:
X set view 60, 30, 1, 1
X set view ,,0.5
X
X The first sets all the four default values. The second changes
X only scale, to 0.5.
X
X See also `set ticslevel`.
3 vrange
?set vrange
?show vrange
?vrange
X The `set vrange` command is similar to the `set urange` command.
X Please see `set urange`.
3 xlabel
?set xlabel
?show xlabel
?xlabel
X The `set xlabel` command sets the x-axis label that is centered along
X the x axis. Using the optional x,y screen offsets, the label can be
X placed anywhere on the plot. `set xlabel` with no parameters clears
X the label.
X
X Syntax:
X set xlabel {"<label>"} {<xoff>}{,<yoff>}
X show xlabel
X
X Specifying constants <xoff> or <yoff> as optional offsets for the
X label will move the label <xoff> or <yoff> character screen
X coordinates. For example,
X
X set xlabel -1
X
X will change only the x offset of the xlabel, moving the label roughly
X one character width to the left.
X
X (The LaTeX, EEPIC, and Imagen drivers allow \\ in a string to specify
X a newline.)
3 xrange
?set xrange
?show xrange
?xrange
X The `set xrange` command sets the horizontal range that will be
X displayed. This command turns x axis autoscaling off.
X
X This range may also be specified on the `plot` command line.
X
X Syntax:
X set xrange [{<xmin> : <xmax>}]
X
X where <xmin> and <xmax> terms are constants or expressions.
X
X Both the <xmin> and <xmax> terms are optional. Anything omitted will
X not be changed, so
X set xrange [:10]
X changes xmax to 10 without affecting xmin.
3 xtics
?set xtics
?set noxtics
?show xtics
?xtics
?noxtics
X Fine control of the x axis tic marks is possible with the
X `set xtics` command. The x-axis tic marks may be turned off with the
X `set noxtics` command. They may be turned on (the default state) with
X `set xtics`.
X
X Syntax:
X set xtics { {<start>, <incr>{, <end>}} |
X {({"<label>"} <pos> {, {"<label>"} <pos>}...)} }
X set noxtics
X show xtics
X
X The <start>, <incr>, <end> form specifies that a series of tics will
X be plotted on the x axis between the x values <start> and <end>
X with an increment of <incr>. If <end> is not given it is assumed to be
X infinity. The increment may be negative. For example,
X set xtics 0,.5,10
X makes tics at 0, 0.5, 1, 1.5, ..., 9.5, 10.
X
X The ("<label>" <pos>, ...) form allows arbitrary tic positions or
X non-numeric tic labels. A set of tics are a set of positions, each
X with its own optional label. Note that the label is a string enclosed
X by quotes, and may be a constant string, such as "hello", or contain
X formatting information for the tic number (which is the same as the
X position), such as "%3f clients". See `set format` for more
X information about this case. The label may even be empty.
X Examples:
X set xtics ("low" 0, "medium" 50, "high" 100)
X set xtics (1,2,4,8,16,32,64,128,256,512,1024)
X set xtics ("bottom" 0, "" 10, "top" 20)
X
X Tics will only be plotted when in range.
X
X The `set ytics` and `set noytics` commands work identically.
X See also the `set format` command.
3 xzeroaxis
?set xzeroaxis
?set noxzeroaxis
?show xzeroaxis
?xzeroaxis
?noxzeroaxis
X `set xzeroaxis` draws the x-axis. By default, this option is on.
X `set noxzeroaxis` causes GNUPLOT to omit the x-axis.
X
X Syntax:
X set xzeroaxis
X set noxzeroaxis
X show xzeroaxis
3 ylabel
?set ylabel
?show ylabel
?ylabel
X The `set ylabel` command sets the y-axis label. The position of this
X label depends on the terminal, and can be one of the following three
X positions (the position can be adjusted with optional parameters).
X
X 1. Horizontal text flushed left at the top left of the plot.
X Terminals that cannot rotate text will probably use this method.
X
X 2. Vertical text centered vertically at the left of the plot.
X Terminals that can rotate text will probably use this method.
X
X 3. Horizontal text centered vertically at the left of the plot.
X The LaTeX and EEPIC drivers use this method. The user must insert
X line breaks using \\ to prevent the ylabel from overwriting
X the plot. To produce a vertical row of characters, add \\
X between every printing character (but this is ugly).
X
X Syntax:
X set ylabel {"<label>"} {<xoff>}{,<yoff>}
X show ylabel
X
X With no parameters, the label is cleared. Specifying constants <xoff>
X or <yoff> as optional offsets for the label will move the label <xoff>
X or <yoff> character screen coordinates. For example,
X
X set ylabel -1
X
X will change only the x offset of the ylabel, moving the label roughly
X one character width left of its default position. This is especially
X useful with the LaTeX driver.
X
X (The LaTeX, EEPIC, and Imagen drivers allow \\ in a string to specify
X a newline.)
3 yrange
?set yrange
?show yrange
?yrange
X The `set yrange` command sets the vertical range that will be
X displayed. This command turns y axis autoscaling off.
X
X This range may also be specified on the `plot` command line.
X
X Syntax:
X set yrange [{<ymin> : <ymax>}]
X
X where <ymin> and <ymax> terms are constants or expressions.
X
X Both the <ymin> and <ymax> terms are optional. Anything omitted will
X not be changed, so
X set yrange [:10]
X changes ymax to 10 without affecting ymin.
3 ytics
?set ytics
?set noytics
?show ytics
?ytics
?noytics
X The `set ytics` and `set noytics` commands are similar to the `set xtics`
X and `set noxtics` commands. Please see `set xtics`.
3 yzeroaxis
?set yzeroaxis
?set noyzeroaxis
?show yzeroaxis
?yzeroaxis
?noyzeroaxis
X `set yzeroaxis` draws the y-axis. By default, this option is on.
X `set noyzeroaxis` causes GNUPLOT to omit the y-axis.
X
X Syntax:
X set yzeroaxis
X set noyzeroaxis
X show yzeroaxis
3 zero
?set zero
?show zero
?zero
X The `zero` value is the default threshold for values approaching 0.0.
X GNUPLOT will not plot a point if its imaginary part is greater in
X magnitude than the `zero` threshold. Axis ranges cannot be less than
X `zero`. The default `zero` value is 1e-8. This can be changed with
X the `set zero` command.
X
X Syntax:
X set zero <expression>
X show zero
3 zeroaxis
?set zeroaxis
?set nozeroaxis
?show zeroaxis
?zeroaxis
SHAR_EOF
true || echo 'restore of gnuplot/docs/gnuplot.doc failed'
fi
echo 'End of part 9'
echo 'File gnuplot/docs/gnuplot.doc is continued in part 10'
echo 10 > _shar_seq_.tmp
#!/bin/sh
# this is Part.13 (part 13 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/command.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 13; 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/command.c'
else
echo 'x - continuing file gnuplot/command.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/command.c' &&
X /* function ! */
X start_token = c_token;
X copy_str(c_dummy_var[0], c_token + 2);
X if(equals(c_token+3,",")) {
X copy_str(c_dummy_var[1], c_token + 4);
X c_token += 2; /* skip the , dummy2 */
X }
X c_token += 5; /* skip (, dummy, ) and = */
X if (END_OF_COMMAND)
X int_error("function definition expected",c_token);
X udf = dummy_func = add_udf(start_token);
X if (udf->at) /* already a dynamic a.t. there */
X free((char *)udf->at); /* so free it first */
X if ((udf->at = perm_at()) == (struct at_type *)NULL)
X int_error("not enough memory for function",start_token);
X m_capture(&(udf->definition),start_token,c_token-1);
X }
X else {
X /* variable ! */
X start_token = c_token;
X c_token +=2;
X udv = add_udv(start_token);
X (void) const_express(&(udv->udv_value));
X udv->udv_undef = FALSE;
X }
}
X
X
get_data(this_plot)
struct curve_points *this_plot;
{
register int i, l_num, datum;
register FILE *fp;
float x, y;
float ylow, yhigh; /* for error bars */
float temp;
BOOLEAN yfirst;
char format[MAX_LINE_LEN+1], data_file[MAX_LINE_LEN+1], line[MAX_LINE_LEN+1];
char *float_format = "%f", *float_skip = "%*f";
int xcol = 1, ycol = 2, yemin = 3, yemax = 4;
struct value colvalue;
#ifdef AMIGA_LC_5_1
int num_perc_ast;
char *start_search;
#endif /* AMIGA_LC_5_1 */
X
X quote_str(data_file, c_token);
X this_plot->plot_type = DATA;
X if ((fp = fopen(data_file, "r")) == (FILE *)NULL)
X os_error("can't open data file", c_token);
X
X format[0] = '\0';
X yfirst = FALSE;
X c_token++; /* skip data file name */
X if (almost_equals(c_token,"u$sing")) {
X c_token++; /* skip "using" */
X if (!END_OF_COMMAND && !isstring(c_token)) {
X struct value a;
X ycol = (int)magnitude(const_express(&a));
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X xcol = ycol;
X ycol = (int)magnitude(const_express(&a));
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X yemin = (int)magnitude(const_express(&a));
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X yemax = (int)magnitude(const_express(&a));
X }
X else
X yemax = -1;
X }
X else {
X yemin = -1;
X yemax = -1;
X }
X }
X else {
X yemin = -1;
X yemax = -1;
X }
X if (xcol > ycol) yfirst = TRUE;
X }
X if (!END_OF_COMMAND && isstring(c_token)) {
X quotel_str(format, c_token);
X c_token++; /* skip format */
X }
X }
X if (strlen(format) == 0) {
X for(i = 1; i <= ((xcol > ycol) ? xcol : ycol); i++)
X if ((i == xcol) || (i == ycol))
X (void) strcat(format,float_format);
X else
X (void) strcat(format,float_skip);
X
X if (yemin > 0) {
X /* We have error bars - handle them. */
X yemin -= (xcol > ycol) ? xcol : ycol;
X yemax -= (xcol > ycol) ? xcol : ycol;
X if (yemin > yemax && yemax > 0) {
X i = yemin;
X yemin = yemax;
X yemax = i;
X }
X
X if (yemin == yemax)
X int_error("Two error bar columns are the same",
X NO_CARET);
X
X if (yemin <= 0)
X int_error("Error bar columns must follow data columns",
X NO_CARET);
X
X for (i = 1; i < yemin; i++)
X (void) strcat(format,float_skip);
X (void) strcat(format,float_format);
X
X if (yemax > 0) {
X for (i = 1; i < yemax - yemin; i++)
X (void) strcat(format,float_skip);
X (void) strcat(format,float_format);
X }
X }
X }
X
X l_num = 0;
X datum = 0;
X i = 0;
#ifdef AMIGA_LC_5_1
X num_perc_ast = 0;
X start_search = format;
X while (*start_search != '\0') {
X if (start_search[0] == '%')
X if (start_search[1] == '*') num_perc_ast++;
X start_search++;
X }
#endif /* AMIGA_LC_5_1 */
X while ( fgets(line, MAX_LINE_LEN, fp) != (char *)NULL ) {
X l_num++;
X if (is_comment(line[0]))
X continue; /* ignore comments */
X if (i >= this_plot->p_max) {
X /* overflow about to occur. Extend size of points[]
X * array. We either double the size, or add 1000 points,
X * whichever is a smaller increment. Note i=p_max.
X */
X cp_extend(this_plot, i + (i < 1000 ? i : 1000));
X }
X if (!line[1]) { /* is it blank line ? */
X /* break in data, make next point undefined */
X this_plot->points[i].type = UNDEFINED;
X i++;
X continue;
X }
X
#ifdef AMIGA_LC_5_1
X switch (sscanf(line, format, &x, &y, &ylow, &yhigh) -
X num_perc_ast) {
#else /* AMIGA_LC_5_1 */
X switch (sscanf(line, format, &x, &y, &ylow, &yhigh)) {
#endif /* AMIGA_LC_5_1 */
X case 1: { /* only one number on the line */
X y = x; /* assign that number to y */
X x = datum; /* and make the index into x */
X /* no break; !!! */
X }
X case 2: {
X if (yfirst) { /* exchange x and y */
X temp = y;
X y = x;
X x = temp;
X }
X datum++;
X
X /* ylow and yhigh are same as y */
X store2d_point(this_plot, i++, x, y, y, y);
X break;
X }
X case 3: { /* x, y, ydelta */
X if (yfirst) { /* exchange x and y */
X temp = y;
X y = x;
X x = temp;
X }
X datum++;
X
X /* ydelta is in the ylow variable */
X store2d_point(this_plot, i++, x, y, y-ylow, y+ylow);
X break;
X }
X case 4: { /* x, y, ylow, yhigh */
X if (yfirst) { /* exchange x and y */
X temp = y;
X y = x;
X x = temp;
X }
X datum++;
X
X store2d_point(this_plot, i++, x, y, ylow, yhigh);
X break;
X }
X default: {
X (void) sprintf(line, "bad data on line %d", l_num);
X int_error(line,c_token);
X }
X }
X }
X this_plot->p_count = i;
X cp_extend(this_plot, i); /* shrink to fit */
X (void) fclose(fp);
}
X
/* called by get_data for each point */
store2d_point(this_plot, i, x, y, ylow, yhigh)
struct curve_points *this_plot;
int i; /* point number */
#ifdef AMIGA_LC_5_1
double x, y;
double ylow, yhigh;
#else
float x, y;
float ylow, yhigh;
#endif
{
X struct coordinate *cp = &(this_plot->points[i]);
X
X /* the easy part: */
X cp->type = INRANGE;
X cp->x = x;
X cp->y = y;
X cp->ylow = ylow;
X cp->yhigh = yhigh;
X
X /* Adjust for log scale. */
X if (log_x)
X cp->type = adjustlog(cp->type, &(cp->x));
X if (log_y) {
X cp->type = adjustlog(cp->type, &(cp->y));
X /* Note ylow,yhigh can't affect cp->type. */
X (void) adjustlog(cp->type, &(cp->ylow));
X (void) adjustlog(cp->type, &(cp->yhigh));
X }
X
X /* Now adjust the xrange, or declare the point out of range */
X /* The yrange is handled later, once we know whether to
X * include ylow, yhigh in the calculation. See adjust_yrange()
X */
X if (cp->type == INRANGE)
X if (autoscale_lx || inrange(x,xmin,xmax)) {
X if (autoscale_lx) {
X if (x < xmin) xmin = x;
X if (x > xmax) xmax = x;
X }
X } else {
X cp->type = OUTRANGE;
X }
}
X
/* Adjust for log scale:
X * take the log of the second parameter, in place, if possible.
X * If not possible, return new type for point; if possible, then
X * return old type for point.
X */
static enum coord_type
adjustlog(type, val)
X enum coord_type type;
X coordval *val;
{
X if (*val < 0.0) {
X return(UNDEFINED);
X } else if (*val == 0.0) {
X *val = -VERYLARGE;
X return(OUTRANGE);
X } else {
X *val = log10(*val);
X return(type);
X }
}
X
X
/* now adjust the yrange, or declare the point out of range */
/* this does all points in a curve */
adjust_yrange(curve)
X struct curve_points *curve;
{
X BOOLEAN ebars = (curve->plot_style == ERRORBARS);
X int npoints = curve->p_count; /* number of points */
X coordval y, ylow, yhigh; /* one point value */
X struct coordinate *cp; /* one coordinate */
X int i; /* index into points */
X
X for (i = 0; i < npoints; i++) {
X cp = &(curve->points[i]);
X if (cp->type == INRANGE) {
X y = cp->y;
X if ((autoscale_ly ||
X inrange(log_y ? pow(10.0, y) : y, ymin, ymax) ||
X polar)) {
X if (autoscale_ly) {
X if (y < ymin) ymin = y;
X if (y > ymax) ymax = y;
X if (ebars) {
X ylow = cp->ylow;
X yhigh = cp->yhigh;
X if (ylow < ymin) ymin = ylow;
X if (ylow > ymax) ymax = ylow;
X if (yhigh < ymin) ymin = yhigh;
X if (yhigh > ymax) ymax = yhigh;
X }
X }
X } else {
X cp->type = OUTRANGE;
X }
X }
X }
}
X
X
get_3ddata(this_plot)
struct surface_points *this_plot;
{
register int i, j, l_num, xdatum, ydatum;
register FILE *fp;
float x, y, z;
BOOLEAN only_z = FALSE;
char format[MAX_LINE_LEN+1], data_file[MAX_LINE_LEN+1], line[MAX_LINE_LEN+1];
char *float_format = "%f", *float_skip = "%*f";
int xcol = 1, ycol = 2, zcol = 3, pt_in_iso_crv = 0, maxcol;
enum XYZ_order_type {XYZ, YXZ, ZXY, XZY, ZYX, YZX, XY, YX} xyz_order;
struct iso_curve *this_iso;
#ifdef AMIGA_LC_5_1
int num_perc_ast;
char *start_search;
#endif /* AMIGA_LC_5_1 */
X
X quote_str(data_file, c_token);
X this_plot->plot_type = DATA3D;
X this_plot->has_grid_topology = TRUE;
X if ((fp = fopen(data_file, "r")) == (FILE *)NULL)
X os_error("can't open data file", c_token);
X
X format[0] = '\0';
X c_token++; /* skip data file name */
X if (almost_equals(c_token,"u$sing")) {
X c_token++; /* skip "using" */
X if (!END_OF_COMMAND && !isstring(c_token)) {
X struct value a;
X zcol = (int)magnitude(const_express(&a));
X only_z = TRUE;
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X only_z = FALSE;
X ycol = zcol;
X zcol = (int)magnitude(const_express(&a));
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X xcol = ycol;
X ycol = zcol;
X zcol = (int)magnitude(const_express(&a));
X }
X else {
X if (mapping3d == MAP3D_CARTESIAN)
X int_error("Must specify 1 or 3 columns",c_token);
X xcol = ycol;
X ycol = zcol;
X }
X }
X if (!only_z)
X if ( (xcol == ycol) || (ycol == zcol) || (xcol == zcol))
X int_error("Columns must be distinct",c_token);
X }
X if (!END_OF_COMMAND && isstring(c_token)) {
X quotel_str(format, c_token);
X c_token++; /* skip format */
X }
X }
X
X switch (mapping3d) {
X case MAP3D_CARTESIAN:
X maxcol = (xcol > ycol) ? xcol : ycol;
X maxcol = (maxcol > zcol) ? maxcol : zcol;
X if (!only_z) { /* Determine ordering of input columns */
X if (zcol == maxcol) {
X if (xcol < ycol)
X xyz_order = XYZ; /* scanf(x,y,z) */
X else
X xyz_order = YXZ; /* scanf(y,x,z) */
X }
X else if (ycol == maxcol) {
X if (xcol < zcol)
X xyz_order = XZY; /* scanf(x,z,y) */
X else
X xyz_order = ZXY; /* scanf(z,x,y) */
X }
X else {
X if (ycol < zcol)
X xyz_order = YZX; /* scanf(y,z,x) */
X else
X xyz_order = ZYX; /* scanf(z,y,x) */
X }
X }
X if (strlen(format) == 0) {
X if (only_z) {
X for(i = 1; i <= zcol; i++)
X if (i == zcol)
X (void) strcat(format,float_format);
X else
X (void) strcat(format,float_skip);
X }
X else {
X for(i = 1; i <= maxcol; i++)
X if ((i == xcol) || (i == ycol) || (i == zcol))
X (void) strcat(format,float_format);
X else
X (void) strcat(format,float_skip);
X }
X }
X break;
X case MAP3D_SPHERICAL:
X case MAP3D_CYLINDRICAL:
X if (only_z)
X int_error("Two columns for spherical/cylindrical coords.",c_token);
X maxcol = (xcol > ycol) ? xcol : ycol;
X xyz_order = (xcol < ycol) ? XY : YX;
X for(i = 1; i <= maxcol; i++)
X if ((i == xcol) || (i == ycol))
X (void) strcat(format,float_format);
X else
X (void) strcat(format,float_skip);
X }
#ifdef AMIGA_LC_5_1
X num_perc_ast = 0;
X start_search = format;
X while (*start_search != '\0') {
X if (start_search[0] == '%')
X if (start_search[1] == '*') num_perc_ast++;
X start_search++;
X }
#endif /* AMIGA_LC_5_1 */
X
X l_num = 0;
X xdatum = 0;
X ydatum = 0;
X this_plot->num_iso_read = 0;
X this_plot->has_grid_topology = TRUE;
X if ( this_plot->iso_crvs != NULL ) {
X struct iso_curve *icrv, *icrvs = this_plot->iso_crvs;
X
X while ( icrvs ) {
X icrv = icrvs;
X icrvs = icrvs->next;
X iso_free( icrv );
X }
X this_plot->iso_crvs = NULL;
X }
X this_iso = iso_alloc( samples );
X
X while ( fgets(line, MAX_LINE_LEN, fp) != (char *)NULL ) {
X l_num++;
X if (is_comment(line[0]))
X continue; /* ignore comments */
X if (!line[1]) { /* is it blank line ? */
X if (pt_in_iso_crv == 0) {
X if (xdatum == 0)
X continue;
X pt_in_iso_crv = xdatum;
X }
X
X if (xdatum > 0) {
X this_iso->p_count = xdatum;
X this_iso->next = this_plot->iso_crvs;
X this_plot->iso_crvs = this_iso;
X this_plot->num_iso_read++;
X
X if (xdatum != pt_in_iso_crv)
X this_plot->has_grid_topology = FALSE;
X
X this_iso = iso_alloc(pt_in_iso_crv);
X xdatum = 0;
X ydatum++;
X }
X continue;
X }
X
X if (xdatum >= this_iso->p_max)
X {
X /* overflow about to occur. Extend size of points[]
X * array. We either double the size, or add 1000 points,
X * whichever is a smaller increment. Note i=p_max.
X */
X iso_extend(this_iso,
X xdatum + (xdatum < 1000 ? xdatum : 1000));
X }
X
#ifdef AMIGA_LC_5_1
X switch (sscanf(line, format, &x, &y, &z) - num_perc_ast) {
#else
X switch (sscanf(line, format, &x, &y, &z)) {
#endif
X case 3: /* All parameter are specified. */
X if (!only_z) {
X switch (xyz_order) {
X case XYZ: /* scanf(x,y,z) */
X this_iso->points[xdatum].x = x;
X this_iso->points[xdatum].y = y;
X this_iso->points[xdatum].z = z;
X break;
X case XZY: /* scanf(x,z,y) */
X this_iso->points[xdatum].x = x;
X this_iso->points[xdatum].y = z;
X this_iso->points[xdatum].z = y;
X break;
X case YXZ: /* scanf(y,x,z) */
X this_iso->points[xdatum].x = y;
X this_iso->points[xdatum].y = x;
X this_iso->points[xdatum].z = z;
X break;
X case ZXY: /* scanf(z,x,y) */
X this_iso->points[xdatum].x = y;
X this_iso->points[xdatum].y = z;
X this_iso->points[xdatum].z = x;
X break;
X case YZX: /* scanf(y,z,x) */
X this_iso->points[xdatum].x = z;
X this_iso->points[xdatum].y = x;
X this_iso->points[xdatum].z = y;
X break;
X case ZYX: /* scanf(z,y,x) */
X this_iso->points[xdatum].x = z;
X this_iso->points[xdatum].y = y;
X this_iso->points[xdatum].z = x;
X break;
X }
X if (xyz_order != XYZ) {
X x = this_iso->points[xdatum].x;
X y = this_iso->points[xdatum].y;
X z = this_iso->points[xdatum].z;
X }
X if (!parametric)
X int_error("Must be in parametric mode.",
X NO_CARET);
X break;
X }
X case 1: /* only one number on the line */
X if (!only_z)
X int_error("3 columns expected, only 1 found", c_token);
X /* assign that number to z */
X this_iso->points[xdatum].z = x;
X z = x;
X this_iso->points[xdatum].x = xdatum;
X x = this_iso->points[xdatum].x;
X this_iso->points[xdatum].y = ydatum;
X y = this_iso->points[xdatum].y;
X if (parametric)
X int_error("Must be in non parametric mode.",
X NO_CARET);
X break;
X case 2:
X switch (xyz_order) {
X case YX:
X z = x; /* Use z as temp */
X x = y;
X y = z;
X break;
X default:
X break;
X }
X switch (mapping3d) {
X case MAP3D_CARTESIAN:
X int_error("2 columns found, 3 expected",
X c_token);
X break;
X case MAP3D_SPHERICAL:
X if (angles_format == ANGLES_DEGREES) {
X x *= DEG2RAD; /* Convert to radians. */
X y *= DEG2RAD;
X }
X this_iso->points[xdatum].x = cos(x) * cos(y);
X this_iso->points[xdatum].y = sin(x) * cos(y);
X this_iso->points[xdatum].z = sin(y);
X break;
X case MAP3D_CYLINDRICAL:
X if (angles_format == ANGLES_DEGREES)
X x *= DEG2RAD; /* Convert to radians. */
X this_iso->points[xdatum].x = cos(x);
X this_iso->points[xdatum].y = sin(x);
X this_iso->points[xdatum].z = y;
X break;
X }
X x = this_iso->points[xdatum].x;
X y = this_iso->points[xdatum].y;
X z = this_iso->points[xdatum].z;
X break;
X default:
X (void) sprintf(line, "bad data on line %d", l_num);
X int_error(line,c_token);
X }
X
X if (log_x) {
X if (x < 0.0)
X int_error("X value must be above 0 for log scale!",
X NO_CARET);
X else
X this_iso->points[xdatum].x =
X log10(this_iso->points[xdatum].x);
X }
X if (log_y) {
X if (y < 0.0)
X int_error("Y value must be above 0 for log scale!",
X NO_CARET);
X else
X this_iso->points[xdatum].y =
X log10(this_iso->points[xdatum].y);
X }
X if (log_z) {
X if (z < 0.0)
X int_error("Z value must be above 0 for log scale!",
X NO_CARET);
X else
X this_iso->points[xdatum].z =
X log10(this_iso->points[xdatum].z);
X }
X
X if (autoscale_lx) {
X if (x < xmin) xmin = x;
X if (x > xmax) xmax = x;
X }
X if (autoscale_ly) {
X if (y < ymin) ymin = y;
X if (y > ymax) ymax = y;
X }
X if (autoscale_lz) {
X if (z < zmin) zmin = z;
X if (z > zmax) zmax = z;
X }
X
X xdatum++;
X }
X
X if (xdatum > 0) {
X this_plot->num_iso_read++; /* Update last iso. */
X this_iso->p_count = xdatum;
X
X this_iso->next = this_plot->iso_crvs;
X this_plot->iso_crvs = this_iso;
X
X if (xdatum != pt_in_iso_crv)
X this_plot->has_grid_topology = FALSE;
X
X }
X else {
X iso_free(this_iso);/* Free last allocation. */
X }
X
X (void) fclose(fp);
X
X if (this_plot->has_grid_topology) {
X struct iso_curve *new_icrvs = NULL;
X int num_new_iso = this_plot->iso_crvs->p_count,
X len_new_iso = this_plot->num_iso_read;
X
X /* Now we need to set the other direction (pseudo) isolines. */
X for (i = 0; i < num_new_iso; i++) {
X struct iso_curve *new_icrv = iso_alloc(len_new_iso);
X
X new_icrv->p_count = len_new_iso;
X
X for (j = 0, this_iso = this_plot->iso_crvs;
X this_iso != NULL;
X j++, this_iso = this_iso->next) {
X new_icrv->points[j].x = this_iso->points[i].x;
X new_icrv->points[j].y = this_iso->points[i].y;
X new_icrv->points[j].z = this_iso->points[i].z;
X }
X
X new_icrv->next = new_icrvs;
X new_icrvs = new_icrv;
X }
X
X /* Append the new iso curves after the read ones. */
X for (this_iso = this_plot->iso_crvs;
X this_iso->next != NULL;
X this_iso = this_iso->next);
X this_iso->next = new_icrvs;
X }
}
X
/* print_points:
X * a debugging routine to print out the points of a curve,
X * and the curve structure. If curve<0, then we print the
X * list of curves.
X */
static char *plot_type_names[4] = {
X "Function", "Data", "3D Function", "3d data"
};
static char *plot_style_names[6] = {
X "Lines", "Points", "Impulses", "LinesPoints", "Dots", "Errorbars"
};
X
print_points(curve)
X int curve; /* which curve to print */
{
X register struct curve_points *this_plot;
X int i;
X
X if (curve < 0) {
X for (this_plot = first_plot, i=0;
X this_plot != NULL;
X i++, this_plot = this_plot->next_cp) {
X printf("Curve %d:\n", i);
X if ((int)this_plot->plot_type >= 0 && (int)(this_plot->plot_type) < 4)
X printf("Plot type %d: %s\n", (int)(this_plot->plot_type),
X plot_type_names[(int)(this_plot->plot_type)]);
X else
X printf("Plot type %d: BAD\n", (int)(this_plot->plot_type));
X if ((int)this_plot->plot_style >= 0 && (int)(this_plot->plot_style) < 6)
X printf("Plot style %d: %s\n", (int)(this_plot->plot_style),
X plot_style_names[(int)(this_plot->plot_style)]);
X else
X printf("Plot style %d: BAD\n", (int)(this_plot->plot_style));
X printf("Plot title: '%s'\n", this_plot->title);
X printf("Line type %d\n", this_plot->line_type);
X printf("Point type %d\n", this_plot->point_type);
X printf("max points %d\n", this_plot->p_max);
X printf("current points %d\n", this_plot->p_count);
X printf("\n");
X }
X } else {
X for (this_plot = first_plot, i = 0;
X i < curve && this_plot != NULL;
X i++, this_plot = this_plot->next_cp)
X ;
X if (this_plot == NULL)
X printf("Curve %d does not exist; list has %d curves\n", curve, i);
X else {
X printf ("Curve %d, %d points\n", curve, this_plot->p_count);
X for (i = 0; i < this_plot->p_count; i++) {
X printf("%c x=%g y=%g z=%g ylow=%g yhigh=%g\n",
X this_plot->points[i].type == INRANGE ? 'i'
X : this_plot->points[i].type == OUTRANGE ? 'o'
X : 'u',
X this_plot->points[i].x,
X this_plot->points[i].y,
X this_plot->points[i].z,
X this_plot->points[i].ylow,
X this_plot->points[i].yhigh);
X }
X printf("\n");
X }
X }
}
X
X
/* This parses the plot command after any range specifications.
X * To support autoscaling on the x axis, we want any data files to
X * define the x range, then to plot any functions using that range.
X * We thus parse the input twice, once to pick up the data files,
X * and again to pick up the functions. Definitions are processed
X * twice, but that won't hurt.
X */
eval_plots()
{
register int i;
register struct curve_points *this_plot, **tp_ptr;
register int start_token, end_token;
register int begin_token;
double x_min, x_max, y_min, y_max;
register double x, xdiff, temp;
static struct value a;
BOOLEAN ltmp, some_data_files = FALSE;
int plot_num, line_num, point_num, xparam=0;
char *xtitle;
void parametric_fixup();
X
X if (autoscale_ly) {
X ymin = VERYLARGE;
X ymax = -VERYLARGE;
X } else if (log_y && (ymin <= 0.0 || ymax <= 0.0))
X int_error("y range must be above 0 for log scale!",
X NO_CARET);
X
X tp_ptr = &(first_plot);
X plot_num = 0;
X line_num = 0; /* default line type */
X point_num = 0; /* default point type */
X
X xtitle = NULL;
X
X begin_token = c_token;
X
/*** First Pass: Read through data files ***/
/* This pass serves to set the xrange and to parse the command, as well
X * as filling in every thing except the function data. That is done after
X * the xrange is defined.
X */
X while (TRUE) {
X if (END_OF_COMMAND)
X int_error("function to plot expected",c_token);
X
X start_token = c_token;
X
X if (is_definition(c_token)) {
X define();
X } else {
X plot_num++;
X
X if (isstring(c_token)) { /* data file to plot */
X if (parametric && xparam)
X int_error("previous parametric function not fully specified",
X c_token);
X
X if (!some_data_files && autoscale_lx) {
X xmin = VERYLARGE;
X xmax = -VERYLARGE;
X }
X some_data_files = TRUE;
X
X if (*tp_ptr)
X this_plot = *tp_ptr;
X else { /* no memory malloc()'d there yet */
X this_plot = cp_alloc(MIN_CRV_POINTS);
X *tp_ptr = this_plot;
X }
X this_plot->plot_type = DATA;
X this_plot->plot_style = data_style;
X end_token = c_token;
X get_data(this_plot); /* this also parses the using option */
X }
X else { /* function to plot */
X if (parametric) /* working on x parametric function */
X xparam = 1 - xparam;
X if (*tp_ptr) {
X this_plot = *tp_ptr;
X cp_extend(this_plot, samples+1);
X } else { /* no memory malloc()'d there yet */
X this_plot = cp_alloc(samples+1);
X *tp_ptr = this_plot;
X }
X this_plot->plot_type = FUNC;
X this_plot->plot_style = func_style;
X dummy_func = &plot_func;
X plot_func.at = temp_at();
X /* ignore it for now */
X end_token = c_token-1;
X }
X
X if (almost_equals(c_token,"t$itle")) {
X if (parametric) {
X if (xparam)
X int_error(
X "\"title\" allowed only after parametric function fully specified",
X c_token);
X else if (xtitle != NULL)
X xtitle[0] = '\0'; /* Remove default title .*/
X }
X c_token++;
X if ( isstring( c_token ) ) {
X m_quote_capture(&(this_plot->title),c_token,c_token);
X }
X else {
X int_error("expecting \"title\" for plot",c_token);
X }
X c_token++;
X }
X else {
X m_capture(&(this_plot->title),start_token,end_token);
X if (xparam) xtitle = this_plot->title;
X }
X
X this_plot->line_type = line_num;
X this_plot->point_type = point_num;
X
X if (almost_equals(c_token,"w$ith")) {
X if (parametric && xparam)
X int_error("\"with\" allowed only after parametric function fully specified",
X c_token);
X this_plot->plot_style = get_style();
X }
X
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X this_plot->line_type = (int)real(const_express(&t))-1;
X }
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X this_plot->point_type = (int)real(const_express(&t))-1;
X }
X if ( (this_plot->plot_style == POINTS) ||
X (this_plot->plot_style == LINESPOINTS) ||
X (this_plot->plot_style == ERRORBARS) )
X if (!xparam) point_num++;
X if (!xparam) line_num++;
X
X if (this_plot->plot_type == DATA)
X /* now that we know the plot style, adjust the yrange */
X adjust_yrange(this_plot);
X
X tp_ptr = &(this_plot->next_cp);
X }
X
X if (equals(c_token,","))
X c_token++;
X else
X break;
X }
X
X if (parametric && xparam)
X int_error("parametric function not fully specified", NO_CARET);
X
X if (parametric) {
X /* Swap t and x ranges for duration of these eval_plot computations. */
X ltmp = autoscale_lx; autoscale_lx = autoscale_lt; autoscale_lt = ltmp;
X temp = xmin; xmin = tmin; tmin = temp;
X temp = xmax; xmax = tmax; tmax = temp;
X }
X
/*** Second Pass: Evaluate the functions ***/
/* Everything is defined now, except the function data. We expect
X * no syntax errors, etc, since the above parsed it all. This makes
X * the code below simpler. If autoscale_ly, the yrange may still change.
X */
X if (fabs(xmax-xmin) < zero)
X if (autoscale_lx) {
X fprintf(stderr, "Warning: empty %c range [%g:%g], ",
X parametric ? 't' : 'x', xmin,xmax);
X if (fabs(xmin) < zero) {
X /* completely arbitary */
X xmin = -1.;
X xmax = 1.;
X } else {
X /* expand range by 10% in either direction */
X xmin = xmin * 0.9;
X xmax = xmax * 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", xmin,xmax);
X } else {
X int_error("x range is less than `zero`", c_token);
X }
X
X /* give error if xrange badly set from missing datafile error */
X if (xmin == VERYLARGE || xmax == -VERYLARGE) {
X int_error("x range is invalid", c_token);
X }
X
X if (log_x) {
X if (xmin <= 0.0 || xmax <= 0.0)
X int_error("x range must be greater than 0 for log scale!",NO_CARET);
X x_min = log10(xmin);
X x_max = log10(xmax);
X } else {
X x_min = xmin;
X x_max = xmax;
X }
X
X xdiff = (x_max - x_min) / (samples - 1);
X
X tp_ptr = &(first_plot);
X plot_num = 0;
X this_plot = first_plot;
X c_token = begin_token; /* start over */
X
X /* Read through functions */
X while (TRUE) {
X if (is_definition(c_token)) {
X define();
X } else {
X plot_num++;
X if (isstring(c_token)) { /* data file to plot */
X /* ignore this now */
X c_token++;
X if (almost_equals(c_token,"u$sing")) {
X c_token++; /* skip "using" */
X if (!isstring(c_token)) {
X struct value a;
X (void)magnitude(const_express(&a)); /* skip xcol */
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X (void)magnitude(const_express(&a)); /* skip ycol */
X }
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X (void)magnitude(const_express(&a)); /* skip yemin */
X }
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X (void)magnitude(const_express(&a)); /* skip yemax */
X }
X }
X if (isstring(c_token))
X c_token++; /* skip format string */
X }
X }
X else { /* function to plot */
X if (parametric) /* working on x parametric function */
X xparam = 1 - xparam;
X dummy_func = &plot_func;
X plot_func.at = temp_at(); /* reparse function */
X
X for (i = 0; i < samples; i++) {
X x = x_min + i*xdiff;
X /* if (log_x) PEM fix logscale x axis */
X /* x = pow(10.0,x); 26-Sep-89 */
X (void) complex(&plot_func.dummy_values[0],
X log_x ? pow(10.0,x) : x,
X 0.0);
X
X evaluate_at(plot_func.at,&a);
X
X if (undefined || (fabs(imag(&a)) > zero)) {
X this_plot->points[i].type = UNDEFINED;
X continue;
X }
X
X temp = real(&a);
X
X if (log_y && temp < 0.0) {
X this_plot->points[i].type = UNDEFINED;
X continue;
X }
X
X this_plot->points[i].x = x;
X if (log_y) {
X if (temp == 0.0) {
X this_plot->points[i].type = OUTRANGE;
X this_plot->points[i].y = -VERYLARGE;
X continue;
X } else {
X this_plot->points[i].y = log10(temp);
X }
X } else
X this_plot->points[i].y = temp;
X
X if (autoscale_ly || polar
X || inrange(temp, ymin, ymax)) {
X this_plot->points[i].type = INRANGE;
X /* When xparam is 1 we are not really computing y's! */
X if (!xparam && autoscale_ly) {
X if (temp < ymin) ymin = temp;
X if (temp > ymax) ymax = temp;
X }
X } else
X this_plot->points[i].type = OUTRANGE;
X }
X this_plot->p_count = i; /* samples */
X }
X
X /* title was handled above */
X if (almost_equals(c_token,"t$itle")) {
X c_token++;
X c_token++;
X }
X
X /* style was handled above */
X if (almost_equals(c_token,"w$ith")) {
X c_token++;
X c_token++;
X }
X
X /* line and point types were handled above */
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X (void)real(const_express(&t));
X }
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X (void)real(const_express(&t));
X }
X
X tp_ptr = &(this_plot->next_cp); /* used below */
X this_plot = this_plot->next_cp;
X }
X
X if (equals(c_token,","))
X c_token++;
X else
X break;
X }
X
X /* throw out all curve_points at end of list, that we don't need */
X cp_free(*tp_ptr);
X *tp_ptr = NULL;
X
X if (fabs(ymax - ymin) < zero)
X /* if autoscale, widen range */
X if (autoscale_ly) {
X fprintf(stderr, "Warning: empty y range [%g:%g], ", ymin, ymax);
X if (fabs(ymin) < zero) {
X ymin = -1.;
X ymax = 1.;
X } else {
X /* expand range by 10% in either direction */
X ymin = ymin * 0.9;
X ymax = ymax * 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", ymin, ymax);
X } else {
X int_error("y range is less than `zero`", c_token);
X }
X
/* Now we finally know the real ymin and ymax */
X if (log_y) {
X y_min = log10(ymin);
X y_max = log10(ymax);
X } else {
X y_min = ymin;
X y_max = ymax;
X }
X capture(replot_line,plot_token,c_token);
X
X if (parametric) {
X /* Now put t and x ranges back before we actually plot anything. */
X ltmp = autoscale_lx; autoscale_lx = autoscale_lt; autoscale_lt = ltmp;
X temp = xmin; xmin = tmin; tmin = temp;
X temp = xmax; xmax = tmax; tmax = temp;
X if (some_data_files && autoscale_lx) {
X /*
X Stop any further autoscaling in this case (may be a mistake, have
X to consider what is really wanted some day in the future--jdc).
X */
X autoscale_lx = 0;
X }
X /* Now actually fix the plot pairs to be single plots. */
X parametric_fixup (first_plot, &plot_num, &x_min, &x_max);
X }
X
X do_plot(first_plot,plot_num,x_min,x_max,y_min,y_max);
X cp_free(first_plot);
X first_plot = NULL;
}
X
/* This parses the splot command after any range specifications.
X * To support autoscaling on the x/z axis, we want any data files to
X * define the x/y range, then to plot any functions using that range.
X * We thus parse the input twice, once to pick up the data files,
X * and again to pick up the functions. Definitions are processed
X * twice, but that won't hurt.
X */
eval_3dplots()
{
register int i,j,k;
register struct surface_points *this_plot, **tp_3d_ptr;
register int start_token, end_token;
register int begin_token;
double x_min, x_max, y_min, y_max, z_min, z_max;
register double x, xdiff, xisodiff, y, ydiff, yisodiff, temp;
static struct value a;
BOOLEAN ltmp, some_data_files = FALSE;
int plot_num, line_num, point_num,
X crnt_param = 0; /* 0=x, 1=y, 2=z */
char *xtitle;
char *ytitle;
void parametric_3dfixup();
X
X if (autoscale_lz) {
X zmin = VERYLARGE;
X zmax = -VERYLARGE;
X } else if (log_z && (zmin <= 0.0 || zmax <= 0.0))
X int_error("z range must be above 0 for log scale!",
X NO_CARET);
X
X tp_3d_ptr = &(first_3dplot);
X plot_num = 0;
X line_num = 0; /* default line type */
X point_num = 0; /* default point type */
X
X xtitle = NULL;
X ytitle = NULL;
X
X begin_token = c_token;
X
/*** First Pass: Read through data files ***/
/* This pass serves to set the x/yranges and to parse the command, as well
X * as filling in every thing except the function data. That is done after
X * the x/yrange is defined.
X */
X while (TRUE) {
X if (END_OF_COMMAND)
X int_error("function to plt3d expected",c_token);
X
X start_token = c_token;
X
X if (is_definition(c_token)) {
X define();
X } else {
X plot_num++;
X
X if (isstring(c_token)) { /* data file to plot */
X if (parametric && crnt_param != 0)
X int_error("previous parametric function not fully specified",
X c_token);
X
X if (!some_data_files) {
X if (autoscale_lx) {
X xmin = VERYLARGE;
X xmax = -VERYLARGE;
X }
X if (autoscale_ly) {
X ymin = VERYLARGE;
X ymax = -VERYLARGE;
X }
X }
X
X some_data_files = TRUE;
X
X if (*tp_3d_ptr)
X this_plot = *tp_3d_ptr;
X else { /* no memory malloc()'d there yet */
X /* Allocate samples * iso_samples twice for */
X /* Each of the isoparametric direction. */
X this_plot = sp_alloc(0,0);
X *tp_3d_ptr = this_plot;
X }
X
X this_plot->plot_type = DATA3D;
X this_plot->plot_style = data_style;
X end_token = c_token;
X get_3ddata(this_plot); /* this also parses the using option */
X }
X else { /* function to plot */
X if (parametric) /* Rotate between x/y/z axes */
X crnt_param = (crnt_param+1) % 3;
X if (*tp_3d_ptr) {
X this_plot = *tp_3d_ptr;
X sp_replace(this_plot,samples,2*iso_samples);
X }
X else { /* no memory malloc()'d there yet */
X /* Allocate samples * iso_samples twice for */
X /* Each of the isoparametric direction. */
X this_plot = sp_alloc(samples,2*iso_samples);
X *tp_3d_ptr = this_plot;
X }
X
X this_plot->plot_type = FUNC3D;
X this_plot->has_grid_topology = TRUE;
X this_plot->plot_style = func_style;
X dummy_func = &plot_func;
X plot_func.at = temp_at();
X /* ignore it for now */
X end_token = c_token-1;
X }
X
X if (almost_equals(c_token,"t$itle")) {
X if (parametric) {
X if (crnt_param)
X int_error(
X "\"title\" allowed only after parametric function fully specified",
X c_token);
X else {
X /* Remove default title */
X if (xtitle != NULL)
X xtitle[0] = '\0';
X if (ytitle != NULL)
X ytitle[0] = '\0';
X }
X }
X c_token++;
X if ( isstring( c_token ) ) {
X m_quote_capture(&(this_plot->title),c_token,c_token);
X }
X else {
X int_error("expecting \"title\" for plot",c_token);
X }
X c_token++;
X }
X else {
X m_capture(&(this_plot->title),start_token,end_token);
X if (crnt_param == 1) xtitle = this_plot->title;
X if (crnt_param == 2) ytitle = this_plot->title;
X }
X
X this_plot->line_type = line_num;
X this_plot->point_type = point_num;
X
X if (almost_equals(c_token,"w$ith")) {
X this_plot->plot_style = get_style();
X }
X
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X this_plot->line_type = (int)real(const_express(&t))-1;
X }
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X this_plot->point_type = (int)real(const_express(&t))-1;
X }
X if ( (this_plot->plot_style == POINTS) ||
X (this_plot->plot_style == LINESPOINTS) ||
X (this_plot->plot_style == ERRORBARS) )
X if (crnt_param == 0)
X point_num +=
X 1 + (draw_contour != 0);
X if (crnt_param == 0)
X line_num += 1 + (draw_contour != 0);
X
X tp_3d_ptr = &(this_plot->next_sp);
X }
X
X if (equals(c_token,","))
X c_token++;
X else
X break;
X }
X
X if (parametric && crnt_param != 0)
X int_error("parametric function not fully specified", NO_CARET);
X
X if (parametric) {
X /* Swap u/v and x/y ranges for duration of these eval_plot computations. */
X ltmp = autoscale_lx; autoscale_lx = autoscale_lu; autoscale_lu = ltmp;
X ltmp = autoscale_ly; autoscale_ly = autoscale_lv; autoscale_lv = ltmp;
X temp = xmin; xmin = umin; umin = temp;
X temp = xmax; xmax = umax; umax = temp;
X temp = ymin; ymin = vmin; vmin = temp;
X temp = ymax; ymax = vmax; vmax = temp;
X }
/*** Second Pass: Evaluate the functions ***/
/* Everything is defined now, except the function data. We expect
X * no syntax errors, etc, since the above parsed it all. This makes
X * the code below simpler. If autoscale_ly, the yrange may still change.
X */
X if (xmin == xmax)
X if (autoscale_lx) {
X fprintf(stderr, "Warning: empty x range [%g:%g], ",
X xmin,xmax);
X if (xmin == 0.0) {
X /* completely arbitary */
X xmin = -1.;
X xmax = 1.;
X } else {
X /* expand range by 10% in either direction */
X xmin = xmin * 0.9;
X xmax = xmax * 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", xmin,xmax);
X } else {
X int_error("x range is empty", c_token);
X }
X
X if (ymin == ymax)
X if (autoscale_ly) {
X fprintf(stderr, "Warning: empty y range [%g:%g], ",
X ymin,ymax);
X if (ymin == 0.0) {
X /* completely arbitary */
X ymin = -1.;
X ymax = 1.;
X } else {
X /* expand range by 10% in either direction */
X ymin = ymin * 0.9;
X ymax = ymax * 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", ymin,ymax);
X } else {
X int_error("y range is empty", c_token);
X }
X
X /* give error if xrange badly set from missing datafile error */
X if (xmin == VERYLARGE || xmax == -VERYLARGE) {
X int_error("x range is invalid", c_token);
X }
X
X if (log_x) {
X if (xmin <= 0.0 || xmax <= 0.0)
X int_error("x range must be greater than 0 for log scale!",NO_CARET);
X x_min = log10(xmin);
X x_max = log10(xmax);
X } else {
X x_min = xmin;
X x_max = xmax;
X }
X
X if (log_y) {
X if (ymin <= 0.0 || ymax <= 0.0)
X int_error("y range must be greater than 0 for log scale!",NO_CARET);
X y_min = log10(ymin);
X y_max = log10(ymax);
X } else {
X y_min = ymin;
X y_max = ymax;
X }
X
X if (samples < 2 || iso_samples < 2)
X int_error("samples or iso_samples < 2. Must be at least 2.\n");
X
X xdiff = (x_max - x_min) / (samples - 1);
X ydiff = (y_max - y_min) / (samples - 1);
X xisodiff = (x_max - x_min) / (iso_samples - 1);
X yisodiff = (y_max - y_min) / (iso_samples - 1);
X
X plot_num = 0;
X this_plot = first_3dplot;
X c_token = begin_token; /* start over */
X
X /* Read through functions */
X while (TRUE) {
X if (is_definition(c_token)) {
X define();
X } else {
X plot_num++;
X if (isstring(c_token)) { /* data file to plot */
X /* ignore this now */
X c_token++;
X if (almost_equals(c_token,"u$sing")) {
X c_token++; /* skip "using" */
X if (!isstring(c_token)) {
X struct value a;
X (void)magnitude(const_express(&a)); /* skip xcol */
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X (void)magnitude(const_express(&a)); /* skip ycol */
X if (equals(c_token,":")) {
X c_token++; /* skip ":" */
X (void)magnitude(const_express(&a)); /* skip zcol */
X }
X }
X }
X if (isstring(c_token))
X c_token++; /* skip format string */
X }
X }
X else { /* function to plot */
X struct iso_curve *this_iso = this_plot->iso_crvs;
X struct coordinate *points = this_iso->points;
X
X if (parametric)
X crnt_param = (crnt_param+1) % 3;
X dummy_func = &plot_func;
X plot_func.at = temp_at(); /* reparse function */
X
X for (j = 0; j < iso_samples; j++) {
X y = y_min + j*yisodiff;
X /* if (log_y) PEM fix logscale y axis */
X /* y = pow(10.0,y); 26-Sep-89 */
X (void) complex(&plot_func.dummy_values[1],
X log_y ? pow(10.0,y) : y,
X 0.0);
X
X for (i = 0; i < samples; i++) {
X x = x_min + i*xdiff;
X /* if (log_x) PEM fix logscale x axis */
X /* x = pow(10.0,x); 26-Sep-89 */
X (void) complex(&plot_func.dummy_values[0],
X log_x ? pow(10.0,x) : x,
X 0.0);
X
X points[i].x = x;
X points[i].y = y;
X
X evaluate_at(plot_func.at,&a);
X
X if (undefined || (fabs(imag(&a)) > zero)) {
X points[i].type = UNDEFINED;
X continue;
X }
X
X temp = real(&a);
X
X if (log_z && temp < 0.0) {
X points[i].type = UNDEFINED;
X continue;
X }
X
X if (log_z) {
X if (temp == 0.0) {
X points[i].type = OUTRANGE;
X points[i].z = -VERYLARGE;
X continue;
X } else {
X points[i].z = log10(temp);
X }
X } else
X points[i].z = temp;
X
X if (autoscale_lz
X || inrange(temp, zmin, zmax)) {
X points[i].type = INRANGE;
X if (autoscale_lz) {
X if (temp < zmin) zmin = temp;
X if (temp > zmax) zmax = temp;
X }
X } else
X points[i].type = OUTRANGE;
X }
X this_iso->p_count = samples;
X this_iso = this_iso->next;
X points = this_iso->points;
X }
X
X for (i = 0; i < iso_samples; i++) {
X x = x_min + i*xisodiff;
X /* if (log_x) PEM fix logscale x axis */
X /* x = pow(10.0,x); 26-Sep-89 */
X (void) complex(&plot_func.dummy_values[0],
X log_x ? pow(10.0,x) : x,
X 0.0);
X
X for (j = 0; j < samples; j++) {
X y = y_min + j*ydiff;
X /* if (log_y) PEM fix logscale y axis */
X /* y = pow(10.0,y); 26-Sep-89 */
X (void) complex(&plot_func.dummy_values[1],
X log_y ? pow(10.0,y) : y,
X 0.0);
X
X points[j].x = x;
X points[j].y = y;
X
X evaluate_at(plot_func.at,&a);
X
X if (undefined || (fabs(imag(&a)) > zero)) {
X points[j].type = UNDEFINED;
X continue;
X }
X
X temp = real(&a);
X
X if (log_z && temp < 0.0) {
X points[j].type = UNDEFINED;
X continue;
X }
X
X if (log_z) {
X if (temp == 0.0) {
X points[j].type = OUTRANGE;
X points[j].z = -VERYLARGE;
X continue;
X } else {
X points[j].z = log10(temp);
X }
X } else
X points[j].z = temp;
X
X if (autoscale_lz
X || inrange(temp, zmin, zmax)) {
X points[j].type = INRANGE;
X if (autoscale_lz) {
X if (temp < zmin) zmin = temp;
X if (temp > zmax) zmax = temp;
X }
X } else
X points[j].type = OUTRANGE;
X }
X this_iso->p_count = samples;
X this_iso = this_iso->next;
X points = this_iso ? this_iso->points : NULL;
X }
X }
X
X /* title was handled above */
X if (almost_equals(c_token,"t$itle")) {
X c_token++;
X c_token++;
X }
X
X /* style was handled above */
X if (almost_equals(c_token,"w$ith")) {
X c_token++;
X c_token++;
X }
X
X /* line and point types were handled above */
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X (void)real(const_express(&t));
X }
X if ( !equals(c_token,",") && !END_OF_COMMAND ) {
X struct value t;
X (void)real(const_express(&t));
X }
X
X this_plot = this_plot->next_sp;
X }
X
X if (equals(c_token,","))
X c_token++;
X else
X break;
X }
X
X if (fabs(zmax - zmin) < zero)
X /* if autoscale, widen range */
X if (autoscale_lz) {
X fprintf(stderr, "Warning: empty z range [%g:%g], ", zmin, zmax);
X if (fabs(zmin) < zero ) {
X zmin = -1.;
X zmax = 1.;
X } else {
X /* expand range by 10% in either direction */
X zmin = zmin * 0.9;
X zmax = zmax * 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", zmin, zmax);
X } else {
X int_error("z range is less than `zero`", c_token);
X }
X
/* Now we finally know the real zmin and zmax */
X if (log_z) {
X if (zmin <= 0.0 || zmax <= 0.0)
X int_error("z range must be greater than 0 for log scale!",NO_CARET);
X z_min = log10(zmin);
X z_max = log10(zmax);
X } else {
X z_min = zmin;
X z_max = zmax;
X }
X capture(replot_line,plot_token,c_token);
X
X if (parametric) {
X /* Now put u/v and x/y ranges back before we actually plot anything. */
X ltmp = autoscale_lx; autoscale_lx = autoscale_lu; autoscale_lu = ltmp;
X ltmp = autoscale_ly; autoscale_ly = autoscale_lv; autoscale_lv = ltmp;
X temp = xmin; xmin = umin; umin = temp;
X temp = xmax; xmax = umax; umax = temp;
X temp = ymin; ymin = vmin; vmin = temp;
X temp = ymax; ymax = vmax; vmax = temp;
X
X /* Now actually fix the plot triplets to be single plots. */
X parametric_3dfixup(first_3dplot, &plot_num,
X &x_min, &x_max, &y_min, &y_max,
X &z_min, &z_max);
X if (log_x) {
X if (x_min <= 0.0 || x_max <= 0.0)
X int_error("x range must be greater than 0 for log scale!",NO_CARET);
X x_min = log10(x_min);
X x_max = log10(x_max);
X }
X
X if (log_y) {
X if (y_min <= 0.0 || y_max <= 0.0)
X int_error("y range must be greater than 0 for log scale!",NO_CARET);
X y_min = log10(y_min);
X y_max = log10(y_max);
X }
X
X if (log_z) {
X if (z_min <= 0.0 || z_max <= 0.0)
X int_error("z range must be greater than 0 for log scale!",NO_CARET);
X z_min = log10(z_min);
X z_max = log10(z_max);
X }
X }
X
X
X /* Creates contours if contours are to be plotted as well. */
X if (draw_contour) {
X for (this_plot=first_3dplot, i=0;
X i < plot_num;
X this_plot=this_plot->next_sp, i++) {
X if (this_plot->contours) {
X struct gnuplot_contours *cntr, *cntrs = this_plot->contours;
X
X while (cntrs) {
X cntr = cntrs;
X cntrs = cntrs->next;
X free(cntr->coords);
X free(cntr);
X }
X }
X /* Make sure this one can be contoured. */
X if (!this_plot->has_grid_topology) {
X this_plot->contours = NULL;
X int_error("Can not contour non grid data!",NO_CARET);
X }
X if (this_plot->plot_type == DATA3D)
X this_plot->contours = contour(
X this_plot->num_iso_read,
X this_plot->iso_crvs,
X contour_levels, contour_pts,
X contour_kind, contour_order);
X else
X this_plot->contours = contour(iso_samples,
X this_plot->iso_crvs,
X contour_levels, contour_pts,
X contour_kind, contour_order);
X }
X }
X
X do_3dplot(first_3dplot,plot_num,x_min,x_max,y_min,y_max,z_min,z_max);
X sp_free(first_3dplot);
X first_3dplot = NULL;
}
X
done(status)
int status;
{
X if (term && term_init)
X (*term_tbl[term].reset)();
#ifdef vms
X vms_reset();
#endif
X exit(status);
}
X
void parametric_fixup (start_plot, plot_num, x_min, x_max)
struct curve_points *start_plot;
int *plot_num;
double *x_min, *x_max;
/*
X The hardest part of this routine is collapsing the FUNC plot types
X in the list (which are gauranteed to occur in (x,y) pairs while
X preserving the non-FUNC type plots intact. This means we have to
X work our way through various lists. Examples (hand checked):
X start_plot:F1->F2->NULL ==> F2->NULL
X start_plot:F1->F2->F3->F4->F5->F6->NULL ==> F2->F4->F6->NULL
X start_plot:F1->F2->D1->D2->F3->F4->D3->NULL ==> F2->D1->D2->F4->D3->NULL
SHAR_EOF
true || echo 'restore of gnuplot/command.c failed'
fi
echo 'End of part 13'
echo 'File gnuplot/command.c is continued in part 14'
echo 14 > _shar_seq_.tmp
#!/bin/sh
# this is Part.14 (part 14 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/command.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 14; 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/command.c'
else
echo 'x - continuing file gnuplot/command.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/command.c' &&
X
X Of course, the more interesting work is to move the y values of
X the x function to become the x values of the y function (checking
X the mins and maxs as we go along).
*/
{
X struct curve_points *xp, *new_list, *yp = start_plot, *tmp,
X *free_list, *free_head=NULL;
X int i, tlen, curve;
X char *new_title;
X double lxmin, lxmax, temp;
X
X if (autoscale_lx) {
X lxmin = VERYLARGE;
X lxmax = -VERYLARGE;
X } else {
X lxmin = xmin;
X lxmax = xmax;
X }
X
/*
X Ok, go through all the plots and move FUNC types together. Note: this
X originally was written to look for a NULL next pointer, but gnuplot
X wants to be sticky in grabbing memory and the right number of items
X in the plot list is controlled by the plot_num variable.
X
X Since gnuplot wants to do this sticky business, a free_list of
X curve_points is kept and then tagged onto the end of the plot list as
X this seems more in the spirit of the original memory behavior than
X simply freeing the memory. I'm personally not convinced this sort
X of concern is worth it since the time spent computing points seems
X to dominate any garbage collecting that might be saved here...
*/
X new_list = xp = start_plot;
X yp = xp->next_cp;
X curve = 0;
X for (; curve < *plot_num; xp = xp->next_cp,yp = yp->next_cp,curve++) {
X if (xp->plot_type != FUNC) {
X continue;
X }
X /* Here's a FUNC parametric function defined as two parts. */
X --(*plot_num);
X /*
X Go through all the points assigning the y's from xp to be the
X x's for yp. Check max's and min's as you go.
X */
X for (i = 0; i < yp->p_count; ++i) {
X /*
X Throw away excess xp points, mark excess yp points as OUTRANGE.
X */
X if (i > xp->p_count) {
X yp->points[i].type = OUTRANGE;
X continue;
X }
X /*
X Just as we had to do when we computed y values--now check that
X x's (computed parametrically) are in the permitted ranges as well.
X */
X temp = xp->points[i].y; /* New x value for yp function. */
X yp->points[i].x = temp;
X /* Handle undefined values differently from normal ranges. */
X if (xp->points[i].type == UNDEFINED)
X yp->points[i].type = xp->points[i].type;
X if (autoscale_lx || polar
X || inrange(temp, lxmin, lxmax)) {
X if (autoscale_lx && temp < lxmin) lxmin = temp;
X if (autoscale_lx && temp > lxmax) lxmax = temp;
X } else
X yp->points[i].type = OUTRANGE; /* Due to x value. */
X }
X /* Ok, fix up the title to include both the xp and yp plots. */
X if (xp->title && xp->title[0] != '\0') {
X tlen = strlen (yp->title) + strlen (xp->title) + 3;
X new_title = alloc ((unsigned int) tlen, "string");
X strcpy (new_title, xp->title);
X strcat (new_title, ", "); /* + 2 */
X strcat (new_title, yp->title); /* + 1 = + 3 */
X free (yp->title);
X yp->title = new_title;
X }
X /* Eliminate the first curve (xparam) and just use the second. */
X if (xp == start_plot) {
X /* Simply nip off the first element of the list. */
X new_list = first_plot = yp;
X xp = xp->next_cp;
X if (yp->next_cp != NULL)
X yp = yp->next_cp;
X /* Add start_plot to the free_list. */
X if (free_head == NULL) {
X free_list = free_head = start_plot;
X free_head->next_cp = NULL;
X } else {
X free_list->next_cp = start_plot;
X start_plot->next_cp = NULL;
X free_list = start_plot;
X }
X }
X else {
X /* Here, remove the xp node and replace it with the yp node. */
X tmp = xp;
X /* Pass over any data files that might have been in place. */
X while (new_list->next_cp && new_list->next_cp != xp)
X new_list = new_list->next_cp;
X new_list->next_cp = yp;
X new_list = new_list->next_cp;
X xp = xp->next_cp;
X if (yp->next_cp != NULL)
X yp = yp->next_cp;
X /* Add tmp to the free_list. */
X tmp->next_cp = NULL;
X if (free_head == NULL) {
X free_list = free_head = tmp;
X } else {
X free_list->next_cp = tmp;
X free_list = tmp;
X }
X }
X }
/* Ok, stick the free list at the end of the curve_points plot list. */
X while (new_list->next_cp != NULL)
X new_list = new_list->next_cp;
X new_list->next_cp = free_head;
X
/* Report the overall graph mins and maxs. */
X *x_min = lxmin;
X *x_max = lxmax;
}
X
void parametric_3dfixup(start_plot, plot_num, x_min, x_max, y_min, y_max,
X z_min, z_max)
struct surface_points *start_plot;
int *plot_num;
double *x_min, *x_max, *y_min, *y_max, *z_min, *z_max;
/*
X The hardest part of this routine is collapsing the FUNC plot types
X in the list (which are gauranteed to occur in (x,y,z) triplets while
X preserving the non-FUNC type plots intact. This means we have to
X work our way through various lists. Examples (hand checked):
X start_plot:F1->F2->F3->NULL ==> F3->NULL
X start_plot:F1->F2->F3->F4->F5->F6->NULL ==> F3->F6->NULL
X start_plot:F1->F2->F3->D1->D2->F4->F5->F6->D3->NULL ==>
X F3->D1->D2->F6->D3->NULL
*/
{
X struct surface_points *xp, *yp, *zp, *new_list, *tmp,
X *free_list, *free_head=NULL;
X struct iso_curve *icrvs, *xicrvs, *yicrvs, *zicrvs;
X int i, tlen, surface;
X char *new_title;
X double lxmin, lxmax, lymin, lymax, lzmin, lzmax, temp;
X
X if (autoscale_lx) {
X lxmin = VERYLARGE;
X lxmax = -VERYLARGE;
X } else {
X lxmin = xmin;
X lxmax = xmax;
X }
X
X if (autoscale_ly) {
X lymin = VERYLARGE;
X lymax = -VERYLARGE;
X } else {
X lymin = ymin;
X lymax = ymax;
X }
X
X if (autoscale_lz) {
X lzmin = VERYLARGE;
X lzmax = -VERYLARGE;
X } else {
X lzmin = zmin;
X lzmax = zmax;
X }
X
/*
X Ok, go through all the plots and move FUNC3D types together. Note:
X this originally was written to look for a NULL next pointer, but
X gnuplot wants to be sticky in grabbing memory and the right number
X of items in the plot list is controlled by the plot_num variable.
X
X Since gnuplot wants to do this sticky business, a free_list of
X surface_points is kept and then tagged onto the end of the plot list as
X this seems more in the spirit of the original memory behavior than
X simply freeing the memory. I'm personally not convinced this sort
X of concern is worth it since the time spent computing points seems
X to dominate any garbage collecting that might be saved here...
*/
X new_list = xp = start_plot;
X for (surface = 0; surface < *plot_num; surface++) {
X if (xp->plot_type != FUNC3D) {
X icrvs = xp->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; ++i) {
X if (lxmin > points[i].x)
X lxmin = points[i].x;
X if (lxmax < points[i].x)
X lxmax = points[i].x;
X if (lymin > points[i].y)
X lymin = points[i].y;
X if (lymax < points[i].y)
X lymax = points[i].y;
X if (lzmin > points[i].z)
X lzmin = points[i].z;
X if (lzmax < points[i].z)
X lzmax = points[i].z;
X }
X
X icrvs = icrvs->next;
X }
X xp = xp->next_sp;
X continue;
X }
X
X yp = xp->next_sp;
X zp = yp->next_sp;
X
X /* Here's a FUNC3D parametric function defined as three parts. */
X (*plot_num) -= 2;
X /*
X Go through all the points and assign the x's and y's from xp
X and yp to zp. Check max's and min's as you go.
X */
X xicrvs = xp->iso_crvs;
X yicrvs = yp->iso_crvs;
X zicrvs = zp->iso_crvs;
X while ( zicrvs ) {
X struct coordinate *xpoints = xicrvs->points,
X *ypoints = yicrvs->points,
X *zpoints = zicrvs->points;
X for (i = 0; i < zicrvs->p_count; ++i) {
X zpoints[i].x = xpoints[i].z;
X zpoints[i].y = ypoints[i].z;
X
X if (lxmin > zpoints[i].x) lxmin = zpoints[i].x;
X if (lxmax < zpoints[i].x) lxmax = zpoints[i].x;
X if (lymin > zpoints[i].y) lymin = zpoints[i].y;
X if (lymax < zpoints[i].y) lymax = zpoints[i].y;
X if (lzmin > zpoints[i].z) lzmin = zpoints[i].z;
X if (lzmax < zpoints[i].z) lzmax = zpoints[i].z;
X }
X xicrvs = xicrvs->next;
X yicrvs = yicrvs->next;
X zicrvs = zicrvs->next;
X }
X
X /* Ok, fix up the title to include xp and yp plots. */
X if ((xp->title && xp->title[0] != '\0') ||
X (yp->title && yp->title[0] != '\0')) {
X tlen = (xp->title ? strlen(xp->title) : 0) +
X (yp->title ? strlen(yp->title) : 0) +
X (zp->title ? strlen(zp->title) : 0) + 5;
X new_title = alloc ((unsigned int) tlen, "string");
X new_title[0] = 0;
X if (xp->title) {
X strcat(new_title, xp->title);
X strcat(new_title, ", "); /* + 2 */
X }
X if (yp->title) {
X strcat(new_title, yp->title);
X strcat(new_title, ", "); /* + 2 */
X }
X if (zp->title) {
X strcat(new_title, zp->title);
X }
X free (zp->title);
X zp->title = new_title;
X }
X
X /* Eliminate the first two surfaces (xp and yp) and just use the third. */
X if (xp == start_plot) {
X /* Simply nip off the first two elements of the list. */
X new_list = first_3dplot = zp;
X xp = zp->next_sp;
X /* Add xp and yp to the free_list. */
X if (free_head == NULL) {
X free_head = start_plot;
X } else {
X free_list->next_sp = start_plot;
X }
X free_list = start_plot->next_sp;
X free_list->next_sp = NULL;
X }
X else {
X /* Here, remove the xp,yp nodes and replace them with the zp node. */
X tmp = xp;
X /* Pass over any data files that might have been in place. */
X while (new_list->next_sp && new_list->next_sp != xp)
X new_list = new_list->next_sp;
X new_list->next_sp = zp;
X new_list = zp;
X xp = zp->next_sp;
X /* Add tmp to the free_list. */
X if (free_head == NULL) {
X free_head = tmp;
X } else {
X free_list->next_sp = tmp;
X }
X free_list = tmp->next_sp;
X free_list->next_sp = NULL;
X }
X }
/* Ok, stick the free list at the end of the surface_points plot list. */
X while (new_list->next_sp != NULL)
X new_list = new_list->next_sp;
X new_list->next_sp = free_head;
X
/* Report the overall graph mins and maxs. */
X if (autoscale_lx) {
X *x_min = (log_x ? pow(10.0, lxmin) : lxmin);
X *x_max = (log_x ? pow(10.0, lxmax) : lxmax);
X }
X else {
X *x_min = xmin;
X *x_max = xmax;
X }
X if (autoscale_ly) {
X *y_min = (log_y ? pow(10.0, lymin) : lymin);
X *y_max = (log_y ? pow(10.0, lymax) : lymax);
X }
X else {
X *y_min = ymin;
X *y_max = ymax;
X }
X if (autoscale_lz) {
X *z_min = (log_z ? pow(10.0, lzmin) : lzmin);
X *z_max = (log_z ? pow(10.0, lzmax) : lzmax);
X }
X else {
X *z_min = zmin;
X *z_max = zmax;
X }
}
X
#ifdef AMIGA_LC_5_1
void sleep(delay)
unsigned int delay;
{
X Delay(50 * delay);
}
#endif
X
#ifdef AMIGA_AC_5
void sleep(delay)
unsigned int delay;
{
unsigned long time_is_up;
X time_is_up = time(NULL) + (unsigned long) delay;
X while (time(NULL)<time_is_up)
X /* wait */ ;
}
#endif
X
#ifdef MSDOS
#ifndef __TURBOC__ /* Turbo C already has sleep() */
#ifndef __ZTC__ /* ZTC already has usleep() */
/* kludge to provide sleep() for msc 5.1 */
void sleep(delay)
unsigned int delay;
{
unsigned long time_is_up;
X time_is_up = time(NULL) + (unsigned long) delay;
X while (time(NULL)<time_is_up)
X /* wait */ ;
}
#endif /* not ZTC */
#endif /* not TURBOC */
#endif /* MSDOS */
X
X
/* Support for input, shell, and help for various systems */
X
#ifdef vms
X
#include <descrip.h>
#include <rmsdef.h>
#include <errno.h>
#include <smgdef.h>
#include <smgmsg.h>
X
extern lib$get_input(), lib$put_output();
extern smg$read_composed_line();
X
int vms_len;
X
unsigned int status[2] = {1, 0};
X
static char help[MAX_LINE_LEN+1] = "gnuplot";
X
$DESCRIPTOR(prompt_desc,PROMPT);
$DESCRIPTOR(line_desc,input_line);
X
$DESCRIPTOR(help_desc,help);
$DESCRIPTOR(helpfile_desc,"GNUPLOT$HELP");
X
X
read_line(prompt)
char *prompt;
{
X int more, start=0;
X char expand_prompt[40];
X
X prompt_desc.dsc$w_length = strlen (prompt);
X prompt_desc.dsc$a_pointer = prompt;
X (void) strcpy (expand_prompt, "_");
X (void) strncat (expand_prompt, prompt, 38);
X do {
X line_desc.dsc$w_length = MAX_LINE_LEN - start;
X line_desc.dsc$a_pointer = &input_line[start];
X switch(status[1] = smg$read_composed_line(&vms_vkid,0,&line_desc, &prompt_desc, &vms_len)){
X case SMG$_EOF:
X done(IO_SUCCESS); /* ^Z isn't really an error */
X break;
X case RMS$_TNS: /* didn't press return in time *
X /
X vms_len--; /* skip the last character */
X break; /* and parse anyway */
X case RMS$_BES: /* Bad Escape Sequence */
X case RMS$_PES: /* Partial Escape Sequence */
X sys$putmsg(status);
X vms_len = 0; /* ignore the line */
X break;
X case SS$_NORMAL:
X break; /* everything's fine */
X default:
X done(status[1]); /* give the error message */
X }
X start += vms_len;
X input_line[start] = '\0';
X inline_num++;
X if (input_line[start-1] == '\\') {
X /* Allow for a continuation line. */
X prompt_desc.dsc$w_length = strlen (expand_prompt);
X prompt_desc.dsc$a_pointer = expand_prompt;
X more = 1;
X --start;
X }
X else {
X line_desc.dsc$w_length = strlen(input_line);
X line_desc.dsc$a_pointer = input_line;
X more = 0;
X }
X } while (more);
}
X
X
do_help()
{
X help_desc.dsc$w_length = strlen(help);
X if ((vaxc$errno = lbr$output_help(lib$put_output,0,&help_desc,
X &helpfile_desc,0,lib$get_input)) != SS$_NORMAL)
X os_error("can't open GNUPLOT$HELP");
}
X
X
do_shell()
{
X if ((vaxc$errno = lib$spawn()) != SS$_NORMAL) {
X os_error("spawn error",NO_CARET);
X }
}
X
X
do_system()
{
X input_line[0] = ' '; /* an embarrassment, but... */
X
X if ((vaxc$errno = lib$spawn(&line_desc)) != SS$_NORMAL)
X os_error("spawn error",NO_CARET);
X
X (void) putc('\n',stderr);
}
X
#else /* vms */
X
/* do_help: (not VMS, although it would work)
X * Give help to the user.
X * It parses the command line into helpbuf and supplies help for that
X * string. Then, if there are subtopics available for that key,
X * it prompts the user with this string. If more input is
X * given, do_help is called recursively, with the argument the index of
X * null character in the string. Thus a more specific help can be
X * supplied. This can be done repeatedly.
X * If null input is given, the function returns, effecting a
X * backward climb up the tree.
X * David Kotz (David...@Dartmouth.edu) 10/89
X */
do_help()
{
X static char *helpbuf = NULL;
X static char *prompt = NULL;
X int base; /* index of first char AFTER help string */
X int len; /* length of current help string */
X BOOLEAN more_help;
X BOOLEAN only; /* TRUE if only printing subtopics */
X int subtopics; /* 0 if no subtopics for this topic */
X int start; /* starting token of help string */
X char *help_ptr; /* name of help file */
X
X if ( (help_ptr = getenv("GNUHELP")) == (char *)NULL )
X /* if can't find environment variable then just use HELPFILE */
X help_ptr = HELPFILE;
X
X /* Since MSDOS DGROUP segment is being overflowed we can not allow such */
X /* huge static variables (1k each). Instead we dynamically allocate them */
X /* on the first call to this function... */
X if (helpbuf == NULL) {
X helpbuf = alloc(MAX_LINE_LEN, "help buffer");
X prompt = alloc(MAX_LINE_LEN, "help prompt");
X helpbuf[0] = prompt[0] = 0;
X }
X
X len = base = strlen(helpbuf);
X
X /* find the end of the help command */
X for (start = c_token; !(END_OF_COMMAND); c_token++)
X ;
X /* copy new help input into helpbuf */
X if (len > 0)
X helpbuf[len++] = ' '; /* add a space */
X capture(helpbuf+len, start, c_token-1);
X squash_spaces(helpbuf+base); /* only bother with new stuff */
X lower_case(helpbuf+base); /* only bother with new stuff */
X len = strlen(helpbuf);
X
X /* now, a lone ? will print subtopics only */
X if (strcmp(helpbuf + (base ? base+1 : 0), "?") == 0) {
X /* subtopics only */
X subtopics = 1;
X only = TRUE;
X helpbuf[base] = '\0'; /* cut off question mark */
X } else {
X /* normal help request */
X subtopics = 0;
X only = FALSE;
X }
X
X switch (help(helpbuf, help_ptr, &subtopics)) {
X case H_FOUND: {
X /* already printed the help info */
X /* subtopics now is true if there were any subtopics */
X screen_ok = FALSE;
X
X do {
X if (subtopics && !only) {
X /* prompt for subtopic with current help string */
X if (len > 0)
X (void) sprintf(prompt, "Subtopic of %s: ", helpbuf);
X else
X (void) strcpy(prompt, "Help topic: ");
X read_line(prompt);
X num_tokens = scanner(input_line);
X c_token = 0;
X more_help = !(END_OF_COMMAND);
X if (more_help)
X /* base for next level is all of current helpbuf */
X do_help();
X } else
X more_help = FALSE;
X } while(more_help);
X
X break;
X }
X case H_NOTFOUND: {
X printf("Sorry, no help for '%s'\n", helpbuf);
X break;
X }
X case H_ERROR: {
X perror(help_ptr);
X break;
X }
X default: { /* defensive programming */
X int_error("Impossible case in switch\n", NO_CARET);
X /* NOTREACHED */
X }
X }
X
X helpbuf[base] = '\0'; /* cut it off where we started */
}
X
#ifdef AMIGA_AC_5
char strg0[256];
#endif
X
do_system()
{
#ifdef AMIGA_AC_5
X char *parms[80];
X void getparms();
X
X getparms(input_line+1,parms);
X if(fexecv(parms[0],parms) < 0)
#else
X if (system(input_line + 1))
#endif
X os_error("system() failed",NO_CARET);
}
X
#ifdef AMIGA_AC_5
X
/******************************************************************************/
/* */
/* Parses the command string (for fexecv use) and converts the first token */
/* to lower case */
/* */
/******************************************************************************/
X
void getparms(command,parms)
X char *command;
X char **parms;
X {
X register int i = 0; /* A bunch of indices */
X register int j = 0;
X register int k = 0;
X
X while(*(command+j) != '\0') /* Loop on string characters */
X {
X parms[k++] = strg0+i;
X while(*(command+j) == ' ') ++j;
X while(*(command+j) != ' ' && *(command+j) != '\0')
X {
X if(*(command+j) == '"') /* Get quoted string */
X for(*(strg0+(i++)) = *(command+(j++));
X *(command+j) != '"';
X *(strg0+(i++)) = *(command+(j++)));
X *(strg0+(i++)) = *(command+(j++));
X }
X *(strg0+(i++)) = '\0'; /* NUL terminate every token */
X }
X parms[k] = '\0';
X
X for(k=strlen(strg0)-1; k>=0; --k) /* Convert to lower case */
X *(strg0+k)>='A' && *(strg0+k)<='Z'? *(strg0+k)|=32: *(strg0+k);
X }
X
#endif /* AMIGA_AC_5 */
X
#ifdef READLINE
char *
rlgets(s, n, prompt)
char *s;
int n;
char *prompt;
{
X char *readline();
X static char *line = (char *)NULL;
X
X /* If we already have a line, first free it */
X if(line != (char *)NULL)
X free(line);
X
X line = readline((interactive)?prompt:"");
X
X /* If it's not an EOF */
X if(line) {
X if (*line)
X add_history(line);
X strncpy(s, line, n);
X return s;
X }
X
X return line;
}
#endif /* READLINE */
X
#ifdef MSDOS
X
#ifdef __TURBOC__
/* cgets implemented using dos functions */
/* Maurice Castro 22/5/91 */
char *doscgets(s)
char *s;
{
X long datseg;
X
X /* protect and preserve segments - call dos to do the dirty work */
X datseg = _DS;
X
X _DX = FP_OFF(s);
X _DS = FP_SEG(s);
X _AH = 0x0A;
X geninterrupt(33);
X _DS = datseg;
X
X /* check for a carriage return and then clobber it with a null */
X if (s[s[1]+2] == '\r')
X s[s[1]+2] = 0;
X
X /* return the input string */
X return(&(s[2]));
X }
#endif /* __TURBOC__ */
X
X
read_line(prompt)
X char *prompt;
{
X register int i;
X int start = 0, ilen = 0;
X BOOLEAN more;
X int last;
X char *p, *crnt_prompt = prompt;
X
#ifndef __ZTC__
X if (interactive) { /* if interactive use console IO so CED will work */
#ifndef READLINE
X cputs(prompt);
#endif /* READLINE */
X do {
X ilen = MAX_LINE_LEN-start-1;
X input_line[start] = ilen > 126 ? 126 : ilen;
#ifdef READLINE
X input_line[start+2] = 0;
X (void) rlgets(&(input_line[start+2]), ilen, crnt_prompt );
X if (p = strchr(&(input_line[start+2]), '\r')) *p = 0;
X if (p = strchr(&(input_line[start+2]), '\n')) *p = 0;
X input_line[start+1] = strlen(&(input_line[start+2]));
#else /* READLINE */
#ifdef __TURBOC__
X (void) doscgets(&(input_line[start]));
#else /* __TURBOC__ */
X (void) cgets(&(input_line[start]));
#endif /* __TURBOC__ */
X (void) putc('\n',stderr);
#endif /* READLINE */
X if (input_line[start+2] == 26) {
X /* end-of-file */
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else {
X (void) putc('\n',stderr);
X done(IO_SUCCESS);
X /* NOTREACHED */
X }
X } else {
X /* normal line input */
X register i = start;
X while ( (input_line[i] = input_line[i+2]) != (char)NULL )
X i++; /* yuck! move everything down two characters */
X
X inline_num++;
X last = strlen(input_line) - 1;
X if (last + 1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
#ifndef READLINE
X if (more)
X cputs("> ");
#else
X crnt_prompt = "> ";
#endif /* READLINE */
X } while(more);
X }
X else { /* not interactive */
#endif /* not ZTC */
X if (interactive)
X fputs(prompt,stderr);
X do {
X /* grab some input */
X if ( fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin)
X == (char *)NULL ) {
X /* end-of-file */
X if (interactive)
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else
X done(IO_SUCCESS); /* no return */
X } else {
X /* normal line input */
X last = strlen(input_line) - 1;
X if (input_line[last] == '\n') { /* remove any newline */
X input_line[last] = '\0';
X /* Watch out that we don't backup beyond 0 (1-1-1) */
X if (last > 0) --last;
X inline_num++;
X } else if (last+1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
X if (more && interactive)
X fputs("> ", stderr);
X } while(more);
#ifndef __ZTC
X }
#endif
}
X
X
do_shell()
{
register char *comspec;
X if ((comspec = getenv("COMSPEC")) == (char *)NULL)
X comspec = "\command.com";
X if (spawnl(P_WAIT,comspec,NULL) == -1)
X os_error("unable to spawn shell",NO_CARET);
}
X
#else /* MSDOS */
X /* plain old Unix */
X
read_line(prompt)
X char *prompt;
{
X int start = 0;
X BOOLEAN more = FALSE;
X int last = 0;
X
#ifndef READLINE
X if (interactive)
X fputs(prompt,stderr);
#endif /* READLINE */
X do {
X /* grab some input */
#ifdef READLINE
X if (((interactive)
X ?rlgets(&(input_line[start]), MAX_LINE_LEN - start,
X ((more)?"> ":prompt))
X :fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin))
X == (char *)NULL ) {
#else
X if ( fgets(&(input_line[start]), MAX_LINE_LEN - start, stdin)
X == (char *)NULL ) {
#endif /* READLINE */
X /* end-of-file */
X if (interactive)
X (void) putc('\n',stderr);
X input_line[start] = '\0';
X inline_num++;
X if (start > 0) /* don't quit yet - process what we have */
X more = FALSE;
X else
X done(IO_SUCCESS); /* no return */
X } else {
X /* normal line input */
X last = strlen(input_line) - 1;
X if (input_line[last] == '\n') { /* remove any newline */
X input_line[last] = '\0';
X /* Watch out that we don't backup beyond 0 (1-1-1) */
X if (last > 0) --last;
X inline_num++;
X } else if (last+1 >= MAX_LINE_LEN)
X int_error("Input line too long",NO_CARET);
X
X if (input_line[last] == '\\') { /* line continuation */
X start = last;
X more = TRUE;
X } else
X more = FALSE;
X }
#ifndef READLINE
X if (more && interactive)
X fputs("> ", stderr);
#endif
X } while(more);
}
X
#ifdef VFORK
X
do_shell()
{
register char *shell;
register int p;
static int execstat;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
#ifdef AMIGA_AC_5
X execstat = fexecl(shell,shell,NULL);
#else
X if ((p = vfork()) == 0) {
X execstat = execl(shell,shell,NULL);
X _exit(1);
X } else if (p == -1)
X os_error("vfork failed",c_token);
X else
X while (wait(NULL) != p)
#endif
X ;
X if (execstat == -1)
X os_error("shell exec failed",c_token);
X (void) putc('\n',stderr);
}
#else /* VFORK */
X
#ifdef AMIGA_LC_5_1
do_shell()
{
register char *shell;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
X
X if (system(shell))
X os_error("system() failed",NO_CARET);
X
X (void) putc('\n',stderr);
}
#else /* AMIGA_LC_5_1 */
X
#define EXEC "exec "
do_shell()
{
static char exec[100] = EXEC;
register char *shell;
X if (!(shell = getenv("SHELL")))
X shell = SHELL;
X
X if (system(strncpy(&exec[sizeof(EXEC)-1],shell,
X sizeof(exec)-sizeof(EXEC)-1)))
X os_error("system() failed",NO_CARET);
X
X (void) putc('\n',stderr);
}
#endif /* AMIGA_LC_5_1 */
#endif /* VFORK */
#endif /* MSDOS */
#endif /* vms */
SHAR_EOF
echo 'File gnuplot/command.c is complete' &&
chmod 0644 gnuplot/command.c ||
echo 'restore of gnuplot/command.c failed'
Wc_c="`wc -c < 'gnuplot/command.c'`"
test 85435 -eq "$Wc_c" ||
echo 'gnuplot/command.c: original size 85435, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/lineproc.mac ==============
if test -f 'gnuplot/lineproc.mac' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/lineproc.mac (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/lineproc.mac (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/lineproc.mac' &&
; lineproc.mac
; MASM macro definition for Bresenham line-drawing routine
; Colin Kelley
; January 13, 1987
X
X
INCAX equ 40h ; for Self-Modifying Code
INCBX equ 43h
DECAX equ 48h
DECBX equ 4bh
X
; usage:
; lineproc linename, pixelname
;
; where linemane is the name you want for the proc, and pixelname is the
; name of the routine that linename is to call to set pixels
;
X
lineproc macro linename, pixelname
beginproc linename
X
X push bp
X mov bp,sp
X push si
X push di
X mov ax,[bp+X] ; x1
X mov bx,[bp+X+2] ; y1
X mov cx,[bp+X+4] ; x2
X mov si,[bp+X+6] ; y2
X
X cmp ax,cx ; x1,x2
X jne i19
X cmp bx,si ; y1,y2
X jne i19
X
X call pixelname
X
X jmp i28
i19:
X mov dx,ax ; dx,x1
X sub dx,cx ; x2
X jnc noabsx
X neg dx
noabsx:
X mov di,bx ; dy,y1
X sub di,si ; y2
X jnc noabsy
X neg di ; dy
noabsy:
X cmp dx,di ; dx,dy
X jb i21 ; go iterate y's
;
; iterate x's
;
X cmp bx,si ; y1,y2
X jb forwardy
X mov byte ptr cs:yinc1,DECBX
X jmp short i22
forwardy:
X mov byte ptr cs:yinc1,INCBX
i22:
X cmp ax,cx ; x1,x2
X jae l20004
X mov byte ptr cs:xinc1,INCAX
X jmp short l20005
l20004:
X mov byte ptr cs:xinc1,DECAX
l20005:
X mov bp,dx ; sum,dx
X shr bp,1 ; sum
d23:
X cmp ax,cx ; x1,x2
X je i28 ; done
xinc1: inc ax ; may become inc or dec
X add bp,di ; sum,dy
X cmp bp,dx
X jb i27
X sub bp,dx ; sum,dx
yinc1: inc bx ; may become inc or dec
i27:
X call pixelname
X jmp short d23
X
;
; else iterate y's
;
i21:
X cmp ax,cx ; x1,x2
X jae l20006
X mov byte ptr cs:xinc2,INCAX
X jmp short l20007
l20006:
X mov byte ptr cs:xinc2,DECAX
l20007:
X cmp bx,si ; y1,y2
X jb forwardy2
X mov byte ptr cs:yinc2,DECBX
X jmp short i29
forwardy2:
X mov byte ptr cs:yinc2,INCBX
i29:
X mov bp,di ; sum,dy
X shr bp,1 ; sum,1
d30:
X cmp bx,si ; y1,y2
X je i28
yinc2: inc bx ; may become inc or dec
X add bp,dx ; sum,dx
X cmp bp,di ; sum,dy
X jb i34
X sub bp,di ; sum,dy
xinc2: inc ax ; may become inc or dec
i34:
X call near ptr pixelname
X jmp short d30
;
; clean up and exit
;
i28:
X pop di
X pop si
X pop bp
X ret
X
linename endp
X endm
SHAR_EOF
chmod 0666 gnuplot/lineproc.mac ||
echo 'restore of gnuplot/lineproc.mac failed'
Wc_c="`wc -c < 'gnuplot/lineproc.mac'`"
test 1980 -eq "$Wc_c" ||
echo 'gnuplot/lineproc.mac: original size 1980, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.msc ==============
if test -f 'gnuplot/linkopt.msc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.msc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.msc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.msc' &&
pcgraph+hrcgraph+corgraph+bitmap+term+graphics+graph3d+contour+
plot+setshow+command+help+internal+misc+
parse+eval+scanner+standard+util+version
gnuplot
nul;
SHAR_EOF
chmod 0644 gnuplot/linkopt.msc ||
echo 'restore of gnuplot/linkopt.msc failed'
Wc_c="`wc -c < 'gnuplot/linkopt.msc'`"
test 159 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.msc: original size 159, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.tc ==============
if test -f 'gnuplot/makefile.tc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.tc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.tc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.tc' &&
# make file for Borland C++ 2.0/Turbo C++ 1.0/Turbo C 2.0
# uses Borland proprietry overlay manager
# Modified from the TurboC makefile by Maurice Castro
# The compile and link includes debug flags. Take them out if you
# do not want them included (-y -v -M, /m /s /v /l)
X
# where to place gnuplot.gih helpfile
HELPFILE = gnuplot.gih
# location of Turbo C compiler
# if this is changed then linkopt.tc/linkopt.tco will need to be edited.
TC = c:\tc
# name of C compiler
CC = bcc
#CC = tcc
# location of TLINK.EXE and TCC.EXE or BCC.EXE
BIN = $(TC)\bin\\
#BIN =
# location of BGI files,
# change this line if not in TC directory, i.e. $(TC)\bgi
BGI = $(TC)\bgi
# location of bgiobj.exe tool - convertion of BGI to a linkable OBJ file.
BGIOBJ = $(TC)\bgi\\
#BGIOBJ =
X
# -c means don't link, -f means emulate 8087 if not present
# -ml means use large model (large code, large data)
# -M means produce link map
# -y means include line numbers for debugger
# -v means include debug info
# -w- means ignore warnings and do not report them
# -DREADLINE to use the history/line editing capability. If you want this
# capability add -DREADLINE to CFLAGS then add 'readline' to linkopt.tc
# and to linkopt.tco in the /o section.
CFLAGS = -c -f -ml -M -y -v -w- -I$(TC)\include -DMSDOS -DPC
TERMFLAGS =
X
# With Overlay Support
#OVLY1 = -Y
#OVLY2 = -Yo
# Without Overlay Support
OVLY1 =
OVLY2 =
X
X
OBJS = bitmap.obj command.obj contour.obj eval.obj graphics.obj graph3d.obj \
X help.obj internal.obj misc.obj parse.obj plot.obj readline.obj \
X scanner.obj setshow.obj standard.obj term.obj util.obj version.obj \
X cgaf.obj egavgaf.obj hercf.obj attf.obj
X
CSOURCE5 = term\aed.trm term\cgi.trm term\dumb.trm term\dxy.trm \
X term\eepic.trm term\epson.trm term\fig.trm term\hp26.trm \
X term\hp2648.trm term\hpgl.trm term\hpljii.trm
CSOURCE6 = term\impcodes.h term\imagen.trm term\object.h \
X term\iris4d.trm term\kyo.trm term\latex.trm term\pc.trm
CSOURCE7 = term\post.trm term\qms.trm term\regis.trm term\sun.trm \
X term\t410x.trm term\tek.trm term\unixpc.trm term\unixplot.trm \
X term\v384.trm term\x11.trm
CSOURCE8 = contour.c
X
all: gnuplot.exe $(HELPFILE)
X
# use linkopt.tc/linkopt.tco to avoid command-line overflow
X
gnuplot.exe: $(OBJS)
# With Overlay Support (select one)
# $(BIN)tlink /m /s /v /l @linkopt.tco
# $(BIN)tlink @linkopt.tco
# Without Overlay Support
# $(BIN)tlink /m /s /v /l @linkopt.tc
X $(BIN)tlink @linkopt.tc
X
# default rules
X
.c.obj:
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) $<
X
# The default for files is to be compiled for overlaying if OVLY1 and
# OVLY2 are defined. plot.c and parse.c are not suitable for overlaying.
X
bitmap.obj: bitmap.c bitmap.h plot.h
X
command.obj: command.c plot.h setshow.h help.h
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) -DHELPFILE="$(HELPFILE)" command.c
X
contour.obj: contour.c plot.h
X
eval.obj: eval.c plot.h
X
graphics.obj: graphics.c plot.h setshow.h
X
graph3d.obj: graphics.c plot.h setshow.h
X
help.obj: help.c plot.h help.h
X
internal.obj: internal.c plot.h
X
misc.obj: misc.c plot.h setshow.h help.h
X
parse.obj: parse.c plot.h
X $(BIN)$(CC) $(OVLY1) $(CFLAGS) parse.c
X
plot.obj: plot.c plot.h setshow.h
X $(BIN)$(CC) $(OVLY1) $(CFLAGS) plot.c
X
readline.obj: readline.c
X
scanner.obj: scanner.c plot.h
X
setshow.obj: setshow.c plot.h setshow.h
X
standard.obj: standard.c plot.h
X
term.obj: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X $(BIN)$(CC) $(OVLY2) $(CFLAGS) $(TERMFLAGS) -Iterm term.c
X
util.obj: util.c plot.h
X
version.obj: version.c
X
# convert gnuplot.doc to gnuplot.gih
$(HELPFILE): doc2gih.exe docs\gnuplot.doc
X doc2gih docs\gnuplot.doc $(HELPFILE)
X
doc2gih.exe: docs\doc2gih.c
X $(BIN)$(CC) -I$(TC)\include -L$(TC)\lib docs\doc2gih.c
X
# convert Borland Graphics Interface files to object for linking
cgaf.obj: $(BGI)\cga.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\cga
X
egavgaf.obj: $(BGI)\egavga.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\egavga
X
hercf.obj: $(BGI)\herc.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\herc
X
attf.obj: $(BGI)\att.bgi
X $(BGIOBJ)bgiobj /F $(BGI)\att
SHAR_EOF
chmod 0644 gnuplot/makefile.tc ||
echo 'restore of gnuplot/makefile.tc failed'
Wc_c="`wc -c < 'gnuplot/makefile.tc'`"
test 4014 -eq "$Wc_c" ||
echo 'gnuplot/makefile.tc: original size 4014, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.vms ==============
if test -f 'gnuplot/linkopt.vms' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.vms (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.vms (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.vms' &&
sys$library:vaxcrtl/share
SHAR_EOF
chmod 0666 gnuplot/linkopt.vms ||
echo 'restore of gnuplot/linkopt.vms failed'
Wc_c="`wc -c < 'gnuplot/linkopt.vms'`"
test 26 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.vms: original size 26, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/README ==============
if test ! -d 'gnuplot/term'; then
echo 'x - creating directory gnuplot/term'
mkdir 'gnuplot/term'
fi
if test -f 'gnuplot/term/README' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/README (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/README' &&
DOCUMENTATION FOR GNUPLOT TERMINAL DRIVER WRITERS
By Russell Lang 1/90
X
Information on each terminal device driver is contained in term.c and
the term/*.trm files. Each driver is contained in a .trm file and is
#include'd into term.c. Each driver has a set of initialisers in
term.c for term_tbl[], an array of struct termentry.
X
Here is the definition of the struct termentry from plot.h:
X
struct termentry {
X char *name;
X char *description;
X unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
X FUNC_PTR options,init,reset,text,scale,graphics,move,vector,linetype,
X put_text,text_angle,justify_text,point,arrow;
};
X
Here's a brief description of each variable:
X
The char *name is a pointer to a string containing the name
of the terminal. This name is used by the 'set terminal' and
'show terminal' commands.
The name must be unique and must not be confused with an abbreviation
of another name. For example if the name "postscript" exists, it is not
possible to have another name "postscript2".
Keep the name under 15 characters.
X
The char *description is a pointer to a string containing a
description of the terminal, which is displayed in response
to the 'set terminal' command.
Keep the description under 60 characters.
X
xmax is the maximum number of points in the x direction.
The range of points used by gnuplot is 0 to xmax-1.
X
ymax is the maximum number of points in the y direction.
The range of points used by gnuplot is 0 to ymax-1.
X
v_char is the height of characters, in the same units as xmax and ymax.
The border for labelling at the top and bottom of the plot is
calculated using v_char.
v_char is used as the vertical line spacing for characters.
X
h_char is the width of characters, in the same units as xmax and ymax.
The border for labelling at the left and right of the plot is
calculated using h_char.
If the _justify_text function returns FALSE, h_char is used to justify
text right or centre. If characters are not fixed width, then the
_justify_text function must correctly justify the text.
X
v_tic is the vertical size of tics along the x axis,
in the same units as ymax.
X
h_tic is the horizontal size of tics along the y axis,
in the same units as xmax.
X
X
Here's a brief description of what each term.c function does:
X
_options() Called when terminal type is selected.
This procedure should parse options on the command line. A list of the
currently selected options should be stored in term_options[] in a form
suitable for use with the set term command. term_options[] is used by
the save command. Use options_null() if no options are available.
X
_init() Called once, when the device is first selected. This procedure
should set up things that only need to be set once, like handshaking and
character sets etc...
X
_reset() Called when gnuplot is exited, the output device changed or
the terminal type changed. This procedure should reset the device,
possibly flushing a buffer somewhere or generating a form feed.
X
_scale(xs,ys) Called just before _graphics(). This takes the x and y
scaling factors as information. If the terminal would like to do its
own scaling, it returns TRUE. Otherwise, it can ignore the information
and return FALSE: do_plot will do the scaling for you. null_scale is
provided to do just this, so most drivers can ignore this function
entirely. The Latex driver is currently the only one providing its own
scaling.
X
_graphics() Called just before a plot is going to be displayed. This
procedure should set the device into graphics mode. Devices which can't
be used as terminals (like plotters) will probably be in graphics mode
always and therefore won't need this.
X
_text() Called immediately after a plot is displayed. This procedure
should set the device back into text mode if it is also a terminal, so
that commands can be seen as they're typed. Again, this will probably
do nothing if the device can't be used as a terminal.
X
_move(x,y) Called at the start of a line. The cursor should move to the
(x,y) position without drawing.
X
_vector(x,y) Called when a line is to be drawn. This should display a line
from the last (x,y) position given by _move() or _vector() to this new (x,y)
position.
X
_linetype(lt) Called to set the line type before text is displayed or
line(s) plotted. This procedure should select a pen color or line
style if the device has these capabilities.
lt is an integer from -2 to 0 or greater.
An lt of -2 is used for the border of the plot.
An lt of -1 is used for the X and Y axes.
lt 0 and upwards are used for plots 0 and upwards.
If _linetype() is called with lt greater than the available line types,
it should map it to one of the available line types.
Most drivers provide 9 different linetypes (lt is 0 to 8).
X
_put_text(x,y,str) Called to display text at the (x,y) position,
while in graphics mode. The text should be vertically (with respect
to the text) justified about (x,y). The text is rotated according
to _text_angle and then horizontally (with respect to the text)
justified according to _justify_text.
X
_text_angle(ang) Called to rotate the text angle when placing the y label.
If ang = 0 then text is horizontal. If ang = 1 then text is vertically
upwards. Returns TRUE if text can be rotated, FALSE otherwise.
X
_justify_text(mode) Called to justify text left, right or centre.
If mode = LEFT then text placed by _put_text is flushed left against (x,y).
If mode = CENTRE then centre of text is at (x,y).
If mode = RIGHT then text is placed flushed right against (x,y).
Returns TRUE if text can be justified
Returns FALSE otherwise and then _put_text assumes text is flushed left;
justification of text is then performed by calculating the text width
using strlen(text) * h_char.
X
_point(x,y,point) Called to place a point at position (x,y).
point is -1 or an integer from 0 upwards.
6 point types (numbered 0 to 5) are normally provided.
Point type -1 is a dot.
If point is more than the available point types then it should
be mapped back to one of the available points.
Two _point() functions called do_point() and line_and_point() are
provided in term.c and should be suitable for most drivers.
do_point() draws the points in the current line type.
If your driver uses dotted line types (generally because it is
monochrome), you should use line_and_point() which changes to
line type 0 before drawing the point. line type 0 should be solid.
X
_arrow(sx,sy,ex,ey,head) Called to draw an arrrow from (sx,sy) to (ex,ey).
A head is drawn on the arrow if head = TRUE.
An _arrow() function called do_arrow() is provided in term.c which will
draw arrows using the _move() and _vector() functions.
Drivers should use do_arrow unless it causes problems.
X
The following should illustrate the order in which calls to these
routines are made:
X
X _init()
X _scale(xs,ys)
X _graphics()
X _linetype(lt)
X _move(x,y)
X _vector(x,y)
X _point(x,y,point)
X _text_angle(angle)
X _justify(mode)
X _put_text(x,y,text)
X _arrow(sx,sy,ex,ey)
X _text()
X _graphics()
X .
X .
X _text()
X _reset()
X
X
SHAR_EOF
chmod 0644 gnuplot/term/README ||
echo 'restore of gnuplot/term/README failed'
Wc_c="`wc -c < 'gnuplot/term/README'`"
test 7115 -eq "$Wc_c" ||
echo 'gnuplot/term/README: original size 7115, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/aed.trm ==============
if test -f 'gnuplot/term/aed.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/aed.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/aed.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/aed.trm' &&
/* GNUPLOT - aed.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 * AED terminals
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#define AED_XMAX 768
#define AED_YMAX 575
X
#define AED_XLAST (AED_XMAX - 1)
#define AED_YLAST (AED_YMAX - 1)
X
#define AED_VCHAR 13
#define AED_HCHAR 8
#define AED_VTIC 8
#define AED_HTIC 7
X
/* slightly different for AED 512 */
#define AED5_XMAX 512
#define AED5_XLAST (AED5_XMAX - 1)
X
AED_init()
{
X fprintf(outfile,
X "\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD");
/* 2 3 4 5 7 6 1
X 1. Clear Screen
X 2. Set Encoding
X 3. Set Default Color
X 4. Set Backround Color Table Entry
X 5. Set Backround Color
X 6. Move to Bottom Lefthand Corner
X 7. Anti-Alias Vectors
*/
}
X
X
AED_graphics()
{
X fprintf(outfile,"\033FFD\033");
}
X
X
AED_text()
{
X fprintf(outfile,"\033MOV.0.9.SEC.7.XXX");
}
X
X
X
AED_linetype(linetype)
int linetype;
{
static int color[2+9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
static int type[2+9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };
X
X if (linetype >= 10)
X linetype %= 10;
X fprintf(outfile,"\033SLS%d.255.",type[linetype+2]);
X fprintf(outfile,"\033SEC%d.",color[linetype+2]);
}
X
X
X
AED_move(x,y)
int x,y;
{
X fprintf(outfile,"\033MOV%d.%d.",x,y);
}
X
X
AED_vector(x,y)
int x,y;
{
X fprintf(outfile,"\033DVA%d.%d.",x,y);
}
X
X
AED_put_text(x,y,str)
int x,y;
char str[];
{
X AED_move(x,y - AED_VCHAR/2 + 2);
X fprintf(outfile,"\033XXX%s\033",str);
}
X
X
#define hxt (AED_HTIC/2)
#define hyt (AED_VTIC/2)
X
AED_reset()
{
X fprintf(outfile,"\033SCT0.1.0.0.0.SBC.0.FFD");
}
X
SHAR_EOF
chmod 0666 gnuplot/term/aed.trm ||
echo 'restore of gnuplot/term/aed.trm failed'
Wc_c="`wc -c < 'gnuplot/term/aed.trm'`"
test 2311 -eq "$Wc_c" ||
echo 'gnuplot/term/aed.trm: original size 2311, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/bigfig.trm ==============
if test -f 'gnuplot/term/bigfig.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/bigfig.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/bigfig.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/bigfig.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-g...@sun.com).
X *
X */
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 by Ian Dall
X * Increased size of plot by Ian Dall
X */
X
#define BFIG_HTIC (7*FIG_RES/80)
#define BFIG_VTIC (7*FIG_RES/80)
#define BFIG_HCHAR (9*FIG_RES/80)
#define BFIG_FONT_S (16)
#define BFIG_VCHAR ((BFIG_FONT_S)*FIG_RES/80) /* height in pixels of font
X */
X
#define BFIG_ARROW_WIDTH BFIG_HTIC
#define BFIG_ARROW_HEIGHT BFIG_HTIC
X
X
X
/* 7 inches wide by 5 inches high */
#define BFIG_XMAX (8 * FIG_RES)
#define BFIG_YMAX (5 * FIG_RES)
X
#define BFIG_XOFF (FIG_RES/2)
#define BFIG_YOFF (FIG_RES/2)
X
X
BFIG_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 BFIG_XOFF + FIG_posx, BFIG_YMAX + BFIG_YOFF - FIG_posy);
X FIG_poly_vec_cnt = 1;
X FIG_polyvec_stat = FIG_poly_part;
X }
X fprintf(outfile, " %d %d",
X BFIG_XOFF + x, BFIG_YMAX + BFIG_YOFF-y);
SHAR_EOF
true || echo 'restore of gnuplot/term/bigfig.trm failed'
fi
echo 'End of part 14'
echo 'File gnuplot/term/bigfig.trm is continued in part 15'
echo 15 > _shar_seq_.tmp
#!/bin/sh
# this is Part.10 (part 10 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/docs/gnuplot.doc continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 10; 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/docs/gnuplot.doc'
else
echo 'x - continuing file gnuplot/docs/gnuplot.doc'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/gnuplot.doc' &&
?nozeroaxis
X `set zeroaxis` draws the x-axis and y-axis. By default, this option is
X on. `set nozeroaxis` causes GNUPLOT to omit the axes, and is
X equivalent to `set noxzeroaxis; set noyzeroaxis.`
X
X Syntax:
X set zeroaxis
X set nozeroaxis
X show zeroaxis
X See `set xzeroaxis` and `set yzeroaxis`.
3 zlabel
?set zlabel
?show zlabel
?zlabel
X The `set zlabel` command sets the z-axis label that is centered along
X the z axis. Using the optional x,y screen offsets, the label can be
X placed anywhere on the plot. `set zlabel` with no parameters clears
X the label.
X
X Syntax:
X set zlabel {"<label>"} {<xoff>}{,<yoff>}
X show zlabel
X
X Specifying constants <xoff> or <yoff> as optional offsets for the
X label will move the label <xoff> or <yoff> character screen
X coordinates. For example,
X
X set zlabel ,1
X
X will change only the y offset of the zlabel, moving the label roughly
X one character height up.
X
X The zlabel will be drawn whenever surfaces or contours are plotted,
X in the space above the grid level.
X
X (The LaTeX, EEPIC, and Imagen drivers allow \\ in a string to specify
X a newline.)
3 zrange
?set zrange
?show zrange
?zrange
X The `set zrange` command sets the vertical range that will be
X displayed. This command turns z axis autoscaling off. The zrange is
X used only by `splot` and is ignored by `plot`.
X
X This range may also be specified on the `splot` command line.
X
X Syntax:
X set zrange [{<zmin> : <zmax>}]
X
X where <zmin> and <zmax> terms are constants or expressions.
X
X Both the <zmin> and <zmax> terms are optional. Anything omitted will
X not be changed, so
X set zrange [2:]
X changes zmin to 2 without affecting zmax.
3 ztics
?set ztics
?set noztics
?show ztics
?ztics
?noztics
X The `set ztics` and `set noztics` commands are similar to the `set
X xtics` and `set noxtics` commands. Please see `set xtics`.
2 shell
?shell
X The `shell` command spawns an interactive shell. To return to
X GNUPLOT, type `logout` if using VMS, `exit` or the END-OF-FILE
X character if using Unix, `endcli` if using AmigaDOS, or `exit` if
X using MS-DOS.
X
X A single shell command may be spawned by preceding it with the !
X character ($ if using VMS) at the beginning of a command line.
X Control will return immediately to GNUPLOT after this command is
X executed. For example, in VMS, AmigaDOS, or MS-DOS,
X
X ! dir
X
X prints a directory listing and then returns to GNUPLOT.
2 splot
X Three-dimensional surface and contour plotting is available in
X GNUPLOT with the `splot` command. See the `plot` command for features
X common to the `plot` command.
X
X See also `set contour`, `set cntrparam`, and `set surface`.
2 start-up
?startup
?start
?.gnuplot
X When GNUPLOT is run, it looks for an initialization file to load.
X This file is called `.gnuplot` on Unix and AmigaDOS systems, and
X `GNUPLOT.INI` on other systems. If this file is not found in the
X current directory, the program will look for it in the home directory
X (under AmigaDOS and MS-DOS, the environment variable GNUPLOT should
X contain the name of this directory).
X
X If this file is found, GNUPLOT executes the commands in this file.
X This is most useful for setting the terminal type and defining any
X functions or variables that are used often.
2 substitution
?substitution
X Command-line substitution is specified by a system command enclosed in
X backquotes. This command is spawned and the output it produces
X replaces the name of the command (and backquotes) on the command line.
X
X Newlines in the output produced by the spawned command are replaced
X with blanks.
X
X Command-line substitution can be used anywhere on the GNUPLOT command
X line.
X
X Example:
X
X This will run the program `leastsq` and replace `leastsq` (including
X backquotes) on the command line with its output:
X
X f(x) = `leastsq`
X
X or, in VMS
X
X f(x) = `run leastsq`
2 user-defined
?userdefined
?variables
X New user-defined variables and functions of one or two variables may be
X declared and used anywhere.
X
X User-defined function syntax:
X <function-name> ( <dummy-var1> {,<dummy-var2>} ) = <expression>
X
X where <expression> is defined in terms of <dummy-var1> and <dummy-var2>.
X
X User-defined variable syntax:
X <variable-name> = <constant-expression>
X
X Examples:
X w = 2
X q = floor(tan(pi/2 - 0.1))
X f(x) = sin(w*x)
X sinc(x) = sin(pi*x)/(pi*x)
X delta(t) = (t == 0)
X ramp(t) = (t > 0) ? t : 0
X min(a,b) = (a < b) ? a : b
X comb(n,k) = n!/(k!*(n-k)!)
X
X Note that the variable `pi` is already defined.
X
X See `show functions` and `show variables`.
2 bugs
?bugs
X The atan() function does not work correctly for complex arguments.
X
X The bessel functions do not work for complex arguments.
X
X The gamma function does not work for complex arguments.
X
X There is a bug in the stdio library for old Sun operating systems
X (SunOS Sys4-3.2). The "%g" format for 'printf' sometimes incorrectly
X prints numbers (e.g., 200000.0 as "2"). Thus, tic mark labels may be
X incorrect on a Sun4 version of GNUPLOT. A work-around is to rescale
X the data or use the `set format` command to change the tic mark format
X to "%7.0f" or some other appropriate format. This appears to have been
X fixed in SunOS 4.0.
X
X Another bug: On a Sun3 under SunOS 4.0, and on Sun4's under Sys4-3.2
X and SunOS 4.0, the 'sscanf' routine incorrectly parses "00 12" with
X the format "%f %f" and reads 0 and 0 instead of 0 and 12. This
X affects data input. If the data file contains x coordinates that are
X zero but are specified like '00', '000', etc, then you will read the
X wrong y values. Check any data files or upgrade the SunOS.
X It appears to have been fixed in SunOS 4.1.1.
X
X Microsoft C 5.1 has a nasty bug associated with the %g format for
X printf. When any of the formats "%.2g", "%.1g", "%.0g", "%.g" are
X used, printf will incorrectly print numbers in the range 1e-4 to 1e-1.
X Numbers that should be printed in the %e format are incorrectly
X printed in the %f format, with the wrong number of zeros after the
X decimal point.
X
X To work around this problem, use the %e or %f formats explicitly.
X
X GNUPLOT, when compiled with Microsoft C, did not work correctly on two
X VGA displays that were tested. The CGA, EGA and VGA drivers should
X probably be rewritten to use the Microsoft C graphics library.
X GNUPLOT compiled with Turbo C uses the Turbo C graphics drivers and
X does work correctly with VGA displays.
X
X VAX/VMS 4.7 C compiler release 2.4 also has a poorly implemented %g
X format for printf. The numbers are printed numerically correct, but
X may not be in the requested format. The K&R second edition says that
X for the %g format, %e is used if the exponent is less than -4 or greater
X than or equal to the precision. The VAX uses %e format if the exponent
X is less than -1. The VAX appears to take no notice of the precision
X when deciding whether to use %e or %f for numbers less than 1.
X To work around this problem, use the %e or %f formats explicitly.
X From the VAX C 2.4 release notes:
X e,E,f,F,g,G Result will always contain a decimal point.
X For g and G, trailing zeros will not be removed from the result.
X
X VAX/VMS 5.2 C compiler release 3.0 has a slightly better implemented
X %g format than release 2.4, but not much. Trailing decimal points are
X now removed, but trailing zeros are still not removed from %g numbers
X in exponential format.
X
X ULTRIX X11R3 has a bug that causes the X11 driver to display "every
X other" plot. The bug seems to be fixed in DEC's release of X11R4 so
X newer releases of ULTRIX don't seem to have the problem. Solutions for
X older sites include upgrading the X11 libraries (from DEC or direct from
X MIT) or defining ULTRIX_KLUDGE when compiling the x11.trm file. Note
X that the kludge is not an ideal fix, however.
X
X The constant HUGE was incorrectly defined in the NeXT OS 2.0 operating
X system. HUGE should be set to 1e38 in plot.h. This error has been
X corrected in the 2.1 version of NeXT OS.
X
X Please report any bugs to pixar!bug-g...@sun.com or
X pixar!bug-g...@ucbvax.berkeley.edu.
SHAR_EOF
echo 'File gnuplot/docs/gnuplot.doc is complete' &&
chmod 0644 gnuplot/docs/gnuplot.doc ||
echo 'restore of gnuplot/docs/gnuplot.doc failed'
Wc_c="`wc -c < 'gnuplot/docs/gnuplot.doc'`"
test 90586 -eq "$Wc_c" ||
echo 'gnuplot/docs/gnuplot.doc: original size 90586, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/lasergnu.1 ==============
if test -f 'gnuplot/docs/lasergnu.1' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/lasergnu.1 (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/lasergnu.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/lasergnu.1' &&
.TH LASERGNU l
.SH NAME
lasergnu \- send gnuplot output to a printer
.SH SYNOPSIS
.B lasergnu
[ flags ] plot-command...
.SH DESCRIPTION
.I lasergnu
runs
.IR gnuplot (1)
in an environment to produce typeset output on an IMAGEN or
Postscript printer.
.PP
The
.B gnuplot
commands
.B plot-command
are performed and the output sent to the printer.
If the
.B -f
option specifies a file for input, the plot command is optional.
The command-line plot commands are executed prior to any in the
file(s).
.PP
For example, to plot the function
.I sin(x)
from -1 to +1, and to use printer im1, use the command
.br
.nf
X lasergnu -Pim1 'plot [-1:1] sin(x) with lines'
.fi
To execute the gnuplot command file
.I myplot,
on the postscript printer lw0, use the command
.br
.nf
X lasergnu -Plw0 -p -f myplot
.fi
The following switches are recognized:
.TP
.BI \-p
Use the postscript language to make the plot, instead of Impress.
This is for use on Postscript printers only. This uses a double-size
plot in landscape mode as the default.
.TP
.BI \-P\0 printer
The output of this program is intended for
.I printer.
\ If the file is being spooled, this determines the printer it is spooled
to (default: $LASER).
Be sure to use the -p flag if the printer is a postscript printer.
.TP
.BI \-f\0 file
Take gnuplot commands from the named file.
Multiple files may be supplied with separate -f options.
.TP
.BI \-t\0 title
Specify the title of the plot.
.TP
.BI \-b
Do not print a banner page.
.TP
.BI \-J
Do not print a banner page.
.TP
.B \-help
Prints a list of options.
.SH SEE ALSO
gnuplot(l), lpr(1)
SHAR_EOF
chmod 0644 gnuplot/docs/lasergnu.1 ||
echo 'restore of gnuplot/docs/lasergnu.1 failed'
Wc_c="`wc -c < 'gnuplot/docs/lasergnu.1'`"
test 1594 -eq "$Wc_c" ||
echo 'gnuplot/docs/lasergnu.1: original size 1594, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/Makefile ==============
if test ! -d 'gnuplot/docs/latextut'; then
echo 'x - creating directory gnuplot/docs/latextut'
mkdir 'gnuplot/docs/latextut'
fi
if test -f 'gnuplot/docs/latextut/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/Makefile (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/Makefile' &&
# Makefile for gnuplot LaTeX tutorial
# To make the manual from scratch, we run latex two times
all: tutorial.dvi done
X
done:
X latex tutorial
X echo > done
X
# To touch it up after changes:
remake: tutorial.dvi
X
# Always runs latex, e.g., to get labels right
force:
X latex tutorial
X
tutorial.dvi: eg1.tex eg2.tex eg3.tex eg4.tex eg5.tex eg6.tex linepoint.tex \
X tutorial.tex header.tex
X latex tutorial
X rm -f done
X
.SUFFIXES: .tex .plt
X
.plt.tex:
X gnuplot $<
X
clean:
X rm -f *~ *.log eg?.tex linepoint.tex
X
spotless:
X rm -f *~ *.log *.aux *.dvi eg?.tex linepoint.tex done
SHAR_EOF
chmod 0644 gnuplot/docs/latextut/Makefile ||
echo 'restore of gnuplot/docs/latextut/Makefile failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/Makefile'`"
test 570 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/Makefile: original size 570, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg1.plt ==============
if test -f 'gnuplot/docs/latextut/eg1.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg1.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg1.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg1.plt' &&
set terminal latex
set output "eg1.tex"
plot [-3.14:3.14] sin(x)
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg1.plt ||
echo 'restore of gnuplot/docs/latextut/eg1.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg1.plt'`"
test 65 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg1.plt: original size 65, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg2.plt ==============
if test -f 'gnuplot/docs/latextut/eg2.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg2.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg2.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg2.plt' &&
set terminal latex
set output "eg2.tex"
set size 5/5., 4/3.
set format xy "$%g$"
set title "This is a plot of $y=sin(x)$"
set xlabel "This is the $x$ axis"
set ylabel "This is\\the\\$y$ axis"
plot [0:6.28] [0:1] sin(x)
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg2.plt ||
echo 'restore of gnuplot/docs/latextut/eg2.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg2.plt'`"
test 219 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg2.plt: original size 219, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg3.dat ==============
if test -f 'gnuplot/docs/latextut/eg3.dat' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg3.dat (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg3.dat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg3.dat' &&
chmod 0666 gnuplot/docs/latextut/eg3.dat ||
echo 'restore of gnuplot/docs/latextut/eg3.dat failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg3.dat'`"
test 781 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg3.dat: original size 781, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg3.plt ==============
if test -f 'gnuplot/docs/latextut/eg3.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg3.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg3.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg3.plt' &&
set terminal latex
set output "eg3.tex"
set format xy "$%g$"
set title "This is another plot"
set xlabel "$x$ axis"
set ylabel "$y$ axis"
set key 15,-10
plot x with lines, "eg3.dat" with linespoints
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg3.plt ||
echo 'restore of gnuplot/docs/latextut/eg3.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg3.plt'`"
test 199 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg3.plt: original size 199, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg4.plt ==============
if test -f 'gnuplot/docs/latextut/eg4.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg4.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg4.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg4.plt' &&
set terminal latex
set output "eg4.tex"
set format y "$%g$"
set format x "$%.2f$"
set title "This is $\sin(x)$"
set xlabel "This is the $x$ axis"
set ylabel "$\sin(x)$"
set nokey
set xtics -pi, pi/4
plot [-pi:pi] [-1:1] sin(x)
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg4.plt ||
echo 'restore of gnuplot/docs/latextut/eg4.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg4.plt'`"
test 227 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg4.plt: original size 227, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg5.plt ==============
if test -f 'gnuplot/docs/latextut/eg5.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg5.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg5.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg5.plt' &&
set terminal latex
set output "eg5.tex"
set format y "$%g$"
set format x "$%4.1f\pi$"
set noclip points
set title "This is $\sin(x)$"
set xlabel "This is the $x$ axis"
set ylabel "$\sin(x)$"
set nokey
set xtics ("$-\pi$" -pi,\
X "$-\frac{\pi}{2}$" -pi/2,\
X "0" 0,\
X "$\frac{\pi}{2}$" pi/2,\
X "$\pi$" pi)
plot [-pi:pi] [-1:1] sin(x)
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg5.plt ||
echo 'restore of gnuplot/docs/latextut/eg5.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg5.plt'`"
test 331 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg5.plt: original size 331, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/eg6.plt ==============
if test -f 'gnuplot/docs/latextut/eg6.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/eg6.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/eg6.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg6.plt' &&
set terminal latex
set output "eg6.tex"
set size 3.5/5, 3/3.
set format y "$%g$"
set format x "$%5.1f\mu$"
set title "This is a title"
set xlabel "This is the $x$ axis"
set ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
set label "Data" at -5,-5 right
set arrow from -5,-5 to -3.3,-6.7
set key -4,8
set xtic -10,5,10
plot [-10:10] [-10:10] "eg3.dat" title "Data File" with linespoints 1 7,\
X 3*exp(-x*x)+1 title "$3e^{-x^{2}}+1$" with lines 4
SHAR_EOF
chmod 0666 gnuplot/docs/latextut/eg6.plt ||
echo 'restore of gnuplot/docs/latextut/eg6.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/eg6.plt'`"
test 457 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/eg6.plt: original size 457, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/header.tex ==============
if test -f 'gnuplot/docs/latextut/header.tex' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/header.tex (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/header.tex (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/header.tex' &&
%
% Header file for tutorial.tex
%
X
% Spacing
\newcommand{\singlespace}
X {\addtolength{\baselineskip}{-.333\baselineskip}}
\newcommand{\doublespace}
X {\addtolength{\baselineskip}{.5\baselineskip}}
X
% Spacing for the whole document
\newcommand{\currentspace}{} % use this for single space
% \newcommand{\currentspace}{\doubleespace} % use this for double space
X
% Common abbreviations
% (Remember to put '\ ' after if an interword space is
% desired rather than end-of-sentence space. Same for '.etc)' ).
\newcommand{\eg}{{\em e.g.}} % e.g.
\newcommand{\ie}{{\em i.e.}} % i.e.
\newcommand{\etc}{{\em etc.}} % etc.
\newcommand{\vs}{{\em vs.}} % vs.
\newcommand{\usec}{{$\mu$}sec} % microseconds
X
% \boxfigure{pos}{wid}{text}: A figure with a box around it
%
% pos the usual figure placement arg: eg. htbp
% wid the width of the figure, in some units: eg. 5in
% text the contents of the figure, including picture/caption/label/etc
%
\newlength{\boxwidth}
\newcommand{\boxfigure}[3]{
X \begin{figure}[#1]
X \setlength{\boxwidth}{#2}
X \addtolength{\boxwidth}{.1in}
X
X \centering
X \framebox[\boxwidth]{
X \begin{minipage}{#2}
X #3
X \end{minipage}
X }
X \end{figure}
}
X
% use \fullboxwidth for arg 2 of boxfigure to get box of size \textwidth
X
% To show a syntax for a gnutex command
\newenvironment{syntax}{\begin{quote}\tt}{\end{quote}}
X
\documentstyle[titlepage,11pt]{article}
X
% Margins
\sloppy
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}
\setlength{\topmargin}{-0.5in}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
X
% see above
\newlength{\fullboxwidth}
\setlength{\fullboxwidth}{\textwidth}
\addtolength{\fullboxwidth}{-0.1in}
X
SHAR_EOF
chmod 0644 gnuplot/docs/latextut/header.tex ||
echo 'restore of gnuplot/docs/latextut/header.tex failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/header.tex'`"
test 1677 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/header.tex: original size 1677, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/tutorial.tex ==============
if test -f 'gnuplot/docs/latextut/tutorial.tex' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/tutorial.tex (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/tutorial.tex (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/tutorial.tex' &&
%
% Tutorial for GNUPLOT plotting program, for LaTeX users
% David Kotz (David...@Dartmouth.edu)
% Duke University Computer Science Department
%
% NOTE: If LaTeX runs out of memory processing plots,
% add ``with lines 4'' to each curve in eg*.plt and rerun make.
%
X
% some header info
\input{header}
X
\begin{document}
X
\title{\LaTeX\ and the GNUPLOT Plotting
Program\thanks{This document describes GNUPLOT version 3.0. All plots
in this document were made with that version of GNUPLOT.} }
\author{David Kotz \\ \verb+Da...@Dartmouth.edu+}
\date{July 3, 1991}
X
\maketitle
X
\pagestyle{myheadings}
\markright{GNUPLOT \LaTeX\ Tutorial Version 3.0}
X
\currentspace % defined in header.tex
X
\section{Introduction and History}
X
GNUPLOT was originally developed by Colin Kelley and Thomas Williams
in 1986 to plot functions and data files on a variety of terminals.
In 1988 and 1989 I created an alternate version, known as Gnu\TeX,
that supported a new ``terminal type'' called {\tt latex}, so gnuplot
would output \LaTeX\ code. The plot could then be included in a
\LaTeX\ document. I added a number of embellishments, supported only
by the {\tt latex} terminal, allowing the user to produce
publication-quality plots.
X
In late 1989 and early 1990 Gnu\TeX\ and a number of other GNUPLOT
variants were merged together into a new release of GNUPLOT, 2.0. This
includes, among many other improvements, a \LaTeX\ driver derived from
the one in Gnu\TeX. Former Gnu\TeX\ users are referred to
Section~\ref{oldusers} for information about adapting to GNUPLOT.
Anyone interested in using GNUPLOT with \LaTeX\ should read the next
section, a tutorial, and the primary GNUPLOT manual.
X
The reader should note that the \LaTeX\ picture environments output by
GNUPLOT can be quite large and complicated, and can easily exceed the
memory capacity of \TeX. If an enlarged version of \TeX\ is available,
it is wise to use it. Otherwise, keep your plots simple and add
\verb+\clearpage+ to your document where necessary.
X
There is also a new EEPIC driver ({\tt eepic}), intended for use with
the EEPIC macro package for \LaTeX. EEPIC allows for much more
efficient line-drawing, runs through \LaTeX\ faster, and uses less
memory. See Section~\ref{s:eepic} for more information.
X
There is a small package of auxiliary files (makefiles and scripts)
that I find useful for making \LaTeX\ plots with GNUPLOT. This is
available for \verb+ftp+ as \verb+pub/gnuplot-latex.shar+ from
\verb+cs.duke.edu+. I can mail copies (see the end of this paper for
information).
X
\section{Using GNUPLOT for \LaTeX: a Tutorial}
X
GNUPLOT is by nature an interactive program. Users making plots for
\LaTeX\ will generally not use GNUPLOT interactively. Whenever hard
copy is desired from GNUPLOT, the program need not be run on a
graphics terminal. In this case the output is directed to a file or
pipe, then sent to the appropriate output device. For example, output
from the terminal type {\tt unixplot} may be sent to a program
interpreting the Unix plotting standard. The terminal types {\tt
imagen} and {\tt postscript} may be used for output to printers
understanding those languages. (A shell script ({\tt lasergnu}) is
supplied with the distribution that will accept a GNUPLOT command or
input file and send the output to an Imagen or Postscript laser
printer. This script may have been adapted to your site.) The terminal
type {\tt fig} outputs FIG code that can be read by the Fig graphics
program and translated into forms usable in both \TeX\ and
\LaTeX\ documents.
X
We now ignore the interactive nature of GNUPLOT and provide the input
to GNUPLOT from a file, \ie,
\begin{verbatim}
X gnuplot gnu.input
\end{verbatim}
In this example, all of the commands to GNUPLOT are contained in the
file {\tt gnu.input}. Multiple filenames may be supplied to GNUPLOT
this way, read in the order they are given. The output (one or more
plots) may be piped to another program or redirected to a file.
Usually, however, we direct the output explicitly with an instruction
to GNUPLOT (the {\tt set output} command). GNUPLOT continues to print
error messages to the terminal (stderr).
X
\paragraph{Example 1:} Here is a first example, producing a plot for
this document. The GNUPLOT input file is given below, and the output
appears as Figure~\ref{eg1}. The input file defines the output to be
in \LaTeX, gives a file name for the output, and plots $y=sin(x)$ for
$x$ on $[-\pi,\pi]$. To produce the figure, I simply
\verb+\input{eg1}+ in a {\tt center} environment in a {\tt figure}
environment. In following examples, I will enclose the figure in a box
to make it look a little better.
X
\singlespace
\begin{verbatim}
X set terminal latex
X set output "eg1.tex"
X plot [-3.14:3.14] sin(x)
\end{verbatim}
\currentspace
X
\begin{figure}[htbp]
X \begin{center}
X \input{eg1}
X \end{center}
X \caption{A first example: $y=sin(x)$}
X \label{eg1}
\end{figure}
X
Note that GNUPLOT has drawn in the axes, labeled the tic marks for us,
scaled the $y$ axis automatically, and added a key in the
upper-right-hand corner (this may be moved with the {\tt set key}
command, and removed with {\tt set nokey}).
X
This is the default line style for the \LaTeX\ driver. Because of the
limited picture capabilities of \LaTeX, many dots are required to
approximate drawing a solid line. This may overload the memory of many
\TeX\ implementations. There are other line types available that draw
dotted lines and use much less memory. The EEPIC driver draws solid
lines with much less memory usage.
X
\paragraph{Example 2:} Now we will embellish the plot a little with
some labels. This input file produces Figure~\ref{eg2}.
X
\singlespace
\begin{verbatim}
X set terminal latex
X set output "eg2.tex"
X set size 5/5., 4/3.
X set format xy "$%g$"
X set title "This is a plot of $y=sin(x)$"
X set xlabel "This is the $x$ axis"
X set ylabel "This is\\the\\$y$ axis"
X plot [0:6.28] [0:1] sin(x)
\end{verbatim}
\currentspace
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{eg2}
X \end{center}
X \caption{A more fancy example.}
X \label{eg2}
}
X
We have specified the plot to be 5 inches wide and 4 inches tall with
the {\tt set size} command. This is the size of the area used by the
plot, {\em including} space for the labels. In the first example,
this size was the default 5 inches by 3 inches. By specifying the
scaling factors of 1 (or 5/5) and 1.3333 (or 4/3), we obtain the
desired plot size.
X
We have requested that the format used by the $x$- and $y$-axis tic
mark labels be in \LaTeX\ math mode. This makes the labels look a
little better. The default is \verb+set format xy "%g"+. The \verb+%g+
represents the general-purpose floating point formatting specification
for the {\tt printf} function in C. Any valid floating-point
formatting specification, or \LaTeX\ command, is allowed in the
format.
X
A title for the plot and labels for the axes were set up in the next
three commands. Note that they are processed by \LaTeX\ and so may
have math mode and other symbols in them. The ylabel may have multiple
lines, delineated with \verb+\\+. The ylabel can be moved around with
optional offset parameters (see {\tt set ylabel} in the GNUPLOT
manual). Typically, the ylabel needs to be moved to the left to avoid
interfering with the left-hand side of the plot. Once these labels
are set up, they will be used for all subsequent plot commands until
they are changed. These labels are also supported by the other
terminal types, but (of course) any \LaTeX\ code in the string will
not be interpreted. We have also defined the range of both $x$ (now
$[0,2\pi]$) and $y$ (here $[0,1]$).
X
So far we have plotted one curve, $y=\sin(x)$, on one plot. In
GNUPLOT, each {\tt plot} command generates a new plot. If the output
is to a screen, the screen is cleared. If to a printer, a new page is
produced. In the {\tt latex} case, a new picture is started. It is not
likely that \LaTeX\ users will want this to happen, so generally each
plot has its own input file and is kept in a separate output ({\tt
.tex}) file for inclusion at different places in the document.
X
\paragraph{Example 3:} To place more than one curve on a plot, use one
{\tt plot} statement and separate the description of each curve by a
comma. In our next example, we will plot both a function and a data
file on the same plot. This plot is shown in Figure~\ref{eg3}.
X
\singlespace
\begin{verbatim}
X set terminal latex
X set output "eg3.tex"
X set format xy "$%g$"
X set title "This is another plot"
X set xlabel "$x$ axis"
X set ylabel "$y$ axis"
X set key 15,-10
X plot x with lines, "eg3.dat" with linespoints
\end{verbatim}
\currentspace
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{eg3}
X \end{center}
X \caption{An example with two curves on the same plot.}
X \label{eg3}
}
X
Here you will see that the $x$ range was not specified. The $x$ range
is determined automatically, unless specified by the user. In
this case, it is defined by the range of the data file
\verb+"eg3.dat"+. The function is plotted over the same range. If no
data files or $x$ range are supplied, the default range of $[-10:10]$
is used. We have also moved the key to a different position. The
function $y=x$ is plotted ``with lines'', which is the default plot
style for functions, and is shown here to illustrate the plot style
option. The data file {\tt eg3.dat} is plotted with style {\tt
linespoints}, a style like {\tt lines} that also plots a symbol at
each data point.
X
There is a style called {\tt points} that only plots the symbols at
data points, and another called {\tt dots} that plots a tiny dot for
each data point. The {\tt points} and {\tt linespoints} styles
produce a different point symbol for each curve on the plot (for up to
twelve symbols, after which they are re-used; see
Figure~\ref{linepoint} for a complete list). The {\tt lines} and {\tt
linespoints} styles use a different line style for each curve on the
plot (in this example the dots have different spacing). The
style {\tt impulses} draws a perpendicular from each point to the
$x$-axis. Finally, the {\tt errorbars} style can draw error bars at
each data point (see the GNUPLOT manual).
X
\paragraph{Example 4:} In the above plots of $\sin(x)$, it would make
more sense to label the axis in units of $\pi$. The position and
labels of the tic labels may be specified by the user, with the {\tt
set xtics} and {\tt set ytics} commands. This is demonstrated by
the following example, shown in Figure~\ref{eg4}.
X
\singlespace
\begin{verbatim}
X set terminal latex
X set output "eg4.tex"
X set format y "$%g$"
X set format x "$%.2f$"
X set title "This is $\sin(x)$"
X set xlabel "This is the $x$ axis"
X set ylabel "$\sin(x)$"
X set nokey
X set xtics -pi, pi/4
X plot [-pi:pi] [-1:1] sin(x)
\end{verbatim}
\currentspace
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{eg4}
X \end{center}
X \caption{An example of the {\tt set xtics} command.}
X \label{eg4}
}
X
Since {\tt pi} is a predefined variable in GNUPLOT, we can use it
anywhere we may use an expression. The {\tt set xtics} command here
specifies that the tics on the $x$ axis start at $-\pi$ and increment
by $\pi/4$. Since no end point is given, the tics continue to the
right edge. We have also turned off the key, and changed the format to
restrict the $x$-axis tic labels to 2 decimal places.
X
With a little more work, the plot can look even better. Another form
of this command allows us to specify the label and position of each
tic individually. Replacing the above {\tt set xtics} command with
the following gives us Figure~\ref{eg5}. We also make use of the line
continuation character, the backslash (\verb+\+), to spread out this
command for readability.
X
\singlespace
\begin{verbatim}
X set xtics ("$-\pi$" -pi,\
X "$-\frac{\pi}{2}$" -pi/2,\
X "0" 0,\
X "$\frac{\pi}{2}$" pi/2,\
X "$\pi$" pi)
\end{verbatim}
\currentspace
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{eg5}
X \end{center}
X \caption{A fancy example of the {\tt set xtics} command.}
X \label{eg5}
}
X
\paragraph{Going further:} You should now be able to make a variety of
plots for your \LaTeX\ document. We will present a final example
without explanation that showcases some of the capabilities of
GNUPLOT. You may find documentation for the various commands in the
GNUPLOT manual, though hopefully this example is somewhat
self-explanatory. This is shown in Figure~\ref{eg6}.
X
\singlespace
\begin{verbatim}
X set terminal latex
X set output "eg6.tex"
X set size 3.5/5, 3/3.
X set format y "$%g$"
X set format x "$%5.1f\mu$"
X set title "This is a title"
X set xlabel "This is the $x$ axis"
X set ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
X set label "Data" at -5,-5 right
X set arrow from -5,-5 to -3.3,-6.7
X set key -4,8
X set xtic -10,5,10
X plot [-10:10] [-10:10] "eg3.dat" title "Data File" with linespoints 1 7,\
X 3*exp(-x*x)+1 title "$3e^{-x^{2}}+1$" with lines 4
\end{verbatim}
\currentspace
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{eg6}
X \end{center}
X \caption{An example of many features.}
X \label{eg6}
}
X
\paragraph{Line and point types:} For reference, we show all of the
line and point types available in Figure~\ref{linepoint}.
X
\boxfigure{htbp}{\fullboxwidth}{
X \begin{center}
X \input{linepoint}
X \end{center}
X \caption{All of the line and point types in the \LaTeX\ driver.}
X \label{linepoint}
}
X
\subsection{Summary --- Use with \LaTeX}
In summary, to use the \LaTeX\ facilities of GNUPLOT, the first
command to GNUPLOT should be
\begin{syntax}
X set terminal latex
\end{syntax}
and the output of GNUPLOT should be directed to a file, for example,
\begin{verbatim}
X set output "plot.tex"
\end{verbatim}
This may be anything you like but it should have a {\tt .tex} extension,
of course. Then the size of the plot should be given. For example, the
command
\begin{verbatim}
X set size 1,2
\end{verbatim}
tells GNUPLOT to use a 5 inch wide by 6 inch high box for the plot.
The numbers given are {\em scale factors}, not the actual size. The
default is 5 inches by 3 inches. This is the size of the complete
plot, including all labels.
X
When finished, the file will contain all of the plots you have
specified (you probably only want one plot per file). This file can
then be used in a \LaTeX\ document, \eg,
X
\singlespace
\begin{verbatim}
X \begin {figure}
X \begin{center}
X \input{plot}
X \end{center}
X \end {figure}
\end{verbatim}
\currentspace
This puts the plot into a figure.
X
You will also want to read about the following commands: {\tt set
title, set xlabel, set ylabel, set key, set label, set xtics, set
ytics}, and {\tt set clip}. These are all described in the regular
GNUPLOT manual.
X
\section{Use with EEPIC}
\label{s:eepic}
EEPIC is a macro package extending the picture environment of \LaTeX.
If you have the EPIC or EEPIC macros, and your {\tt dvi} translator
supports the {\em tpic\/} \verb+\special+s, then you can save \LaTeX\
memory. With EEPIC pictures, the {\tt plot.tex} file will be smaller,
\LaTeX\ will run much faster (and need much less memory), and the {\tt
dvi} file will be smaller. The quality of the output is about the
same. If you change the source, you can generate some more interesting
line styles.
X
To use EEPIC, set GNUPLOT's terminal type to {\tt eepic} instead of
{\tt latex}, and use GNUPLOT as before. The line styles will change.
Include the file {\tt plot.tex} in your document as before, along with
the document style options {\tt [epic,eepic]}.
X
\section{For Former Gnu\TeX\ Users}
\label{oldusers}
X
Former Gnu\TeX\ users may be pleased with many of the new features
(many inspired by your suggestions!), but will also find many changes.
GNUPLOT will {\em not\/} run all Gnu\TeX\ input files unchanged.
Several Gnu\TeX\ features were not included in GNUPLOT because they
were specific to the \LaTeX\ driver. I encourage you to use the newer
GNUPLOT. A translator is available that attempts to translate your
old Gnu\TeX\ 1.6 input files into GNUPLOT 3.0 files. You can ftp it
from \verb+cs.duke.edu+ as \verb+dist/sources/gnuplot/gnut2p.tar.Z+.
This file also contains directions and a list of changes from Gnu\TeX\
to GNUPLOT.
X
\section{Contact}
Please contact me at \verb+Da...@Dartmouth.edu+ with any comments you may
have on GNUPLOT's \LaTeX\ driver. For general GNUPLOT questions, send
mail to the GNUPLOT mailing list
(\verb+pixar!info-g...@ucbvax.berkeley.edu+).
X
X
\end{document}
SHAR_EOF
chmod 0644 gnuplot/docs/latextut/tutorial.tex ||
echo 'restore of gnuplot/docs/latextut/tutorial.tex failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/tutorial.tex'`"
test 16623 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/tutorial.tex: original size 16623, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/latextut/linepoint.plt ==============
if test -f 'gnuplot/docs/latextut/linepoint.plt' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/latextut/linepoint.plt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/latextut/linepoint.plt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/linepoint.plt' &&
# Plots all line types and point types
set term latex
set out "linepoint.tex"
set clip points
set dummy t,y
set nokey
set parametric
set samples 14 # for trange 0:13, we get 14 points: 0, 1, ..., 13
set function style lines
set xtics 1,1,12
set ytics 1,1,6
set title "Up to 6 line types and 12 point types"
set trange [0 : 13]
set xlabel "Points"
set xrange [0 : 13]
set ylabel "Lines"
set yrange [0 : 7]
plot t,1, t,2, t,3, t,4, t,5, t,6, 1,t w p, 2,t w p, 3,t w p, 4,t w p,5,t w p, 6,t w p, 7,t w p, 8,t w p, 9,t w p, 10,t w p, 11,t w p, 12,t w p
SHAR_EOF
chmod 0644 gnuplot/docs/latextut/linepoint.plt ||
echo 'restore of gnuplot/docs/latextut/linepoint.plt failed'
Wc_c="`wc -c < 'gnuplot/docs/latextut/linepoint.plt'`"
test 550 -eq "$Wc_c" ||
echo 'gnuplot/docs/latextut/linepoint.plt: original size 550, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/titlepage.ms ==============
if test -f 'gnuplot/docs/titlepage.ms' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/titlepage.ms (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/titlepage.ms (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/titlepage.ms' &&
.nr HM 3.2i
.TL
GNUPLOT
.br
An Interactive Plotting Program
.sp
.AU
Thomas Williams & Colin Kelley
.br
X Version 3.0 organized by: Gershon Elber
.br
X Version 3.0 major contributors (alphabetic order):
.br
X John Campbell
.br
X Gershon Elber
.br
X David Kotz
.br
X Ed Kubaitis
.br
X Russell Lang
.br
X Tom Tkacik
.br
X Alex Woo
X
.AI
X Mailing list for comments: pixar!info-g...@sun.com
.br
X Mailing list for bug reports: pixar!bug-g...@sun.com
\*(DY
.br
X
X
X
X
X
X
This manual is for GNUPLOT version 3.0.
.AB no
.AE
.LP
.nr HM 1.2i
.ds CH
.ds LH GNUPLOT 3.0
.ds RH %
.\".nr PS 12
.\".nr VS 13
SHAR_EOF
chmod 0644 gnuplot/docs/titlepage.ms ||
echo 'restore of gnuplot/docs/titlepage.ms failed'
Wc_c="`wc -c < 'gnuplot/docs/titlepage.ms'`"
test 599 -eq "$Wc_c" ||
echo 'gnuplot/docs/titlepage.ms: original size 599, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/doc2tex.c ==============
if test -f 'gnuplot/docs/doc2tex.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/doc2tex.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/doc2tex.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2tex.c' &&
/*
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
static char rcsid[] = "$Id: doc2tex.c,v 1.1 90/01/11 15:44:06 dfk Exp Locker: dfk $";
X
#include <stdio.h>
#include <ctype.h>
#ifdef AMIGA_LC_5_1
#include <string.h>
#endif
X
#define MAX_NAME_LEN 256
#define MAX_LINE_LEN 256
#define TRUE 1
#define FALSE 0
X
typedef int boolean;
X
boolean intable = FALSE;
boolean verb = FALSE;
X
main()
{
X init(stdout);
X convert(stdin,stdout);
X finish(stdout);
X exit(0);
}
X
X
init(b)
FILE *b;
{
X (void) fputs("\\input{titlepage.tex}\n",b);
}
X
X
convert(a,b)
X FILE *a,*b;
{
X static char line[MAX_LINE_LEN];
X
X while (fgets(line,MAX_LINE_LEN,a)) {
X process_line(line, b);
X }
}
X
process_line(line, b)
X char *line;
X FILE *b;
{
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 if (line[0] == '\n')
X puttex(line,b); /* handle totally blank line */
X else
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
/* process a line with a digit control char */
/* starts a new [sub]section */
X
section(line, b)
X char *line;
X FILE *b;
{
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 }
#ifdef AMIGA_LC_5_1
X (void) sscanf(line,"%d",&sh_i);
X strcpy(string,strchr(line,' ')+1);
X {
X char *p;
X p = strchr(string,'\n');
X if (p != NULL) *p = '\0';
X }
#else
X (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
#endif
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
/* put text in string str to file while buffering special TeX characters */
puttex(str,file)
FILE *file;
register char *str;
{
register char ch;
static 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
finish(b)
FILE *b;
{
X (void) fputs("\\end{document}\n",b);
}
SHAR_EOF
chmod 0644 gnuplot/docs/doc2tex.c ||
echo 'restore of gnuplot/docs/doc2tex.c failed'
Wc_c="`wc -c < 'gnuplot/docs/doc2tex.c'`"
test 5029 -eq "$Wc_c" ||
echo 'gnuplot/docs/doc2tex.c: original size 5029, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/titlepage.tex ==============
if test -f 'gnuplot/docs/titlepage.tex' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/titlepage.tex (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/titlepage.tex (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/titlepage.tex' &&
\documentstyle[toc_entry]{article}
\setlength{\textwidth}{6.25in}
\setlength{\oddsidemargin}{0.5cm}
\setlength{\topmargin}{-0.5in}
\setlength{\textheight}{9in}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\adjustarticle
\begin{document}
X
\pagestyle{empty}
X \rule{0in}{3in}
X \begin{center}
SHAR_EOF
true || echo 'restore of gnuplot/docs/titlepage.tex failed'
fi
echo 'End of part 10'
echo 'File gnuplot/docs/titlepage.tex is continued in part 11'
echo 11 > _shar_seq_.tmp
#!/bin/sh
# this is Part.11 (part 11 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/docs/titlepage.tex continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 11; 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/docs/titlepage.tex'
else
echo 'x - continuing file gnuplot/docs/titlepage.tex'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/titlepage.tex' &&
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 3.0 organized by: Gershon Elber \\
X Version 3.0 major contributors (alphabetic order):\\
X John Campbell\\
X Gershon Elber\\
X David Kotz\\
X Ed Kubaitis\\
X Russell Lang\\
X Tom Tkacik\\
X Alex Woo\\
X
X \vspace{3ex}
X Mailing list for comments: \verb+pixar!info-g...@sun.com+\\
X Mailing list for bug reports: \verb+pixar!bug-g...@sun.com+
X
X \vfill
X {\small This manual is for GNUPLOT version 3.0.}
X
X \end{center}
\newpage
X
\tableofcontents
\newpage
X
\setcounter{page}{1}
\pagestyle{myheadings}
\markboth{GNUPLOT 3.0}{GNUPLOT 3.0}
SHAR_EOF
echo 'File gnuplot/docs/titlepage.tex is complete' &&
chmod 0644 gnuplot/docs/titlepage.tex ||
echo 'restore of gnuplot/docs/titlepage.tex failed'
Wc_c="`wc -c < 'gnuplot/docs/titlepage.tex'`"
test 1027 -eq "$Wc_c" ||
echo 'gnuplot/docs/titlepage.tex: original size 1027, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/toc_entry.sty ==============
if test -f 'gnuplot/docs/toc_entry.sty' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/toc_entry.sty (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/toc_entry.sty (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/toc_entry.sty' &&
%
% TOC_ENTRY.STY of 13 Dec 90
% written by Stefan Timphus
%
% Will produce the right space for sectionnumbers in the tableofcontents
% Necessary for entries where the number for each kind of section
% is greater 10 (e.g. "12.14.18 Sectionname")
% When using the original definition the first letter of the sectionname
% overwrites the last number of the sectionnumber
%
% call adjustments with command \adjustSTYLENAME
%
X
\typeout{`toc_entry.sty' 1.0 of 13 Dec 90}
X
%
% HERE ARE THE ORIGINAL DEFINITIONS
%
X
% article.sty
%
%\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
%\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
%\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
%\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
X
% report.sty and book.sty
%
%\def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
%\def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
%\def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
%\def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
%\def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
X
%
% MODIFICATIONS
%
X
\newlength{\twonum}
X \settowidth{\twonum}{99.99.}
\newlength{\threenum}
X \settowidth{\threenum}{99.99.99.}
\newlength{\fournum}
X \settowidth{\fournum}{99.99.99.99.}
\newlength{\fivenum}
X \settowidth{\fivenum}{99.99.99.99.99.}
\newlength{\sixnum}
X \settowidth{\sixnum}{99.99.99.99.99.99.}
X
\newcommand{\adjustarticle}
{\def\l@subsection{\@dottedtocline{2}{1.5em}{\twonum}}
\def\l@subsubsection{\@dottedtocline{3}{4.0em}{\threenum}}
\def\l@paragraph{\@dottedtocline{4}{7.8em}{\fournum}}
\def\l@subparagraph{\@dottedtocline{5}{10.4em}{\fivenum}}}
X
\newcommand{\adjustreport}
{\def\l@section{\@dottedtocline{1}{1.5em}{\twonum}}
\def\l@subsection{\@dottedtocline{2}{4.0em}{\threenum}}
\def\l@subsubsection{\@dottedtocline{3}{7.8em}{\fournum}}
\def\l@paragraph{\@dottedtocline{4}{10.4em}{\fivenum}}
\def\l@subparagraph{\@dottedtocline{5}{12.6em}{\sixnum}}}
X
\newcommand{\adjustbook}{\adjustreport}
X
% end of TOC_ENTRY.STY
SHAR_EOF
chmod 0644 gnuplot/docs/toc_entry.sty ||
echo 'restore of gnuplot/docs/toc_entry.sty failed'
Wc_c="`wc -c < 'gnuplot/docs/toc_entry.sty'`"
test 2009 -eq "$Wc_c" ||
echo 'gnuplot/docs/toc_entry.sty: original size 2009, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/docs/Makefile.ami ==============
if test -f 'gnuplot/docs/Makefile.ami' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/docs/Makefile.ami (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/docs/Makefile.ami (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/Makefile.ami' &&
#
# Makefile for GNUPLOT documentation (Aztec C v5.xx Version)
#
# Note that the top-level file for documentation is gnuplot.doc.
# See README.
#
# To print manual:
# make gnuplot.dvi (for latex)
# (print or view gnuplot.dvi)
# OR
# make gnuplot.nroff (for nroff)
# (print or view gnuplot.nroff)
# or
# make "TROFF=itroff" troff (for troff; use your troff for itroff here)
#
# $Id: Makefile,v 1.1 90/01/11 15:43:03 dfk Exp Locker: dfk $
X
# usually overridden by ../Makefile
HELPDEST = /usr/local/lib/
X
# substitute your troff command (and any flags) for this one
TROFF=itroff
X
# substitute cp if you do not have the install program
INSTALL=install
X
# Compiler flags
# -DSYSV if att sys V
# -DMSDOS if MSDOS PS
# -traditional -g -O if gcc (set 'CC = gcc')
# no extra flags for BSD
CFLAGS =
CC = cc
LN =ln
LFLAGS = -lm -lc
X
# default is what is needed for interactive gnuplot
default: gnuplot.hlp gnuplot.gih
X
### [tn]roff documentation
troff: gnuplot.ms titlepage.ms
X tbl gnuplot.ms | eqn | $(TROFF) -ms
X
# for screen viewing, or printers with backspace/overstrike, remove the -Tlpr
nroff gnuplot.nroff: gnuplot.ms titlepage.ms
X tbl gnuplot.ms | neqn | nroff -ms -Tlpr > gnuplot.nroff
X
ms gnuplot.ms: doc2ms gnuplot.doc
X doc2ms < gnuplot.doc > gnuplot.ms
X
doc2ms: doc2ms.c
X $(CC) $(CFLAGS) -o doc2ms.o doc2ms.c
X $(LN) -o doc2ms doc2ms.o $(LFLAGS)
X
### LaTeX documentation
tex gnuplot.tex: doc2tex gnuplot.doc
X doc2tex < gnuplot.doc > gnuplot.tex
X
dvi gnuplot.dvi: gnuplot.tex titlepage.tex
X latex gnuplot.tex
X latex gnuplot.tex
X
doc2tex: doc2tex.c
X $(CC) $(CFLAGS) -o doc2tex.o doc2tex.c
X $(LN) -o doc2tex doc2tex.o $(LFLAGS)
X
# this is how to make gnuplot.hlp
hlp gnuplot.hlp: doc2hlp gnuplot.doc
X doc2hlp < gnuplot.doc > gnuplot.hlp
X
doc2hlp: doc2hlp.c
X $(CC) $(CFLAGS) -o doc2hlp.o doc2hlp.c
X $(LN) -o doc2hlp doc2hlp.o $(LFLAGS)
X
# this is how to make gnuplot.gih
gih gnuplot.gih: doc2gih gnuplot.doc
X doc2gih < gnuplot.doc > gnuplot.gih
X
doc2gih: doc2gih.c
X $(CC) $(CFLAGS) -o doc2gih.o doc2gih.c
X $(LN) -o doc2gih doc2gih.o $(LFLAGS)
X
# this is how to check the gnuplot.doc file
check: checkdoc gnuplot.doc
X checkdoc < gnuplot.doc
X
checkdoc: checkdoc.c
X $(CC) $(CFLAGS) -o checkdoc.o checkdoc.c
X $(LN) -o checkdoc checkdoc.o $(LFLAGS)
X
# For Unix and MSDOS only
install-unix: gnuplot.gih
X $(INSTALL) gnuplot.gih $(HELPDEST)
X
# for VMS only
install-vms: gnuplot.hlp
X $(INSTALL) gnuplot.hlp $(HELPDEST)
X
# remove all derived files
clean:
X rm -f doc2ms gnuplot.nroff gnuplot.ms
X rm -f doc2tex gnuplot.tex gnuplot.dvi gnuplot.aux gnuplot.log gnuplot.toc
X rm -f doc2hlp gnuplot.hlp
X rm -f doc2gih gnuplot.gih
X rm -f checkdoc *~ *.o core a.out
SHAR_EOF
chmod 0644 gnuplot/docs/Makefile.ami ||
echo 'restore of gnuplot/docs/Makefile.ami failed'
Wc_c="`wc -c < 'gnuplot/docs/Makefile.ami'`"
test 2688 -eq "$Wc_c" ||
echo 'gnuplot/docs/Makefile.ami: original size 2688, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/corgraph.asm ==============
if test -f 'gnuplot/corgraph.asm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/corgraph.asm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/corgraph.asm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/corgraph.asm' &&
TITLE Corona graphics module
; Colin Kelley
; January 1987
X
include header.mac
X
if1
include lineproc.mac
endif
X
X
_text segment
X
public _GrInit,_GrReset,_GrOnly,_TxOnly,_GrandTx,_Cor_line,_Cor_mask
X
corpixel proc near
X ror word ptr linemask,1
X jc cont
X ret
cont: push bp
X mov bp,sp
X push ax
X push bx
X push cx
X mov es,ScSeg
X shl bx,1 ; y
X mov bx,word ptr LookUp[bx] ; bx has y mem address
X mov cl,al ; x
X and cl,7
X shr ax,1
X shr ax,1
X shr ax,1 ; ax /= 8
X add bx,ax
X mov al,1
X shl al,cl ; al contains bit mask
X or byte ptr es:[bx],al
X pop cx
X pop bx
X pop ax
X pop bp
X ret
X
lineproc _Cor_line, corpixel
X
beginproc _GrInit
X push bp
X mov bp,sp
X push di
X mov ax, [bp+X] ; screen number (0 - 7)
X mov cl,11
X shl ax,cl ; multiply by 2048 to get segment
X mov ScSeg,ax ; save segment for later
X push ax
X mov es, ax
X xor ax,ax
X mov di,ax
X mov cx, 4000h
X cld
X rep stosw
X pop cx
X call near ptr GrAddr
X mov ax,es
X pop di
X pop bp
X ret
_GrInit endp
X
beginproc _GrReset
X mov cx, 0
X call near ptr GrAddr
X ret
_GrReset endp
X
GrAddr proc near
X mov dx,3b4h ; address of 6845
X mov al,0ch ; register 12
X out dx,al
X inc dx
X mov al,ch ; Graphics Segment High
X out dx,al
X dec dx
X mov al,0dh ; register 13
X out dx,al
X mov al,cl ; Graphics Segment Low
X inc dx
X out dx,al
X ret
GrAddr endp
X
beginproc _GrOnly
X mov dx,3b8h
X mov al,0a0h
X out dx,al
X ret
_GrOnly endp
X
beginproc _TxOnly
X mov dx,3b8h
X mov al,28h
X out dx,al
X ret
_TxOnly endp
X
beginproc _GrandTx
X mov dx,3b8h
X mov al,0a8h
X out dx,al
X ret
_GrandTx endp
X
beginproc _Cor_mask
X push bp
X mov bp,sp
X mov ax,[bp+x] ; mask
X mov linemask,ax
X pop bp
X ret
_Cor_mask endp
X
corpixel endp
X
_text ends
X
X
_data segment
linemask dw -1
ScSeg dw 0
_data ends
X
const segment
X
K equ 1024
X
mem_mac MACRO x
X dw x,2*K+x,4*K+x,6*K+x,8*K+x,10*K+x,12*K+x,14*K+x,16*K+x
X dw 18*K+x,20*K+x,22*K+x,24*K+x
X ENDM
LookUp equ $
X mem_mac 0
X mem_mac 80
X mem_mac (80*2)
X mem_mac (80*3)
X mem_mac (80*4)
X mem_mac (80*5)
X mem_mac (80*6)
X mem_mac (80*7)
X mem_mac (80*8)
X mem_mac (80*9)
X mem_mac (80*10)
X mem_mac (80*11)
X mem_mac (80*12)
X mem_mac (80*13)
X mem_mac (80*14)
X mem_mac (80*15)
X mem_mac (80*16)
X mem_mac (80*17)
X mem_mac (80*18)
X mem_mac (80*19)
X mem_mac (80*20)
X mem_mac (80*21)
X mem_mac (80*22)
X mem_mac (80*23)
X mem_mac (80*24)
X
const ends
X
X end
SHAR_EOF
chmod 0666 gnuplot/corgraph.asm ||
echo 'restore of gnuplot/corgraph.asm failed'
Wc_c="`wc -c < 'gnuplot/corgraph.asm'`"
test 2272 -eq "$Wc_c" ||
echo 'gnuplot/corgraph.asm: original size 2272, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/corplot.c ==============
if test -f 'gnuplot/corplot.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/corplot.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/corplot.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/corplot.c' &&
/* GNUPLOT - corplot.c */
#include <stdio.h>
#include <process.h>
#include <dos.h>
X
#define BOUNDARY 32768
#define segment(addr) (FP_SEG(m) + ((FP_OFF(m)+15) >> 4));
#define round(value,boundary) (((value) + (boundary) - 1) & ~((boundary) - 1))
X
char *malloc(),*realloc();
X
char prog[] = "gnuplot";
char corscreen[] = "CORSCREEN=0";
X
main()
{
register unsigned int segm,start;
char *m;
X if (!(m = malloc(BOUNDARY))) {
X printf("malloc() failed\n");
X exit(1);
X }
X segm = segment(m);
X start = round(segm,BOUNDARY/16);
X
X if (realloc(m,BOUNDARY+(start-segm)*16) != m) {
X printf("can't realloc() memory\n");
X exit(2);
X }
X
X if ((segm = start >> 11) >= 8) {
X printf("not enough room in first 256K\n");
X exit(3);
X }
X
X corscreen[sizeof(corscreen)-2] = '0' + segm;
X if (putenv(corscreen))
X perror("putenv");
X
X if (spawnlp(P_WAIT,prog,prog,NULL))
X perror("spawnlp");
}
SHAR_EOF
chmod 0666 gnuplot/corplot.c ||
echo 'restore of gnuplot/corplot.c failed'
Wc_c="`wc -c < 'gnuplot/corplot.c'`"
test 1979 -eq "$Wc_c" ||
echo 'gnuplot/corplot.c: original size 1979, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/eval.c ==============
if test -f 'gnuplot/eval.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/eval.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/eval.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/eval.c' &&
/* GNUPLOT - eval.c */
#include "plot.h"
X
extern int c_token;
extern struct ft_entry ft[];
extern struct udvt_entry *first_udv;
extern struct udft_entry *first_udf;
extern struct at_type at;
extern struct lexical_unit token[];
X
struct value *integer();
X
X
X
struct udvt_entry *
add_udv(t_num) /* find or add value and return pointer */
int t_num;
{
register struct udvt_entry **udv_ptr = &first_udv;
X
X /* check if it's already in the table... */
X
X while (*udv_ptr) {
X if (equals(t_num,(*udv_ptr)->udv_name))
X return(*udv_ptr);
X udv_ptr = &((*udv_ptr)->next_udv);
X }
X
X *udv_ptr = (struct udvt_entry *)
X alloc((unsigned int)sizeof(struct udvt_entry), "value");
X (*udv_ptr)->next_udv = NULL;
X copy_str((*udv_ptr)->udv_name,t_num);
X (*udv_ptr)->udv_value.type = INT; /* not necessary, but safe! */
X (*udv_ptr)->udv_undef = TRUE;
X return(*udv_ptr);
}
X
X
struct udft_entry *
add_udf(t_num) /* find or add function and return pointer */
int t_num; /* index to token[] */
{
register struct udft_entry **udf_ptr = &first_udf;
X
X while (*udf_ptr) {
X if (equals(t_num,(*udf_ptr)->udf_name))
X return(*udf_ptr);
X udf_ptr = &((*udf_ptr)->next_udf);
X }
X *udf_ptr = (struct udft_entry *)
X alloc((unsigned int)sizeof(struct udft_entry), "function");
X (*udf_ptr)->next_udf = (struct udft_entry *) NULL;
X (*udf_ptr)->definition = NULL;
X (*udf_ptr)->at = NULL;
X copy_str((*udf_ptr)->udf_name,t_num);
X (void) integer(&((*udf_ptr)->dummy_values[0]), 0);
X (void) integer(&((*udf_ptr)->dummy_values[1]), 0);
X return(*udf_ptr);
}
X
X
union argument *
add_action(sf_index)
enum operators sf_index; /* index of p-code function */
{
X if (at.a_count >= MAX_AT_LEN)
X int_error("action table overflow",NO_CARET);
X at.actions[at.a_count].index = sf_index;
X return(&(at.actions[at.a_count++].arg));
}
X
X
int standard(t_num) /* return standard function index or 0 */
{
register int i;
X for (i = (int)SF_START; ft[i].f_name != NULL; i++) {
X if (equals(t_num,ft[i].f_name))
X return(i);
X }
X return(0);
}
X
X
X
execute_at(at_ptr)
struct at_type *at_ptr;
{
register int i,index,count,offset;
X
X count = at_ptr->a_count;
X for (i = 0; i < count;) {
X index = (int)at_ptr->actions[i].index;
X offset = (*ft[index].func)(&(at_ptr->actions[i].arg));
X if (is_jump(index))
X i += offset;
X else
X i++;
X }
}
X
/*
X
X 'ft' is a table containing C functions within this program.
X
X An 'action_table' contains pointers to these functions and arguments to be
X passed to them.
X
X at_ptr is a pointer to the action table which must be executed (evaluated)
X
X so the iterated line exectues the function indexed by the at_ptr and
X passes the address of the argument which is pointed to by the arg_ptr
X
*/
SHAR_EOF
chmod 0666 gnuplot/eval.c ||
echo 'restore of gnuplot/eval.c failed'
Wc_c="`wc -c < 'gnuplot/eval.c'`"
test 3799 -eq "$Wc_c" ||
echo 'gnuplot/eval.c: original size 3799, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/gnuplot.el ==============
if test -f 'gnuplot/gnuplot.el' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/gnuplot.el (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/gnuplot.el (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/gnuplot.el' &&
;
; gnu-plot.el - Definitions of GNU-PLOT mode for emacs editor.
;
; Author: Gershon Elber
; Computer Science Dept.
; University of Utah
; Date: Tue May 14 1991
; Copyright (c) 1991, Gershon Elber
;
; This file defines an environment to run edit and execute GNU-PLOT programs.
; Such a program should have a '.gp' extension in order it to be in
; gnu-plot-mode major mode. Two new functions are provided to communicate
; between the editted file and the plotting program:
; 1. send-line-to-gnu-plot - sends a single line to the plotting program for
; execution. The line sent is the line the cursor is on,
; Bounded to Meta-E be default.
; 2. send-region-to-gnu-plot - sends the region from the current mark
; (mark-marker) to current position (point-marker) to the plotting program.
; This function is convenient for sending a large block of commands.
; Bounded to Meta-R be default.
; Both functions checks for existance of a buffer named gnu-plot-program
; and a process named "gnu-plot" hooked to it, and will restart a new process
; or buffer if none exists. The program to execute as process "gnu-plot" is
; defined by the gnu-plot-program constant below.
;
X
(defvar gnu-plot-program "gnuplot"
X "*The executable to run for gnu-plot-program buffer.")
X
(defvar gnu-plot-echo-program t
X "*Control echo of executed commands to gnu-plot-program buffer.")
X
(defvar gnu-plot-mode-map nil "")
(if gnu-plot-mode-map
X ()
X (setq gnu-plot-mode-map (make-sparse-keymap))
X (define-key gnu-plot-mode-map "\M-e" 'send-line-to-gnu-plot)
X (define-key gnu-plot-mode-map "\M-r" 'send-region-to-gnu-plot))
X
;;;
;;; Define the gnu-plot-mode
;;;
(defun gnu-plot-mode ()
X "Major mode for editing and executing GNU-PLOT files.
X
see send-line-to-gnu-plot and send-region-to-gnu-plot for more."
X (interactive)
X (use-local-map gnu-plot-mode-map)
X (setq major-mode 'gnu-plot-mode)
X (setq mode-name "Gnu-Plot")
X (run-hooks 'gnu-plot-mode-hook))
X
;;;
;;; Define send-line-to-gnu-plot - send from current cursor position to next
;;; semicolin detected.
;;;
(defun send-line-to-gnu-plot ()
X "Sends one line of code from current buffer to the GNU-PLOT program.
X
Use to execute a line in the GNU-PLOT plotting program. The line send is
the line the cursor (point) is on.
X
The GNU-PLOT plotting program buffer name is gnu-plot-program and the
process name is 'gnu-plot'. If none exists, a new one is created.
X
The name of the gnu-plot program program to execute is stored in
gnu-plot-program variable and may be changed."
X (interactive)
X (if (equal major-mode 'gnu-plot-mode)
X (progn
X (make-gnu-plot-buffer) ; In case we should start a new one.
X (beginning-of-line)
X (let ((start-mark (point-marker)))
X (next-line 1)
X (let* ((crnt-buffer (buffer-name))
X (end-mark (point-marker))
X (string-copy (buffer-substring start-mark end-mark)))
X (switch-to-buffer-other-window (get-buffer "gnu-plot-program"))
X (end-of-buffer)
X (if gnu-plot-echo-program
X (insert string-copy))
X (set-marker (process-mark (get-process "gnu-plot")) (point-marker))
X (if (not (pos-visible-in-window-p))
X (recenter 3))
X (switch-to-buffer-other-window (get-buffer crnt-buffer))
X (process-send-region "gnu-plot" start-mark end-mark)
X (goto-char end-mark))))
X (message "Should be invoked in gnu-plot-mode only.")))
X
;;;
;;; Define send-region-to-gnu-plot - send from current cursor position to
;;; current marker.
;;;
(defun send-region-to-gnu-plot ()
X "Sends a region of code from current buffer to the GNU-PLOT program.
X
When this function is invoked on an GNU-PLOT file it send the region
from current point to current mark to the gnu-plot plotting program.
X
The GNU-PLOT plotting program buffer name is gnu-plot-program and the
process name is 'gnu-plot'. If none exists, a new one is created.
X
The name of the gnu-plot program program to execute is stored in
gnu-plot-program variable and may be changed."
X (interactive)
X (if (equal major-mode 'gnu-plot-mode)
X (progn
X (make-gnu-plot-buffer) ; In case we should start a new one.
X (copy-region-as-kill (mark-marker) (point-marker))
X (let ((crnt-buffer (buffer-name)))
X (switch-to-buffer-other-window (get-buffer "gnu-plot-program"))
X (end-of-buffer)
X (if gnu-plot-echo-program
X (yank))
X (set-marker (process-mark (get-process "gnu-plot")) (point-marker))
X (if (not (pos-visible-in-window-p))
X (recenter 3))
X (switch-to-buffer-other-window (get-buffer crnt-buffer))
X (process-send-region "gnu-plot" (mark-marker) (point-marker))))
X (message "Should be invoked in gnu-plot-mode only.")))
X
;;;
;;; Switch to "gnu-plot-program" buffer if exists. If not, creates one and
;;; execute the program defined by gnu-plot-program.
;;;
(defun make-gnu-plot-buffer ()
X "Switch to iris-program buffer or create one if none exists"
X (interactive)
X (if (get-buffer "gnu-plot-program")
X (if (not (get-process "gnu-plot"))
X (progn
X (message "Starting GNU-PLOT plotting program...")
X (start-process "gnu-plot" "gnu-plot-program" gnu-plot-program)
X (process-send-string "gnu-plot" "\n")
X (message "Done.")))
X (progn
X (message "Starting GNU-PLOT plotting program...")
X (start-process "gnu-plot" "gnu-plot-program" gnu-plot-program)
X (process-send-string "gnu-plot" "\n")
X (message "Done."))))
X
;;;
;;; Autoload gnu-plot-mode on any file with gp extension.
;;;
(setq auto-mode-alist (append '(("\\.gp$" . gnu-plot-mode))
X auto-mode-alist))
SHAR_EOF
chmod 0666 gnuplot/gnuplot.el ||
echo 'restore of gnuplot/gnuplot.el failed'
Wc_c="`wc -c < 'gnuplot/gnuplot.el'`"
test 5487 -eq "$Wc_c" ||
echo 'gnuplot/gnuplot.el: original size 5487, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/gnuplot_x11.c ==============
if test -f 'gnuplot/gnuplot_x11.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/gnuplot_x11.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/gnuplot_x11.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/gnuplot_x11.c' &&
/*-----------------------------------------------------------------------------
X * gnuplot_x11 - X11 outboard terminal driver for gnuplot 3
X *
X * Requires installation of companion inboard x11 driver in gnuplot/term.c
X *
X * Acknowledgements:
X * Chris Peterson (MIT) - original Xlib gnuplot support (and Xaw examples)
X * Dana Chee (Bellcore) - mods to original support for gnuplot 2.0
X * Arthur Smith (Cornell) - graphical-label-widget idea (xplot)
X * Hendri Hondorp (University of Twente, The Netherlands) - Motif xgnuplot
X *
X * This code is provided as is and with no warranties of any kind.
X *
X * Ed Kubaitis - Computing Services Office - University of Illinois, Urbana
X *---------------------------------------------------------------------------*/
X
#include <stdio.h>
#include <signal.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Label.h> /* use -Idir for location on your system */
#ifdef MOTIF
#include <Xm.h> /* use -Idir for location on your system */
#define LabelWC xmLabelWidgetClass
#define LabelBPM XmNbackgroundPixmap
#else
#define LabelWC labelWidgetClass
#define LabelBPM XtNbitmap
#endif
X
#define Color (D>1)
#define Ncolors 11
unsigned long colors[Ncolors];
char color_keys[Ncolors][30] = { "text", "border", "axis",
X "line1", "line2", "line3", "line4", "line5", "line6", "line7", "line8" };
char color_values[Ncolors][30] = { "black", "black", "black",
X "red", "green", "blue", "magenta", "cyan", "sienna", "orange", "coral" };
X
char dashes[10][5] = { {0}, {1,6,0},
X {0}, {4,2,0}, {1,3,0}, {4,4,0}, {1,5,0}, {4,4,4,1,0}, {4,2,0}, {1,3,0}
X };
X
Widget w_top, w_label; Window win; Display *dpy;
Pixmap pixmap; GC gc = (GC)NULL;
Dimension W = 640 , H = 450; int D;
Arg args[5];
static void gnuplot(), resize();
X
int cx=0, cy=0, vchar, nc = 0, ncalloc = 0;
double xscale, yscale;
#define X(x) (Dimension) (x * xscale)
#define Y(y) (Dimension) ((4095-y) * yscale)
enum JUSTIFY { LEFT, CENTRE, RIGHT } jmode;
#define Nbuf 1024
char buf[Nbuf];
String *commands = NULL;
X
typedef struct { /* See "X Toolkit Intrinsics Programming Manual" */
X XFontStruct *font; /* Nye and O'Reilly, O'Reilly & Associates, pp. 80-85 */
X unsigned long fg;
X unsigned long bg;
X } RValues, *RVptr;
RValues rv;
X
XXtResource resources[] = {
X { XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
X XtOffset(RVptr, font), XtRString, "fixed" },
X { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
X XtOffset(RVptr, fg), XtRString, XtDefaultForeground },
X { XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
X XtOffset(RVptr, bg), XtRString, XtDefaultBackground },
X };
X
/*-----------------------------------------------------------------------------
X * main program - fire up application and callbacks
X *---------------------------------------------------------------------------*/
X
main(argc, argv) int argc; char *argv[]; {
X
X signal(SIGINT, SIG_IGN);
#ifdef SIGTSTP
X signal(SIGTSTP, SIG_IGN);
#endif
X
X /* initialize application */
X w_top = XtInitialize("gnuplot", "Gnuplot", NULL, 0, &argc, argv);
X XtSetArg(args[0], XtNwidth, W);
X XtSetArg(args[1], XtNheight, H);
X w_label = XtCreateManagedWidget ("", LabelWC, w_top, args, (Cardinal)2);
X XtRealizeWidget(w_top);
X
X /* extract needed information */
X dpy = XtDisplay(w_top); win = XtWindow(w_label);
X D = DisplayPlanes(dpy,DefaultScreen(dpy));
X if (Color) {
X char option[20], *value;
X XColor used, exact; int n;
X
X for(n=0; n<Ncolors; n++) {
X strcpy(option, color_keys[n]);
X strcat(option, "Color");
X value = XGetDefault(dpy, "gnuplot", option);
X if (!value) { value = color_values[n]; }
X if (XAllocNamedColor(dpy, DefaultColormap(dpy,0), value, &used,&exact))
X colors[n] = used.pixel;
X else {
X fprintf(stderr, "gnuplot: cannot allocate %s:%s\n", option, value);
X fprintf(stderr, "gnuplot: assuming %s:black\n", option);
X colors[n] = BlackPixel(dpy,0);
X }
X }
X }
X XtSetArg(args[0], XtNwidth, &W);
X XtSetArg(args[1], XtNheight,&H);
X XtGetValues(w_label, args, (Cardinal)2);
X XtGetApplicationResources(w_top, &rv, resources, XtNumber(resources),NULL,0);
X vchar = (rv.font->ascent + rv.font->descent);
X
X /* add callbacks on input-from-gnuplot-on-stdin & window-resized */
X XtAddInput(0, XtInputReadMask, gnuplot, NULL);
X XtAddEventHandler(w_label, StructureNotifyMask, FALSE, resize, NULL);
X
X XtMainLoop();
X }
X
/*-----------------------------------------------------------------------------
X * display - display accumulated commands from inboard driver
X *---------------------------------------------------------------------------*/
X
display() {
X int n, x, y, sw, sl, lt, width, type;
X char *buf, *str;
X
X /* set scaling factor between internal driver & window geometry */
X xscale = (double)W / 4096.; yscale = (double)H / 4096.;
X
X /* create new pixmap & GC */
X if (gc) { XFreeGC(dpy, gc); XFreePixmap(dpy, pixmap); }
X pixmap = XCreatePixmap(dpy, RootWindow(dpy,DefaultScreen(dpy)), W, H, D);
X gc = XCreateGC(dpy, pixmap, 0, NULL);
X XSetFont(dpy, gc, rv.font->fid);
X
X /* erase pixmap */
#ifndef MOTIF
X if (Color) { /* Athena needs different erase for color and mono */
#endif
X XSetForeground(dpy, gc, rv.bg);
X XFillRectangle(dpy, pixmap, gc, 0, 0, W, H);
X XSetForeground(dpy, gc, rv.fg);
X XSetBackground(dpy, gc, rv.bg);
#ifndef MOTIF
X }
X else {
X XSetFunction(dpy, gc, GXxor);
X XCopyArea(dpy, pixmap, pixmap, gc, 0, 0, W, H, 0, 0);
X XSetFunction(dpy, gc, GXcopyInverted);
X }
#endif
X
X /* connect new pixmap to label widget */
X XtSetArg(args[0], LabelBPM, pixmap);
X XtSetValues(w_label, args, (Cardinal)1);
X
X /* loop over accumulated commands from inboard driver */
X for (n=0; n<nc; n++) {
X buf = commands[n];
X
X /* X11_vector(x,y) - draw vector */
X if (*buf == 'V') {
X sscanf(buf, "V%4d%4d", &x, &y);
X XDrawLine(dpy, pixmap, gc, X(cx), Y(cy), X(x), Y(y));
X cx = x; cy = y;
X }
X
X /* X11_move(x,y) - move */
X else if (*buf == 'M')
X sscanf(buf, "M%4d%4d", &cx, &cy);
X
X /* X11_put_text(x,y,str) - draw text */
X else if (*buf == 'T') {
X sscanf(buf, "T%4d%4d", &x, &y);
X str = buf + 9; sl = strlen(str) - 1;
X sw = XTextWidth(rv.font, str, sl);
X switch(jmode) {
X case LEFT: sw = 0; break;
X case CENTRE: sw = -sw/2; break;
X case RIGHT: sw = -sw; break;
X }
X if (!Color)
X XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
X else {
X XSetForeground(dpy, gc, colors[0]);
X XDrawString(dpy, pixmap, gc, X(x)+sw, Y(y)+vchar/3, str, sl);
X XSetForeground(dpy, gc, colors[lt+1]);
X }
X }
X
X /* X11_justify_text(mode) - set text justification mode */
X else if (*buf == 'J')
X sscanf(buf, "J%4d", &jmode);
X
X /* X11_linetype(type) - set line type */
X else if (*buf == 'L') {
X sscanf(buf, "L%4d", <);
X lt = (lt%8)+2;
X width = (lt == 0) ? 2 : 0;
X if (Color) {
X if (lt != 1)
X type = LineSolid;
X else {
X type = LineOnOffDash;
X XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
X }
X XSetForeground(dpy, gc, colors[lt+1]);
X }
X else {
X type = (lt == 0 || lt == 2) ? LineSolid : LineOnOffDash;
X if (dashes[lt][0])
X XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
X }
X XSetLineAttributes( dpy,gc, width, type, CapButt, JoinBevel);
X }
X }
X
X /* trigger expose events to display pixmap */
X XClearArea(dpy, win, 0, 0, 0, 0, True);
X }
X
/*-----------------------------------------------------------------------------
X * gnuplot - Xt callback on input from gnuplot inboard X11 driver
X * resize - Xt callback when window resized
X *---------------------------------------------------------------------------*/
X
static void
gnuplot(cd, s, id) char *cd; int *s; XtInputId *id; {
X
X while (fgets(buf, Nbuf, stdin)) {
X if (*buf == 'G') { /* enter graphics mode */
X if (commands) {
X int n; for (n=0; n<nc; n++) XtFree(commands[n]);
X XtFree(commands);
X }
X commands = NULL; nc = ncalloc = 0;
X }
X else if (*buf == 'E') { display(); break; } /* leave graphics mode */
X else if (*buf == 'R') { exit(0); } /* leave X11/x11 mode */
X else {
X if (nc >= ncalloc) {
X ncalloc = ncalloc*2 + 1;
X commands = (String *)XtRealloc(commands, ncalloc * sizeof(String));
X }
X commands[nc++] = XtNewString(buf);
X }
X }
X if (feof(stdin) || ferror(stdin)) exit(0);
X }
X
static void
resize(w, cd, e) Widget w; char *cd; XConfigureEvent *e; {
X if (e->type != ConfigureNotify) return;
X W = e->width; H = e->height;
X display();
X }
SHAR_EOF
chmod 0644 gnuplot/gnuplot_x11.c ||
echo 'restore of gnuplot/gnuplot_x11.c failed'
Wc_c="`wc -c < 'gnuplot/gnuplot_x11.c'`"
test 8774 -eq "$Wc_c" ||
echo 'gnuplot/gnuplot_x11.c: original size 8774, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.tc ==============
if test -f 'gnuplot/linkopt.tc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.tc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.tc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.tc' &&
c:\tc\lib\C0l +
bitmap command eval graphics graph3d help internal misc parse +
plot scanner setshow standard term util version contour +
egavgaf hercf cgaf attf +
,gnuplot,gnuplot, +
c:\tc\lib\emu +
c:\tc\lib\mathl +
c:\tc\lib\cl +
c:\tc\lib\graphics
SHAR_EOF
chmod 0666 gnuplot/linkopt.tc ||
echo 'restore of gnuplot/linkopt.tc failed'
Wc_c="`wc -c < 'gnuplot/linkopt.tc'`"
test 252 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.tc: original size 252, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/lasergnu ==============
if test -f 'gnuplot/lasergnu' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/lasergnu (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/lasergnu (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/lasergnu' &&
#!/bin/csh -f
#
# Print gnuplot output on an Imagen or Postscript laser printer.
X
set print_banner = on # Print a banner page unless told otherwise.
set input_files = () # the plot input command files
set lpr_opts = () # options to lpr
X
# Default printer set by shell variable PRINTER.
if (! $?PRINTER) then
X if ($?LASER) then
X set PRINTER=$LASER
X else
X set PRINTER="lw0"
X endif
endif
set printer = (-P$PRINTER)
X
# File for plot commands, and for plot output
set TMP=/tmp/plot$$
set outfile=$TMP.out # the output file
onintr cleanup
X
# default is Imagen mode for Imagen printer; see -p option
set setterm="set terminal imagen"
set LANG="-Limpress"
X
set usage="usage: lasergnu [-Pprinter] [-b] [-p] [-t title] [-f file] ['plot command']...."
X
# Loop through the command-line arguments.
X
top:
X if ($#argv > 0) then
X
X switch ("$argv[1]")
X
X case -b*: # Do not print a banner page.
X case -J*: # Compatible with imprint.
X set print_banner = off
X set lpr_opts=($lpr_opts -h)
X shift argv
X goto top
X
X case -f?*: # Specify file containing plot commands
X set input_files = ($input_files `echo $argv[1] | sed 's/^-f//'`)
X shift argv
X goto top
X
X case -f: # Specify file containing plot commands
X shift argv
X if ($#argv > 0) then
X set input_files = ($input_files $argv[1])
X shift argv
X else
X echo "Usage: -f file ..."
X echo "Type lasergnu -help for help."
X exit (1)
X endif
X goto top
X
X case -t?*: # Specify title of plot
X echo set title \""`echo $argv[1] | sed 's/^-t//'`"\" >> $TMP
X shift argv
X goto top
X
X case -t: # Specify title of plot
X shift argv
X if ($#argv > 0) then
X echo set title \""$1"\" >> $TMP
X shift argv
X else
X echo "Usage: -t title ..."
X echo "Type lasergnu -help for help."
X exit (1)
X endif
X goto top
X case -help:
X echo "$usage"
X exit(1)
X
X case -P?*: # Set the printer, exactly as by itroff.
X set printer = $argv[1]
X shift argv
X goto top
X
X case -P: # Set the printer, exactly as by itroff.
X shift argv
X if ($#argv > 0) then
X set printer = (-P$argv[1])
X shift argv
X else
X echo "Usage: -P printer ..."
X echo "Type lasergnu -help for help."
X exit (1)
X endif
X goto top
X
X # use impress
X case -I:
X echo Imagen is the default mode now
X shift argv
X goto top
X
X # use postscript instead of impress language
X case -p:
X set setterm="set term postscript"
X set LANG="-Lpostscript"
X shift argv
X goto top
X
X case -?*:
X echo "I do not recognize option $argv[1]."
X echo "$usage"
X exit (1)
X
X default:
X echo "$argv[1]" >> $TMP
X shift argv
X goto top
X
X endsw
X endif
X
# try to devine the printer type
if ($printer =~ -Plw*) then
X set setterm="set term postscript"
X set LANG="-Lpostscript"
endif
X
if ($printer =~ -Pim*) then
X set setterm="set term imagen"
X set LANG="-Limpress"
endif
X
# Set up input file
echo $setterm > $TMP.plt
echo set output \"$outfile\" >> $TMP.plt
if (-e $TMP) cat $TMP >> $TMP.plt
X
# If input file is specified AND command line contains plot commands, then
# do command line args first, then plot commands in input file.
gnuplot $TMP.plt $input_files
X
if ($status == 0 && -e $outfile && ! -z $outfile) then
X # The printer is whatever printer was last specified,
X # or the default printer if none was specified.
X if ($LANG == -Limpress) then
X /usr/local/bin/ipr $LANG $printer \
X -D"jobheader $print_banner" \
X -D"pagereversal on" \
X -D"program lasergnu" $outfile
X else if ($LANG == -Lpostscript) then
X lpr $lpr_opts $printer $outfile
X endif
else
X echo "lasergnu: error in plotting or empty plot; nothing printed."
endif
X
cleanup:
rm -f $TMP* $outfile
SHAR_EOF
chmod 0644 gnuplot/lasergnu ||
echo 'restore of gnuplot/lasergnu failed'
Wc_c="`wc -c < 'gnuplot/lasergnu'`"
test 3801 -eq "$Wc_c" ||
echo 'gnuplot/lasergnu: original size 3801, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/header.mac ==============
if test -f 'gnuplot/header.mac' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/header.mac (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/header.mac (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/header.mac' &&
if1
LARGE equ 1 ; define your memory model here
X
ifdef SMALL
X ; default, so do nothing
X else
X
ifdef MEDIUM
X LARGE_CODE equ 1
X else
X
ifdef COMPACT
X LARGE_DATA equ 1
X else
X
ifdef LARGE
X LARGE_DATA equ 1
X LARGE_CODE equ 1
X
else
X %out No memory model defined--assuming SMALL
X
endif ; LARGE
endif ; COMPACT
endif ; MEDIUM
endif ; SMALL
X
X
beginproc macro procname
X
ifdef LARGE_CODE
X procname proc far
else
X procname proc near
endif ; LARGE_CODE
X
X endm ; beginproc
X
X
endif ; if1
X
X
_TEXT SEGMENT BYTE PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT WORD PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT WORD PUBLIC 'BSS'
_BSS ENDS
X
DGROUP GROUP CONST, _BSS, _DATA
X assume cs:_text, ds:dgroup, ss:dgroup, es:dgroup
X
; define X as the offset of first argument on stack frame
X
ifdef LARGE_CODE
X X equ 6 ; return offset and segment + old BP
else
X X equ 4 ; return offset + old BP
endif ; LARGE_CODE
SHAR_EOF
chmod 0666 gnuplot/header.mac ||
echo 'restore of gnuplot/header.mac failed'
Wc_c="`wc -c < 'gnuplot/header.mac'`"
test 918 -eq "$Wc_c" ||
echo 'gnuplot/header.mac: original size 918, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/readline.c ==============
if test -f 'gnuplot/readline.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/readline.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/readline.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/readline.c' &&
/* GNUPLOT - readline.c */
/*
X * Copyright (C) 1986, 1987, 1990, 1991 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 * Tom Tkacik
X *
X * Msdos port and some enhancements:
X * Gershon Elber and many others.
X *
X * Send your comments or suggestions to
X * pixar!info-g...@sun.com.
X * This is a mailing list; to join it send a note to
X * pixar!info-gnupl...@sun.com.
X * Send bug reports to
X * pixar!bug-g...@sun.com.
X */
X
#ifdef READLINE
X
/* a small portable version of GNU's readline */
X
/* do not need any terminal capabilities except backspace,
/* and space overwrites a character */
X
/* NANO-EMACS line editing facility */
/* printable characters print as themselves (insert not overwrite) */
/* ^A moves to the beginning of the line */
/* ^B moves back a single character */
/* ^E moves to the end of the line */
/* ^F moves forward a single character */
/* ^K kills from current position to the end of line */
/* ^P moves back through history */
/* ^N moves forward through history */
/* ^H and DEL delete the previous character */
/* ^D deletes the current character, or EOF if line is empty */
/* ^L/^R redraw line in case it gets trashed */
/* ^U kills the entire line */
/* ^W kills last word */
/* LF and CR return the entire line regardless of the cursor postition */
/* EOF with an empty line returns (char *)NULL */
X
/* all other characters are ignored */
X
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
X
/* SIGTSTP defines job control */
/* if there is job control then we need termios.h instead of termio.h */
#ifdef SIGTSTP
#define TERMIOS
#endif
X
X
#ifndef MSDOS
X
/* UNIX specific stuff */
#ifdef TERMIOS
#include <termios.h>
static struct termios orig_termio, rl_termio;
#else
#include <termio.h>
static struct termio orig_termio, rl_termio;
#endif /* TERMIOS */
static int term_set = 0; /* =1 if rl_termio set */
X
#else
X
/* MSDOS specific stuff */
#define getc(stdin) msdos_getch()
static char msdos_getch();
X
#endif /* MSDOS */
X
X
/* is it <string.h> or <strings.h>? just declare what we need */
extern int strlen();
extern char *strcpy();
extern char *malloc();
X
#define MAXBUF 1024
#define BACKSPACE 0x08 /* ^H */
#define SPACE ' '
X
struct hist {
X char *line;
X struct hist *prev;
X struct hist *next;
};
X
static struct hist *history = NULL; /* no history yet */
static struct hist *cur_entry = NULL;
X
static char cur_line[MAXBUF]; /* current contents of the line */
static int cur_pos = 0; /* current position of the cursor */
static int max_pos = 0; /* maximum character position */
X
X
void add_history();
static void fix_line();
static void redraw_line();
static void clear_line();
static void clear_eoline();
static void copy_line();
static void set_termio();
static void reset_termio();
X
char *
readline(prompt)
char *prompt;
{
X
X char cur_char;
X char *new_line;
X
X /* set the termio so we can do our own input processing */
X set_termio();
X
X /* print the prompt */
X fputs(prompt, stderr);
X cur_line[0] = '\0';
X cur_pos = 0;
X max_pos = 0;
X cur_entry = NULL;
X
X /* get characters */
X for(;;) {
X cur_char = getc(stdin);
X if(isprint(cur_char)) {
X int i;
X for(i=max_pos; i>cur_pos; i--) {
X cur_line[i] = cur_line[i-1];
X }
X putc(cur_char, stderr);
X cur_line[cur_pos] = cur_char;
X cur_pos += 1;
X max_pos += 1;
X if (cur_pos < max_pos)
X fix_line();
X cur_line[max_pos] = '\0';
X
X /* else interpret unix terminal driver characters */
#ifdef VERASE
X } else if(cur_char == orig_termio.c_cc[VERASE] ){ /* DEL? */
X if(cur_pos > 0) {
X int i;
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X for(i=cur_pos; i<max_pos; i++)
X cur_line[i] = cur_line[i+1];
X max_pos -= 1;
X fix_line();
X }
#endif /* VERASE */
#ifdef VEOF
X } else if(cur_char == orig_termio.c_cc[VEOF] ){ /* ^D? */
X if(max_pos == 0) {
X reset_termio();
X return((char *)NULL);
X }
X if((cur_pos < max_pos)&&(cur_char == 004)) { /* ^D */
X int i;
X for(i=cur_pos; i<max_pos; i++)
X cur_line[i] = cur_line[i+1];
X max_pos -= 1;
X fix_line();
X }
#endif /* VEOF */
#ifdef VKILL
X } else if(cur_char == orig_termio.c_cc[VKILL] ){ /* ^U? */
X clear_line(prompt);
#endif /* VKILL */
#ifdef VWERASE
X } else if(cur_char == orig_termio.c_cc[VWERASE] ){ /* ^W? */
X while((cur_pos > 0) &&
X (cur_line[cur_pos-1] == SPACE)) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X while((cur_pos > 0) &&
X (cur_line[cur_pos-1] != SPACE)) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X clear_eoline();
X max_pos = cur_pos;
#endif /* VWERASE */
#ifdef VREPRINT
X } else if(cur_char == orig_termio.c_cc[VREPRINT] ){ /* ^R? */
X putc('\n',stderr); /* go to a fresh line */
X redraw_line(prompt);
#else
#ifdef VRPRNT /* on Ultrix VREPRINT is VRPRNT */
X } else if(cur_char == orig_termio.c_cc[VRPRNT] ){ /* ^R? */
X putc('\n',stderr); /* go to a fresh line */
X redraw_line(prompt);
#endif /* VRPRNT */
#endif /* VREPRINT */
#ifdef VSUSP
X } else if(cur_char == orig_termio.c_cc[VSUSP]) {
X reset_termio();
X kill(0, SIGTSTP);
X
X /* process stops here */
X
X set_termio();
X /* print the prompt */
X redraw_line(prompt);
#endif /* VSUSP */
X } else {
X /* do normal editing commands */
X /* some of these are also done above */
X int i;
X switch(cur_char) {
X case EOF:
X reset_termio();
X return((char *)NULL);
X case 001: /* ^A */
X while(cur_pos > 0) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X break;
X case 002: /* ^B */
X if(cur_pos > 0) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X break;
X case 005: /* ^E */
X while(cur_pos < max_pos) {
X putc(cur_line[cur_pos], stderr);
X cur_pos += 1;
X }
X break;
X case 006: /* ^F */
X if(cur_pos < max_pos) {
X putc(cur_line[cur_pos], stderr);
X cur_pos += 1;
X }
X break;
X case 013: /* ^K */
X clear_eoline();
X max_pos = cur_pos;
X break;
X case 020: /* ^P */
X if(history != NULL) {
X if(cur_entry == NULL) {
X cur_entry = history;
X clear_line(prompt);
X copy_line(cur_entry->line);
X } else if(cur_entry->prev != NULL) {
X cur_entry = cur_entry->prev;
X clear_line(prompt);
X copy_line(cur_entry->line);
X }
X }
X break;
X case 016: /* ^N */
X if(cur_entry != NULL) {
X cur_entry = cur_entry->next;
X clear_line(prompt);
X if(cur_entry != NULL)
X copy_line(cur_entry->line);
X else
X cur_pos = max_pos = 0;
X }
X break;
X case 014: /* ^L */
X case 022: /* ^R */
X putc('\n',stderr); /* go to a fresh line */
X redraw_line(prompt);
X break;
X case 0177: /* DEL */
X case 010: /* ^H */
X if(cur_pos > 0) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X for(i=cur_pos; i<max_pos; i++)
X cur_line[i] = cur_line[i+1];
X max_pos -= 1;
X fix_line();
X }
X break;
X case 004: /* ^D */
X if(max_pos == 0) {
X reset_termio();
X return((char *)NULL);
X }
X if(cur_pos < max_pos) {
X for(i=cur_pos; i<max_pos; i++)
X cur_line[i] = cur_line[i+1];
X max_pos -= 1;
X fix_line();
X }
X break;
X case 025: /* ^U */
X clear_line(prompt);
X break;
X case 027: /* ^W */
SHAR_EOF
true || echo 'restore of gnuplot/readline.c failed'
fi
echo 'End of part 11'
echo 'File gnuplot/readline.c is continued in part 12'
echo 12 > _shar_seq_.tmp
#!/bin/sh
# this is Part.12 (part 12 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/readline.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 12; 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/readline.c'
else
echo 'x - continuing file gnuplot/readline.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/readline.c' &&
X while((cur_pos > 0) &&
X (cur_line[cur_pos-1] == SPACE)) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X while((cur_pos > 0) &&
X (cur_line[cur_pos-1] != SPACE)) {
X cur_pos -= 1;
X putc(BACKSPACE, stderr);
X }
X clear_eoline();
X max_pos = cur_pos;
X break;
X break;
X case '\n': /* ^J */
X case '\r': /* ^M */
X cur_line[max_pos+1] = '\0';
X putc('\n', stderr);
X new_line = malloc(strlen(cur_line)+1);
X strcpy(new_line,cur_line);
X reset_termio();
X return(new_line);
X default:
X break;
X }
X }
X }
}
X
/* fix up the line from cur_pos to max_pos */
/* do not need any terminal capabilities except backspace,
/* and space overwrites a character */
static void
fix_line()
{
X int i;
X
X /* write tail of string */
X for(i=cur_pos; i<max_pos; i++)
X putc(cur_line[i], stderr);
X
X /* write a space at the end of the line in case we deleted one */
X putc(SPACE, stderr);
X
X /* backup to original position */
X for(i=max_pos+1; i>cur_pos; i--)
X putc(BACKSPACE, stderr);
X
}
X
/* redraw the entire line, putting the cursor where it belongs */
static void
redraw_line(prompt)
char *prompt;
{
X int i;
X
X fputs(prompt, stderr);
X fputs(cur_line, stderr);
X
X /* put the cursor where it belongs */
X for(i=max_pos; i>cur_pos; i--)
X putc(BACKSPACE, stderr);
}
X
/* clear cur_line and the screen line */
static void
clear_line(prompt)
char *prompt;
{
X int i;
X for(i=0; i<max_pos; i++)
X cur_line[i] = '\0';
X
X for(i=cur_pos; i>0; i--)
X putc(BACKSPACE, stderr);
X
X for(i=0; i<max_pos; i++)
X putc(SPACE, stderr);
X
X putc('\r', stderr);
X fputs(prompt, stderr);
X
X cur_pos = 0;
X max_pos = 0;
}
X
/* clear to end of line and the screen end of line */
static void
clear_eoline(prompt)
char *prompt;
{
X int i;
X for(i=cur_pos; i<max_pos; i++)
X cur_line[i] = '\0';
X
X for(i=cur_pos; i<max_pos; i++)
X putc(SPACE, stderr);
X for(i=cur_pos; i<max_pos; i++)
X putc(BACKSPACE, stderr);
}
X
/* copy line to cur_line, draw it and set cur_pos and max_pos */
static void
copy_line(line)
char *line;
{
X strcpy(cur_line, line);
X fputs(cur_line, stderr);
X cur_pos = max_pos = strlen(cur_line);
}
X
/* add line to the history */
void
add_history(line)
char *line;
{
X struct hist *entry;
X entry = (struct hist *)malloc(sizeof(struct hist));
X entry->line = malloc((unsigned int)strlen(line)+1);
X strcpy(entry->line, line);
X
X entry->prev = history;
X entry->next = NULL;
X if(history != NULL) {
X history->next = entry;
X }
X history = entry;
}
X
#ifdef MSDOS
X
/* Convert Arrow keystrokes to Control characters: */
static char
msdos_getch()
{
X char c = getch();
X
X if (c == 0) {
X c = getch(); /* Get the extended code. */
X switch (c) {
X case 75: /* Left Arrow. */
X c = 002;
X break;
X case 77: /* Right Arrow. */
X c = 006;
X break;
X case 72: /* Up Arrow. */
X c = 020;
X break;
X case 80: /* Down Arrow. */
X c = 016;
X break;
X case 115: /* Ctl Left Arrow. */
X case 71: /* Home */
X c = 001;
X break;
X case 116: /* Ctl Right Arrow. */
X case 79: /* End */
X c = 005;
X break;
X case 83: /* Delete */
X c = 004;
X break;
X default:
X c = 0;
X break;
X }
X }
X else if (c == 033) { /* ESC */
X c = 025;
X }
X
X
X return c;
}
X
#endif /* MSDOS */
X
/* set termio so we can do our own input processing */
static void
set_termio()
{
#ifndef MSDOS
X if(term_set == 0) {
#ifdef TERMIOS
#ifdef TCGETS
X ioctl(0, TCGETS, &orig_termio);
#else
X tcgetattr(0, &orig_termio);
#endif /* TCGETS */
#else
X ioctl(0, TCGETA, &orig_termio);
#endif /* TERMIOS */
X rl_termio = orig_termio;
X
X rl_termio.c_iflag &= ~(BRKINT|PARMRK|INPCK|IUCLC|IXON|IXOFF);
X rl_termio.c_iflag |= (IGNBRK|IGNPAR);
X
X rl_termio.c_oflag &= ~(ONOCR);
X
X rl_termio.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|NOFLSH);
X rl_termio.c_lflag |= (ISIG);
X
X rl_termio.c_cc[VMIN] = 1;
X rl_termio.c_cc[VTIME] = 0;
X
#ifdef VSUSP
X /* disable suspending process on ^Z */
X rl_termio.c_cc[VSUSP] = 0;
#endif /* VSUSP */
X
#ifdef TERMIOS
#ifdef TCSETSW
X ioctl(0, TCSETSW, &rl_termio);
#else
X tcsetattr(0, TCSADRAIN, &rl_termio);
#endif /* TCSETSW */
#else
X ioctl(0, TCSETAW, &rl_termio);
#endif /* TERMIOS */
X term_set = 1;
X }
#endif /* MSDOS */
}
X
static void
reset_termio()
{
#ifndef MSDOS
X if(term_set == 1) {
#ifdef TERMIOS
#ifdef TCSETSW
X ioctl(0, TCSETSW, &orig_termio);
#else
X tcsetattr(0, TCSADRAIN, &orig_termio);
#endif /* TCSETSW */
#else
X ioctl(0, TCSETAW, &orig_termio);
#endif /* TERMIOS */
X term_set = 0;
X }
#endif /* MSDOS */
}
#endif /* READLINE */
SHAR_EOF
echo 'File gnuplot/readline.c is complete' &&
chmod 0644 gnuplot/readline.c ||
echo 'restore of gnuplot/readline.c failed'
Wc_c="`wc -c < 'gnuplot/readline.c'`"
test 12274 -eq "$Wc_c" ||
echo 'gnuplot/readline.c: original size 12274, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/help.h ==============
if test -f 'gnuplot/help.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/help.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/help.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/help.h' &&
/* GNUPLOT - help.h */
/* Exit status returned by help() */
#define H_FOUND 0 /* found the keyword */
#define H_NOTFOUND 1 /* didn't find the keyword */
#define H_ERROR (-1) /* didn't find the help file */
X
extern void FreeHelp(); /* use this if you need memory */
SHAR_EOF
chmod 0666 gnuplot/help.h ||
echo 'restore of gnuplot/help.h failed'
Wc_c="`wc -c < 'gnuplot/help.h'`"
test 1383 -eq "$Wc_c" ||
echo 'gnuplot/help.h: original size 1383, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/hrcgraph.asm ==============
if test -f 'gnuplot/hrcgraph.asm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/hrcgraph.asm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/hrcgraph.asm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/hrcgraph.asm' &&
TITLE Hercules graphics module
X
; Michael Gordon - 8-Dec-86
;
; Certain routines were taken from the Hercules BIOS of Dave Tutelman - 8/86
; Others came from pcgraph.asm included in GNUPLOT by Colin Kelley
;
; modified slightly by Colin Kelley - 22-Dec-86
; added header.mac, parameterized declarations
; added dgroup: in HVmodem to reach HCh_Parms and HGr_Parms - 30-Jan-87
; modified by Russell Lang 3 Jun 1988
; added H_init
X
include header.mac
X
if1
include lineproc.mac
endif
X
X
GPg1_Base equ 0B800h ; Graphics page 1 base address
X
_text segment
X
X public _H_line, _H_color, _H_mask, _HVmode, _H_puts
X public _H_init
X
HCfg_Switch equ 03BFH ; Configuration Switch - software switch
X ; to select graphics card memory map
X
beginproc _H_init
X mov al, 03H ; allow graphics in b8000:bffff
X mov dx, HCfg_Switch
X out dx, al
X ret
_H_init endp
X
hpixel proc near
X ror word ptr bmask,1
X jc cont
X ret
cont:
X push ax
X push bx
X push cx
X push dx
X push si
X mov cx,ax ; x
X mov dx,bx ; y
;
; [couldn't this be done faster with a lookup table? -cdk]
;
X ; first compute the address of byte to be modified
X ; = 90*[row/4] + [col/8] + 2^D*[row/4] + 2^F*page
X mov bh,cl ; col (low order) in BH
X mov bl,dl ; row (low order) in BL
X and bx,0703H ; mask the col & row remainders
IFDEF iAPX286
X shr cx,3 ; col / 8
X shr dx,2 ; row / 4
X mov al,90
X mul dx ; AX = 90*[ row/4 ]
X add ax,cx ; ... + col/8
X shl bl,5 ; align row remainder
ELSE ; same as above, obscure but fast for 8086
X shr cx,1 ; divide col by 8
X shr cx,1
X shr cx,1
X shr dx,1 ; divide row by 4
X shr dx,1
X shl dx,1 ; begin fast multiply by 90 (1011010 B)
X mov ax,dx
X shl dx,1
X shl dx,1
X add ax,dx
X shl dx,1
X add ax,dx
X shl dx,1
X shl dx,1
X add ax,dx ; end fast multiply by 90
X add ax,cx ; add on the col/8
X shl bl,1 ; align row remainder
X shl bl,1
X shl bl,1
X shl bl,1
X shl bl,1
ENDIF
X add ah,bl ; use aligned row remainder
end_adr_calc: ; address of byte is now in AX
X mov dx,GPg1_Base ; base of pixel display to DX
X mov es,dx ; ...and thence to segment reg
X mov si,ax ; address of byte w/ pixel to index reg
X mov cl,bh ; bit addr in byte
X mov al,80H ; '1000 0000' in AL
X shr al,cl ; shift mask to line up with bit to read/write
set_pix: ; set the pixel
X or es:[si],al ; or the mask with the right byte
X pop si
X pop dx
X pop cx
X pop bx
X pop ax
X ret
hpixel endp
X
lineproc _H_line, hpixel
X
;
; clear - clear page 1 of the screen buffer to zero (effectively, blank
; the screen)
;
clear proc near
X push es
X push ax
X push cx
X push di
X mov ax, GPg1_Base
X mov es, ax
X xor di, di
X mov cx, 4000h
X xor ax, ax
X cld
X rep stosw ; zero out screen page
X pop di
X pop cx
X pop ax
X pop es
X ret
clear endp
X
beginproc _H_color
X push bp
X mov bp,sp
X mov al,[bp+X] ; color
X mov byte ptr color,al
X pop bp
X ret
_H_color endp
X
beginproc _H_mask
X push bp
X mov bp,sp
X mov ax,[bp+X] ; mask
X mov word ptr bmask,ax
X pop bp
X ret
_H_mask endp
X
HCtrl_Port equ 03B8H ; Hercules 6845 control port IO addr
HIndx_Port equ 03B4H ; Hercules 6845 index port IO addr
HScrn_Enable equ 008h ; Control port bit to enable video
HCh_Mode equ 020h ; Character output mode
HGr_Mode equ 082h ; Graphics output mode page 1
X
parm_count equ 12
X
beginproc _HVmode
X push bp
X mov bp, sp
X push si
X mov ax, [bp+X]
X or ah, al
X mov al, HCh_Mode ; Assume character mode is wanted
X mov si, offset dgroup:HCh_Parms
X cmp ah, 0 ; nonzero means switch to graphics
X jz vmode_ok
X call near ptr clear ; clear the graphics page
X mov al, HGr_Mode
X mov si, offset dgroup:HGr_Parms
vmode_ok:
X mov dx, HCtrl_Port
X out dx, al ; Set Hercules board to proper mode
X call near ptr setParms ; Set the 6845 parameters
X or al, HScrn_Enable ; Enable the video output
X out dx, al
X pop si
X pop bp
X ret
_HVmode endp
X
setParms proc near ; Send 6845 parms to Hercules board
X push ax
X push dx
X push si
X mov dx, HIndx_Port ; Index port addr -> DX
X mov ah, 0 ; 0 -> parameter counter
sp_loop:
X mov al, ah
X out dx, al ; output to 6845 addr register
X inc dx ; next output to data register
X mov al, [si] ; next control byte -> al
X inc si
X out dx, al ; output control byte
X dec dx ; 6845 index addr -> dx
X inc ah ; bump addr
X cmp ah, parm_count
X jnz sp_loop
X pop si
X pop dx
X pop ax
X ret
setParms endp
X
; H_puts - print text in graphics mode
;
; cx = row
; bx = column
; si = address of string (null terminated) to print
X
beginproc _H_puts
X push bp
X mov bp, sp
X push si
X push ds
X mov si, [bp+X] ; string offset
X
ifdef LARGE_DATA
X mov ds, [bp+X+2] ; string segment
X mov cx, [bp+X+4] ; row
X mov bx, [bp+X+6] ; col
else
X mov cx, [bp+X+2] ; row
X mov bx, [bp+X+4] ; col
endif
X
ploop: lodsb ; get next char
X or al, al ; end of display?
X je pdone
X call near ptr display
X inc bx ; bump to next column
X jmp ploop
pdone: pop ds
X pop si
X pop bp
X ret
_H_puts endp
X
;
; display - output an 8x8 character from the IBM ROM to the Herc board
;
; AX = char, BX = column (0-89), CX = row(0-42) ** all preserved **
;
CON8 db 8
CON180 db 180
IBMROM equ 0F000h
CHARTAB equ 0FA6Eh
X
display proc near
X push ds ; save the lot
X push es
X push ax
X push bx
X push cx
X push dx
X push si
X push di
X
; setup ds -> IBM ROM, and si -> index into IBM ROM character table located
; at 0fa6eh in the ROM
X
X and ax, 07fh
X mul cs:CON8 ; mult by 8 bytes of table per char
X mov si, ax
X mov ax, IBMROM
X mov ds, ax
X assume ds:nothing
X add si, CHARTAB ; add offset of character table
X
; compute index into Hercules screen memory for scan line 0. The remaining
; seven scan lines are all at fixed offsets from the first.
;
; Since graphics mode treats the screen as sets of 16x4 "characters",
; we need to map an 8x8 real character onto the front or back of
; a pair of graphics "characters". The first four scan lines of our
; 8x8 character will map to the top graphics "character", and the second
; four scan lines map to the graphics character on the "line" (4 scan
; lines high) below it.
;
; For some exotic hardware reason (probably speed), all scan line 0
; bits (i.e. every fourth scan line) are stored in memory locations
; 0-2000h in the screen buffer. All scan line 1 bits are stored
; 2000h-4000h. Within these banks, they are stored by rows. The first
; scan line on the screen (scan line 0 of graphics character row 0)
; is the first 45 words of memory in the screen buffer. The next 45
; words are the first scan line graphics row 1, and since graphics
; "characters" are 4 bits high, this second scan line is physically
; the fifth scan line displayed on the screen.
;
; SO, to display an 8x8 character, the 1st and 5th rows of dots are
; both scan line 0 of the graphics "character", the 2nd and 6th are
; scan line 1, and so on.
;
; The column (0-89) tells which byte in a scan line we need to load.
; Since it takes two rows of graphics characters to hold one row of
; our characters, column+90 is a index to scan line 4 rows of pixels
; higher (n+4). Thus 180 bytes of screen memory in any bank (0h, 2000h,
; 4000h, 6000h) represent a row of 8x8 characters.
;
; The starting location in screen memory for the first scan line of
; a character to be displayed will be: (row*180)+column
; The 5th scan line will be at: (row*180)+column+90
;
; The second and 6th scan lines will be at the above offsets plus
; the bank offset of 2000h. The third and 7th, add 4000h and finally
; the 4th and 8th, add 6000h.
;
X mov ax, GPg1_Base
X mov es, ax ; es = hercules page 0
X mov ax, cx ; get row
X mul cs:CON180 ; mult by 180(10)
X mov di, ax ; di = index reg
X cld ; insure right direction
X
;output 8 segments of character to video ram
X
X lodsb ; line 0
X mov es:[di+bx], al
X lodsb
X mov es:[di+bx+2000h], al ; line 1
X lodsb
X mov es:[di+bx+4000h], al ; line 2
X lodsb
X mov es:[di+bx+6000h], al ; line 3
X lodsb
X mov es:[di+bx+90], al ; line 4
X lodsb
X mov es:[di+bx+2000h+90], al ; line 5
X lodsb
X mov es:[di+bx+4000h+90], al ; line 6
X lodsb
X mov es:[di+bx+6000h+90], al ; line 7
X
X pop di
X pop si
X pop dx
X pop cx
X pop bx
X pop ax
X pop es
X pop ds
X ret
display endp
X
_text ends
X
_data segment
bmask dw -1
color db 1
_data ends
X
const segment
HCh_Parms db 61H, 50H, 52H, 0FH, 19H, 06H, 19H, 19H, 02H, 0DH, 0BH, 0CH
HGr_Parms db 35H, 2DH, 2EH, 07H, 5BH, 02H, 57H, 57H, 02H, 03H, 00H, 00H
const ends
X
X end
X
X
SHAR_EOF
chmod 0666 gnuplot/hrcgraph.asm ||
echo 'restore of gnuplot/hrcgraph.asm failed'
Wc_c="`wc -c < 'gnuplot/hrcgraph.asm'`"
test 8192 -eq "$Wc_c" ||
echo 'gnuplot/hrcgraph.asm: original size 8192, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/internal.c ==============
if test -f 'gnuplot/internal.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/internal.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/internal.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/internal.c' &&
/* GNUPLOT - internal.c */
#include <math.h>
#include <stdio.h>
#include "plot.h"
X
BOOLEAN undefined;
X
char *strcpy();
X
struct value *pop(), *complex(), *integer();
double magnitude(), angle(), real();
X
struct value stack[STACK_DEPTH];
X
int s_p = -1; /* stack pointer */
X
X
/*
X * System V and MSC 4.0 call this when they wants to print an error message.
X * Don't!
X */
#ifdef MSDOS
#ifdef __TURBOC__
int matherr() /* Turbo C */
#else
int matherr(x) /* MSC 5.1 */
struct exception *x;
#endif /* TURBOC */
#else /* not MSDOS */
#ifdef apollo
int matherr(struct exception *x) /* apollo */
#else /* apollo */
#ifdef AMIGA_LC_5_1
int matherr(x) /* AMIGA_LC_5_1 */
struct exception *x;
#else /* Most everyone else (not apollo). */
int matherr()
#endif /* AMIGA_LC_5_1 */
#endif /* apollo */
#endif /* MSDOS */
{
X return (undefined = TRUE); /* don't print error message */
}
X
X
reset_stack()
{
X s_p = -1;
}
X
X
check_stack() /* make sure stack's empty */
{
X if (s_p != -1)
X fprintf(stderr,"\nwarning: internal error--stack not empty!\n");
}
X
X
struct value *pop(x)
struct value *x;
{
X if (s_p < 0 )
X int_error("stack underflow",NO_CARET);
X *x = stack[s_p--];
X return(x);
}
X
X
push(x)
struct value *x;
{
X if (s_p == STACK_DEPTH - 1)
X int_error("stack overflow",NO_CARET);
X stack[++s_p] = *x;
}
X
X
#define ERR_VAR "undefined variable: "
X
f_push(x)
union argument *x; /* contains pointer to value to push; */
{
static char err_str[sizeof(ERR_VAR) + MAX_ID_LEN] = ERR_VAR;
struct udvt_entry *udv;
X
X udv = x->udv_arg;
X if (udv->udv_undef) { /* undefined */
X (void) strcpy(&err_str[sizeof(ERR_VAR) - 1], udv->udv_name);
X int_error(err_str,NO_CARET);
X }
X push(&(udv->udv_value));
}
X
X
f_pushc(x)
union argument *x;
{
X push(&(x->v_arg));
}
X
X
f_pushd1(x)
union argument *x;
{
X push(&(x->udf_arg->dummy_values[0]));
}
X
X
f_pushd2(x)
union argument *x;
{
X push(&(x->udf_arg->dummy_values[1]));
}
X
X
#define ERR_FUN "undefined function: "
X
f_call(x) /* execute a udf */
union argument *x;
{
static char err_str[sizeof(ERR_FUN) + MAX_ID_LEN] = ERR_FUN;
register struct udft_entry *udf;
struct value save_dummy;
X
X udf = x->udf_arg;
X if (!udf->at) { /* undefined */
X (void) strcpy(&err_str[sizeof(ERR_FUN) - 1],
X udf->udf_name);
X int_error(err_str,NO_CARET);
X }
X save_dummy = udf->dummy_values[0];
X (void) pop(&(udf->dummy_values[0]));
X
X execute_at(udf->at);
X udf->dummy_values[0] = save_dummy;
}
X
f_call2(x) /* execute a udf of two variables */
union argument *x;
{
static char err_str[sizeof(ERR_FUN) + MAX_ID_LEN] = ERR_FUN;
register struct udft_entry *udf;
struct value save_dummy0, save_dummy1;
X
X udf = x->udf_arg;
X if (!udf->at) { /* undefined */
X (void) strcpy(&err_str[sizeof(ERR_FUN) - 1],
X udf->udf_name);
X int_error(err_str,NO_CARET);
X }
X save_dummy1 = udf->dummy_values[1];
X save_dummy0 = udf->dummy_values[0];
X (void) pop(&(udf->dummy_values[1]));
X (void) pop(&(udf->dummy_values[0]));
X
X execute_at(udf->at);
X udf->dummy_values[1] = save_dummy1;
X udf->dummy_values[0] = save_dummy0;
}
X
X
static int_check(v)
struct value *v;
{
X if (v->type != INT)
X int_error("non-integer passed to boolean operator",NO_CARET);
}
X
X
f_lnot()
{
struct value a;
X int_check(pop(&a));
X push(integer(&a,!a.v.int_val) );
}
X
X
f_bnot()
{
struct value a;
X int_check(pop(&a));
X push( integer(&a,~a.v.int_val) );
}
X
X
f_bool()
{ /* converts top-of-stack to boolean */
X int_check(&top_of_stack);
X top_of_stack.v.int_val = !!top_of_stack.v.int_val;
}
X
X
f_lor()
{
struct value a,b;
X int_check(pop(&b));
X int_check(pop(&a));
X push( integer(&a,a.v.int_val || b.v.int_val) );
}
X
f_land()
{
struct value a,b;
X int_check(pop(&b));
X int_check(pop(&a));
X push( integer(&a,a.v.int_val && b.v.int_val) );
}
X
X
f_bor()
{
struct value a,b;
X int_check(pop(&b));
X int_check(pop(&a));
X push( integer(&a,a.v.int_val | b.v.int_val) );
}
X
X
f_xor()
{
struct value a,b;
X int_check(pop(&b));
X int_check(pop(&a));
X push( integer(&a,a.v.int_val ^ b.v.int_val) );
}
X
X
f_band()
{
struct value a,b;
X int_check(pop(&b));
X int_check(pop(&a));
X push( integer(&a,a.v.int_val & b.v.int_val) );
}
X
X
f_uminus()
{
struct value a;
X (void) pop(&a);
X switch(a.type) {
X case INT:
X a.v.int_val = -a.v.int_val;
X break;
X case CMPLX:
X a.v.cmplx_val.real =
X -a.v.cmplx_val.real;
X a.v.cmplx_val.imag =
X -a.v.cmplx_val.imag;
X }
X push(&a);
}
X
X
f_eq() /* note: floating point equality is rare because of roundoff error! */
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val ==
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val ==
X b.v.cmplx_val.real &&
X b.v.cmplx_val.imag == 0.0);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (b.v.int_val == a.v.cmplx_val.real &&
X a.v.cmplx_val.imag == 0.0);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real==
X b.v.cmplx_val.real &&
X a.v.cmplx_val.imag==
X b.v.cmplx_val.imag);
X }
X }
X push(integer(&a,result));
}
X
X
f_ne()
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val !=
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val !=
X b.v.cmplx_val.real ||
X b.v.cmplx_val.imag != 0.0);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (b.v.int_val !=
X a.v.cmplx_val.real ||
X a.v.cmplx_val.imag != 0.0);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real !=
X b.v.cmplx_val.real ||
X a.v.cmplx_val.imag !=
X b.v.cmplx_val.imag);
X }
X }
X push(integer(&a,result));
}
X
X
f_gt()
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val >
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val >
X b.v.cmplx_val.real);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (a.v.cmplx_val.real >
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real >
X b.v.cmplx_val.real);
X }
X }
X push(integer(&a,result));
}
X
X
f_lt()
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val <
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val <
X b.v.cmplx_val.real);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (a.v.cmplx_val.real <
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real <
X b.v.cmplx_val.real);
X }
X }
X push(integer(&a,result));
}
X
X
f_ge()
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val >=
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val >=
X b.v.cmplx_val.real);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (a.v.cmplx_val.real >=
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real >=
X b.v.cmplx_val.real);
X }
X }
X push(integer(&a,result));
}
X
X
f_le()
{
struct value a, b;
X register int result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X result = (a.v.int_val <=
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.int_val <=
X b.v.cmplx_val.real);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X result = (a.v.cmplx_val.real <=
X b.v.int_val);
X break;
X case CMPLX:
X result = (a.v.cmplx_val.real <=
X b.v.cmplx_val.real);
X }
X }
X push(integer(&a,result));
}
X
X
f_plus()
{
struct value a, b, result;
X (void) pop(&b);
X (void) pop(&a);
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X (void) integer(&result,a.v.int_val +
X b.v.int_val);
X break;
X case CMPLX:
X (void) complex(&result,a.v.int_val +
X b.v.cmplx_val.real,
X b.v.cmplx_val.imag);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X (void) complex(&result,b.v.int_val +
X a.v.cmplx_val.real,
X a.v.cmplx_val.imag);
X break;
X case CMPLX:
X (void) complex(&result,a.v.cmplx_val.real+
X b.v.cmplx_val.real,
X a.v.cmplx_val.imag+
X b.v.cmplx_val.imag);
X }
X }
X push(&result);
}
X
X
f_minus()
{
struct value a, b, result;
X (void) pop(&b);
X (void) pop(&a); /* now do a - b */
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X (void) integer(&result,a.v.int_val -
X b.v.int_val);
X break;
X case CMPLX:
X (void) complex(&result,a.v.int_val -
X b.v.cmplx_val.real,
X -b.v.cmplx_val.imag);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X (void) complex(&result,a.v.cmplx_val.real -
X b.v.int_val,
X a.v.cmplx_val.imag);
X break;
X case CMPLX:
X (void) complex(&result,a.v.cmplx_val.real-
X b.v.cmplx_val.real,
X a.v.cmplx_val.imag-
X b.v.cmplx_val.imag);
X }
X }
X push(&result);
}
X
X
f_mult()
{
struct value a, b, result;
X (void) pop(&b);
X (void) pop(&a); /* now do a*b */
X
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X (void) integer(&result,a.v.int_val *
X b.v.int_val);
X break;
X case CMPLX:
X (void) complex(&result,a.v.int_val *
X b.v.cmplx_val.real,
X a.v.int_val *
X b.v.cmplx_val.imag);
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X (void) complex(&result,b.v.int_val *
X a.v.cmplx_val.real,
X b.v.int_val *
X a.v.cmplx_val.imag);
X break;
X case CMPLX:
X (void) complex(&result,a.v.cmplx_val.real*
X b.v.cmplx_val.real-
X a.v.cmplx_val.imag*
X b.v.cmplx_val.imag,
X a.v.cmplx_val.real*
X b.v.cmplx_val.imag+
X a.v.cmplx_val.imag*
X b.v.cmplx_val.real);
X }
X }
X push(&result);
}
X
X
f_div()
{
struct value a, b, result;
register double square;
X (void) pop(&b);
X (void) pop(&a); /* now do a/b */
X
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X if (b.v.int_val)
X (void) integer(&result,a.v.int_val /
X b.v.int_val);
X else {
X (void) integer(&result,0);
X undefined = TRUE;
X }
X break;
X case CMPLX:
X square = b.v.cmplx_val.real*
X b.v.cmplx_val.real +
X b.v.cmplx_val.imag*
X b.v.cmplx_val.imag;
X if (square)
X (void) complex(&result,a.v.int_val*
X b.v.cmplx_val.real/square,
X -a.v.int_val*
X b.v.cmplx_val.imag/square);
X else {
X (void) complex(&result,0.0,0.0);
X undefined = TRUE;
X }
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X if (b.v.int_val)
X
X (void) complex(&result,a.v.cmplx_val.real/
X b.v.int_val,
X a.v.cmplx_val.imag/
X b.v.int_val);
X else {
X (void) complex(&result,0.0,0.0);
X undefined = TRUE;
X }
X break;
X case CMPLX:
X square = b.v.cmplx_val.real*
X b.v.cmplx_val.real +
X b.v.cmplx_val.imag*
X b.v.cmplx_val.imag;
X if (square)
X (void) complex(&result,(a.v.cmplx_val.real*
X b.v.cmplx_val.real+
X a.v.cmplx_val.imag*
X b.v.cmplx_val.imag)/square,
X (a.v.cmplx_val.imag*
X b.v.cmplx_val.real-
X a.v.cmplx_val.real*
X b.v.cmplx_val.imag)/
X square);
X else {
X (void) complex(&result,0.0,0.0);
X undefined = TRUE;
X }
X }
X }
X push(&result);
}
X
X
f_mod()
{
struct value a, b;
X (void) pop(&b);
X (void) pop(&a); /* now do a%b */
X
X if (a.type != INT || b.type != INT)
X int_error("can only mod ints",NO_CARET);
X if (b.v.int_val)
X push(integer(&a,a.v.int_val % b.v.int_val));
X else {
X push(integer(&a,0));
X undefined = TRUE;
X }
}
X
X
f_power()
{
struct value a, b, result;
register int i, t, count;
register double mag, ang;
X (void) pop(&b);
X (void) pop(&a); /* now find a**b */
X
X switch(a.type) {
X case INT:
X switch (b.type) {
X case INT:
X count = abs(b.v.int_val);
X t = 1;
X for(i = 0; i < count; i++)
X t *= a.v.int_val;
X if (b.v.int_val >= 0)
X (void) integer(&result,t);
X else
X if (t != 0)
X (void) complex(&result,1.0/t,0.0);
X else {
X undefined = TRUE;
X (void) complex(&result, 0.0, 0.0);
X }
X break;
X case CMPLX:
X mag =
X pow(magnitude(&a),fabs(b.v.cmplx_val.real));
X if (b.v.cmplx_val.real < 0.0)
X if (mag != 0.0)
X mag = 1.0/mag;
X else
X undefined = TRUE;
X mag *= exp(-b.v.cmplx_val.imag*angle(&a));
X ang = b.v.cmplx_val.real*angle(&a) +
X b.v.cmplx_val.imag*log(magnitude(&a));
X (void) complex(&result,mag*cos(ang),
X mag*sin(ang));
X }
X break;
X case CMPLX:
X switch (b.type) {
X case INT:
X if (a.v.cmplx_val.imag == 0.0) {
X mag = pow(a.v.cmplx_val.real,(double)abs(b.v.int_val));
X if (b.v.int_val < 0)
X if (mag != 0.0)
X mag = 1.0/mag;
X else
X undefined = TRUE;
X (void) complex(&result,mag,0.0);
X }
X else {
X /* not so good, but...! */
X mag = pow(magnitude(&a),(double)abs(b.v.int_val));
X if (b.v.int_val < 0)
X if (mag != 0.0)
X mag = 1.0/mag;
X else
X undefined = TRUE;
X ang = angle(&a)*b.v.int_val;
X (void) complex(&result,mag*cos(ang),
X mag*sin(ang));
X }
X break;
X case CMPLX:
X mag = pow(magnitude(&a),fabs(b.v.cmplx_val.real));
X if (b.v.cmplx_val.real < 0.0)
X if (mag != 0.0)
X mag = 1.0/mag;
X else
X undefined = TRUE;
X mag *= exp(-b.v.cmplx_val.imag*angle(&a));
X ang = b.v.cmplx_val.real*angle(&a) +
X b.v.cmplx_val.imag*log(magnitude(&a));
X (void) complex(&result,mag*cos(ang),
X mag*sin(ang));
X }
X }
X push(&result);
}
X
X
f_factorial()
{
struct value a;
register int i;
register double val;
X
X (void) pop(&a); /* find a! (factorial) */
X
X switch (a.type) {
X case INT:
X val = 1.0;
X for (i = a.v.int_val; i > 1; i--) /*fpe's should catch overflows*/
X val *= i;
X break;
X default:
X int_error("factorial (!) argument must be an integer",
X NO_CARET);
X }
X
X push(complex(&a,val,0.0));
X
}
X
X
int
f_jump(x)
union argument *x;
{
X return(x->j_arg);
}
X
X
int
f_jumpz(x)
union argument *x;
{
struct value a;
X int_check(&top_of_stack);
X if (top_of_stack.v.int_val) { /* non-zero */
X (void) pop(&a);
X return 1; /* no jump */
X }
X else
X return(x->j_arg); /* leave the argument on TOS */
}
X
X
int
f_jumpnz(x)
union argument *x;
{
struct value a;
X int_check(&top_of_stack);
X if (top_of_stack.v.int_val) /* non-zero */
X return(x->j_arg); /* leave the argument on TOS */
X else {
X (void) pop(&a);
X return 1; /* no jump */
X }
}
X
X
int
f_jtern(x)
union argument *x;
{
struct value a;
X
X int_check(pop(&a));
X if (a.v.int_val)
X return(1); /* no jump; fall through to TRUE code */
X else
X return(x->j_arg); /* go jump to FALSE code */
}
SHAR_EOF
chmod 0644 gnuplot/internal.c ||
echo 'restore of gnuplot/internal.c failed'
Wc_c="`wc -c < 'gnuplot/internal.c'`"
test 16092 -eq "$Wc_c" ||
echo 'gnuplot/internal.c: original size 16092, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/command.c ==============
if test -f 'gnuplot/command.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/command.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/command.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/command.c' &&
/* GNUPLOT - command.c */
X
#ifdef AMIGA_AC_5
#include <time.h>
void sleep(); /* defined later */
#endif
X
#ifdef MSDOS
#include <process.h>
X
#ifdef __ZTC__
#define P_WAIT 0
#include <time.h> /* usleep() */
#else
X
#ifdef __TURBOC__
#include <dos.h> /* sleep() */
#include <conio.h>
extern unsigned _stklen = 16394; /* increase stack size */
X
#else /* must be MSC */
#include <time.h> /* kludge to provide sleep() */
void sleep(); /* defined later */
#endif /* TURBOC */
#endif /* ZTC */
X
#endif /* MSDOS */
X
#ifdef AMIGA_LC_5_1
#include <proto/dos.h>
void sleep();
#endif /* AMIGA_LC_5_1 */
X
#include "plot.h"
#include "setshow.h"
#include "help.h"
X
#ifndef STDOUT
#define STDOUT 1
#endif
X
#ifndef HELPFILE
#ifdef AMIGA_LC_5_1
#define HELPFILE "S:gnuplot.gih"
#else
#define HELPFILE "docs/gnuplot.gih" /* changed by makefile */
#endif
#endif
X
#define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
X
/*
X * instead of <strings.h>
X */
X
extern char *gets(),*getenv();
extern char *strcpy(),*strncpy(),*strcat();
extern int strlen(), strcmp();
X
/*
X * Only reference to contours library.
X */
extern struct gnuplot_contours *contour();
X
#if defined(unix) && !defined(hpux)
#ifdef GETCWD
extern char *getcwd(); /* some Unix's use getcwd */
#else
extern char *getwd(); /* most Unix's use getwd */
#endif
#else
extern char *getcwd(); /* Turbo C, MSC and VMS use getcwd */
#endif
X
#ifdef vms
int vms_vkid; /* Virtual keyboard id */
#endif
X
extern int chdir();
X
extern double magnitude(),angle(),real(),imag();
extern struct value *const_express(), *pop(), *complex();
extern struct at_type *temp_at(), *perm_at();
extern struct udft_entry *add_udf();
extern struct udvt_entry *add_udv();
extern void squash_spaces();
extern void lower_case();
X
/* local functions */
static enum coord_type adjustlog();
X
extern BOOLEAN interactive; /* from plot.c */
X
/* input data, parsing variables */
struct lexical_unit token[MAX_TOKENS];
char input_line[MAX_LINE_LEN+1] = "";
int num_tokens, c_token;
int inline_num = 0; /* input line number */
X
char c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; /* current dummy vars */
X
/* the curves/surfaces of the plot */
struct curve_points *first_plot = NULL;
struct surface_points *first_3dplot = NULL;
static struct udft_entry plot_func;
struct udft_entry *dummy_func;
X
/* support for replot command */
char replot_line[MAX_LINE_LEN+1] = "";
static int plot_token; /* start of 'plot' command */
X
/* If last plot was a 3d one. */
BOOLEAN is_3d_plot = FALSE;
X
com_line()
{
X read_line(PROMPT);
X
X /* So we can flag any new output: if false at time of error, */
X /* we reprint the command line before printing caret. */
X /* TRUE for interactive terminals, since the command line is typed. */
X /* FALSE for non-terminal stdin, so command line is printed anyway. */
X /* (DFK 11/89) */
X screen_ok = interactive;
X
X do_line();
}
X
X
do_line() /* also used in load_file */
{
X if (is_system(input_line[0])) {
X do_system();
X (void) fputs("!\n",stderr);
X return;
X }
X num_tokens = scanner(input_line);
X c_token = 0;
X while(c_token < num_tokens) {
X command();
X if (c_token < num_tokens) /* something after command */
X if (equals(c_token,";"))
X c_token++;
X else
X int_error("';' expected",c_token);
X }
}
X
X
X
command()
{
X int i;
X char sv_file[MAX_LINE_LEN+1];
X /* string holding name of save or load file */
X
X for (i = 0; i < MAX_NUM_VAR; i++)
X c_dummy_var[i][0] = '\0'; /* no dummy variables */
X
X if (is_definition(c_token))
X define();
X else if (almost_equals(c_token,"h$elp") || equals(c_token,"?")) {
X c_token++;
X do_help();
X }
X else if (almost_equals(c_token,"test")) {
X c_token++;
X test_term();
X }
X else if (almost_equals(c_token,"pa$use")) {
X struct value a;
X int stime, text=0;
X char buf[MAX_LINE_LEN+1];
X
X c_token++;
X stime = (int )real(const_express(&a));
X if (!(END_OF_COMMAND)) {
X if (!isstring(c_token))
X int_error("expecting string",c_token);
X else {
X quotel_str(buf,c_token);
X (void) fprintf (stderr, "%s",buf);
X text = 1;
X }
X }
X if (stime < 0) (void) fgets (buf,MAX_LINE_LEN,stdin);
X /* Hold until CR hit. */
#ifdef __ZTC__
X if (stime > 0) usleep((unsigned long) stime);
#else
X if (stime > 0) sleep((unsigned int) stime);
#endif
X if (text != 0 && stime >= 0) (void) fprintf (stderr,"\n");
X c_token++;
X screen_ok = FALSE;
X }
X else if (almost_equals(c_token,"pr$int")) {
X struct value a;
X
X c_token++;
X (void) const_express(&a);
X (void) putc('\t',stderr);
X disp_value(stderr,&a);
X (void) putc('\n',stderr);
X screen_ok = FALSE;
X }
X else if (almost_equals(c_token,"p$lot")) {
X plot_token = c_token++;
X plotrequest();
X }
X else if (almost_equals(c_token,"sp$lot")) {
X plot_token = c_token++;
X plot3drequest();
X }
X else if (almost_equals(c_token,"rep$lot")) {
X if (replot_line[0] == '\0')
X int_error("no previous plot",c_token);
X c_token++;
X replotrequest();
X }
X else if (almost_equals(c_token,"se$t"))
X set_command();
X else if (almost_equals(c_token,"sh$ow"))
X show_command();
X else if (almost_equals(c_token,"cl$ear")) {
X if (!term_init) {
X (*term_tbl[term].init)();
X term_init = TRUE;
X }
X (*term_tbl[term].graphics)();
X (*term_tbl[term].text)();
X (void) fflush(outfile);
X screen_ok = FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"she$ll")) {
X do_shell();
X screen_ok = FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"sa$ve")) {
X if (almost_equals(++c_token,"f$unctions")) {
X if (!isstring(++c_token))
X int_error("expecting filename",c_token);
X else {
X quote_str(sv_file,c_token);
X save_functions(fopen(sv_file,"w"));
X }
X }
X else if (almost_equals(c_token,"v$ariables")) {
X if (!isstring(++c_token))
X int_error("expecting filename",c_token);
X else {
X quote_str(sv_file,c_token);
X save_variables(fopen(sv_file,"w"));
X }
X }
X else if (almost_equals(c_token,"s$et")) {
X if (!isstring(++c_token))
X int_error("expecting filename",c_token);
X else {
X quote_str(sv_file,c_token);
X save_set(fopen(sv_file,"w"));
X }
X }
X else if (isstring(c_token)) {
X quote_str(sv_file,c_token);
X save_all(fopen(sv_file,"w"));
X }
X else {
X int_error(
X "filename or keyword 'functions', 'variables', or 'set' expected",
X c_token);
X }
X c_token++;
X }
X else if (almost_equals(c_token,"l$oad")) {
X if (!isstring(++c_token))
X int_error("expecting filename",c_token);
X else {
X quote_str(sv_file,c_token);
X load_file(fopen(sv_file,"r"), sv_file);
X /* input_line[] and token[] now destroyed! */
X c_token = num_tokens = 0;
X }
X }
X else if (almost_equals(c_token,"cd")) {
X if (!isstring(++c_token))
X int_error("expecting directory name",c_token);
X else {
X quotel_str(sv_file,c_token);
X if (chdir(sv_file)) {
X int_error("Can't change to this directory",c_token);
X }
X c_token++;
X }
X }
X else if (almost_equals(c_token,"pwd")) {
#if defined(unix) && !defined(hpux)
#ifdef GETCWD
X (void) getcwd(sv_file,MAX_ID_LEN); /* some Unix's use getcwd */
#else
X (void) getwd(sv_file); /* most Unix's use getwd */
#endif
#else
/* Turbo C and VMS have getcwd() */
X (void) getcwd(sv_file,MAX_ID_LEN);
#endif
X fprintf(stderr,"%s\n", sv_file);
X c_token++;
X }
X else if (almost_equals(c_token,"ex$it") ||
X almost_equals(c_token,"q$uit")) {
X done(IO_SUCCESS);
X }
X else if (!equals(c_token,";")) { /* null statement */
X int_error("invalid command",c_token);
X }
}
X
replotrequest()
{
char str[MAX_LINE_LEN+1];
X if(equals(c_token,"["))
X int_error("cannot set range with replot",c_token);
X if (!END_OF_COMMAND) {
X capture(str,c_token,num_tokens-1);
X if ( (strlen(str) + strlen(replot_line)) <= MAX_LINE_LEN-1) {
X (void) strcat(replot_line,",");
X (void) strcat(replot_line,str);
X } else {
X int_error("plot line too long with replot arguments",c_token);
X }
X }
X (void) strcpy(input_line,replot_line);
X screen_ok = FALSE;
X num_tokens = scanner(input_line);
X c_token = 1; /* skip the 'plot' part */
X is_3d_plot ? plot3drequest() : plotrequest();
}
X
X
plotrequest()
/*
X In the parametric case we can say
X plot [a= -4:4] [-2:2] [-1:1] sin(a),a**2
X while in the non-parametric case we would say only
X plot [b= -2:2] [-1:1] sin(b)
*/
{
X BOOLEAN changed;
X int dummy_token = -1;
X
X is_3d_plot = FALSE;
X
X if (parametric && strcmp(dummy_var[0], "u") == 0)
X strcpy (dummy_var[0], "t");
X
X autoscale_lt = autoscale_t;
X autoscale_lx = autoscale_x;
X autoscale_ly = autoscale_y;
X
X if (!term) /* unknown */
X int_error("use 'set term' to set terminal type first",c_token);
X
X if (equals(c_token,"[")) {
X c_token++;
X if (isletter(c_token)) {
X if (equals(c_token+1,"=")) {
X dummy_token = c_token;
X c_token += 2;
X } else {
X /* oops; probably an expression with a variable. */
X /* Parse it as an xmin expression. */
X /* used to be: int_error("'=' expected",c_token); */
X }
X }
X changed = parametric ? load_range(&tmin,&tmax):load_range(&xmin,&xmax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed) {
X if (parametric)
X autoscale_lt = FALSE;
X else
X autoscale_lx = FALSE;
X }
X }
X
X if (parametric && equals(c_token,"[")) { /* set optional x ranges */
X c_token++;
X changed = load_range(&xmin,&xmax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed)
X autoscale_lx = FALSE;
X }
X
X if (equals(c_token,"[")) { /* set optional y ranges */
X c_token++;
X changed = load_range(&ymin,&ymax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed)
X autoscale_ly = FALSE;
X }
X
X /* use the default dummy variable unless changed */
X if (dummy_token >= 0)
X copy_str(c_dummy_var[0],dummy_token);
X else
X (void) strcpy(c_dummy_var[0],dummy_var[0]);
X
X eval_plots();
}
X
plot3drequest()
/*
X in the parametric case we would say
X splot [u= -Pi:Pi] [v= 0:2*Pi] [-1:1] [-1:1] [-1:1] sin(v)*cos(u),sin(v)*cos(u),sin(u)
X in the non-parametric case we would say only
X splot [x= -2:2] [y= -5:5] sin(x)*cos(y)
X
*/
{
X BOOLEAN changed;
X int dummy_token0 = -1,
X dummy_token1 = -1;
X
X is_3d_plot = TRUE;
X
X if (parametric && strcmp(dummy_var[0], "t") == 0) {
X strcpy (dummy_var[0], "u");
X strcpy (dummy_var[1], "v");
X }
X
X autoscale_lx = autoscale_x;
X autoscale_ly = autoscale_y;
X autoscale_lz = autoscale_z;
X
X if (!term) /* unknown */
X int_error("use 'set term' to set terminal type first",c_token);
X
X if (equals(c_token,"[")) {
X c_token++;
X if (isletter(c_token)) {
X if (equals(c_token+1,"=")) {
X dummy_token0 = c_token;
X c_token += 2;
X } else {
X /* oops; probably an expression with a variable. */
X /* Parse it as an xmin expression. */
X /* used to be: int_error("'=' expected",c_token); */
X }
X }
X changed = parametric ? load_range(&umin,&umax):load_range(&xmin,&xmax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed && !parametric) {
X autoscale_lx = FALSE;
X }
X }
X
X if (equals(c_token,"[")) {
X c_token++;
X if (isletter(c_token)) {
X if (equals(c_token+1,"=")) {
X dummy_token1 = c_token;
X c_token += 2;
X } else {
X /* oops; probably an expression with a variable. */
X /* Parse it as an xmin expression. */
X /* used to be: int_error("'=' expected",c_token); */
X }
X }
X changed = parametric ? load_range(&vmin,&vmax):load_range(&ymin,&ymax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed && !parametric) {
X autoscale_ly = FALSE;
X }
X }
X
X if (equals(c_token,"[")) { /* set optional x ranges */
X c_token++;
X changed = load_range(&xmin,&xmax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed)
X autoscale_lx = FALSE;
X }
X
X if (equals(c_token,"[")) { /* set optional y ranges */
X c_token++;
X changed = load_range(&ymin,&ymax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed)
X autoscale_ly = FALSE;
X }
X
X if (equals(c_token,"[")) { /* set optional z ranges */
X c_token++;
X changed = load_range(&zmin,&zmax);
X if (!equals(c_token,"]"))
X int_error("']' expected",c_token);
X c_token++;
X if (changed)
X autoscale_lz = FALSE;
X }
X
X /* use the default dummy variable unless changed */
X if (dummy_token0 >= 0)
X copy_str(c_dummy_var[0],dummy_token0);
X else
X (void) strcpy(c_dummy_var[0],dummy_var[0]);
X
X if (dummy_token1 >= 0)
X copy_str(c_dummy_var[1],dummy_token1);
X else
X (void) strcpy(c_dummy_var[1],dummy_var[1]);
X
X eval_3dplots();
}
X
X
define()
{
register int start_token; /* the 1st token in the function definition */
register struct udvt_entry *udv;
register struct udft_entry *udf;
X
X if (equals(c_token+1,"(")) {
SHAR_EOF
true || echo 'restore of gnuplot/command.c failed'
fi
echo 'End of part 12'
echo 'File gnuplot/command.c is continued in part 13'
echo 13 > _shar_seq_.tmp
#!/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 <r...@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, eln...@monu3.OZ
X * Further modified Jan 1990 by Russell Lang, r...@monu1.cc.monash.oz
X *
X * send your comments or suggestions to (pixar!info-g...@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-g...@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-g...@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, r...@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, r...@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, w...@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-g...@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-g...@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-g...@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-g...@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
#!/bin/sh
# this is Part.16 (part 16 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/hpljii.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 16; 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/hpljii.trm'
else
echo 'x - continuing file gnuplot/term/hpljii.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/hpljii.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 * hpljii, hpdj
X *
X * AUTHORS
X * John Engels
X * Russell Lang
X * Maurice Castro
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/* The following HP laserjet series II driver uses generic bit mapped graphics
X routines from bitmap.c to build up a bit map in memory. The driver
X interchanges colomns and lines in order to access entire lines
X easily and returns the lines to get bits in the right order :
X (x,y) -> (y,XMAX-1-x). */
/* This interchange is done by calling b_makebitmap() with reversed
X xmax and ymax, and then setting b_rastermode to TRUE. b_setpixel()
X will then perform the interchange before each pixel is plotted */
/* by John Engels JEN...@BNANDP51.BITNET, inspired by the hpljet driver
X of Jyrki Yli-Nokari */
X
#ifdef HPLJII
X
/* We define 4 different print qualities : 300ppi, 150ppi, 100ppi and
X 75ppi. (Pixel size = 1, 2, 3, 4 dots) */
X
#define HPLJII_DPP (hplj_dpp) /* dots per pixel */
#define HPLJII_PPI (300/HPLJII_DPP) /* pixel per inch */
/* make XMAX and YMAX a multiple of 8 */
#define HPLJII_XMAX (8*(unsigned int)(xsize*1920/HPLJII_DPP/8.0+0.9))
#define HPLJII_YMAX (8*(unsigned int)(ysize*1920/HPLJII_DPP/8.0+0.9))
X
#define HPLJII_VCHAR (HPLJII_PPI/6) /* Courier font with 6 lines per inch */
#define HPLJII_HCHAR (HPLJII_PPI/10) /* Courier font with 10 caracters
X per inch */
X
/* default values for term_tbl */
#define HPLJII_75PPI_XMAX (1920/4)
#define HPLJII_75PPI_YMAX (1920/4)
#define HPLJII_75PPI_HCHAR (1920/4/6)
#define HPLJII_75PPI_VCHAR (1920/4/10)
#define HPLJII_75PPI_VTIC 5
#define HPLJII_75PPI_HTIC 5
X
X
#define HPLJII_PUSH_CURSOR fprintf(outfile,"\033&f0S") /* Save current
X cursor position */
#define HPLJII_POP_CURSOR fprintf(outfile,"\033&f1S") /* Restore
X cursor position */
#define HPLJII_COURIER fprintf(outfile,"\033(0N\033(s0p10.0h12.0v0s0b3T\033&l6D")
X /* be sure to use courier font with 6lpi and 10cpi */
X
static int hplj_dpp=4;
/* bm_pattern not appropriate for 300ppi graphics */
static unsigned int b_300ppi_pattern[] = {0xffff, 0x1111,
X 0xffff, 0x3333, 0x0f0f, 0x3f3f, 0x0fff, 0x00ff, 0x33ff};
X
HPLJIIoptions()
{
char opt[4];
X
#define HPDJERROR "expecting dots per inch size 75, 100, 150 or 300"
X if (!END_OF_COMMAND) {
X if (token[c_token].length>3)
X int_error(HPDJERROR,c_token);
X
X /* almost_equals() won't accept numbers - use strcmp() instead */
X capture(opt,c_token,c_token);
X if (!strcmp(opt,"75")) {
X hplj_dpp = 4;
X }
X else if (!strcmp(opt,"100")) {
X hplj_dpp = 3;
X }
X else if (!strcmp(opt,"150")) {
X hplj_dpp = 2;
X }
X else if (!strcmp(opt,"300")) {
X hplj_dpp = 1;
X } else {
X int_error(HPDJERROR,c_token);
X }
X c_token++;
X }
X
X term_tbl[term].xmax = HPLJII_XMAX;
X term_tbl[term].ymax = HPLJII_YMAX;
X switch(hplj_dpp) {
X case 1:
X strcpy(term_options,"300");
X term_tbl[term].v_tic = 15;
X term_tbl[term].h_tic = 15;
X break;
X case 2:
X strcpy(term_options,"150");
X term_tbl[term].v_tic = 8;
X term_tbl[term].h_tic = 8;
X break;
X case 3:
X strcpy(term_options,"100");
X term_tbl[term].v_tic = 6;
X term_tbl[term].h_tic = 6;
X break;
X case 4:
X strcpy(term_options,"75");
X term_tbl[term].v_tic = 5;
X term_tbl[term].h_tic = 5;
X break;
X }
}
X
X
HPLJIIinit()
{
#ifdef vms
X reopen_binary();
#endif /* vms */
#ifdef PC
X reopen_binary();
#endif /* PC */
}
X
X
HPLJIIgraphics()
{
X term_tbl[term].v_char = HPLJII_VCHAR;
X term_tbl[term].h_char = HPLJII_HCHAR;
X HPLJII_COURIER;
X HPLJII_PUSH_CURSOR;
X /* rotate plot -90 degrees by reversing XMAX and YMAX and by
X setting b_rastermode to TRUE */
X b_makebitmap(HPLJII_YMAX,HPLJII_XMAX,1);
X b_rastermode = TRUE;
}
X
X
/* HPLJIItext by rjl - no compression */
HPLJIItext()
{
X register int x,j,row;
X
X fprintf(outfile,"\033*t%dR", HPLJII_PPI);
X HPLJII_POP_CURSOR;
X fprintf(outfile, "\033*r1A");
X
X /* dump bitmap in raster mode */
X for (x = b_xsize-1; x >= 0; x--) {
X row = (b_ysize/8)-1;
X fprintf(outfile, "\033*b0m%dW", b_ysize/8);
X for (j = row; j >= 0; j--) {
X (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
X }
X }
X fprintf(outfile, "\033*rB");
X
X b_freebitmap();
X
#ifndef vms /* most vms spoolers add a formfeed character */
X fprintf(outfile,"\f");
#endif /* not vms */
}
X
X
X
HPLJIIlinetype(linetype)
int linetype;
{
X
X if (hplj_dpp == 1) {
X if (linetype>=7)
X linetype %= 7;
X /* b_pattern not appropriate for 300ppi graphics */
X b_linemask = b_300ppi_pattern[linetype+2];
X b_maskcount=0;
X }
X else {
X b_setlinetype(linetype);
X }
}
X
#define HPLJIImove b_move
#define HPLJIIvector b_vector
#define HPLJIItext_angle b_text_angle
X
HPLJIIput_text(x,y,str)
unsigned int x, y;
char *str;
{
X switch (b_angle) {
X case 0:
X y -= HPLJII_VCHAR/5;
X HPLJII_POP_CURSOR;
X HPLJII_PUSH_CURSOR;
X /* (0,0) is the upper left point of the paper */
X fprintf(outfile, "\033*p%+dx%+dY", x*HPLJII_DPP
X , (HPLJII_YMAX-y-1)*HPLJII_DPP );
X fputs(str, outfile);
/* for (; *str; ++str, x += HPLJII_HCHAR)
X HPLJIIputc (x, y, *str, b_angle);*/
X break;
X case 1:
X y += (HPLJII_HCHAR-2*HPLJII_VCHAR)/2;
X y += (HPLJII_VCHAR+HPLJII_HCHAR)*strlen(str)/2;
X for (; *str; ++str, y -= HPLJII_VCHAR)
X HPLJIIputc (x, y, *str, b_angle);
X break;
X }
}
X
HPLJIIputc(x,y,c,angle)
unsigned int x,y;
int angle;
char c;
{
X HPLJII_POP_CURSOR;
X HPLJII_PUSH_CURSOR;
X /* (0,0) is the upper left point of the paper */
X fprintf(outfile, "\033*p%+dx%+dY", x*HPLJII_DPP
X , (HPLJII_YMAX-y-1)*HPLJII_DPP );
X fputc(c, outfile);
}
X
X
HPLJIIreset()
{
#ifdef vms
X fflush_binary();
#endif /* vms */
}
X
X
/* HP DeskJet routines */
HPDJgraphics()
{
X switch(hplj_dpp) {
X case 1:
X b_charsize(FNT13X25);
X term_tbl[term].v_char = FNT13X25_VCHAR;
X term_tbl[term].h_char = FNT13X25_HCHAR;
X break;
X case 2:
X b_charsize(FNT13X25);
X term_tbl[term].v_char = FNT13X25_VCHAR;
X term_tbl[term].h_char = FNT13X25_HCHAR;
X break;
X case 3:
X b_charsize(FNT9X17);
X term_tbl[term].v_char = FNT9X17_VCHAR;
X term_tbl[term].h_char = FNT9X17_HCHAR;
X break;
X case 4:
X b_charsize(FNT5X9);
X term_tbl[term].v_char = FNT5X9_VCHAR;
X term_tbl[term].h_char = FNT5X9_HCHAR;
X break;
X }
X /* rotate plot -90 degrees by reversing XMAX and YMAX and by
X setting b_rastermode to TRUE */
X b_makebitmap(HPLJII_YMAX,HPLJII_XMAX,1);
X b_rastermode = TRUE;
}
X
X
/* 0 compression raster bitmap dump. Compatible with HP DeskJet 500
X hopefully compatible with other HP Deskjet printers */
HPDJtext()
{
X register int x,j,row;
X
X fprintf(outfile,"\033*b0M");
X fprintf(outfile,"\033*t%dR", HPLJII_PPI);
X fprintf(outfile, "\033*r0A");
X
X /* dump bitmap in raster mode */
X for (x = b_xsize-1; x >= 0; x--) {
X row = (b_ysize/8)-1;
X fprintf(outfile, "\033*b%dW", b_ysize/8);
X for (j = row; j >= 0; j--) {
X (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
X }
X }
X fprintf(outfile, "\033*rbC");
X
X b_freebitmap();
X
#ifndef vms /* most vms spoolers add a formfeed character */
X fprintf(outfile,"\f");
#endif /* not vms */
}
X
#define HPDJtext_angle b_text_angle
#define HPDJput_text b_put_text
X
#endif /* HPLJII */
X
SHAR_EOF
echo 'File gnuplot/term/hpljii.trm is complete' &&
chmod 0644 gnuplot/term/hpljii.trm ||
echo 'restore of gnuplot/term/hpljii.trm failed'
Wc_c="`wc -c < 'gnuplot/term/hpljii.trm'`"
test 8101 -eq "$Wc_c" ||
echo 'gnuplot/term/hpljii.trm: original size 8101, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/pc.trm ==============
if test -f 'gnuplot/term/pc.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/pc.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/pc.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/pc.trm' &&
/* GNUPLOT - pc.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 * Under Microsoft C
X * cga, egabios, egalib, vgabios, hercules, corona325, att
X * Under Turboc C
X * egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, William Wilson, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#ifdef __TURBOC__
#include <graphics.h>
#include <conio.h>
#include <dos.h>
X int g_driver, g_mode, g_error;
X char far *path;
X char *pathp, path_s[128];
X
/* instead of string.h */
extern char *strrchr();
X
get_path()
{
X path=(char far *) getenv("BGI");
X if (path==NULL) {
X (void) strcpy(path_s,_argv[0]);
X pathp=strrchr(path_s,'\\');
X *pathp=0x00;
X path=path_s;
X }
}
X
static struct text_info tinfo; /* So we can restore starting text mode. */
#endif
X
X
static char near buf[80]; /* kludge since EGA.LIB is compiled SMALL */
X
static int pattern[] = {0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f};
X
static int graphics_on = FALSE;
int startx, starty;
X
int pc_angle;
#define PC_VCHAR FNT5X9_VCHAR
#define PC_HCHAR FNT5X9_HCHAR
X
pause() /* press any key to continue... */
{
X (void) getch();
}
X
X
PC_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
#ifdef __TURBOC__
X restorecrtmode();
X textmode(tinfo.currmode);
X clrscr();
#else
X Vmode(3);
#endif
}
X
PC_reset()
{
#ifdef __TURBOC__
X closegraph();
X textmode(tinfo.currmode);
X clrscr();
#endif
}
X
X
#ifndef __TURBOC__
X
PC_putc(x,y,c,angle,line_func)
unsigned int x,y;
char c;
int angle;
FUNC_PTR line_func;
{
int i,j,k;
unsigned int pixelon;
X i = (int)(c) - 32;
X for (j=0; j<FNT5X9_VBITS; j++) {
X for (k=0; k<FNT5X9_HBITS; k++) {
X pixelon = (((unsigned int)(fnt5x9[i][j])) >> k & 1);
X if (pixelon) {
X switch(angle) {
X case 0 : (*line_func)(x+k+1,y-j,x+k+1,y-j);
X break;
X case 1 : (*line_func)(x-j,y-k-1,x-j,y-k-1);
X break;
X }
X }
X }
X }
}
X
X
int PC_text_angle(ang)
int ang;
{
X pc_angle=ang;
X return TRUE;
}
X
X
#define CGA_XMAX 640
#define CGA_YMAX 200
X
#define CGA_XLAST (CGA_XMAX - 1)
#define CGA_YLAST (CGA_YMAX - 1)
X
#define CGA_VCHAR PC_VCHAR
#define CGA_HCHAR PC_HCHAR
#define CGA_VTIC 4
#define CGA_HTIC 6
X
int line_cga;
X
CGA_init()
{
X PC_color(1); /* monochrome */
}
X
CGA_graphics()
{
X graphics_on = TRUE;
X Vmode(6);
}
X
#define CGA_text PC_text
X
CGA_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X line_cga=linetype;
X PC_mask(pattern[linetype+2]);
}
X
CGA_move(x,y)
{
X startx = x;
X starty = y;
}
X
X
CGA_vector(x,y)
{
X PC_line(startx,CGA_YLAST-starty,x,CGA_YLAST-y);
X startx = x;
X starty = y;
}
X
X
CGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
int line;
X line= line_cga; /* disable the dotted lines temporarily */
X PC_mask(pattern[0]);
X switch(pc_angle) {
X case 0 : y -= CGA_VCHAR/2;
X break;
X case 1 : x += CGA_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,CGA_YLAST-y,str[i],pc_angle,PC_line);
X switch(pc_angle) {
X case 0 : x+=CGA_HCHAR ;
X break;
X case 1 : y+=CGA_HCHAR ;
X break;
X }
X }
X PC_mask(pattern[line]); /* enable dotted lines */
}
X
X
#define CGA_text_angle PC_text_angle
X
#define CGA_reset PC_reset
X
X
#define EGA_XMAX 640
#define EGA_YMAX 350
X
#define EGA_XLAST (EGA_XMAX - 1)
#define EGA_YLAST (EGA_YMAX - 1)
X
#define EGA_VCHAR PC_VCHAR
#define EGA_HCHAR PC_HCHAR
#define EGA_VTIC 4
#define EGA_HTIC 5
X
static int ega64color[] = {1,1,5,4,3,5,4,3, 5, 4, 3, 5, 4, 3,5};
static int ega256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
X
static int *egacolor;
X
X
EGA_init()
{
X PC_mask(0xffff);
X egacolor = ega256color; /* should be smarter */
}
X
EGA_graphics()
{
X graphics_on = TRUE;
X Vmode(16);
}
X
#define EGA_text PC_text
X
EGA_linetype(linetype)
{
X if (linetype >= 13)
X linetype %= 13;
X PC_color(egacolor[linetype+2]);
}
X
EGA_move(x,y)
{
X startx = x;
X starty = y;
}
X
EGA_vector(x,y)
{
X PC_line(startx,EGA_YLAST-starty,x,EGA_YLAST-y);
X startx = x;
X starty = y;
}
X
X
EGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
X switch(pc_angle) {
X case 0 : y -= EGA_VCHAR/2;
X break;
X case 1 : x += EGA_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,EGA_YLAST-y,str[i],pc_angle,PC_line);
X switch(pc_angle) {
X case 0 : x+=EGA_HCHAR ;
X break;
X case 1 : y+=EGA_HCHAR ;
X break;
X }
X }
}
X
X
#define EGA_text_angle PC_text_angle
X
#define EGA_reset PC_reset
X
X
X
/* The following VGA routines are hacked from the above EGA routines
X They worked on two VGA cards.
X Russell Lang, eln...@monu1.cc.monash.oz */
#define VGA_XMAX 640
#define VGA_YMAX 480
X
#define VGA_XLAST (VGA_XMAX - 1)
#define VGA_YLAST (VGA_YMAX - 1)
X
#define VGA_VCHAR PC_VCHAR
#define VGA_HCHAR PC_HCHAR
#define VGA_VTIC 5
#define VGA_HTIC 5
X
static int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
X
static int *vgacolor;
X
X
VGA_init()
{
X PC_mask(0xffff);
X vgacolor = vga256color; /* should be smarter */
}
X
VGA_graphics()
{
X graphics_on = TRUE;
X Vmode(18);
}
X
#define VGA_text PC_text
X
VGA_linetype(linetype)
{
X if (linetype >= 13)
X linetype %= 13;
X PC_color(vgacolor[linetype+2]);
}
X
VGA_move(x,y)
{
X startx = x;
X starty = y;
}
X
VGA_vector(x,y)
{
X PC_line(startx,VGA_YLAST-starty,x,VGA_YLAST-y);
X startx = x;
X starty = y;
}
X
X
VGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
X switch(pc_angle) {
X case 0 : y -= VGA_VCHAR/2;
X break;
X case 1 : x += VGA_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,VGA_YLAST-y,str[i],pc_angle,PC_line);
X switch(pc_angle) {
X case 0 : x+=VGA_HCHAR ;
X break;
X case 1 : y+=VGA_HCHAR ;
X break;
X }
X }
}
X
X
#define VGA_text_angle PC_text_angle
X
#define VGA_reset PC_reset
X
X
X
#ifdef EGALIB
X
#define EGALIB_XMAX 640
#define EGALIB_YMAX 350
X
#define EGALIB_XLAST (EGA_XMAX - 1)
#define EGALIB_YLAST (EGA_YMAX - 1)
X
#define EGALIB_VCHAR 14
#define EGALIB_HCHAR 8
#define EGALIB_VTIC 4
#define EGALIB_HTIC 5
X
#include "mcega.h"
X
EGALIB_init()
{
X GPPARMS();
X if (GDTYPE != 5) {
X term = 0;
X int_error("color EGA board not found",NO_CARET);
X }
X egacolor = (GDMEMORY < 256) ? ega64color : ega256color;
}
X
EGALIB_graphics()
{
X graphics_on = TRUE;
X GPINIT();
}
X
EGALIB_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X GPTERM();
}
X
EGALIB_linetype(linetype)
{
X if (linetype >= 13)
X linetype %= 13;
X GPCOLOR(egacolor[linetype+2]);
}
X
EGALIB_move(x,y)
{
X GPMOVE(x,GDMAXROW-y);
}
X
X
EGALIB_vector(x,y)
{
X GPLINE(x,GDMAXROW-y);
}
X
X
EGALIB_put_text(x,y,str)
int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X GotoXY((int)(x/EGALIB_HCHAR),
X (int)((EGALIB_YMAX-y-(EGALIB_VCHAR/2))/EGALIB_VCHAR));
X gprintf(buf);
}
X
X
#define EGALIB_reset PC_reset
X
#endif /* EGALIB */
X
X
#ifdef HERCULES
X
#define HERC_XMAX 720
#define HERC_YMAX 348
X
#define HERC_XLAST (HERC_XMAX - 1)
#define HERC_YLAST (HERC_YMAX - 1)
X
#define HERC_VCHAR PC_VCHAR
#define HERC_HCHAR PC_HCHAR
#define HERC_VTIC 4
#define HERC_HTIC 5
X
int line_herc;
X
HERC_init()
{
X H_init();
}
X
HERC_graphics()
{
X HVmode(1);
X graphics_on = TRUE;
}
X
HERC_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X HVmode(0);
}
X
HERC_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X H_mask(pattern[linetype+2]);
X line_herc = linetype;
}
X
HERC_move(x,y)
{
X if (x < 0)
X startx = 0;
X else if (x > HERC_XLAST)
X startx = HERC_XLAST;
X else
X startx = x;
X
X if (y < 0)
X starty = 0;
X else if (y > HERC_YLAST)
X starty = HERC_YLAST;
X else
X starty = y;
}
X
HERC_vector(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > HERC_XLAST)
X x = HERC_XLAST;
X if (y < 0)
X y = 0;
X else if (y > HERC_YLAST)
X y = HERC_YLAST;
X
X H_line(startx,HERC_YLAST-starty,x,HERC_YLAST-y);
X startx = x;
X starty = y;
}
X
X
HERC_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
int line;
X line= line_herc; /* disable the dotted lines temporarily */
X H_mask(pattern[0]);
X switch(pc_angle) {
X case 0 : y -= HERC_VCHAR/2;
X break;
X case 1 : x += HERC_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,HERC_YLAST-y,str[i],pc_angle,H_line);
X switch(pc_angle) {
X case 0 : x+=HERC_HCHAR ;
X break;
X case 1 : y+=HERC_HCHAR ;
X break;
X }
X }
X H_mask(pattern[line]); /* enable dotted lines */
}
X
X
#define HERC_text_angle PC_text_angle
X
#define HERC_reset PC_reset
X
X
#endif /* HERCULES */
X
X
/* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
X ATT 6300 driver */
X
X
#ifdef ATT6300
X
#define ATT_XMAX 640
#define ATT_YMAX 400
X
#define ATT_XLAST (ATT_XMAX - 1)
#define ATT_YLAST (ATT_YMAX - 1)
X
#define ATT_VCHAR PC_VCHAR
#define ATT_HCHAR PC_HCHAR
#define ATT_VTIC 4
#define ATT_HTIC 5
X
#define ATT_init CGA_init
X
ATT_graphics()
{
X graphics_on = TRUE;
X Vmode(0x40); /* 40H is the magic number for the AT&T driver */
}
X
#define ATT_text CGA_text
X
#define ATT_linetype CGA_linetype
X
#define ATT_move CGA_move
X
ATT_vector(x,y)
{
X PC_line(startx,ATT_YLAST-starty,x,ATT_YLAST-y);
X startx = x;
X starty = y;
}
X
X
ATT_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
int line;
X line= line_cga; /* disable the dotted lines temporarily */
X PC_mask(pattern[0]);
X switch(pc_angle) {
X case 0 : y -= ATT_VCHAR/2;
X break;
X case 1 : x += ATT_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,ATT_YLAST-y,str[i],pc_angle,PC_line);
X switch(pc_angle) {
X case 0 : x+=ATT_HCHAR ;
X break;
X case 1 : y+=ATT_HCHAR ;
X break;
X }
X }
X PC_mask(pattern[line]); /* enable dotted lines */
}
X
X
#define ATT_text_angle PC_text_angle
X
#define ATT_reset CGA_reset
X
#endif /* ATT6300 */
X
X
#ifdef CORONA
X
#define COR_XMAX 640
#define COR_YMAX 325
X
#define COR_XLAST (COR_XMAX - 1)
#define COR_YLAST (COR_YMAX - 1)
X
#define COR_VCHAR PC_VCHAR
#define COR_HCHAR PC_HCHAR
#define COR_VTIC 4
#define COR_HTIC 5
X
int line_cor;
X
static int corscreen; /* screen number, 0 - 7 */
X
COR_init()
{
register char *p;
X if (!(p = getenv("CORSCREEN")))
X int_error("must run CORPLOT for Corona graphics",NO_CARET);
X corscreen = *p - '0';
}
X
COR_graphics()
{
X graphics_on = TRUE;
X Vmode(3); /* clear text screen */
X grinit(corscreen);
X grandtx();
}
X
COR_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X grreset();
X txonly();
X Vmode(3);
}
X
COR_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X line_cor = linetype;
X Cor_mask(pattern[linetype+2]);
}
X
COR_move(x,y)
{
X if (x < 0)
X startx = 0;
X else if (x > COR_XLAST)
X startx = COR_XLAST;
X else
X startx = x;
X
X if (y < 0)
X starty = 0;
X else if (y > COR_YLAST)
X starty = COR_YLAST;
X else
X starty = y;
}
X
COR_vector(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > COR_XLAST)
X x = COR_XLAST;
X if (y < 0)
X y = 0;
X else if (y > COR_YLAST)
X y = COR_YLAST;
X
X Cor_line(startx,COR_YLAST-starty,x,COR_YLAST-y);
X startx = x;
X starty = y;
}
X
X
COR_put_text(x,y,str)
unsigned int x, y;
char *str;
{
int i;
int line;
X line= line_cor; /* disable the dotted lines temporarily */
X Cor_mask(pattern[0]);
X switch(pc_angle) {
X case 0 : y -= COR_VCHAR/2;
X break;
X case 1 : x += COR_VCHAR/2;
X break;
X }
X for (i=0;str[i];i++) {
X PC_putc(x,COR_YLAST-y,str[i],pc_angle,Cor_line);
X switch(pc_angle) {
X case 0 : x+=COR_HCHAR ;
X break;
X case 1 : y+=COR_HCHAR ;
X break;
X }
X }
X COR_mask(pattern[line]); /* enable dotted lines */
}
X
X
#define COR_text_angle PC_text_angle
X
#define COR_reset PC_reset
X
#endif /* CORONA */
X
X
#else /* ifndef __TURBOC__ */
/* all of the Turbo C routines for the different graphics devices go here */
X
#define VGA_XMAX 640
#define VGA_YMAX 480
X
#define VGA_XLAST (VGA_XMAX - 1)
#define VGA_YLAST (VGA_YMAX - 1)
X
#define VGA_VCHAR 10
#define VGA_HCHAR 8
#define VGA_VTIC 4
#define VGA_HTIC 5
X
#define SVGA_XMAX 640
#define SVGA_YMAX 480
X
#define SVGA_VCHAR 10
#define SVGA_HCHAR 8
#define SVGA_VTIC 4
#define SVGA_HTIC 5
X
static int vga256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
static int *vgacolor;
X
static int svga_xmax = SVGA_XMAX,
X svga_ymax = SVGA_YMAX,
X svga_xlast = 639,
X svga_ylast = 479;
X
#define VGA_reset EGALIB_reset
#define VGA_text EGALIB_text
#define VGA_move EGALIB_move
#define VGA_vector EGALIB_vector
#define VGA_text_angle PC_text_angle
#define VGA_justify_text PC_justify_text
X
#define SVGA_reset EGALIB_reset
#define SVGA_text EGALIB_text
#define SVGA_move EGALIB_move
#define SVGA_vector EGALIB_vector
#define SVGA_text_angle PC_text_angle
#define SVGA_justify_text PC_justify_text
#define SVGA_linetype VGA_linetype
X
int PC_text_angle(ang)
int ang;
{
X int size = svga_ymax > 600 ? 2 : 1;
X
X pc_angle = ang;
X
X switch (ang) {
X case 0 : settextstyle(DEFAULT_FONT,HORIZ_DIR,size);
X break;
X case 1 : settextstyle(DEFAULT_FONT,VERT_DIR,size);
X break;
X }
X return TRUE;
}
X
int PC_justify_text(mode)
enum JUSTIFY mode;
{
X switch(mode) {
X case LEFT :
X settextjustify(LEFT_TEXT,CENTER_TEXT);
X break;
X case CENTRE :
X settextjustify(CENTER_TEXT,CENTER_TEXT);
X break;
X case RIGHT:
X settextjustify(RIGHT_TEXT,CENTER_TEXT);
X break;
X }
X return TRUE;
}
X
VGA_init()
{
X g_driver=VGA;
X g_mode=2;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X if(g_driver!=9){
X term=0;
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
X
/* int_error("color VGA board not found",NO_CARET);*/
X }
X if(g_driver==VGA) vgacolor=vga256color;
}
X
VGA_graphics()
{ g_driver=VGA;
X g_mode=2;
X graphics_on = TRUE;
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X VGA_justify_text(LEFT);
}
X
VGA_linetype(linetype)
{
X if (linetype >= 13)
X linetype %= 13;
X setcolor(vgacolor[linetype+2]);
}
X
VGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,VGA_YLAST-y,buf);
}
X
X
VGAMONO_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X setlinestyle(4,pattern[linetype+2],1);
}
X
static int huge detect_svga(void)
{
X return g_mode;
}
X
SVGA_init()
{
X char *p, name[128], *SVGA = getenv( "SVGA" );
X
X if (SVGA == NULL)
X int_error("'SVGA' driver environment variable is not set",
X NO_CARET);
X
X strcpy(name, SVGA);
X if ((p = strrchr(name, '.')) == NULL ||
X sscanf(&p[1], "%d", &g_mode) != 1)
X int_error("'SVGA' envvar should be of the form 'name.mode'",
X NO_CARET);
X
X *p = 0;
X
X installuserdriver(name, detect_svga);
X gettextinfo(&tinfo);
X g_driver = 0;
X initgraph(&g_driver,&g_mode,path);
X if(g_driver<0){
X term=0;
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
X
X }
X else
X vgacolor=vga256color;
X
X /* Get the screen size: */
X svga_xmax = term_tbl[term].xmax = getmaxx() + 1;
X svga_ymax = term_tbl[term].ymax = getmaxy() + 1;
X svga_xlast = svga_xmax-1;
X svga_ylast = svga_ymax-1;
X
X if (svga_ymax > 600) { /* Double the tic/font sizes. */
X term_tbl[term].h_char = SVGA_HCHAR * 2;
X term_tbl[term].v_char = SVGA_VCHAR * 2;
X term_tbl[term].h_tic = SVGA_HTIC * 2;
X term_tbl[term].v_tic = SVGA_VTIC * 2;
X settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
X }
X else
X settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
}
X
SVGA_graphics()
{
X graphics_on = TRUE;
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X VGA_justify_text(LEFT);
X
X svga_ymax = getmaxy() + 1;
X if (svga_ymax > 600) /* Double the tic/font sizes. */
X settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
X else
X settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
}
X
SVGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,svga_ylast-y,buf);
}
X
#define MCGA_XMAX 640
#define MCGA_YMAX 480
X
#define MCGA_XLAST (MCGA_XMAX - 1)
#define MCGA_YLAST (MCGA_YMAX - 1)
X
#define MCGA_VCHAR 10
#define MCGA_HCHAR 8
#define MCGA_VTIC 4
#define MCGA_HTIC 5
X
static int *MCGAcolor;
X
#define MCGA_reset EGALIB_reset
#define MCGA_text EGALIB_text
#define MCGA_move EGALIB_move
#define MCGA_vector EGALIB_vector
#define MCGA_text_angle PC_text_angle
#define MCGA_justify_text PC_justify_text
X
MCGA_init()
{
X g_driver=MCGA;
X g_mode=5;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X if(g_driver!=2){
X term=0;
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
X }
}
X
MCGA_graphics()
{
X graphics_on = TRUE;
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X MCGA_justify_text(LEFT);
}
X
X
MCGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,MCGA_YLAST-y,buf);
}
X
X
MCGA_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X setlinestyle(4,pattern[linetype+2],1);
}
X
X
#define EGALIB_XMAX 640
#define EGALIB_YMAX 350
X
#define EGALIB_XLAST (EGALIB_XMAX - 1)
#define EGALIB_YLAST (EGALIB_YMAX - 1)
X
#define EGALIB_VCHAR 10
#define EGALIB_HCHAR 8
#define EGALIB_VTIC 4
#define EGALIB_HTIC 5
X
static int ega64color[] = {1,1,5,4,3,5,4,3, 5, 4, 3, 5, 4, 3,5};
static int ega256color[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6};
X
static int *egacolor;
X
#define EGALIB_text_angle PC_text_angle
#define EGALIB_justify_text PC_justify_text
X
EGALIB_init()
{
X g_driver=EGA;
X g_mode=1;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X if(g_driver<3 || g_driver>4){
X term=0;
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
X
/* int_error("color EGA board not found",NO_CARET);*/
X }
X if(g_driver==EGA) egacolor=ega256color;
X if(g_driver==EGA64) egacolor=ega64color;
}
X
EGALIB_graphics()
{
X graphics_on = TRUE;
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X EGALIB_justify_text(LEFT);
}
X
EGALIB_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X restorecrtmode();
X textmode(tinfo.currmode);
X clrscr();
X svga_ymax = SVGA_YMAX; /* Since it may double font size if too high. */
}
X
EGALIB_linetype(linetype)
{
X if (linetype >= 13)
X linetype %= 13;
X setcolor(egacolor[linetype+2]);
}
X
EGALIB_move(x,y)
{
X moveto(x,getmaxy()-y);
}
X
X
EGALIB_vector(x,y)
{
X lineto(x,getmaxy()-y);
}
X
X
EGALIB_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,EGALIB_YLAST-y,buf);
}
X
X
EGALIB_reset()
{
X closegraph();
X textmode(tinfo.currmode);
X clrscr();
X svga_ymax = SVGA_YMAX; /* Since it may double font size if too high. */
}
X
X
#define CGA_XMAX 640
#define CGA_YMAX 200
X
#define CGA_XLAST (CGA_XMAX - 1)
#define CGA_YLAST (CGA_YMAX - 1)
X
#define CGA_VCHAR 10
#define CGA_HCHAR 8
#define CGA_VTIC 4
#define CGA_HTIC 6
X
#define CGA_text_angle PC_text_angle
#define CGA_justify_text PC_justify_text
#define CGA_reset PC_reset
X
CGA_init()
{
X g_driver=CGA;
X g_mode=4;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
/* PC_color(1); monochrome */
X
}
X
CGA_graphics()
{
X graphics_on = TRUE;
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X CGA_justify_text(LEFT);
X /* Vmode(6);*/
}
X
#define CGA_text PC_text
X
CGA_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X setlinestyle(4,pattern[linetype+2],1);
}
X
CGA_move(x,y)
{
X moveto(x,getmaxy()-y);
}
X
X
CGA_vector(x,y)
{
X lineto(x,getmaxy()-y);
}
X
CGA_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,CGA_YLAST-y,buf);
}
X
X
X
#define HERC_XMAX 720
#define HERC_YMAX 348
X
#define HERC_XLAST (HERC_XMAX - 1)
#define HERC_YLAST (HERC_YMAX - 1)
X
#define HERC_VCHAR 10
#define HERC_HCHAR 8
#define HERC_VTIC 4
#define HERC_HTIC 5
X
#define HERC_text_angle PC_text_angle
#define HERC_justify_text PC_justify_text
#define HERC_reset PC_reset
X
HERC_init()
{
X g_driver=HERCMONO;
X g_mode=0;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
}
X
HERC_graphics()
{
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X HERC_justify_text(LEFT);
X graphics_on = TRUE;
}
X
HERC_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X restorecrtmode();
X textmode(tinfo.currmode);
X clrscr();
}
X
HERC_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X setlinestyle(4,pattern[linetype+2],1);
}
X
HERC_move(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > HERC_XLAST)
X x = HERC_XLAST;
X
X if (y < 0)
X y = 0;
X else if (y > HERC_YLAST)
X y = HERC_YLAST;
X moveto(x,getmaxy()-y);
}
X
HERC_vector(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > HERC_XLAST)
X x = HERC_XLAST;
X if (y < 0)
X y = 0;
X else if (y > HERC_YLAST)
X y = HERC_YLAST;
X
X lineto(x,getmaxy()-y);
}
X
X
HERC_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,HERC_YLAST-y,buf);
}
X
X
#ifdef ATT6300
/* this driver added by r...@monu1.cc.monash.edu.au */
X
#define ATT_XMAX 640
#define ATT_YMAX 400
X
#define ATT_XLAST (ATT_XMAX - 1)
#define ATT_YLAST (ATT_YMAX - 1)
X
#define ATT_VCHAR PC_VCHAR
#define ATT_HCHAR PC_HCHAR
#define ATT_VTIC 4
#define ATT_HTIC 5
X
#define ATT_text_angle PC_text_angle
#define ATT_justify_text PC_justify_text
#define ATT_reset PC_reset
X
ATT_init()
{
X g_driver=ATT400;
X g_mode=5;
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X }
}
X
ATT_graphics()
{
X gettextinfo(&tinfo);
X setgraphmode(getgraphmode());
X ATT_justify_text(LEFT);
X graphics_on = TRUE;
}
X
ATT_text()
{
X if (graphics_on) {
X graphics_on = FALSE;
X pause();
X }
X restorecrtmode();
X textmode(tinfo.currmode);
X clrscr();
}
X
ATT_linetype(linetype)
{
X if (linetype >= 5)
X linetype %= 5;
X setlinestyle(4,pattern[linetype+2],1);
}
X
ATT_move(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > ATT_XLAST)
X x = ATT_XLAST;
X
X if (y < 0)
X y = 0;
X else if (y > ATT_YLAST)
X y = ATT_YLAST;
X moveto(x,getmaxy()-y);
}
X
ATT_vector(x,y)
{
X if (x < 0)
X x = 0;
X else if (x > ATT_XLAST)
X x = ATT_XLAST;
X if (y < 0)
X y = 0;
X else if (y > ATT_YLAST)
X y = ATT_YLAST;
X
X lineto(x,getmaxy()-y);
}
X
X
ATT_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X strcpy((char far *)buf,str);
X outtextxy(x,ATT_YLAST-y,buf);
}
#endif /* ifdef ATT6300 */
X
#endif /* ifndef __TURBOC__ */
X
SHAR_EOF
chmod 0644 gnuplot/term/pc.trm ||
echo 'restore of gnuplot/term/pc.trm failed'
Wc_c="`wc -c < 'gnuplot/term/pc.trm'`"
test 25264 -eq "$Wc_c" ||
echo 'gnuplot/term/pc.trm: original size 25264, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/imagen.trm ==============
if test -f 'gnuplot/term/imagen.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/imagen.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/imagen.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/imagen.trm' &&
/* GNUPLOT - imagen.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 * Imagen laser printers
X *
X * AUTHORS
X * Paul E. McKenney, David Kotz
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/*
X * Original for direct Imagen output (but retaining many of the
X * LaTeX extensions) by Paul E. McKenney, 1989.
X * Further modified by David Kotz to fit into gnuplot 2.0.
X * Information Science and Technology Division, SRI International,
X * 333 Ravenswood Ave, Menlo Park, CA 94025.
X * Mail to mcke...@sri.com.
X */
X
#include "impcodes.h"
X
#define IMAGEN_PTS_PER_INCH (300)
X
#define IMAGEN_XMAX (IMAGEN_PTS_PER_INCH * 10) /* 10.0 inches */
#define IMAGEN_YMAX (IMAGEN_PTS_PER_INCH * 75 / 10) /* 7.5 inches */
X
#define IMAGEN_FONTSIZE 12
X
#define IMAGEN_HTIC (20)
#define IMAGEN_VTIC (20)
#define IMAGEN_VCHAR (IMAGEN_FONTSIZE*5)
#define IMAGEN_HCHAR (IMAGEN_VCHAR/2)
X
static int IMAGEN_orgx; /* absolute-pixel-ORIgin of graph. */
static int IMAGEN_orgy;
static int IMAGEN_posx; /* current drawing position (lines). */
static int IMAGEN_posy;
static int IMAGEN_inplot;
static int IMAGEN_xmax; /* width of graph in pixels. */
static int IMAGEN_ymax; /* height of graph in pixels. */
static int IMAGEN_hchar; /* Height of CHAR in current font. */
static int IMAGEN_wchar; /* Width of CHAR in current font. */
static int IMAGEN_blofs; /* BaseLine OFfSet from bounding box. */
static int IMAGEN_angle = -1; /* 0 for horizontal text, 1 for vertical */
static enum JUSTIFY IMAGEN_justify = LEFT; /* left/center/right */
X
static IMAGEN_seq_pos; /* position in sequence */
X
static void IMAGEN_putwd();
static void IMAGEN_createfamily();
static void IMAGEN_setfont();
static void IMAGEN_setpos();
static char *IMAGEN_cvts();
X
IMAGEN_init()
{
X char font[10]; /* font name */
X
X IMAGEN_posx = IMAGEN_posy = 0;
X
X IMAGEN_orgx = (11.0 * IMAGEN_PTS_PER_INCH - IMAGEN_XMAX) / 2;
X IMAGEN_orgy = (8.5 * IMAGEN_PTS_PER_INCH - IMAGEN_YMAX)/ 2;
X
X fputs("@document(language impress)", outfile);
X
X putc(imP_SET_HV_SYSTEM, outfile);
X putc((3<<3)|5, outfile);
X
X sprintf(font, "cour%02d", IMAGEN_FONTSIZE);
X IMAGEN_createfamily(font, IMAGEN_FONTSIZE);
X IMAGEN_setfont(IMAGEN_FONTSIZE);
X
X IMAGEN_text_angle(0);
X
X putc(imP_SET_ABS_H, outfile);
X IMAGEN_putwd(0);
X putc(imP_SET_ABS_V, outfile);
X IMAGEN_putwd(0);
X
X IMAGEN_linetype(-1);
}
X
IMAGEN_graphics()
{
X static BOOLEAN first = TRUE;
X
X if (!first)
X putc(imP_ENDPAGE, outfile);
X first = FALSE;
X
X IMAGEN_move(0, 0);
}
X
IMAGEN_text()
{
}
X
X
IMAGEN_linetype(linetype)
int linetype;
{
X static int lastlinetype = -10;
X
X if (linetype < 0)
X linetype = -linetype;
X else
X linetype *= 2;
X
X if (lastlinetype == linetype)
X return;
X
X lastlinetype = linetype; /* now >= 0 */
X
X putc(imP_SET_PEN, outfile);
X putc(linetype, outfile);
}
X
X
IMAGEN_move(x,y)
X unsigned int x,y;
{
X IMAGEN_posx = x;
X IMAGEN_posy = y;
}
X
IMAGEN_vector(ux,uy)
X unsigned int ux,uy;
{
X /* Create path. */
X
X putc(imP_CREATE_PATH, outfile);
X IMAGEN_putwd(2);
X IMAGEN_putwd(IMAGEN_posx + IMAGEN_orgx);
X IMAGEN_putwd(IMAGEN_posy + IMAGEN_orgy);
X IMAGEN_putwd(ux + IMAGEN_orgx);
X IMAGEN_putwd(uy + IMAGEN_orgy);
X
X /* Draw path with black pen. */
X
X putc(imP_DRAW_PATH, outfile);
X putc(15, outfile);
X
X /* Set current position to end of line. */
X
X IMAGEN_move(ux, uy);
}
X
static void
IMAGEN_setpos(ux, uy)
X int ux,uy;
{
X /* Set x and y position (for text), also set beginning-of-line. */
X
X putc(imP_SET_ABS_H, outfile);
X IMAGEN_putwd(ux + IMAGEN_orgx);
X putc(imP_SET_ABS_V, outfile);
X IMAGEN_putwd(uy + IMAGEN_orgy);
X putc(imP_SET_BOL, outfile);
X if (IMAGEN_angle == 1)
X IMAGEN_putwd(uy + IMAGEN_orgx); /* vertical */
X else
X IMAGEN_putwd(ux + IMAGEN_orgx); /* horizontal */
}
X
IMAGEN_text_angle(angle)
X int angle;
{
X if (IMAGEN_angle != angle) {
X IMAGEN_angle = angle; /* record for later use */
X putc(imP_SET_ADV_DIRS, outfile);
X putc(angle == 0 ? 0 : 7, outfile); /* 0=>horiz : 7=>vert */
X }
X
X return(TRUE);
}
X
IMAGEN_justify_text(mode)
X enum JUSTIFY mode;
{
X IMAGEN_justify = mode;
X return(TRUE);
}
X
static char *
IMAGEN_cvts(str, width, height)
X char *str;
X int *width;
X int *height;
{
X char *cp1;
X char *cp2;
X static char *buf = NULL;
X int h;
X int maxw;
X int w;
X
X /* Free up old buffer, if there is one, get a new one. Since */
X /* all transformations shorten the string, get a buffer that is */
X /* the same size as the input string. */
X
X if (buf != NULL)
X (void) free(buf);
X buf = (char *) alloc(strlen(str), "converted label string");
X
X /* Do the transformations. */
X
X cp1 = str;
X cp2 = buf;
X h = 1;
X maxw = 0;
X w = 0;
X while (strlen(cp1) > 0) {
X switch (*cp1) {
X case ' ' : /* Space character. */
X *cp2++ = imP_SP;
X w++;
X break;
X
X case '\\' : /* Escape sequence. */
X if (*++cp1 == '\\') {
X /* Begin new line. */
X h++;
X if (w > maxw)
X maxw = w;
X w = 0;
X *cp2++ = imP_CRLF;
X break;
X }
X
X /* Fall through to just copy next char out. */
X
X default :
X *cp2++ = *cp1;
X w++;
X break;
X }
X cp1++;
X }
X
X *cp2 = '\0';
X if (w > maxw)
X maxw = w;
X
X if (height != NULL)
X *height = IMAGEN_angle ?
X IMAGEN_wchar * maxw :
X IMAGEN_hchar * h;
X if (width != NULL)
X *width = IMAGEN_angle ?
X IMAGEN_hchar * h :
X IMAGEN_wchar * maxw;
X return (buf);
}
X
IMAGEN_put_text(x, y, str)
X int x,y; /* reference point of string */
X char str[]; /* the text */
{
X char *cvstr;
X int height;
X int width;
X
X cvstr = IMAGEN_cvts(str, &width, &height);
X
X switch (IMAGEN_justify) {
X case LEFT: break;
X case CENTRE: x -= width/2; break;
X case RIGHT: x -= width; break;
X }
X
X if (IMAGEN_angle) { /* vertical */
X x += IMAGEN_hchar;
X y -= height/2;
X } else /* horizontal */
X y += height/2 - IMAGEN_hchar;
X
X IMAGEN_setpos(x, y + IMAGEN_blofs);
X fputs(cvstr, outfile);
}
X
X
IMAGEN_reset()
{
X putc(imP_EOF, outfile);
}
X
static void
IMAGEN_putwd(w)
{
X putc(w>>8, outfile);
X putc(w, outfile);
}
X
static void
IMAGEN_createfamily(c, sz)
X char *c;
X int sz;
{
X putc(imP_CREATE_FAMILY_TABLE, outfile);
X putc(sz, outfile);
X putc(1, outfile);
X putc(0, outfile);
X fputs(c, outfile);
X putc(0, outfile);
}
X
static void
IMAGEN_setfont(sz)
X int sz;
{
X IMAGEN_hchar = sz * 5;
X IMAGEN_wchar = IMAGEN_hchar / 2;
X IMAGEN_blofs = IMAGEN_hchar / 3;
X putc(imP_SET_FAMILY, outfile);
X putc(sz, outfile);
X putc(imP_SET_SP, outfile);
X IMAGEN_putwd(IMAGEN_wchar);
X putc(imP_SET_IL, outfile);
X IMAGEN_putwd(IMAGEN_hchar);
}
SHAR_EOF
chmod 0666 gnuplot/term/imagen.trm ||
echo 'restore of gnuplot/term/imagen.trm failed'
Wc_c="`wc -c < 'gnuplot/term/imagen.trm'`"
test 7396 -eq "$Wc_c" ||
echo 'gnuplot/term/imagen.trm: original size 7396, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/iris4d.trm ==============
if test -f 'gnuplot/term/iris4d.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/iris4d.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/iris4d.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/iris4d.trm' &&
/* GNUPLOT - iris4d.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 * IRIS terminals
X *
X * AUTHORS
X * John H. Merritt
X * (Applied Research Corporation) 7/1/89
X * INTERNET: mer...@iris613.gsfc.nasa.gov
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#include <gl.h>
X
#define IRIS4DRC ".gnuplot_iris4d"
X
#define IRIS4D_XMAX 1024
#define IRIS4D_YMAX 1024
X
#define IRIS4D_XLAST (IRIS4D_XMAX - 1)
#define IRIS4D_YLAST (IRIS4D_YMAX - 1)
X
#define IRIS4D_VCHAR (IRIS4D_YMAX/30)
#define IRIS4D_HCHAR (IRIS4D_XMAX/72)
#define IRIS4D_VTIC (IRIS4D_YMAX/80)
#define IRIS4D_HTIC (IRIS4D_XMAX/80)
X
static short colors24bits[][3] =
{
X { 85, 85, 85 }, /* 0. BACK GROUND ( DARKGRAY ) */
X { 0, 0, 0 }, /* 1. BLACK */
X { 170, 0, 170 }, /* 2. MAGENTA */
X { 85, 255, 255 }, /* 3. LIGHTCYAN */
X { 170, 0, 0 }, /* 4. RED */
X { 0, 170, 0 }, /* 5. GREEN */
X { 255, 85, 255 }, /* 6. LIGHTMAGENTA */
X { 255, 255, 85 }, /* 7. YELLOW */
X { 255, 85, 85 }, /* 8. LIGHTRED */
X { 85, 255, 85 }, /* 9. LIGHTGREEN */
X { 0, 170, 170 }, /* 10. CYAN */
X { 170, 170, 0 }, /* 11. BROWN */
};
#define COLOR24_SIZE (sizeof(colors24bits) / (sizeof(short) * 3))
X
static iris24bits = FALSE;
X
#define IRIS4D_BACKGROUND 0
#define IRIS4D_BLACK 1
#define IRIS4D_MAGENTA 2
#define IRIS4D_LIGHTCYAN 3
#define IRIS4D_RED 4
#define IRIS4D_GREEN 5
#define IRIS4D_LIGHTMAGENTA 6
#define IRIS4D_YELLOW 7
#define IRIS4D_LIGHTRED 8
#define IRIS4D_LIGHTGREEN 9
#define IRIS4D_CYAN 10
#define IRIS4D_BROWN 11
X
IRIS4D_options()
{
X int i = 0;
X struct value a;
X extern struct value *const_express();
X extern double real();
X
X if (!END_OF_COMMAND) {
X i = (int) real(const_express(&a));
X }
X
X iris24bits = (i == 24);
X
X sprintf(term_options, "%s",iris24bits ? "24" : "8");
}
X
IRIS4D_init()
{
X int i;
X char homedirfile[80], line[80];
X FILE *f;
X
X foreground();
X winopen("Gnuplot");
X if (iris24bits)
X {
X RGBmode();
X gconfig();
X }
X
X strcat(strcat(strcpy(homedirfile,getenv("HOME")),"/"),IRIS4DRC);
X if ((f = fopen(IRIS4DRC, "r")) != NULL ||
X (f = fopen(homedirfile, "r")) != NULL) {
X int c1, c2, c3;
X for (i = 0; i < COLOR24_SIZE; i++) {
X if (fgets(line, 79, f) == NULL ||
X sscanf(line, "%d %d %d", &c1, &c2, &c3) != 3)
X int_error("Iris4d color file terminated prematurely or wrong format.\n", NO_CARET);
X colors24bits[i][0] = c1;
X colors24bits[i][1] = c2;
X colors24bits[i][2] = c3;
X }
X
X fclose(f);
X }
X deflinestyle(1, 0x3FFF); /* long dash */
X deflinestyle(2, 0x5555); /* dotted */
X deflinestyle(3, 0x3333); /* short dash */
X deflinestyle(4, 0xB5AD); /* dotdashed */
X deflinestyle(5, 0x0F0F); /* dashed */
X deflinestyle(6, 0xBBBB); /* dotdashed */
X deflinestyle(7, 0x3F3F); /* mid-long dash */
X deflinestyle(8, 0x7777); /* mid-long dash */
X
X return;
}
X
IRIS4D_graphics()
{
X reshapeviewport();
X ortho2((Coord)0, (Coord)IRIS4D_XMAX, (Coord)0, (Coord)IRIS4D_YMAX);
X if (iris24bits)
X RGBcolor(colors24bits[IRIS4D_BACKGROUND][0],
X colors24bits[IRIS4D_BACKGROUND][1],
X colors24bits[IRIS4D_BACKGROUND][2]);
X else
X color(WHITE);
X
X clear();
SHAR_EOF
true || echo 'restore of gnuplot/term/iris4d.trm failed'
fi
echo 'End of part 16'
echo 'File gnuplot/term/iris4d.trm is continued in part 17'
echo 17 > _shar_seq_.tmp
#!/bin/sh
# this is Part.17 (part 17 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/iris4d.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 17; 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/iris4d.trm'
else
echo 'x - continuing file gnuplot/term/iris4d.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/iris4d.trm' &&
X
X return;
}
X
IRIS4D_text()
{
X return; /* enter text from another window!!! */
}
X
IRIS4D_linetype(linetype)
int linetype;
{
X static int pen_color_24[11] =
X {
X IRIS4D_BLACK, /* reserved for border and numbers */
X IRIS4D_MAGENTA, /* reserved for axis traces */
X IRIS4D_LIGHTCYAN,
X IRIS4D_RED,
X IRIS4D_GREEN,
X IRIS4D_LIGHTMAGENTA,
X IRIS4D_YELLOW,
X IRIS4D_LIGHTRED,
X IRIS4D_LIGHTGREEN,
X IRIS4D_CYAN,
X IRIS4D_BROWN,
X };
X static int pen_color[8] = {0 ,1, 4, 5, 6, 1, 2, 4};
X
X if (iris24bits)
X {
X int pencolor = pen_color_24[linetype < 0 ? linetype + 2 : linetype % 9 + 2];
X
X RGBcolor(colors24bits[pencolor][0],
X colors24bits[pencolor][1],
X colors24bits[pencolor][2]);
X /* Make all lines solid (linestyle 0) upto to the ninth. If more than
X * 9 colors are needed, start to use the different line styles (1 to 8).
X */
X setlinestyle(linetype < 9 ? 0 : (linetype + 2) % 8 + 1);
X }
X else
X {
X linetype = linetype % 8;
X color((Colorindex) pen_color[linetype]);
X setlinestyle(linetype);
X }
X return;
}
X
IRIS4D_move(x, y)
unsigned int x, y;
{
X move2i(x, y);
X return;
}
X
IRIS4D_cmove(x, y)
unsigned int x, y;
{
X cmov2i(x, y);
X return;
}
X
IRIS4D_vector(x, y)
unsigned x, y;
{
X draw2i(x, y);
X return;
}
X
X
IRIS4D_put_text(x,y,str)
int x, y;
char *str;
{
X IRIS4D_cmove(x,y - IRIS4D_VCHAR/2);
X charstr(str);
X return;
}
X
X
IRIS4D_reset()
{
X return;
}
X
SHAR_EOF
echo 'File gnuplot/term/iris4d.trm is complete' &&
chmod 0644 gnuplot/term/iris4d.trm ||
echo 'restore of gnuplot/term/iris4d.trm failed'
Wc_c="`wc -c < 'gnuplot/term/iris4d.trm'`"
test 5305 -eq "$Wc_c" ||
echo 'gnuplot/term/iris4d.trm: original size 5305, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/kyo.trm ==============
if test -f 'gnuplot/term/kyo.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/kyo.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/kyo.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/kyo.trm' &&
/* Prescribe (KYOCERA) driver - Michael Waldor */
/* Modified for gnuplot 2.0 sk@sun4 24-Apr-1990 13:23 */
#ifdef PRESCRIBE
X
#define PRE_XMAX 2567
#define PRE_YMAX 1815 /* X:Y = sqrt(2) */
X
#define PRE_XLAST (PRE_XMAX - 1)
#define PRE_YLAST (PRE_YMAX - 1)
X
#define PRE_VCHAR (PRE_YMAX/30)
#define PRE_HCHAR 33 /* about 9 chars per inch */
#define PRE_HTIC (PRE_XMAX/80)
#define PRE_VTIC PRE_HTIC
X
/* for Courier font: */
#define KYO_VCHAR (14*(300/72)) /* 12 pt + 2 pt baselineskip */
#define KYO_HCHAR (300/10) /* 10 chars per inch */
X
enum JUSTIFY pre_justify=LEFT; /* text is flush left */
X
PRE_init()
{
X (void) fprintf(outfile,"!R! RES;\n") ;
X /* UNIT: units are dots, 300 dots = 1 in = 72 pt */
X /* SPO: landscape format */
X /* STM, SLM set top, left margin*/
X /* Font: bold Helvetica (proportional font) */
X (void) fprintf(outfile,"PAGE; UNIT D; SPO L; STM 280; SLM 440;\n") ;
X (void) fprintf(outfile,"FTMD 15; FONT 29; SCPI 9;\n") ;
}
X
KYO_init()
{
X (void) fprintf(outfile,"!R! RES;\n") ;
X /* UNIT: units are dots, 300 dots = 1 in = 72 pt */
X /* SPO: landscape format */
X /* STM, SLM set top, left margin */
X /* Font: Courier (fixed width font) */
X (void) fprintf(outfile,"PAGE; UNIT D; SPO L; STM 280; SLM 440;\n") ;
X (void) fprintf(outfile,"FTMD 15; FONT 17; SCPI 10;\n") ;
}
X
PRE_graphics()
{
}
X
PRE_text() /* eject page after each plot */
{
X (void) fprintf(outfile,"PAGE;\n") ;
}
X
PRE_linetype(linetype)
int linetype ;
{
X /* actually choose pendiameter */
X if (linetype < 0) linetype = -linetype;
X else linetype = 3;
X (void) fprintf(outfile,"SPD %d;\n", linetype) ;
}
X
PRE_move(x,y)
unsigned int x,y ;
{
X (void) fprintf(outfile,"MAP %1d,%1d;\n",x,PRE_YMAX-y) ;
}
X
PRE_vector(x,y)
unsigned int x,y ;
{
X (void) fprintf(outfile,"DAP %1d, %1d;\n",x,PRE_YMAX-y) ;
}
X
PRE_put_text(x, y, str)
unsigned int x,y ;
char *str;
{
X PRE_move(x,y);
X switch(pre_justify){
X case RIGHT:
X (void) fprintf(outfile,"RTXT \"%s\", B;\n",str) ;
X break;
X default:
X (void) fprintf(outfile,"TEXT \"%s\", B;\n",str) ;
X }
}
X
int PRE_justify_text(mode)
enum JUSTIFY mode;
{
X pre_justify=mode;
X switch(pre_justify){
X case LEFT:
X case RIGHT:
X return(TRUE);
X default:
X return(FALSE);
X }
X
}
X
PRE_reset()
{
X (void) fprintf(outfile,"PAGE; RES; EXIT;\n");
}
X
#endif /* PRESCRIBE */
SHAR_EOF
chmod 0666 gnuplot/term/kyo.trm ||
echo 'restore of gnuplot/term/kyo.trm failed'
Wc_c="`wc -c < 'gnuplot/term/kyo.trm'`"
test 2313 -eq "$Wc_c" ||
echo 'gnuplot/term/kyo.trm: original size 2313, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/latex.trm ==============
if test -f 'gnuplot/term/latex.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/latex.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/latex.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/latex.trm' &&
/* GNUPLOT - latex.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 * LaTeX pictures (latex).
X * LaTeX pictures with emTeX specials (emtex).
X *
X * AUTHORS
X * David Kotz, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/* modified to optimize use of \rule for long lines */
X
/* the following LATEX driver has been modified by
X Russell Lang, eln...@monu1.cc.monash.oz from the
X GnuTeX 1.3 driver by David Kotz, David...@Dartmouth.edu.
X Since then it has been further extended by David Kotz.
X EmTeX driver by Russell Lang. */
X
X
#define LATEX_PTS_PER_INCH (72.27)
#define DOTS_PER_INCH (300) /* resolution of printer we expect to use */
#define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
X
/* 5 inches wide by 3 inches high (default) */
#define LATEX_XMAX (5*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
#define LATEX_YMAX (3*DOTS_PER_INCH) /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
X
#define LATEX_HTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
#define LATEX_VTIC (5*DOTS_PER_INCH/72) /* (5./LATEX_UNIT) */
#define LATEX_HCHAR (DOTS_PER_INCH*53/10/72) /* (5.3/LATEX_UNIT) */
#define LATEX_VCHAR (DOTS_PER_INCH*11/72) /* (11./LATEX_UNIT) */
X
static int LATEX_posx;
static int LATEX_posy;
static enum JUSTIFY latex_justify=LEFT;
static int latex_angle=0;
X
/* Default line-drawing character */
/* the definition of plotpoint varies with linetype */
#define LATEX_DOT "\\usebox{\\plotpoint}"
#define LATEX_TINY_DOT "\\rule{.1pt}{.1pt}" /* for dots plot style */
X
/* POINTS */
#define LATEX_POINT_TYPES 12 /* we supply more point types */
static char *LATEX_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 */
static float LATEX_size = 0; /* current thick of line in points */
static float LATEX_dotspace = 0; /* current dotspace of line in points */
#define LATEX_LINE_TYPES 6 /* number of line types below */
#define LATEX_THIN_LINE 0 /* the thinnest solid line type */
static struct {
X float size; /* size of dot, or thick of line in points */
X float dotspace; /* inter-dot space in points; 0 for lines */
} LATEX_lines[] = {
X {.35, 0.0}, /* thin solid line */
X {.7, 0.0}, /* thick solid line */
X {1.0, 0.0}, /* Thick solid line */
X {.5, 5.0}, /* dotted line */
X {.5, 9.0}, /* widely dotted line */
X {.5, 13.0} /* really widely dotted line */
};
/* for drawing dotted and solid lines */
static void LATEX_dot_line();
static void LATEX_solid_line();
static void LATEX_rule();
static void LATEX_flushdot();
#define LATEX_flushrule() LATEX_rule(2, 0.,0.,0.,0.) /* flush old rule */
static BOOLEAN LATEX_moved = TRUE; /* pen is up after move */
static float LATEX_dotsize; /* size of LATEX_DOT in units */
static BOOLEAN LATEX_needsdot = FALSE;/* does dotted line need termination? */
X
#ifdef EMTEX
BOOLEAN emtex=FALSE; /* not currently using emtex */
static void EMTEX_solid_line();
#endif
X
/* ARROWS */
/* the set of non-vertical/non-horizontal LaTeX vector slopes */
/* except negatives - they are handled specially */
static struct vslope {
X int dx, dy;
} LATEX_slopes[] = {
X {1,1}, {1,2}, {1,3}, {1,4},
X {2,1}, {2,3},
X {3,1}, {3,2}, {3,4},
X {4,1}, {4,3},
X {0,0} /* terminator */
};
static void best_latex_arrow(); /* figure out the best arrow */
X
LATEX_init()
{
#ifdef EMTEX
X emtex = FALSE;
#endif
X LATEX_posx = LATEX_posy = 0;
X fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
X fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
X fprintf(outfile,
X "\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n");
X LATEX_linetype(-1);
}
X
X
LATEX_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 LATEX_graphics */
X t->xmax = (unsigned int)(LATEX_XMAX * xs);
X t->ymax = (unsigned int)(LATEX_YMAX * ys);
X
X return(TRUE);
}
X
LATEX_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
LATEX_text()
{
X LATEX_flushrule();
X LATEX_flushdot();
X fprintf(outfile, "\\end{picture}\n");
X LATEX_posx = LATEX_posy = 0; /* current position */
X LATEX_moved = TRUE; /* pen is up after move */
}
X
LATEX_linetype(linetype)
X int linetype;
{
X float size;
X
X if (linetype >= LATEX_LINE_TYPES)
X linetype %= LATEX_LINE_TYPES;
X
#ifdef EMTEX
X if (!emtex)
#endif
X LATEX_flushrule();
X LATEX_flushdot();
X
X /* Find the new desired line thickness. */
X /* negative linetypes (for axes) use a thin line */
X /* only relevant for drawing axes/border in 3d */
X size = (linetype >= 0 ? LATEX_lines[linetype].size
X : LATEX_lines[LATEX_THIN_LINE].size);
X
X /* If different from current size, redefine \plotpoint */
X if (size != LATEX_size) {
X fprintf(outfile,
X "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}%%\n",
X -size/2, size, size);
#ifdef EMTEX
X if (emtex) /* change line width */
X fprintf(outfile, "\\special{em:linewidth %.1fpt}%%\n", size);
#endif
X }
X
X LATEX_size = size;
X LATEX_dotsize = size / LATEX_UNIT;
X LATEX_dotspace = (linetype >= 0) ? LATEX_lines[linetype].dotspace : 0;
X LATEX_moved = TRUE; /* reset */
}
X
LATEX_move(x,y)
X unsigned int x,y;
{
X LATEX_flushdot();
X
X LATEX_posx = x;
X LATEX_posy = y;
X LATEX_moved = TRUE; /* reset */
}
X
X
LATEX_point(x,y, number) /* version of line_and_point */
X unsigned int x,y;
X int number; /* type of point */
{
X LATEX_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 ? LATEX_TINY_DOT
X : LATEX_points[number % LATEX_POINT_TYPES]));
}
X
X
LATEX_vector(ux,uy)
X unsigned int ux,uy;
{
X if (LATEX_dotspace == 0.0) {
X /* solid line */
#ifdef EMTEX
X if (emtex)
X EMTEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
X else
#endif
X LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
X } else
X /* dotted line */
X LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
X
X LATEX_posx = ux;
X LATEX_posy = uy;
}
X
static void
LATEX_solid_line(x1,x2, y1,y2)
X int x1,x2, y1,y2;
{
X float slope;
X int inc;
X float next;
X float x,y;
X int code; /* possibly combine with previous rule */
X
X /* we draw a solid line using the current line thickness (size) */
X /* we do it with lots of \\rules */
X
X if (x1 == x2 && y1 == y2) { /* zero-length line - just a dot */
X if (LATEX_moved) {
X LATEX_flushrule();
X /* plot a dot */
X fprintf(outfile, "\\put(%u,%u){%s}\n", x1, y1, LATEX_DOT);
X }
X } else {
X code = (LATEX_moved ? 0 : 1); /* no combine after move */
X if (x1 == x2) /* vertical line - special case */
X LATEX_rule(code, (double)x1, (double)y1,
X LATEX_dotsize, (double)y2-y1);
X else if (y1 == y2) /* horizontal line - special case */
X LATEX_rule(code, (double)x1, (double)y1, (double)x2-x1,
X LATEX_dotsize);
X else {
X slope = ((float)y2-y1)/((float)x2-x1);
X if (abs(slope) <= 1.0) {
X /* longer than high */
X inc = sign(y2-y1);
X for (x = x1, y = y1; (y2-y)*inc >= 0; y += inc) {
X next = inc/slope + x;
X if ((x2>x1 && next > x2) || (x2<x1 && next < x2)) {
X LATEX_rule(code, x,y, x2-x, LATEX_dotsize);
X break;
X } else {
X LATEX_rule(code, x,y, next-x, LATEX_dotsize);
X x = next;
X }
X code = 0;
X }
X } else {
X /* higher than long */
X inc = sign(x2-x1);
X for (x = x1, y = y1; (x2-x)*inc >= 0; x += inc) {
X next = inc*slope + y;
X if ((y2>y1 && next > y2) || (y2<y1 && next < y2)) {
X LATEX_rule(code, x,y, LATEX_dotsize, y2-y);
X break;
X } else {
X LATEX_rule(code, x,y, LATEX_dotsize, next-y);
X y = next;
X }
X code = 0;
X }
X }
X }
X }
X LATEX_moved = FALSE;
}
X
/* Draw a \rule. Width or height may be negative; we can correct.
X * The rule is never output immediately. The previous rule is output
X * as-is if code is 0, and the previous rule is
X * combined with the current rule (if possible) if code is 1.
X * The previous rule is output, and the new one ignored, if code is 2.
X */
static void
LATEX_rule(code, x,y, width, height)
X int code; /* how do we treat this rule? */
X double x, y;
X double width;
X double height;
{
X static float lastx, lasty;
X static float lastw, lasth;
X static BOOLEAN valid = FALSE; /* is 'last' data valid? */
X BOOLEAN combine = (code == 1);
X BOOLEAN flush = (code == 2);
X
X if (!flush)
X if (width == 0 || height == 0)
X return; /* ignore this rule */
X
X if (valid && combine) {
X /* try to combine new rule with old rule */
X if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
X if (lasth * height >= 0) { /* same sign */
X lasth += height;
X return;
X }
X } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
X if (lastw * width >= 0) { /* same sign */
X lastw += width;
X return;
X }
X }
X /* oh well, output last and remember the new one */
X }
X
X if (valid) {
X /* output the rule */
X if (lastw < 0) {
X lastx += lastw;
X lastw = -lastw;
X }
X if (lasth < 0) {
X lasty += lasth;
X lasth = -lasth;
X }
X
X /* if very small use canned dot */
X if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
X fprintf(outfile, "\\put(%d,%d){%s}\n",
X (int)lastx, (int)lasty, LATEX_DOT);
X else
X fprintf(outfile, "\\put(%d,%d){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
X (int)lastx, (int)lasty, -LATEX_dotsize*LATEX_UNIT/2,
X lastw*LATEX_UNIT, lasth*LATEX_UNIT);
X }
X
X if (flush) {
X valid = FALSE;
X } else {
X lastx = x; lasty = y;
X lastw = width; lasth = height;
X valid = TRUE;
X }
}
X
static void
LATEX_dot_line(x1,x2, y1,y2)
X int x1,x2, y1,y2;
{
X static float LATEX_left; /* fraction of space left after last dot */
#ifndef AMIGA_AC_5
X extern double sqrt();
#endif
X /* we draw a dotted line using the current dot spacing */
X
X if (LATEX_moved)
X LATEX_left = 1.0; /* reset after a move */
X
X /* zero-length line? */
X if (x1 == x2 && y1 == y2) {
X if (LATEX_moved)
X /* plot a dot */
X fprintf(outfile, "\\put(%u,%u){%s}\n", x1, y1, LATEX_DOT);
X } else {
X float dotspace = LATEX_dotspace / LATEX_UNIT;
X float x,y; /* current position */
X float xinc, yinc; /* increments */
X float slope; /* slope of line */
X float lastx = -1; /* last x point plotted */
X float lasty = -1; /* last y point plotted */
X
X /* first, figure out increments for x and y */
X if (x2 == x1) {
X xinc = 0.0;
X yinc = dotspace;
X } else {
X slope = ((float)y2-y1)/((float)x2-x1);
X xinc = dotspace / sqrt(1 + slope*slope) * sign(x2-x1);
X yinc = slope * xinc;
X }
X
X /* now draw the dotted line */
X /* we take into account where we last placed a dot */
X for (x=x1 + xinc*(1-LATEX_left), y=y1 + yinc*(1-LATEX_left);
X (x2-x)*xinc >= 0 && (y2-y)*yinc >= 0; /* same sign or zero */
X lastx = x, x += xinc,
X lasty = y, y += yinc)
X fprintf(outfile, "\\put(%d,%d){%s}\n", (int)x, (int)y, LATEX_DOT);
X
X /* how much is left over, as a fraction of dotspace? */
X if (xinc != 0.0) /* xinc must be nonzero */
X if (lastx >= 0)
X LATEX_left = abs(x2 - lastx) / abs(xinc);
X else
X LATEX_left += abs(x2-x1) / abs(xinc);
X else
X if (lasty >= 0)
X LATEX_left = abs(y2 - lasty) / abs(yinc);
X else
X LATEX_left += abs(y2-y1) / abs(yinc);
X }
X
X LATEX_needsdot = (LATEX_left > 0);
X
X LATEX_moved = FALSE;
}
X
static void
LATEX_flushdot()
{
X if (LATEX_needsdot)
X fprintf(outfile, "\\put(%d,%d){%s}\n",
X LATEX_posx, LATEX_posy, LATEX_DOT);
X LATEX_needsdot = FALSE;
}
X
LATEX_arrow(sx,sy, ex,ey, head)
X int sx,sy, ex,ey;
X BOOLEAN head;
{
X best_latex_arrow(sx,sy, ex,ey, 1, head);
X
X LATEX_posx = ex;
X LATEX_posy = ey;
}
X
static void best_latex_arrow(sx,sy, ex,ey, who, head)
X int sx,sy, ex,ey; /* start and end points */
X int who; /* 1=LATEX, 2=EEPIC */
X BOOLEAN head;
{
X int dx = ex - sx;
X int dy = ey - sy;
X int x, y; /* points near sx,sy */
X float m; /* slope of line */
X float arrowslope; /* slope of arrow */
X float minerror = 0; /* best-case error */
X struct vslope *slope; /* one of the slopes */
X struct vslope *bestslope; /* the slope with min error */
X BOOLEAN horiz; /* was it the horiz line that was best? */
X
X /* We try to draw a real arrow (ie, \vector). If we can't get
X * a slope that is close, we draw a bent arrow.
X */
X
X if (dx == 0) {
X /* vertical arrow */
X fprintf(outfile, "\\put(%d,%d){\\%s(0,%d){%d}}\n",
X sx, sy, head ? "vector":"line",
X sign(ey-sy), abs(ey-sy));
X } else if (dy == 0) {
X /* horizontal arrow */
X fprintf(outfile, "\\put(%d,%d){\\%s(%d,0){%d}}\n",
X sx, sy, head ? "vector":"line",
X sign(ex-sx), abs(ex-sx));
X } else {
X /* Slanted arrow. We'll give it a try.
X * we try to find the closest-slope arrowhead.
X */
X bestslope = NULL;
X minerror = 0; /* to shut up turbo C */
X m = abs((float)dy/dx); /* the slope we want */
X for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
X /* find the slope of the arrow */
X arrowslope = (float) slope->dy / slope->dx;
X if (bestslope == NULL || abs(m-arrowslope) < minerror) {
X minerror = abs(m-arrowslope);
X bestslope = slope;
X }
X }
X
X /* now we have the best slope arrow */
X /* maybe it's exactly the right slope! */
X if (minerror == 0.0) /* unlikely but possible */
X fprintf(outfile, "\\put(%d,%d){\\%s(%d,%d){%d}}\n",
X sx, sy, head ? "vector" : "line",
X bestslope->dx*sign(ex-sx), bestslope->dy*sign(ey-sy),
X abs(ex-sx));
X else {
X /* we draw the line the usual way, with thin lines */
#ifdef EMTEX
X if (emtex) {
X LATEX_linetype(LATEX_THIN_LINE);
X EMTEX_solid_line(sx,ex,sy,ey);
X } else
#endif
X if (who == 1) {
X LATEX_linetype(LATEX_THIN_LINE);
X LATEX_solid_line(sx,ex,sy,ey);
X }
#ifdef EEPIC
X else {
X EEPIC_move(sx,sy);
X EEPIC_vector(ex,ey);
X }
#endif /* EEPIC */
X /* and then draw an arrowhead (a short vector) there */
X if (head)
X fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
X ex, ey,
X bestslope->dx*sign(ex-sx), bestslope->dy*sign(ey-sy));
X }
X }
}
X
X
LATEX_put_text(x, y, str)
X int x,y; /* reference point of string */
X char str[]; /* the text */
{
X /* ignore empty strings */
X if (str[0] == '\0')
X return;
X
X fprintf(outfile, "\\put(%d,%d)",x,y);
X switch(latex_angle) {
X case 0: {
X switch(latex_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(latex_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 LATEX_justify_text(mode)
X enum JUSTIFY mode;
{
X latex_justify = mode;
X return (TRUE);
}
X
int LATEX_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 latex_angle = angle;
X return (TRUE);
}
X
LATEX_reset()
{
X LATEX_posx = LATEX_posy = 0; /* current position */
X LATEX_moved = TRUE; /* pen is up after move */
}
X
X
#ifdef EMTEX
X
EMTEX_init()
{
X emtex=TRUE;
X LATEX_posx = LATEX_posy = 0;
X fprintf(outfile, "%% GNUPLOT: LaTeX picture with emtex specials\n");
X fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
X fprintf(outfile,
X "\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n");
X LATEX_linetype(-1);
}
X
X
EMTEX_reset()
{
X emtex=FALSE;
X LATEX_posx = LATEX_posy = 0;
}
X
X
EMTEX_text()
{
X fprintf(outfile, "\\end{picture}\n");
}
X
X
static void
EMTEX_solid_line(x1,x2, y1,y2)
X int x1,x2, y1,y2;
{
X /* emtex special solid line */
X if (LATEX_moved)
X fprintf(outfile, "\\put(%d,%d){\\special{em:moveto}}\n", x1, y1);
X if ( (x1!=x2) || (y1!=y2) )
X fprintf(outfile, "\\put(%d,%d){\\special{em:lineto}}\n", x2, y2);
X LATEX_posx = x2;
X LATEX_posy = y2;
X LATEX_moved = FALSE;
}
X
X
#endif /* EMTEX */
SHAR_EOF
chmod 0644 gnuplot/term/latex.trm ||
echo 'restore of gnuplot/term/latex.trm failed'
Wc_c="`wc -c < 'gnuplot/term/latex.trm'`"
test 17764 -eq "$Wc_c" ||
echo 'gnuplot/term/latex.trm: original size 17764, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/object.h ==============
if test -f 'gnuplot/term/object.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/object.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/object.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/object.h' &&
/*
X * FIG : Facility for Interactive Generation of figures
X *
X * (c) copy right 1985 by Supoj Sutanthavibul (su...@sally.utexas.edu)
X * January 1985.
X * 1st revision : Aug 1985.
X * 2nd revision : Feb 1988.
X *
X * %W% %G%
*/
#define DEFAULT -1
X
typedef struct f_pattern {
X int w, h;
X int *p;
X }
X F_pattern;
X
typedef struct f_pen {
X int x, y;
X int *p;
X }
X F_pen;
X
typedef struct f_point {
X int x, y;
X struct f_point *next;
X }
X F_point;
X
typedef struct f_pos {
X int x, y;
X }
X F_pos;
X
typedef struct f_arrow {
X int type;
X int style;
X float thickness;
X float wid;
X float ht;
X }
X F_arrow;
X
typedef struct f_ellipse {
X int type;
#define T_ELLIPSE_BY_RAD 1
#define T_ELLIPSE_BY_DIA 2
#define T_CIRCLE_BY_RAD 3
#define T_CIRCLE_BY_DIA 4
X int style;
X int thickness;
X int color;
#define BLACK 0
X int depth;
X int direction;
X float style_val;
X float angle;
X struct f_pen *pen;
X struct f_pattern *area_fill;
#define UNFILLED (F_pattern *)0
#define BLACK_FILL (F_pattern *)1
#define DARK_GRAY_FILL (F_pattern *)2
#define MED_GRAY_FILL (F_pattern *)3
#define LIGHT_GRAY_FILL (F_pattern *)4
#define WHITE_FILL (F_pattern *)4
X struct f_pos center;
X struct f_pos radiuses;
X struct f_pos start;
X struct f_pos end;
X struct f_ellipse *next;
X }
X F_ellipse;
X
typedef struct f_arc {
X int type;
#define T_3_POINTS_ARC 1
X int style;
X int thickness;
X int color;
X int depth;
X struct f_pen *pen;
X struct f_pattern *area_fill;
X float style_val;
X int direction;
X struct f_arrow *for_arrow;
X struct f_arrow *back_arrow;
X struct {float x, y;} center;
X struct f_pos point[3];
X struct f_arc *next;
X }
X F_arc;
X
typedef struct f_line {
X int type;
#define T_POLYLINE 1
#define T_BOX 2
#define T_POLYGON 3
X int style;
X int thickness;
X int color;
X int depth;
X float style_val;
X struct f_pen *pen;
X struct f_pattern *area_fill;
X struct f_arrow *for_arrow;
X struct f_arrow *back_arrow;
X struct f_point *points;
X struct f_line *next;
X }
X F_line;
X
typedef struct f_text {
X int type;
#define T_LEFT_JUSTIFIED 0
#define T_CENTER_JUSTIFIED 1
#define T_RIGHT_JUSTIFIED 2
X int font;
#define DEFAULT_FONT 0
#define ROMAN_FONT 1
#define BOLD_FONT 2
#define ITALIC_FONT 3
#define MODERN_FONT 4
#define TYPEWRITER_FONT 5
X int size; /* point size */
X int color;
X int depth;
X float angle; /* in radian */
X int style;
#define PLAIN 1
#define ITALIC 2
#define BOLD 4
#define OUTLINE 8
#define SHADOW 16
X int height; /* pixels */
X int length; /* pixels */
X int base_x;
X int base_y;
X struct f_pen *pen;
X char *cstring;
X struct f_text *next;
X }
X F_text;
X
typedef struct f_control {
X float lx, ly, rx, ry;
X struct f_control *next;
X }
X F_control;
X
#define int_spline(s) (s->type & 0x2)
#define normal_spline(s) (!(s->type & 0x2))
#define closed_spline(s) (s->type & 0x1)
#define open_spline(s) (!(s->type & 0x1))
X
typedef struct f_spline {
X int type;
#define T_OPEN_NORMAL 0
#define T_CLOSED_NORMAL 1
#define T_OPEN_INTERPOLATED 2
#define T_CLOSED_INTERPOLATED 3
X int style;
X int thickness;
X int color;
X int depth;
X float style_val;
X struct f_pen *pen;
X struct f_pattern *area_fill;
X struct f_arrow *for_arrow;
X struct f_arrow *back_arrow;
X /*
X For T_OPEN_NORMAL and T_CLOSED_NORMAL points
X are control points while they are knots for
X T_OPEN_INTERPOLATED and T_CLOSED_INTERPOLTED
X whose control points are stored in controls.
X */
X struct f_point *points;
X struct f_control *controls;
X struct f_spline *next;
X }
X F_spline;
X
typedef struct f_compound {
X struct f_pos nwcorner;
X struct f_pos secorner;
X struct f_line *lines;
X struct f_ellipse *ellipses;
X struct f_spline *splines;
X struct f_text *texts;
X struct f_arc *arcs;
X struct f_compound *compounds;
X struct f_compound *next;
X }
X F_compound;
X
#define ARROW_SIZE sizeof(struct f_arrow)
#define POINT_SIZE sizeof(struct f_point)
#define CONTROL_SIZE sizeof(struct f_control)
#define ELLOBJ_SIZE sizeof(struct f_ellipse)
#define ARCOBJ_SIZE sizeof(struct f_arc)
#define LINOBJ_SIZE sizeof(struct f_line)
#define TEXOBJ_SIZE sizeof(struct f_text)
#define SPLOBJ_SIZE sizeof(struct f_spline)
#define COMOBJ_SIZE sizeof(struct f_compound)
X
/********************** object codes **********************/
X
#define O_ELLIPSE 1
#define O_POLYLINE 2
#define O_SPLINE 3
#define O_TEXT 4
#define O_ARC 5
#define O_COMPOUND 6
#define O_END_COMPOUND -O_COMPOUND
#define O_ALL_OBJECT 99
X
/************ object styles (except for f_text) ************/
X
#define SOLID_LINE 0
#define DASH_LINE 1
#define DOTTED_LINE 2
X
#define CLOSED_PATH 0
#define OPEN_PATH 1
SHAR_EOF
chmod 0666 gnuplot/term/object.h ||
echo 'restore of gnuplot/term/object.h failed'
Wc_c="`wc -c < 'gnuplot/term/object.h'`"
test 5063 -eq "$Wc_c" ||
echo 'gnuplot/term/object.h: original size 5063, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/post.trm ==============
if test -f 'gnuplot/term/post.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/post.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/post.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/post.trm' &&
/* GNUPLOT - post.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 * postscript
X *
X * AUTHORS
X * Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X * The 'postscript' driver produces landscape output 10" wide and 7" high.
X * To get a smaller epsf output use 'set size 0.5,0.5',
X * 'set term postscript portrait', make only one plot per file
X * and change the first line of the postscript file from
X * '%!PS-Adobe-2.0' to '%!PS-Adobe-2.0 EPSF-2.0'
X * To change font to Times-Roman and font size to 20pts use
X * 'set term postscript "Times-Roman" 20'.
X */
X
X
/* PostScript driver by Russell Lang, r...@monu1.cc.monash.edu.au */
X
char ps_font[MAX_ID_LEN+1] = "Courier" ; /* name of font */
int ps_fontsize = 14; /* size of font in pts */
BOOLEAN ps_portrait = FALSE; /* vertical page */
BOOLEAN ps_color = FALSE;
int ps_page=0; /* page count */
int ps_path_count=0; /* count of lines in path */
int ps_ang=0; /* text angle */
enum JUSTIFY ps_justify=LEFT; /* text is flush left */
X
char *PS_header[] = {
"/vpt2 vpt 2 mul def\n",
"/hpt2 hpt 2 mul def\n",
/* flush left show */
"/Lshow { currentpoint stroke moveto\n",
" 0 vshift rmoveto show } def\n",
/* flush right show */
"/Rshow { currentpoint stroke moveto\n",
" dup stringwidth pop neg vshift rmoveto show } def\n",
/* centred show */
"/Cshow { currentpoint stroke moveto\n",
" dup stringwidth pop -2 div vshift rmoveto show } def\n",
/* Dash or Color Line */
"/DL { Color {setrgbcolor [] 0 setdash pop}\n",
" {pop pop pop 0 setdash} ifelse } def\n",
/* Border Lines */
"/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
/* Axes Lines */
"/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
/* Plot Lines */
"/PL { stroke gnulinewidth setlinewidth } def\n",
/* Line Types */
"/LTb { BL [] 0 0 0 DL } def\n", /* border */
"/LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def\n", /* axes */
"/LT0 { PL [] 0 1 0 DL } def\n",
"/LT1 { PL [4 dl 2 dl] 0 0 1 DL } def\n",
"/LT2 { PL [2 dl 3 dl] 1 0 0 DL } def\n",
"/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def\n",
"/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def\n",
"/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def\n",
"/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def\n",
"/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def\n",
"/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def\n",
"/M {moveto} def\n",
"/L {lineto} def\n",
"/P { stroke [] 0 setdash\n", /* Point */
" currentlinewidth 2 div sub moveto\n",
" 0 currentlinewidth rlineto stroke } def\n",
"/D { stroke [] 0 setdash 2 copy vpt add moveto\n", /* Diamond */
" hpt neg vpt neg rlineto hpt vpt neg rlineto\n",
" hpt vpt rlineto hpt neg vpt rlineto closepath stroke\n",
" P } def\n",
"/A { stroke [] 0 setdash vpt sub moveto 0 vpt2 rlineto\n", /* Plus (Add) */
" currentpoint stroke moveto\n",
" hpt neg vpt neg rmoveto hpt2 0 rlineto stroke\n",
" } def\n",
"/B { stroke [] 0 setdash 2 copy exch hpt sub exch vpt add moveto\n", /* Box */
" 0 vpt2 neg rlineto hpt2 0 rlineto 0 vpt2 rlineto\n",
" hpt2 neg 0 rlineto closepath stroke\n",
" P } def\n",
"/C { stroke [] 0 setdash exch hpt sub exch vpt add moveto\n", /* Cross */
" hpt2 vpt2 neg rlineto currentpoint stroke moveto\n",
" hpt2 neg 0 rmoveto hpt2 vpt2 rlineto stroke } def\n",
"/T { stroke [] 0 setdash 2 copy vpt 1.12 mul add moveto\n", /* Triangle */
" hpt neg vpt -1.62 mul rlineto\n",
" hpt 2 mul 0 rlineto\n",
" hpt neg vpt 1.62 mul rlineto closepath stroke\n",
" P } def\n",
"/S { 2 copy A C} def\n", /* Star */
NULL
};
X
#define PS_XOFF 50 /* page offset in pts */
#define PS_YOFF 50
X
#define PS_XMAX 7200
#define PS_YMAX 5040
X
#define PS_XLAST (PS_XMAX - 1)
#define PS_YLAST (PS_YMAX - 1)
X
#define PS_VTIC (PS_YMAX/80)
#define PS_HTIC (PS_YMAX/80)
X
#define PS_SC (10) /* scale is 1pt = 10 units */
#define PS_LW (0.5*PS_SC) /* linewidth = 0.5 pts */
X
#define PS_VCHAR (14*PS_SC) /* default is 14 point characters */
#define PS_HCHAR (14*PS_SC*6/10)
X
X
PS_options()
{
X extern struct value *const_express();
X extern double real();
X
X if (!END_OF_COMMAND) {
X if (almost_equals(c_token,"p$ortrait")) {
X ps_portrait=TRUE;
X c_token++;
X }
X else if (almost_equals(c_token,"l$andscape")) {
X ps_portrait=FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"d$efault")) {
X ps_portrait=FALSE;
X ps_color=FALSE;
X strcpy(ps_font,"Courier");
X ps_fontsize = 14;
X c_token++;
X }
X }
X
X if (!END_OF_COMMAND) {
X if (almost_equals(c_token,"m$onochrome")) {
X ps_color=FALSE;
X c_token++;
X }
X else if (almost_equals(c_token,"c$olor")) {
X ps_color=TRUE;
X c_token++;
X }
X }
X
X if (!END_OF_COMMAND && isstring(c_token)) {
X quote_str(ps_font,c_token);
X c_token++;
X }
X
X if (!END_OF_COMMAND) {
X /* We have font size specified */
X struct value a;
X ps_fontsize = (int)real(const_express(&a));
X c_token++;
X term_tbl[term].v_char = (unsigned int)(ps_fontsize*PS_SC);
X term_tbl[term].h_char = (unsigned int)(ps_fontsize*PS_SC*6/10);
X }
X
X sprintf(term_options,"%s %s \"%s\" %d",
X ps_portrait ? "portrait" : "landscape",
X ps_color ? "color" : "monochrome",ps_font,ps_fontsize);
}
X
X
PS_init()
{
struct termentry *t = &term_tbl[term];
int i;
X ps_page = 0;
X fprintf(outfile,"%%!PS-Adobe-2.0\n");
X fprintf(outfile,"%%%%Creator: gnuplot\n");
X fprintf(outfile,"%%%%DocumentFonts: %s\n", ps_font);
X fprintf(outfile,"%%%%BoundingBox: %d %d ", PS_XOFF,PS_YOFF);
X if (ps_portrait)
X fprintf(outfile,"%d %d\n",
X (int)(xsize*(PS_XMAX)/PS_SC+0.5+PS_XOFF),
X (int)(ysize*(PS_YMAX)/PS_SC+0.5+PS_YOFF) );
X else
X fprintf(outfile,"%d %d\n",
X (int)(ysize*(PS_YMAX)/PS_SC+0.5+PS_XOFF),
X (int)(xsize*(PS_XMAX)/PS_SC+0.5+PS_YOFF) );
X fprintf(outfile,"%%%%Pages: (atend)\n");
X fprintf(outfile,"%%%%EndComments\n");
X fprintf(outfile,"/gnudict 40 dict def\ngnudict begin\n");
X fprintf(outfile,"/Color %s def\n",ps_color ? "true" : "false");
X fprintf(outfile,"/gnulinewidth %.3f def\n",PS_LW);
X fprintf(outfile,"/vshift %d def\n", (int)(t->v_char)/(-3));
X fprintf(outfile,"/dl {%d mul} def\n",PS_SC); /* dash length */
X fprintf(outfile,"/hpt %.1f def\n",PS_HTIC/2.0);
X fprintf(outfile,"/vpt %.1f def\n",PS_VTIC/2.0);
X for ( i=0; PS_header[i] != NULL; i++)
X fprintf(outfile,"%s",PS_header[i]);
X fprintf(outfile,"end\n");
X fprintf(outfile,"%%%%EndProlog\n");
}
X
X
PS_graphics()
{
struct termentry *t = &term_tbl[term];
X ps_page++;
X fprintf(outfile,"%%%%Page: %d %d\n",ps_page,ps_page);
X fprintf(outfile,"gnudict begin\n");
X fprintf(outfile,"gsave\n");
X fprintf(outfile,"%d %d translate\n",PS_XOFF,PS_YOFF);
X if (ps_portrait) {
X fprintf(outfile,"%.3f %.3f scale\n", xsize/PS_SC, ysize/PS_SC);
X }
X else {
X fprintf(outfile,"%.3f %.3f scale\n", ysize/PS_SC, xsize/PS_SC);
X fprintf(outfile,"90 rotate\n0 %d translate\n", -PS_YMAX);
X }
X fprintf(outfile,"0 setgray\n");
X fprintf(outfile,"/%s findfont %d ", ps_font, (t->v_char) );
X fprintf(outfile,"scalefont setfont\n");
X fprintf(outfile,"newpath\n");
X ps_path_count = 0;
}
X
X
PS_text()
{
X ps_path_count = 0;
X fprintf(outfile,"stroke\ngrestore\nend\nshowpage\n");
}
X
X
PS_reset()
{
X fprintf(outfile,"%%%%Trailer\n");
X fprintf(outfile,"%%%%Pages: %d\n",ps_page);
}
X
X
PS_linetype(linetype)
int linetype;
{
char *line = "ba012345678";
X fprintf(outfile,"LT%c\n", line[(linetype%9)+2]);
X ps_path_count = 0;
}
X
X
PS_move(x,y)
unsigned int x,y;
{
X fprintf(outfile,"%d %d M\n", x, y);
X ps_path_count += 1;
}
X
X
PS_vector(x,y)
unsigned int x,y;
{
X fprintf(outfile,"%d %d L\n", x, y);
X ps_path_count += 1;
X if (ps_path_count >= 400) {
X fprintf(outfile,"currentpoint stroke moveto\n");
X ps_path_count = 0;
X }
}
X
X
PS_put_text(x,y,str)
unsigned int x, y;
char *str;
{
char ch;
X PS_move(x,y);
X if (ps_ang != 0)
X fprintf(outfile,"currentpoint gsave translate %d rotate 0 0 moveto\n"
X ,ps_ang*90);
X putc('(',outfile);
X ch = *str++;
X while(ch!='\0') {
X if ( (ch=='(') || (ch==')') || (ch=='\\') )
X putc('\\',outfile);
X putc(ch,outfile);
X ch = *str++;
X }
X switch(ps_justify) {
X case LEFT : fprintf(outfile,") Lshow\n");
X break;
X case CENTRE : fprintf(outfile,") Cshow\n");
X break;
X case RIGHT : fprintf(outfile,") Rshow\n");
X break;
X }
X if (ps_ang != 0)
X fprintf(outfile,"grestore\n");
X ps_path_count = 0;
}
X
int PS_text_angle(ang)
int ang;
{
X ps_ang=ang;
X return TRUE;
}
X
int PS_justify_text(mode)
enum JUSTIFY mode;
{
X ps_justify=mode;
X return TRUE;
}
X
/* postscript point routines */
PS_point(x,y,number)
int x,y;
int number;
{
char *point = "PDABCTS";
X number %= POINT_TYPES;
X if (number < -1)
X number = -1; /* negative types are all 'dot' */
X fprintf(outfile,"%d %d %c\n", x, y, point[number+1]);
X ps_path_count = 0;
}
X
SHAR_EOF
chmod 0644 gnuplot/term/post.trm ||
echo 'restore of gnuplot/term/post.trm failed'
Wc_c="`wc -c < 'gnuplot/term/post.trm'`"
test 9281 -eq "$Wc_c" ||
echo 'gnuplot/term/post.trm: original size 9281, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/dxf.trm ==============
if test -f 'gnuplot/term/dxf.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/dxf.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/dxf.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/dxf.trm' &&
/* GNUPLOT - dxf.trm */
/*
X * Copyright (C) 1991
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 * AutoCad (Release 10.x) dxf file format (import with AutoCad dxfin command)
X *
X *
X * AUTHOR
X * Florian Hiss (fhis...@w204zrz.zrz.tu-berlin.de)
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
*/
X
#define DXF_UNIT 60.0
#define LINEWIDTH 0.0351 /* default line width is 1 pt */
X
/* 120 (autocad units) wide by 80 (autocad units) high (default)
X use the GNUPLOT 'set size' command to change the defaults */
#define DXF_XMAX (120.0 * DXF_UNIT)
#define DXF_YMAX (80.0 * DXF_UNIT)
#define DXF_HTIC (0.01 * DXF_XMAX) /* 1.0 percent */
#define DXF_VTIC (0.01 * DXF_YMAX) /* 1.0 percent */
#define DXF_HCHAR (0.014 * DXF_XMAX) /* 1.4 percent */
#define DXF_VCHAR (0.026 * DXF_YMAX) /* 2.6 percent */
#define DXF_TEXTHEIGHT (0.7 * DXF_VCHAR) /* actual text height */
#define DXF_TEXTWIDTH (0.7 * DXF_HCHAR) /* actual text width,
X only a guess, we don't know the width of a character of given height
X of the AutoCad STANDARD text font, so change it if you like */
#define DXF_LINE_TYPES 7 /* number of line types we support. see below */
#define MAX_LAYER 7 /* number of layers used for the drawing. see below */
#define LT_SCALE 1 /* line type scaling */
X
static unsigned int DXF_posx;
static unsigned int DXF_posy;
static unsigned int dxf_linetype; /* linetype is mapped to a layer. see below. */
enum JUSTIFY dxf_justify = LEFT;
static float dxf_angle = 0.0; /* either 0 (horizontal) or 90.0 (vertical) */
X
/* text style used in the entire drawing */
static char *text_style = "STANDARD";
/* text always resides on layer 0 */
#define TEXT_LAYER 0
/* each linetype resides on its own layer. each layer has its own color.
X this avoids difficulties that AutoCad has with proper scaling of
X the linetypes.
X change the colors according to your needs */
static char *layer_name[] = {"0","1","2","3","4","5","6"};
/* the colours are white, red, yellow, green, cyan, blue, magenta.
X change them according to your needs.
X when using a black and white plotting device the colours map to different
X line thicknesses. see description of AutoCad print / plot command */
static char *layer_colour[] = {"7","1","2","3","4","5","6"};
/* support line types AutoCad has to offer by default. */
static char *layer_lines[] = {"CONTINUOUS","DASHED","HIDDEN","CENTER","PHANTOM",
X "DOT","DASHDOT"};
X
static BOOLEAN vector_was_last = FALSE;
X
DXF_init()
{
X DXF_posx = DXF_posy = 0;
X dxf_linetype = 0;
X dxf_angle = 0.0;
X vector_was_last = FALSE;
}
X
DXF_graphics()
{
X register struct termentry *t = &term_tbl[term];
X int i;
X
X fprintf(outfile,"999\n");
X fprintf(outfile,"%% GNUPLOT: dxf file for AutoCad\n");
X fprintf(outfile," 0\nSECTION\n 2\nHEADER\n");
X fprintf(outfile," 9\n$EXTMIN\n");
X fprintf(outfile," 10\n0.000\n 20\n0.000\n");
X fprintf(outfile," 9\n$EXTMAX\n");
X fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n",t->xmax/DXF_UNIT,t->ymax/DXF_UNIT);
X fprintf(outfile," 9\n$LIMMIN\n");
X fprintf(outfile," 10\n0.000\n 20\n0.000\n");
X fprintf(outfile," 9\n$LIMMAX\n");
X fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n",t->xmax/DXF_UNIT,t->ymax/DXF_UNIT);
X fprintf(outfile," 9\n$TEXTSTYLE\n 7\n%s\n",text_style);
X fprintf(outfile," 9\n$TEXTSIZE\n 40\n%-6.3f\n",DXF_TEXTHEIGHT/DXF_UNIT);
X fprintf(outfile," 9\n$PLINEWID\n 40\n%-6.4f\n",LINEWIDTH);
X fprintf(outfile," 9\n$LTSCALE\n 40\n%-6.3f\n",LT_SCALE);
X fprintf(outfile," 9\n$COORDS\n 70\n 1\n");
X fprintf(outfile," 9\n$CELTYPE\n 6\nBYLAYER\n"); /* entity line type name */
X fprintf(outfile," 9\n$CLAYER\n 8\n0\n"); /* current layer */
X fprintf(outfile," 9\n$CECOLOR\n 62\n %s\n",layer_colour[0]);
X fprintf(outfile," 9\n$MENU\n 1\nacad\n");
X fprintf(outfile," 0\nENDSEC\n");
X fprintf(outfile," 0\nSECTION\n 2\nTABLES\n");
X /* the linetype table */
X fprintf(outfile,"0\nTABLE\n 2\nLTYPE\n 70\n %d\n",DXF_LINE_TYPES);
X fprintf(outfile,"0\nLTYPE\n 2\nCONTINUOUS\n 70\n 64\n");
X fprintf(outfile," 3\nSolid line\n 72\n 65\n 73\n 0\n 40\n0.0\n");
X fprintf(outfile," 0\nLTYPE\n 2\nDASHED\n 70\n 64\n");
X fprintf(outfile," 3\n__ __ __ __ __ __ __ __ __ __ __ __ __ __ __\n");
X fprintf(outfile," 72\n 65\n 73\n 2\n 40\n0.75\n 49\n0.5\n 49\n-0.25\n");
X fprintf(outfile," 0\nLTYPE\n 2\nHIDDEN\n 70\n 64\n");
X fprintf(outfile," 3\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n");
X fprintf(outfile," 72\n 65\n 73\n 2\n 40\n0.375\n 49\n0.25\n 49\n-0.125\n");
X fprintf(outfile," 0\nLTYPE\n 2\nCENTER\n 70\n 64\n");
X fprintf(outfile," 3\n____ _ ____ _ ____ _ ____ _ ____ _ ____ _ ____\n");
X fprintf(outfile," 72\n 65\n 73\n 4\n 40\n2.0\n 49\n1.25\n 49\n-0.25\n");
X fprintf(outfile," 49\n0.25\n 49\n-0.25\n");
X fprintf(outfile," 0\nLTYPE\n 2\nPHANTOM\n 70\n 64\n");
X fprintf(outfile," 3\n_____ _ _ _____ _ _ _____ _ _ _____ _ _ ____\n");
X fprintf(outfile," 72\n 65\n 73\n 6\n 40\n2.5\n 49\n1.25\n");
X fprintf(outfile," 49\n-0.25\n 49\n0.25\n 49\n-0.25\n 49\n0.25\n 49\n-0.25\n");
X fprintf(outfile," 0\nLTYPE\n 2\nDOT\n 70\n 64\n");
X fprintf(outfile," 3\n...............................................\n");
X fprintf(outfile," 72\n 65\n 73\n 2\n 40\n0.25\n 49\n0.0\n 49\n-0.25\n");
X fprintf(outfile," 0\nLTYPE\n 2\nDASHDOT\n 70\n 64\n");
X fprintf(outfile," 3\n__ . __ . __ . __ . __ . __ . __ . __ . __ . __\n");
X fprintf(outfile," 72\n 65\n 73\n 4\n 40\n1.0\n 49\n0.5\n 49\n-0.25\n");
X fprintf(outfile," 49\n0.0\n 49\n-0.25\n");
X fprintf(outfile," 0\nENDTAB\n");
X /* the layer table */
X fprintf(outfile," 0\nTABLE\n 2\nLAYER\n 70\n %-d\n",MAX_LAYER);
X for (i = 1; i <= MAX_LAYER; i++)
X fprintf(outfile," 0\nLAYER\n 2\n%s\n 70\n 64\n62\n %s\n 6\n%s\n",
X layer_name[i-1],layer_colour[i-1],layer_lines[i-1]);
X fprintf(outfile," 0\nENDTAB\n0\nENDSEC\n");
X /* no blocks for insertion */
X fprintf(outfile," 0\nSECTION\n 2\nBLOCKS\n 0\nENDSEC\n");
X /* start the entity section */
X fprintf(outfile," 0\nSECTION\n");
X fprintf(outfile," 2\nENTITIES\n");
}
X
DXF_text()
{
X if (vector_was_last) fprintf(outfile," 0\nSEQEND\n");
X fprintf(outfile," 0\nENDSEC\n 0\nEOF\n");
}
X
DXF_linetype(linetype)
X int linetype;
{
X linetype = abs(linetype);
X linetype = linetype%DXF_LINE_TYPES;
X dxf_linetype = linetype;
}
X
DXF_move(x, y)
X unsigned int x, y;
{
X DXF_posx = x;
X DXF_posy = y;
X if (vector_was_last) fprintf(outfile," 0\nSEQEND\n");
X vector_was_last = FALSE;
X fprintf(outfile," 0\nPOLYLINE\n 8\n%s\n 66\n 1\n",layer_name[dxf_linetype]);
X fprintf(outfile," 6\n%s\n",layer_lines[dxf_linetype]);
X fprintf(outfile," 0\nVERTEX\n 8\n%s\n",layer_name[dxf_linetype]);
X fprintf(outfile," 6\n%s\n",layer_lines[dxf_linetype]);
X fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",DXF_posx/DXF_UNIT,DXF_posy/DXF_UNIT);
}
X
DXF_vector(ux, uy)
X unsigned int ux, uy;
{
X DXF_posx = ux;
X DXF_posy = uy;
X vector_was_last = TRUE;
X fprintf(outfile," 0\nVERTEX\n 8\n%s\n",layer_name[dxf_linetype]);
X fprintf(outfile," 6\n%s\n",layer_lines[dxf_linetype]);
X fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",
X DXF_posx/DXF_UNIT,DXF_posy/DXF_UNIT);
}
X
DXF_put_text(x, y, str)
X int x, y;
X char str[];
{
X int stl;
X float xleftpos, yleftpos, xrightpos,yrightpos;
X /* ignore empty strings */
X if (str[0] == '\0') return;
SHAR_EOF
true || echo 'restore of gnuplot/term/dxf.trm failed'
fi
echo 'End of part 17'
echo 'File gnuplot/term/dxf.trm is continued in part 18'
echo 18 > _shar_seq_.tmp
#!/bin/sh
# this is Part.18 (part 18 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/dxf.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 18; 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/dxf.trm'
else
echo 'x - continuing file gnuplot/term/dxf.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/dxf.trm' &&
X
X stl = 0; while (str[stl] != '\0') ++stl; /* get string length */
X
X if (vector_was_last) fprintf(outfile," 0\nSEQEND\n");
X vector_was_last = FALSE;
X fprintf(outfile," 0\nTEXT\n 8\n%s\n",layer_name[TEXT_LAYER]);
X if (dxf_angle != 90.0)
X {
X switch (dxf_justify)
X {
X case LEFT : xleftpos = (float) x;
X yleftpos = (float)(y-DXF_VCHAR/4.0);
X xrightpos = (float)(x+stl*DXF_TEXTWIDTH);
X yrightpos = yleftpos; break;
X case RIGHT : xleftpos = (float)(x-stl*DXF_TEXTWIDTH);
X yleftpos = (float)(y-DXF_VCHAR/4.0);
X xrightpos = (float) x;
X yrightpos = yleftpos; break;
X case CENTRE: xleftpos = (float)(x-stl*DXF_TEXTWIDTH/2.0);
X yleftpos = (float)(y-DXF_VCHAR/4.0);
X xrightpos = (float) x; /* center point */
X yrightpos = yleftpos;
X break;
X }
X }
X else
X {
X switch (dxf_justify)
X {
X case LEFT : xleftpos = (float)(x+DXF_VCHAR/4.0);
X yleftpos = (float) y;
X xrightpos = xleftpos;
X yrightpos = (float)(y+stl*DXF_TEXTWIDTH); break;
X case RIGHT : xleftpos = (float)(x+DXF_VCHAR/4.0);
X yleftpos = (float)(y-stl*DXF_HCHAR);
X xrightpos = xleftpos;
X yrightpos = (float) y; break;
X case CENTRE: xleftpos = (float)(x+DXF_VCHAR/4.0);
X yleftpos = (float)(y-stl*DXF_TEXTWIDTH/2.0);
X xrightpos = xleftpos;
X yrightpos = (float) y; /* center point */
X break;
X }
X }
X fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",
X xleftpos/DXF_UNIT,yleftpos/DXF_UNIT);
X fprintf(outfile," 40\n%-6.3f\n 1\n%s\n 50\n%-6.3f\n",
X DXF_TEXTHEIGHT/DXF_UNIT,str,dxf_angle);
X fprintf(outfile," 7\n%s\n",text_style);
X if (dxf_justify != LEFT)
X {
X fprintf(outfile," 72\n%d\n",dxf_justify);
X fprintf(outfile," 11\n%-6.3f\n 21\n%-6.3f\n 31\n0.000\n",
X xrightpos/DXF_UNIT,yrightpos/DXF_UNIT);
X }
}
X
DXF_text_angle(angle)
X int angle;
{
X dxf_angle = 0.0;
X if (angle == 1) dxf_angle = 90.0;
X return(TRUE);
}
X
DXF_justify_text(mode)
X enum JUSTIFY mode;
{
X dxf_justify = mode;
X return(TRUE);
}
X
DXF_reset()
{
X DXF_posx = DXF_posy = 0;
}
X
X
SHAR_EOF
echo 'File gnuplot/term/dxf.trm is complete' &&
chmod 0644 gnuplot/term/dxf.trm ||
echo 'restore of gnuplot/term/dxf.trm failed'
Wc_c="`wc -c < 'gnuplot/term/dxf.trm'`"
test 9980 -eq "$Wc_c" ||
echo 'gnuplot/term/dxf.trm: original size 9980, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/qms.trm ==============
if test -f 'gnuplot/term/qms.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/qms.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/qms.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/qms.trm' &&
/* GNUPLOT - qms.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 * QMS laser printers
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#define QMS_XMAX 9000
#define QMS_YMAX 6000
X
#define QMS_XLAST (QMS_XMAX - 1)
#define QMS_YLAST (QMS_YMAX - 1)
X
#define QMS_VCHAR 120
#define QMS_HCHAR 70
#define QMS_VTIC 70
#define QMS_HTIC 70
X
int qms_line = 0; /* to remember current line type */
X
QMS_init()
{
/* This was just ^IOL, but at Rutgers at least we need some more stuff */
X fprintf(outfile,"^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n");
/* ^ QUIC on ^set defaults ^ set botttom,top,left margins
X ^landscape ^free format */
/* set defaults are: implicit decimal point, units in inches,
X numbers left justified, units in 1/1000 inch, do not ignore spaces */
/* margins are in 1/1000 inch units */
}
X
X
QMS_graphics()
{
X fprintf(outfile,"^IGV\n");
/* ^enter graphics vector mode */
}
X
X
X
QMS_text()
{
/* added ^-, because ^, after an ^I command doesn't actually print a page */
/* Did anybody try this code out? [uhh...-cdk] */
X fprintf(outfile,"^IGE\n^-^,");
/* ^exit graphics vector mode
X ^pass terminator
X ^print page */
}
X
X
QMS_linetype(linetype)
int linetype;
{
static int width[2+9] = {7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7};
static int type[2+9] = {0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3};
/*
X * I don't know about Villanova, but on our printer, using ^V without
X * previously setting up a pattern crashes the microcode.
X * [nope, doesn't crash here. -cdk]
X * [it generates a controller error here on dotted lines. - rjl]
X */
/* Code to define patterns added by rjl
X * According to the manual it should work - but it doesn't
X */
X qms_line = linetype;
X if (linetype >= 9)
X linetype %= 9;
X fprintf(outfile,"^PW%02d\n",width[linetype+2]);
/* ^width in dots */
X switch (type[linetype+2]) {
X case 1 : /* short dash */
X fprintf(outfile,"^PV102025^G\n^V1\n");
/* ^PV = define pattern vector, 1 = pattern number,
X 02 = number of pen downs and ups, 025 = .025" length of ups/downs */
X break;
X case 2 : /* medium dash */
X fprintf(outfile,"^PV202050^G\n^V2\n");
X break;
X case 3 : /* long dash */
X fprintf(outfile,"^PV302100^G\n^V3\n");
X break;
X default:
X case 0 :
X fprintf(outfile,"^V0\n");
X break;
X }
}
X
X
QMS_move(x,y)
int x,y;
{
X fprintf(outfile,"^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
/* ^pen up vector*/
}
X
X
QMS_vector(x2,y2)
int x2,y2;
{
X fprintf(outfile,"^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
/* ^pen down vector*/
}
X
X
QMS_put_text(x,y,str)
unsigned int x,y;
char str[];
{
char ch;
X QMS_move(x,y + QMS_VCHAR/3);
X fputs("^IGE\n",outfile);
X ch = *str++;
X while(ch!='\0') {
X if (ch=='^')
X putc('^',outfile);
X putc(ch,outfile);
X ch = *str++;
X }
X fputs("\n^IGV\n",outfile);
X QMS_linetype(qms_line); /* restore line type */
}
X
X
QMS_reset()
{
X fprintf(outfile,"^PN^-\n");
/* ^QUIC off*/
}
X
SHAR_EOF
chmod 0666 gnuplot/term/qms.trm ||
echo 'restore of gnuplot/term/qms.trm failed'
Wc_c="`wc -c < 'gnuplot/term/qms.trm'`"
test 3785 -eq "$Wc_c" ||
echo 'gnuplot/term/qms.trm: original size 3785, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/regis.trm ==============
if test -f 'gnuplot/term/regis.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/regis.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/regis.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/regis.trm' &&
/* GNUPLOT - regis.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 * REGIS devices
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#define REGISXMAX 800
#define REGISYMAX 440
X
#define REGISXLAST (REGISXMAX - 1)
#define REGISYLAST (REGISYMAX - 1)
X
#define REGISVCHAR 20
#define REGISHCHAR 9
#define REGISVTIC 8
#define REGISHTIC 6
X
int REGISang = 0;
X
REGISinit()
{
X fprintf(outfile,"\033[r\033[24;1H");
/* 1 2
X 1. reset scrolling region
X 2. locate cursor on bottom line
*/
}
X
X
/* thanks to calmasd!dko (Dan O'Neill) for adding S(E) for vt125s */
REGISgraphics()
{
X fprintf(outfile,"\033[2J\033P1pS(C0)S(E)");
/* 1 2 3 4 5
X 1. clear screen
X 2. enter ReGIS graphics
X 3. turn off graphics diamond cursor
X 4. clear graphics screen
*/
X (void) REGIStext_angle(0); /* select text size and angle */
}
X
X
REGIStext()
{
X fprintf(outfile,"\033\\\033[24;1H");
/* 1 2
X 1. Leave ReGIS graphics mode
X 2. locate cursor on last line of screen
*/
}
X
X
REGISlinetype(linetype)
int linetype;
{
X /* This will change color in order G,R,B,G-dot,R-dot,B-dot */
static int in_map[9 + 2] = {2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1};
static int lt_map[9 + 2] = {1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6};
X
X if (linetype >= 9)
X linetype %= 9;
X fprintf(outfile, "W(I%d)", in_map[linetype + 2]);
X fprintf(outfile, "W(P%d)", lt_map[linetype + 2]);
}
X
X
REGISmove(x,y)
int x,y;
{
X fprintf(outfile,"P[%d,%d]",x,REGISYLAST-y,x,REGISYLAST-y);
}
X
X
REGISvector(x,y)
int x,y;
{
X fprintf(outfile,"v[]v[%d,%d]",x,REGISYLAST - y);
/* the initial v[] is needed to get the first pixel plotted */
}
X
X
/* put_text and text_angle by rjl */
REGISput_text(x,y,str)
int x, y;
char *str;
{
X if (REGISang==1)
X REGISmove(x-REGISVCHAR/2-1,y);
X else
X REGISmove(x,y+REGISVCHAR/2-1);
X (void) putc('T',outfile); (void) putc('\'',outfile);
X while (*str) {
X (void) putc(*str,outfile);
X if (*str == '\'')
X (void) putc('\'',outfile); /* send out another one */
X str++;
X }
X (void) putc('\'',outfile);
}
X
X
int REGIStext_angle(ang)
int ang;
{
X REGISang = ang;
X if (ang == 1)
X fputs("T(D90,S1)",outfile);
X else
X fputs("T(D0,S1)",outfile);
X return TRUE;
}
X
X
REGISreset()
{
X fprintf(outfile,"\033[2J\033[24;1H");
}
X
SHAR_EOF
chmod 0666 gnuplot/term/regis.trm ||
echo 'restore of gnuplot/term/regis.trm failed'
Wc_c="`wc -c < 'gnuplot/term/regis.trm'`"
test 2967 -eq "$Wc_c" ||
echo 'gnuplot/term/regis.trm: original size 2967, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/sun.trm ==============
if test -f 'gnuplot/term/sun.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/sun.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/sun.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/sun.trm' &&
/* GNUPLOT - sun.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 * SUNview windowing system
X *
X * AUTHORS
X * Maurice Castro
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#include <suntool/sunview.h>
#include <suntool/canvas.h>
#include <suntool/scrollbar.h>
#include <suntool/panel.h>
#include <pixrect/pixrect_hs.h>
X
#define SUN_XMAX 600
#define SUN_YMAX 512
X
#define SUN_VCHAR (12) /* default, will be changed */
#define SUN_HCHAR (8) /* default, will be changed */
#define SUN_VTIC (SUN_YMAX/80)
#define SUN_HTIC (SUN_XMAX/80)
#define MARGIN 5
#define MINWIN 128
X
static Frame frame;
static Canvas canvas;
static Pixwin *pw;
static struct pixfont *sun_font = NULL;
X
static enum JUSTIFY sun_justify=LEFT;
X
static Notify_value local_notice_destroy();
X
extern Notify_error notify_dispatch();
X
/* dotted line generator */
unsigned int sun_value = 1; /* this can be used for colour */
unsigned int sun_line_mask = 0xffff; /* 16 bit mask for dotted lines */
static unsigned int sun_pattern[] = {0xffff, 0x1111,
X 0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
int sun_mask_count = 0;
unsigned int sun_lastx, sun_lasty; /* last pixel set - used by sun_line */
X
X
SUN_init()
{
X struct termentry *t = &term_tbl[term];
X struct pr_subregion bound;
X
X frame = window_create(NULL, FRAME,
X FRAME_LABEL, "Gnuplot",
X 0);
X notify_interpose_destroy_func(frame,local_notice_destroy);
X canvas = window_create(frame, CANVAS,
X CANVAS_AUTO_EXPAND, TRUE,
X CANVAS_AUTO_SHRINK, TRUE,
X CANVAS_MARGIN, MARGIN,
X 0);
X notify_do_dispatch();
X pw = canvas_pixwin(canvas);
X window_set(frame, WIN_SHOW, TRUE, 0);
X
X /* figure out font and rough size */
X sun_font = pf_default();
X pf_textbound(&bound, 1, sun_font, "M");
X t->v_char = bound.size.y;
X t->h_char = bound.size.x;
X
X return;
}
X
SUN_graphics()
{
X term_tbl[term].xmax = (int) window_get(canvas,CANVAS_WIDTH);
X term_tbl[term].ymax = (int) window_get(canvas,CANVAS_HEIGHT);
X pw_writebackground(pw,0,0,term_tbl[term].xmax, term_tbl[term].ymax, PIX_SRC );
X notify_dispatch();
X /* do not let the user make the window too small */
X if ((term_tbl[term].xmax)<MINWIN)
X {
X window_set(frame,
X WIN_WIDTH, MINWIN+2*MARGIN+24,
X 0);
X notify_dispatch();
X SUN_graphics();
X }
X if ((term_tbl[term].ymax) <MINWIN)
X {
X window_set(frame,
X WIN_HEIGHT, MINWIN+2*MARGIN+24,
X 0);
X notify_dispatch();
X SUN_graphics();
X }
X notify_dispatch();
X return;
}
X
SUN_text()
{
X notify_dispatch();
X return; /* enter text from another window!!! */
}
X
SUN_linetype(linetype)
int linetype;
{
X if (linetype>=7)
X linetype %= 7;
X sun_line_mask = sun_pattern[linetype+2];
X sun_mask_count=0;
}
X
X
SUN_move(x, y)
unsigned int x, y;
{
X sun_lastx = x;
X sun_lasty = y;
X notify_dispatch();
X return;
}
X
SUN_vector(x, y)
unsigned int x, y;
{
X if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
X return;
X sun_line(sun_lastx,x,sun_lasty,y);
X canvas_pixwin(canvas);
X notify_dispatch();
X return;
}
X
X
SUN_put_text(x,y,str)
unsigned int x, y;
char *str;
{
X struct pr_subregion bound;
X
X if ( (x>=term_tbl[term].xmax) || (y>=term_tbl[term].ymax) )
X return;
X
X pf_textbound(&bound, strlen(str), sun_font, str);
X y = term_tbl[term].ymax-1-y + bound.size.y/3; /* vertical centering */
X
X switch(sun_justify) {
X case LEFT: break;
X case CENTRE: x -= bound.size.x/2; break;
X case RIGHT: x -= bound.size.x; break;
X }
X pw_text(pw, x,y, PIX_SRC | PIX_DST, 0, str);
X canvas_pixwin(canvas);
X notify_dispatch();
X return;
}
X
X
int SUN_justify_text(mode)
X enum JUSTIFY mode;
{
X sun_justify = mode;
X return (TRUE);
}
X
X
X
X
SUN_reset()
{
X
X term_tbl[term].xmax = SUN_XMAX;
X term_tbl[term].ymax = SUN_YMAX;
X window_set(frame, WIN_SHOW, FALSE, 0);
X return;
}
X
X
X
sun_setmaskpixel(x,y,value)
unsigned int x,y,value;
{
X /* dotted line generator */
X if ((sun_line_mask>>sun_mask_count)&(unsigned int)(1)) {
X pw_put(pw,x,term_tbl[term].ymax-1-y,sun_value);
X }
X sun_mask_count= (sun_mask_count+1) % 16;
X sun_lastx= x; /* last pixel set with mask */
X sun_lasty= y;
}
X
X
X
X
sun_line(x1,x2,y1,y2)
unsigned int x1,x2,y1,y2;
{
int runcount;
int dx,dy;
int xinc,yinc;
unsigned int xplot,yplot;
X
X runcount=0;
X dx = abs((int)(x1)-(int)(x2));
X if (x2>x1) xinc= 1;
X if (x2==x1) xinc= 0;
X if (x2<x1) xinc= -1;
X dy = abs((int)(y1)-(int)(y2));
X if (y2>y1) yinc= 1;
X if (y2==y1) yinc= 0;
X if (y2<y1) yinc= -1;
X xplot=x1;
X yplot=y1;
X if (dx>dy) {
X /* iterate x */
X if ( (sun_line_mask==0xffff) ||
X ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
X sun_setmaskpixel(xplot,yplot,sun_value);
X while (xplot!=x2) {
X xplot+=xinc;
X runcount+=dy;
X if (runcount>=(dx-runcount)) {
X yplot+=yinc;
X runcount-=dx;
X }
X sun_setmaskpixel(xplot,yplot,sun_value);
X }
X } else {
X /* iterate y */
X if ( (sun_line_mask==0xffff) ||
X ((xplot!=sun_lastx) && (yplot!=sun_lasty)) )
X sun_setmaskpixel(xplot,yplot,sun_value);
X while (yplot!=y2) {
X yplot+=yinc;
X runcount+=dx;
X if (runcount>=(dy-runcount)) {
X xplot+=xinc;
X runcount-=dy;
X }
X sun_setmaskpixel(xplot,yplot,sun_value);
X }
X }
}
X
X
static Notify_value local_notice_destroy(frame, status)
X Frame frame;
X Destroy_status status;
{
X if (status != DESTROY_CHECKING)
X {
X SUN_reset();
X term_init = FALSE;
X }
X return(NOTIFY_DONE);
X }
X
SHAR_EOF
chmod 0666 gnuplot/term/sun.trm ||
echo 'restore of gnuplot/term/sun.trm failed'
Wc_c="`wc -c < 'gnuplot/term/sun.trm'`"
test 6147 -eq "$Wc_c" ||
echo 'gnuplot/term/sun.trm: original size 6147, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/t410x.trm ==============
if test -f 'gnuplot/term/t410x.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/t410x.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/t410x.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/t410x.trm' &&
/* GNUPLOT - t410x.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: Tektronix 410x and 420x series terminals
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/* Tektronix 410X and 420X driver written by Cary D. Renzema.
X * email address: ca...@vice.ico.tek.com
X *
X * I've tested this driver on the following terminals: 4106, 4107A, 4109
X * and 4207. It should work, without editing, on other terminals in the
X * 410x and 420x families. It will probably need to be changed to work
X * on a 4105 (screen size and character rotation are two guesses). This
X * file can also be used as a start for a 411x driver.
X *
X * Cary R.
X * April 5, 1990
X */
X
#ifdef T410X
X
#define T410XXMAX 4095
#define T410XYMAX 3131
X
#define T410XVCHAR 71
#define T410XHCHAR 51
#define T410XVTIC 36
#define T410XHTIC 36
X
static int T410X_angle=0;
X
T410X_init()
{
X (void) fprintf(outfile, "\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1");
X (void) fprintf(outfile, "\033MG1\033RK!\033SK!\033LZ\033%%!1");
/*
X 1. set tek mode
X 2. set character path to 0 (characters placed equal to rotation)
X 3. set character size to 59 height
X 4. set character precision to string
X 5. set character text index to 1
X 6. set character write mode to overstrike
X 7. clear the view
X 8. clear the segments
X 9. clear the dialog buffer
X 10. set ansi mode
*/
X (void) fflush(outfile);
}
X
X
T410X_reset()
{
X (void) fprintf(outfile, "\033%%!0\033LZ\033%%!1");
/*
X 1. set tek mode
X 2. clear the dialog buffer
X 3. set ansi mode
*/
X (void) fflush(outfile);
}
X
X
T410X_graphics()
{
X (void) fprintf(outfile, "\033%%!0\033\014\033LV0");
/*
X 1. set tek mode
X 2. clear the screen
X 3. set dialog area invisible
*/
X (void) fflush(outfile);
}
X
T410X_text()
{
X (void) fprintf(outfile, "\033LV1\033%%!1");
/*
X 1. set dialog area visible
X 2. set ansi mode
*/
X (void) fflush(outfile);
}
X
X
T410X_move(x, y)
unsigned int x, y;
{
X (void) fprintf(outfile, "\033LF");
X (void) T410X_encode_x_y(x, y);
X (void) fflush(outfile);
}
X
X
T410X_vector(x, y)
unsigned int x, y;
{
X (void) fprintf(outfile, "\033LG");
X (void) T410X_encode_x_y(x, y);
X (void) fflush(outfile);
}
X
X
T410X_point(x, y, number)
unsigned int x, y;
int number;
{
X (void) fprintf(outfile, "\033MM");
X (void) T410X_encode_int(max(number, 0)%11);
X (void) fprintf(outfile, "\033LH");
X (void) T410X_encode_x_y(x, y);
X (void) fflush(outfile);
}
X
X
T410X_linetype(linetype)
int linetype;
{
X switch (linetype) {
X case -1:
X (void) fprintf(outfile, "\033ML5");
X break;
X case -2:
X (void) fprintf(outfile, "\033ML?");
X break;
X default:
X (void) fprintf(outfile, "\033ML");
X (void) T410X_encode_int(linetype%14+2);
X break;
X }
X (void) fprintf(outfile, "\033MV");
X (void) T410X_encode_int(max(linetype, 0)%8);
X (void) fflush(outfile);
}
X
X
T410X_put_text(x, y, str)
unsigned int x, y;
char str[];
{
X extern int T410X_angle;
X
X if (T410X_angle == 0) {
X (void) T410X_move(x, y-T410XVCHAR/2+6);
X (void) fprintf(outfile, "\033MR00");
X } else {
X (void) T410X_move(x+T410XHCHAR/2-6, y);
X (void) fprintf(outfile, "\033MRE:0");
X }
X (void) fprintf(outfile, "\033LT");
X (void) T410X_encode_int(strlen(str));
X (void) fputs(str, outfile);
X (void) fflush(outfile);
}
X
T410X_text_angle(ang)
int ang;
{
X extern int T410X_angle;
X
X T410X_angle = ang;
X return(TRUE);
}
X
/* These last two routines are based on fortran code found in the
X * 4106/4107/4109/CX PROGRAMMERS manual.
X */
X
T410X_encode_x_y(x, y)
unsigned int x, y;
{
X static char chix=0, chiy=0, cloy=0, ceb=0;
X
X register unsigned int hix, lox, hiy, loy, eb, lx, ly;
X
X lx = (x <= T410XXMAX) ? x : T410XXMAX;
X ly = (y <= T410XYMAX) ? y : T410XYMAX;
X
X hix = lx/128 + 32;
X lox = (lx/4)%32 + 64;
X hiy = ly/128 + 32;
X loy = (ly/4)%32 + 96;
X eb = (ly%4)*4 + lx%4 + 96;
X
X if (chiy != hiy) (void) putc(hiy, outfile);
X if (ceb != eb) (void) putc(eb, outfile);
X if ((cloy!=loy) || (ceb!=eb) || (chix!=hix)) (void) putc(loy, outfile);
X if (chix != hix) (void) putc(hix, outfile);
X (void) putc(lox, outfile);
X
X chix = hix;
X chiy = hiy;
X cloy = loy;
X ceb = eb;
}
X
X
T410X_encode_int(number)
int number;
{
X register unsigned int mag, hi1, hi2, lo;
X
X mag = abs(number);
X
X hi1 = mag/1024 + 64;
X hi2 = (mag/16)%64 + 64;
X lo = mag%16 + 32;
X
X if (number >= 0) lo += 16;
X
X if (hi1 != 64) (void) putc(hi1, outfile);
X if ((hi2 != 64) || (hi1 != 64)) (void) putc(hi2, outfile);
X (void) putc(lo, outfile);
X
}
X
X
#endif /* T410X */
SHAR_EOF
chmod 0666 gnuplot/term/t410x.trm ||
echo 'restore of gnuplot/term/t410x.trm failed'
Wc_c="`wc -c < 'gnuplot/term/t410x.trm'`"
test 5056 -eq "$Wc_c" ||
echo 'gnuplot/term/t410x.trm: original size 5056, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/tek.trm ==============
if test -f 'gnuplot/term/tek.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/tek.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/tek.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/tek.trm' &&
/* GNUPLOT - tek.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 * tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
X * ln03plus
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#ifdef TEK
X
#define TEK40XMAX 1024
#define TEK40YMAX 780
X
#define TEK40XLAST (TEK40XMAX - 1)
#define TEK40YLAST (TEK40YMAX - 1)
X
#define TEK40VCHAR 25
#define TEK40HCHAR 14
#define TEK40VTIC 11
#define TEK40HTIC 11
X
#define HX 0x20 /* bit pattern to OR over 5-bit data */
#define HY 0x20
#define LX 0x40
#define LY 0x60
X
#define LOWER5 31
#define UPPER5 (31<<5)
X
X
TEK40init()
{
}
X
X
TEK40graphics()
{
#ifdef vms
X term_pasthru();
#endif /* vms */
X fprintf(outfile,"\033\014");
/* 1
X 1. clear screen
*/
X (void) fflush(outfile);
X sleep(1);
X /* sleep 1 second to allow screen time to clear on real
X tektronix terminals */
}
X
TEK40text()
{
X TEK40move(0,12);
X fprintf(outfile,"\037");
/* 1
X 1. into alphanumerics
*/
#ifdef vms
X term_nopasthru();
#endif /* vms */
}
X
X
TEK40linetype(linetype)
int linetype;
{
}
X
TEK40move(x,y)
unsigned int x,y;
{
X (void) putc('\035', outfile); /* into graphics */
X TEK40vector(x,y);
}
X
X
TEK40vector(x,y)
unsigned int x,y;
{
X (void) putc((HY | (y & UPPER5)>>5), outfile);
X (void) putc((LY | (y & LOWER5)), outfile);
X (void) putc((HX | (x & UPPER5)>>5), outfile);
X (void) putc((LX | (x & LOWER5)), outfile);
}
X
X
TEK40put_text(x,y,str)
unsigned int x,y;
char str[];
{
X TEK40move(x,y-11);
X fprintf(outfile,"\037%s\n",str);
}
X
X
TEK40reset()
{
}
X
#endif /* TEK */
X
X
X
/* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
X
#ifdef BITGRAPH
X
#define BG_XMAX 768 /* width of plot area */
#define BG_YMAX 768 /* height of plot area */
#define BG_SCREEN_HEIGHT 1024 /* full screen height */
X
#define BG_XLAST (BG_XMAX - 1)
#define BG_YLAST (BG_YMAX - 1)
X
#define BG_VCHAR 16
#define BG_HCHAR 9
#define BG_VTIC 8
#define BG_HTIC 8
X
X
#define BG_init TEK40init
X
#define BG_graphics TEK40graphics
X
X
#define BG_linetype TEK40linetype
X
#define BG_move TEK40move
X
#define BG_vector TEK40vector
X
X
BG_text()
{
X BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
X fprintf(outfile,"\037");
/* 1
X 1. into alphanumerics
*/
}
X
X
BG_put_text(x,y,str)
unsigned int x,y;
char str[];
{
X BG_move(x,y-11);
X fprintf(outfile,"\037%s\n",str);
}
X
X
#define BG_reset TEK40reset
X
#endif /* BITGRAPH */
X
X
/* Color and Monochrome specials for the MS-Kermit Tektronix Emulator
X by Russell Lang, eln...@monu1.cc.monash.oz */
X
#ifdef KERMIT
X
#define KTEK40HCHAR 13
X
KTEK40graphics()
{
#ifdef vms
X term_mode_tek();
X term_pasthru();
#endif /* vms */
X fprintf(outfile,"\033\014");
/* 1
X 1. clear screen
*/
X /* kermit tektronix emulation doesn't need to wait */
}
X
KTEK40Ctext()
{
X TEK40text();
X KTEK40Clinetype(0); /* change to green */
#ifdef vms
X term_nopasthru();
#endif /* vms */
}
X
/* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
/* 0 = normal, 1 = bright
X foreground color (30-37) = 30 + colors
X where colors are 1=red, 2=green, 4=blue */
static char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
X "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
X "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
X "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
X "\033[0;33m"};
X
KTEK40Clinetype(linetype)
int linetype;
{
X if (linetype >= 13)
X linetype %= 13;
X fprintf(outfile,"%s",kermit_color[linetype+2]);
}
X
X
/* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
/* `=solid, a=fine dots, b=short dashes, c=dash dot,
X d=long dash dot, e=dash dot dot */
static char *kerm_linetype = "`a`abcde" ;
X
KTEK40Mlinetype(linetype)
int linetype;
{
X if (linetype >= 6)
X linetype %= 6;
X fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
}
X
KTEK40reset()
{
X fprintf(outfile,"\030\n"); /* turn off Tek emulation */
#ifdef vms
X term_mode_native();
#endif /* vms */
}
X
#endif /* KERMIT */
X
X
/* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
X Selanar driver */
X
#ifdef SELANAR
X
SEL_init()
{
X fprintf(outfile,"\033\062");
/* 1
X 1. set to ansi mode
*/
}
X
X
SEL_graphics()
{
X fprintf(outfile,"\033[H\033[J\033\061\033\014");
/* 1 2 3
X 1. clear ANSI screen
X 2. set to TEK mode
X 3. clear screen
*/
}
X
X
SEL_text()
{
X TEK40move(0,12);
X fprintf(outfile,"\033\062");
/* 1
X 1. into ANSI mode
*/
}
X
SEL_reset()
{
X fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
/* 1 2 3 4
1 set tek mode
2 clear screen
3 set ansi mode
4 clear screen
*/
}
#endif /* SELANAR */
X
#ifdef VTTEK
X
VTTEK40init()
{
X fprintf(outfile,"\033[?38h");
X fflush(outfile);
X sleep(1);
X /* sleep 1 second to allow screen time to clear on some terminals */
#ifdef vms
X term_mode_tek();
#endif /* vms */
}
X
VTTEK40reset()
{
X fprintf(outfile,"\033[?38l");
X fflush(outfile);
X sleep(1);
X /* sleep 1 second to allow screen time to clear on some terminals */
#ifdef vms
X term_mode_native();
#endif /* vms */
}
X
/* linetypes for VT-type terminals in tektronix emulator mode */
/* `=solid, a=fine dots, b=short dashes, c=dash dot,
X d=long dash dot, h=bold solid, i=bold fine dots, j=bold short dashes,
X k=bold dash dot, l=bold long dash dot */
static char *vt_linetype = "`a`abcdhijkl" ;
static int last_vt_linetype = 0;
VTTEK40linetype(linetype)
int linetype;
{
X if (linetype >= 10)
X linetype %= 10;
X fprintf(outfile,"\033%c",vt_linetype[linetype+2]);
X last_vt_linetype = linetype;
}
X
VTTEK40put_text(x,y,str)
unsigned int x,y;
char str[];
{
X int linetype;
X linetype = last_vt_linetype;
X VTTEK40linetype(0);
X TEK40put_text(x,y,str);
X VTTEK40linetype(linetype);
}
X
#endif /* VTTEK */
X
#ifdef LN03P
X
LN03Pinit()
{
X fprintf(outfile,"\033[?38h");
}
X
LN03Preset()
{
X fprintf(outfile,"\033[?38l");
}
#endif LN03P
SHAR_EOF
chmod 0644 gnuplot/term/tek.trm ||
echo 'restore of gnuplot/term/tek.trm failed'
Wc_c="`wc -c < 'gnuplot/term/tek.trm'`"
test 6716 -eq "$Wc_c" ||
echo 'gnuplot/term/tek.trm: original size 6716, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/unixpc.trm ==============
if test -f 'gnuplot/term/unixpc.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/unixpc.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/unixpc.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/unixpc.trm' &&
/* GNUPLOT - unixpc.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 * Unix PC's (ATT 3b1)
X *
X * AUTHORS
X * John Campbell
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/*
>From: John Campbell (...!arizona!naucse!jdc)
X
I originally ported gnuplot to the ATT 3b1 (ATT7300) on 12/4/88, and then
added the minimal code needed to bring it up to 2.0 level on 1/28/90. The
3b1, as I view it, is a 720x300 bitmapped, monochrome display (often people
don't use the top 12 scan lines and thus the effective size is 720x288). I
tried to maximize the size of the graph area, by using these top 12 lines
(normally reserved) and set up a signal handler to restore them upon exit,
abort, etc.
X
Line styles were "fudged" (they do not know the aspect ratio). The same
line style may look different depending upon the slope of the curve. Due to
this only 4 line styles were implemented. While more line types are possible,
the current styles were chosen as distinguishable.
X
The 3b1 has 4 "special" rows at the bottom that I could not use in graphics
mode. It has been suggested that we use these lines for command prompting.
Others have requested that we have a graphics window and a command window.
My experience with gnuplot only includes relatively dumb graphics devices--
hence gnuplot "looks and feels" normal to me the way I implemented it.
I welcome either of these changes from someone else, however.
*/
X
#include <sys/window.h> /* Started with tam.h--too much trouble. */
#include <sys/signal.h>
#include <errno.h>
X
#define uPC_HIGH_BIT (0x8000)
X
typedef unsigned short Scr_type;
typedef unsigned char Scr_kluge;
X
#define uPC_XMAX 720
#define uPC_YMAX 300
X
#define uPC_XSIZE 45 /* Short ints. */
#define uPC_YSIZE uPC_YMAX
X
Scr_type uPC_display[uPC_YSIZE][uPC_XSIZE];
int uPC_width = 2*uPC_XSIZE;
int uPC_sx=0, uPC_sy=0;
int uPC_cur_linetype=0;
int uPC_angle = 0;
unsigned short uPC_raster_count=0;
static Scr_type lookup[] = {
X 0x0001, 0x0002, 0x0004, 0x0008,
X 0x0010, 0x0020, 0x0040, 0x0080,
X 0x0100, 0x0200, 0x0400, 0x0800,
X 0x1000, 0x2000, 0x4000, 0x8000,
X };
X
#define uPC_XLAST (uPC_XMAX - 1)
#define uPC_YLAST (uPC_YMAX - 1)
X
#define uPC_VCHAR FNT5X9_VCHAR
#define uPC_HCHAR FNT5X9_HCHAR
#define uPC_VTIC uPC_VCHAR/2 /* Was 8 */
#define uPC_HTIC uPC_HCHAR /* Was 12 */
X
extern errno, sys_nerr;
extern char *sys_errlist[];
X
static struct urdata uPC_ur = {(unsigned short *)uPC_display, 2*uPC_XSIZE, 0, 0,
X 0, 0, 0, 0, uPC_XMAX, uPC_YMAX, SRCSRC, DSTOR, 0};
X
#define IfErrOut(e1,e2,s1,s2) if (e1 e2) {\
fprintf(stderr, "%s:: %s %s\n", sys_errlist[errno], s1, s2);\
uPC_fixwind(0);\
exit(-1);}
X
uPC_init()
{
/* This routine will ioctl to change 0 size */
X int i;
X struct uwdata uw;
X int uPC_fixwind();
X short gw;
X
/* Check that we are on the bitmapped window. */
X if (iswind() != 0) {
X fprintf (stderr, "Sorry--must run from the bitmapped terminal\n");
X exit(-1);
X }
X for (i=1; i<=16; i++) {
X if (i != SIGINT && i != SIGFPE) /* Two are caught in plot.c */
X signal (i, uPC_fixwind);
X }
X
/* Increase the screen size */
X uw.uw_x = 0;
X uw.uw_y = 0; /* Leave room for top status line. */
X uw.uw_width = uPC_XMAX; /* 720 */
X uw.uw_height = uPC_YMAX; /* 288 normal--we clobber 12 (top row)*/
X uw.uw_uflags = 1; /* Creates with no border */
X
X IfErrOut (ioctl(1, WIOCSETD, &uw), <0, "ioctl failed on", "WIOCSETD");
}
X
X
uPC_graphics()
{
/* This routine will clear the uPC_display buffer and window. */
X register Scr_type *j;
X register int i;
X
X j = (Scr_type *)uPC_display;
X i = uPC_YSIZE*uPC_XSIZE + 1;
X
X while (--i)
X *j++ = 0;
/*
X Position the cursor to the bottom of the screen so when we come back to
X text mode we are just below the graph.
*/
X printf ("\033[25;1H");
X
X uPC_ur.ur_dstop = DSTSRC; /* replace (clear screen). */
X IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
X "ioctl failed", "WIOCRASTOP");
X uPC_ur.ur_dstop = DSTOR; /* Or in (show text) */
}
X
X
uPC_text()
{
/* This routine will flush the display. */
X
X IfErrOut (ioctl(1, WIOCRASTOP, &uPC_ur), <0,
X "ioctl failed", "WIOCRASTOP");
}
X
X
uPC_linetype(linetype)
int linetype;
{
/* This routine records the current linetype. */
X if (uPC_cur_linetype != linetype) {
X uPC_raster_count = 0;
X uPC_cur_linetype = linetype;
X }
}
X
X
uPC_move(x,y)
unsigned int x,y;
{
/* This routine just records x and y in uPC_sx, uPC_sy */
X uPC_sx = x;
X uPC_sy = y;
}
X
X
/* Was just (*(a)|=(b)) */
#define uPC_PLOT(a,b) (uPC_cur_linetype != 0 ? uPC_plot_word (a,b) :\
X (*(a)|=(b)))
X
uPC_plot_word(a,b)
Scr_type *a, b;
/*
X Weak attempt to make line styles. The real problem is the aspect
X ratio. This routine is called only when a bit is to be turned on in
X a horizontal word. A better line style routine would know something
X about the slope of the line around the current point (in order to
X change weighting).
X
X This yields 3 working linetypes plus a usable axis line type.
*/
{
/* Various line types */
X switch (uPC_cur_linetype) {
X case -1:
X /* Distinguish between horizontal and vertical axis. */
X if (uPC_sx > uPC_XMAX/8 && uPC_sx < 7*uPC_XMAX/8) {
X /* Fuzzy tolerance because we don't know exactly where the y axis is */
X if (++uPC_raster_count % 2 == 0) *(a) |= b;
X }
X else {
X /* Due to aspect ratio, take every other y pixel and every third x. */
X *(a) |= (b & 0x9999);
X }
X break;
X case 1:
X case 5:
X /* Make a | |----| |----| type of line. */
X if ((1<<uPC_raster_count) & 0xF0F0) *(a) |= b;
X if (++uPC_raster_count > 15) uPC_raster_count = 0;
X break;
X case 2:
X case 6:
X /* Make a |----|----|----|--- | | type of line. */
X if ((1<<uPC_raster_count) & 0x0EFFF) *(a) |= b;
X if (++uPC_raster_count > 19) uPC_raster_count = 0;
X break;
X case 3:
X case 7:
X /* Make a | - | - | - | - | type of line. */
X if ((1<<uPC_raster_count) & 0x4444) *(a) |= b;
X if (++uPC_raster_count > 15) uPC_raster_count = 0;
X break;
X case 4:
X case 8:
X default:
X *(a) |= b;
X break;
X }
}
X
uPC_vector(x,y)
unsigned int x,y;
{
/* This routine calls line with x,y */
X int x1 = uPC_sx, y1=uPC_sy, x2 = x, y2 = y;
X register int c, e, dx, dy, width;
X register Scr_type mask, *a;
X
/* Record new sx, sy for next call to the vector routine. */
X uPC_sx = x2;
X uPC_sy = y2;
X
X a = &uPC_display[(uPC_YSIZE - 1) - y1][x1 >> 4];
X mask = lookup[x1 & 0x0f];
X width = uPC_width;
X
X if ((dx = x2 - x1) > 0) {
X if ((dy = y2 - y1) > 0) {
X if (dx > dy) { /* dx > 0, dy > 0, dx > dy */
X dy <<= 1;
X e = dy - dx;
X c = dx + 2;
X dx <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X (Scr_kluge *)a -= width;
X e -= dx;
X }
X if (mask & uPC_HIGH_BIT) {
X mask = 1;
X a++;
X } else
X mask <<= 1;
X e += dy;
X }
X } else { /* dx > 0, dy > 0, dx <= dy */
X dx <<= 1;
X e = dx - dy;
X c = dy + 2;
X dy <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X if (mask & uPC_HIGH_BIT) {
X mask = 1;
X a++;
X } else
X mask <<= 1;
X e -= dy;
X }
X (Scr_kluge *)a -= width;
X e += dx;
X }
X }
X } else {
X dy = -dy;
X if (dx > dy) { /* dx > 0, dy <= 0, dx > dy */
X dy <<= 1;
X e = dy - dx;
X c = dx + 2;
X dx <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X (Scr_kluge *)a += width;
X e -= dx;
X }
X if (mask & uPC_HIGH_BIT) {
X mask = 1;
X a++;
X } else
X mask <<= 1;
X e += dy;
X }
X } else { /* dx > 0, dy <= 0, dx <= dy */
X dx <<= 1;
X e = dx - dy;
X c = dy + 2;
X dy <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X if (mask & uPC_HIGH_BIT) {
X mask = 1;
X a++;
X } else
X mask <<= 1;
X e -= dy;
X }
X (Scr_kluge *)a += width;
X e += dx;
X }
X }
X }
X } else {
X dx = -dx;
X if ((dy = y2 - y1) > 0) {
X if (dx > dy) { /* dx <= 0, dy > 0, dx > dy */
X dy <<= 1;
X e = dy - dx;
X c = dx + 2;
X dx <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X (Scr_kluge *)a -= width;
X e -= dx;
X }
X if (mask & 1) {
X mask = uPC_HIGH_BIT;
X a--;
X } else
X mask >>= 1;
X e += dy;
X }
X } else { /* dx <= 0, dy > 0, dx <= dy */
X dx <<= 1;
X e = dx - dy;
X c = dy + 2;
X dy <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X if (mask & 1) {
X mask = uPC_HIGH_BIT;
X a--;
X } else
X mask >>= 1;
X e -= dy;
X }
X (Scr_kluge *)a -= width;
X e += dx;
X }
X }
X } else {
X dy = -dy;
X if (dx > dy) { /* dx <= 0, dy <= 0, dx > dy */
X dy <<= 1;
X e = dy - dx;
X c = dx + 2;
X dx <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X (Scr_kluge *)a += width;
X e -= dx;
X }
X if (mask & 1) {
X mask = uPC_HIGH_BIT;
X a--;
X } else
X mask >>= 1;
X e += dy;
X }
X } else { /* dx <= 0, dy <= 0, dx <= dy */
X dx <<= 1;
X e = dx - dy;
X c = dy + 2;
X dy <<= 1;
X
X while (--c) {
X uPC_PLOT(a, mask);
X if (e >= 0) {
X if (mask & 1) {
X mask = uPC_HIGH_BIT;
X a--;
X } else
X mask >>= 1;
X e -= dy;
X }
X (Scr_kluge *)a += width;
X e += dx;
X }
X }
X }
X }
}
X
X
#ifdef uPC_NOT_USED
/* Added by Russell Lang, eln...@monu1.cc.monash.oz
X This placement to the nearest character cell worked, and I'm leaving
X it here so the calculations involved won't be lost! (jdc)
*/
uPC_put_text(x,y,str)
unsigned int x,y;
char str[];
{
/* This routine puts the text at the cursor location nearest
X to (x,y). Obviously the exact postion would look better */
X
/* Just use the ANSI escape sequence CUP (iswind said that was ok!) */
X printf ("\033[%d;%dH%s\033[25;1H", (int)(24-(y-uPC_VCHAR/2)*25/uPC_YMAX),
X (int)(x*80/uPC_XMAX), str);
X fflush (stdout);
}
#endif
X
X
uPC_put_text(x,y,str)
unsigned int x,y;
char str[];
{
X if (uPC_angle == 1)
X x += uPC_VCHAR/2;
X else
X y -= uPC_VCHAR/2;
X
X switch (uPC_angle) {
X case 0:
X for (; *str; ++str, x += uPC_HCHAR)
X uPC_putc (x, y, *str, uPC_angle);
X break;
X case 1:
X for (; *str; ++str, y += uPC_HCHAR)
X uPC_putc (x, y, *str, uPC_angle);
X break;
X }
}
X
X
uPC_putc (x, y, c, angle)
unsigned int x, y;
int c, angle;
/*
X Put a character at an x,y location in the bit map (using the fnt5x9
X array. This is mostly just copied from the bitmap.c driver.
*/
{
X int i, j, k;
X register Scr_type mask, *a;
X char_row fc;
X unsigned int pixelon;
X
X i = c - ' ';
X for (j=0; j<FNT5X9_VBITS; j++) {
X fc = fnt5x9[i][j];
X for (k=0; k<FNT5X9_HBITS; k++) {
X pixelon = ((unsigned int)(fc))>>k & 1;
X if (pixelon) {
X switch (angle) {
X case 0:
X mask = lookup[x+k+1 & 0x0f];
X a = &uPC_display[(uPC_YSIZE - 1) - (y+j)][(x+k+1) >> 4];
X break;
X case 1:
X mask = lookup[x-j & 0x0f];
X a = &uPC_display[(uPC_YSIZE - 1) - (y+k+1)][(x-j) >> 4];
X break;
X }
X *(a) |= (mask); /* see uPC_PLOT macro */
X }
X }
X }
}
X
X
uPC_text_angle (ang)
int ang;
{
X uPC_angle = ang;
X return TRUE;
}
X
X
uPC_reset()
{
/* Reset window to normal size. */
X uPC_fixwind (0);
}
X
X
X
uPC_fixwind(signo)
int signo;
{
X static struct uwdata wreset = { 0, 12, 720, 288, 0x1};
X struct utdata ut;
X
/* Reset the window to the right size. */
X ioctl(1, WIOCSETD, &wreset); /* 0, not wncur here! */
X
/* Scroll the screen once. (avoids typing over the same line) */
X fprintf (stderr, "\n");
X
X if (signo) {
X if (signo == SIGILL || signo == SIGTRAP || signo == SIGPWR)
X signal (signo, SIG_DFL);
X kill (0,signo); /* Redo the signal (as if we never trapped it). */
X }
}
SHAR_EOF
chmod 0644 gnuplot/term/unixpc.trm ||
echo 'restore of gnuplot/term/unixpc.trm failed'
Wc_c="`wc -c < 'gnuplot/term/unixpc.trm'`"
test 14242 -eq "$Wc_c" ||
echo 'gnuplot/term/unixpc.trm: original size 14242, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/unixplot.trm ==============
if test -f 'gnuplot/term/unixplot.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/unixplot.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/unixplot.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/unixplot.trm' &&
/* GNUPLOT -- unixplot.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 * Unix plot(5) graphics language
X *
X * AUTHORS
X * Colin Kelley, Thomas Williams, Russell Lang
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/*
Unixplot library writes to stdout. A fix was put in place by
..!arizona!naucse!jdc to let set term and set output redirect
stdout. All other terminals write to outfile.
*/
X
#define UP_XMAX 4096
#define UP_YMAX 4096
X
#define UP_XLAST (UP_XMAX - 1)
#define UP_YLAST (UP_YMAX - 1)
X
#define UP_VCHAR (UP_YMAX/30) /* just a guess--no way to know this! */
#define UP_HCHAR (UP_XMAX/60) /* just a guess--no way to know this! */
#define UP_VTIC (UP_YMAX/80)
#define UP_HTIC (UP_XMAX/80)
X
UP_init()
{
X openpl();
X space(0, 0, UP_XMAX, UP_YMAX);
}
X
X
UP_graphics()
{
X erase();
}
X
X
UP_text()
{
}
X
X
UP_linetype(linetype)
int linetype;
SHAR_EOF
true || echo 'restore of gnuplot/term/unixplot.trm failed'
fi
echo 'End of part 18'
echo 'File gnuplot/term/unixplot.trm is continued in part 19'
echo 19 > _shar_seq_.tmp
#!/bin/sh
# this is Part.19 (part 19 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/unixplot.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 19; 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/unixplot.trm'
else
echo 'x - continuing file gnuplot/term/unixplot.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/unixplot.trm' &&
{
static char *lt[2+5] = {"solid", "longdashed", "solid", "dotted","shortdashed",
X "dotdashed", "longdashed"};
X
X if (linetype >= 5)
X linetype %= 5;
X linemod(lt[linetype+2]);
}
X
X
UP_move(x,y)
unsigned int x,y;
{
X move(x,y);
}
X
X
UP_vector(x,y)
unsigned int x,y;
{
X cont(x,y);
}
X
X
UP_put_text(x,y,str)
unsigned int x,y;
char str[];
{
X UP_move(x+UP_HCHAR/2,y+UP_VCHAR/5);
X label(str);
}
X
UP_reset()
{
X closepl();
}
X
SHAR_EOF
echo 'File gnuplot/term/unixplot.trm is complete' &&
chmod 0666 gnuplot/term/unixplot.trm ||
echo 'restore of gnuplot/term/unixplot.trm failed'
Wc_c="`wc -c < 'gnuplot/term/unixplot.trm'`"
test 1929 -eq "$Wc_c" ||
echo 'gnuplot/term/unixplot.trm: original size 1929, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/v384.trm ==============
if test -f 'gnuplot/term/v384.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/v384.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/v384.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/v384.trm' &&
/* GNUPLOT - v384.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 * Vectrix 384 - works with tandy color printer as well
X *
X * AUTHORS
X * rol...@moncskermit.OZ (Roland Yap)
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
/*
X * Vectrix 384 driver - works with tandy color printer as well
X * in reverse printing 8 color mode.
X * This doesn't work on Vectrix 128 because it redefines the
X * color table. It can be hacked to work on the 128 by changing
X * the colours but then it will probably not print best. The color
X * table is purposely designed so that it will print well
X *
X */
X
#define V384_XMAX 630
#define V384_YMAX 480
X
#define V384_XLAST (V384_XMAX - 1)
#define V384_YLAST (V384_YMAX - 1)
X
#define V384_VCHAR 12
#define V384_HCHAR 7
#define V384_VTIC 8
#define V384_HTIC 7
X
X
V384_init()
{
X fprintf(outfile,"%c%c G0 \n",27,18);
X fprintf(outfile,"Q 0 8\n");
X fprintf(outfile,"0 0 0\n");
X fprintf(outfile,"255 0 0\n");
X fprintf(outfile,"0 255 0\n");
X fprintf(outfile,"0 0 255\n");
X fprintf(outfile,"0 255 255\n");
X fprintf(outfile,"255 0 255\n");
X fprintf(outfile,"255 255 0\n");
X fprintf(outfile,"255 255 255\n");
}
X
X
V384_graphics()
{
X fprintf(outfile,"%c%c E0 RE N 65535\n",27,18);
}
X
X
V384_text()
{
X fprintf(outfile,"%c%c\n",27,17);
}
X
X
V384_linetype(linetype)
int linetype;
{
static int color[]= {
X 1 /* red */,
X 2 /* green */,
X 3 /* blue */,
X 4 /* cyan */,
X 5 /* magenta */,
X 6 /* yellow */, /* not a good color so not in use at the moment */
X 7 /* white */
X };
X
X if (linetype < 0)
X linetype=6;
X else
X linetype %= 5;
X fprintf(outfile,"C %d\n",color[linetype]);
}
X
X
V384_move(x,y)
unsigned int x,y;
{
X fprintf(outfile,"M %d %d\n",x+20,y);
}
X
X
V384_vector(x,y)
unsigned int x,y;
{
X fprintf(outfile,"L %d %d\n",x+20,y);
}
X
X
V384_put_text (x, y, str)
unsigned int x, y;
char str[];
{
X V384_move (x, y + V384_VCHAR/2);
X fprintf (outfile, "$%s\n", str);
}
X
X
V384_reset()
{
}
X
SHAR_EOF
chmod 0666 gnuplot/term/v384.trm ||
echo 'restore of gnuplot/term/v384.trm failed'
Wc_c="`wc -c < 'gnuplot/term/v384.trm'`"
test 2579 -eq "$Wc_c" ||
echo 'gnuplot/term/v384.trm: original size 2579, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/vws.trm ==============
if test -f 'gnuplot/term/vws.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/vws.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/vws.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/vws.trm' &&
/* GNUPLOT - vws.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 * IRIS terminals
X *
X * AUTHORS
X * Walter Speth
X * BITNET: SPETH@DBNPIB5
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#define VWS_XMAX 1024
#define VWS_YMAX 780
#define VWS_VCHAR 25
#define VWS_HCHAR 15
#define VWS_VTIC 10
#define VWS_HTIC 10
X
#include stdio
/*
#include math
#include ssdef
*/
#include descrip
X
#include <uisentry.h>
#include <uisusrdef.h>
X
X
#define DEFAULT_ATTR 0
#define OVER_ATTR 1
#define ERAS_ATTR 2
#define BIS_ATTR 3
#define COLOR_ATTR 4
#define TEXT_ATTR 5
#define LINE_ATTR 6
#define BACK_ATTR 7
X
X
float current_x, current_y;
X
X
int vd_id, wd_id;
int vcm_id;
X
static $DESCRIPTOR(ws_devname, "SYS$WORKSTATION");
static $DESCRIPTOR(vd_title, "gnuplot");
X
static float x0, y0, xsiz, ysiz,
X wc_xmin_new, wc_ymin_new, wc_xmax_new, wc_ymax_new,
X wc_xmin, wc_ymin, wc_xmax, wc_ymax,
X vd_width, vd_height;
X
VWS_resize_ast()
{ uis$resize_window(&vd_id, &wd_id, &x0, &y0, &xsiz, &ysiz,
X &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
X replotrequest();
}
/****************************************************************************/
VWS_init()
X
X
{
X int i;
X int cattr;
X $DESCRIPTOR(a_font,"DTABER0003WK00PG0001UZZZZ02A000");
X
X vd_width = 14;
X vd_height = 10; /* aspect sqrt(2) as DIN A paper */
X
X wc_xmin = 0.0;
X wc_ymin = 0.0;
X wc_xmax = (float) VWS_XMAX;
X wc_ymax = (float) VWS_YMAX;
X
X vcm_id = uis$create_color_map(&8);
X
X vd_id = uis$create_display(&wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
X &vd_width, &vd_height, &vcm_id);
X
X uis$set_color(&vd_id, &0, &.5, &.5, &.5);
X uis$set_color(&vd_id, &1, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &2, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &3, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &4, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &5, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &6, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &7, &0.0, &0.0, &0.0);
X
/*
X uis$set_color(&vd_id, &2, &.2, &.2, &.2);
X uis$set_color(&vd_id, &3, &.3, &.3, &.3);
X uis$set_color(&vd_id, &4, &.4, &.4, &.4);
X uis$set_color(&vd_id, &5, &.5, &.5, &.5);
X uis$set_color(&vd_id, &6, &.6, &.6, &.6);
X uis$set_color(&vd_id, &7, &.7, &.7, &.7);
X
/* perhaps better for color terms (which I do not have)
X uis$set_color(&vd_id, &0, &0.0, &0.0, &0.0);
X uis$set_color(&vd_id, &1, &0.9, &0.0, &0.0);
X uis$set_color(&vd_id, &2, &0.0, &0.9, &0.0);
X uis$set_color(&vd_id, &3, &0.9, &0.9, &0.0);
X uis$set_color(&vd_id, &4, &0.0, &0.0, &0.9);
X uis$set_color(&vd_id, &5, &0.9, &0.0, &0.9);
X uis$set_color(&vd_id, &6, &0.0, &0.9, &0.9);
X uis$set_color(&vd_id, &7, &0.9, &0.9, &0.9);
/*
*/
X uis$disable_display_list(&vd_id);
X
X wd_id = uis$create_window(&vd_id, &ws_devname, &vd_title,
X &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax,
X &vd_width, &vd_height);
X
X uis$set_resize_ast(&vd_id, &wd_id, &VWS_resize_ast, &0,
X &x0, &y0, &xsiz, &ysiz,
X &wc_xmin_new, &wc_ymin_new, &wc_xmax_new, &wc_ymax_new);
X
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &OVER_ATTR, &UIS$C_MODE_OVER);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &ERAS_ATTR, &UIS$C_MODE_ERAS);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &BIS_ATTR, &UIS$C_MODE_BIS);
/*
X for (i=0; i<8; i++) {
X cattr = COLOR_ATTR+i;
X uis$set_writing_index(&vd_id, ©_ATTR, &cattr, &i);
X }
*/
X uis$set_background_index(&vd_id, &DEFAULT_ATTR, &BACK_ATTR, &0);
X uis$set_writing_mode(&vd_id, &DEFAULT_ATTR, &TEXT_ATTR, &UIS$C_MODE_OVER);
X uis$set_font(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&a_font);
X uis$set_char_size(&vd_id,&TEXT_ATTR,&TEXT_ATTR,&0,
X &(float)VWS_HCHAR,&(float)VWS_VCHAR);
X uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
}
X
/****************************************************************************/
X
VWS_reset()
{
X uis$delete_display(&vd_id);
}
/****************************************************************************/
VWS_scale(xs,ys)
int xs,ys;
{
X return FALSE;
}
/****************************************************************************/
VWS_graphics()
{
X uis$erase(&vd_id, &wc_xmin, &wc_ymin, &wc_xmax, &wc_ymax);
}
/****************************************************************************/
VWS_text()
{
}
/****************************************************************************/
VWS_move(x,y)
int x,y;
{
X current_x= (float)(x);
X current_y= (float)(y);
}
/****************************************************************************/
VWS_vector(x,y)
int x,y;
{ int col;
X float fx,fy;
X fx=(float) x;
X fy=(float) y;
X
X uis$line(&vd_id, &LINE_ATTR,
X ¤t_x, ¤t_y, &fx, &fy);
X VWS_move (x,y);
}
/****************************************************************************/
VWS_linetype(lt)
int lt;
{
long int lstyle[9]={ 0xffffffff,
X 0Xff00ff00,
X 0xffffff00,
X 0xffff0000,
X 0xf0f0f0f0,
X 0Xfff0fff0,
X 0xf000f000,
X 0xa5a5a5af,
X 0xf00f00f0 };
X
X switch(lt) {
case -1: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.5);
X break;
case -2: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&2.0);
X break;
/*
default: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&lstyle[lt % 8]);
X makes part of curve disappear on my workstation
*/
default: uis$set_line_style(&vd_id,&LINE_ATTR,&LINE_ATTR,&0xFFFFFFFF);
X uis$set_line_width(&vd_id,&LINE_ATTR,&LINE_ATTR,&1.0);
}
}
X
/****************************************************************************/
static int justify_mode =CENTRE,up;;
X
VWS_put_text(x,y,str)
int x,y; char* str;
{
X float fx,fy, thih, twid;
X
X
/* uis$text parameter is descriptor string not character string */
X
X struct dsc$descriptor_s textline = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,""};
X
X
X textline.dsc$a_pointer = str;
X textline.dsc$w_length = strlen(textline.dsc$a_pointer);
X uis$measure_text(&vd_id,&TEXT_ATTR,&textline,&twid,&thih);
X fx=(float)x;
X fy=(float)y;
X
X switch (justify_mode) {
X case LEFT : fy+=thih/2.;
X break;
X case RIGHT : fy+=thih/2.;
X fx-=twid;
X break;
X
X case CENTRE : fy+=thih/2.;
X fx-=twid/2;
X break;
X };
X
X uis$text(&vd_id,&TEXT_ATTR,&textline,&fx,&fy);
X /* write to Example Viewport window */
X
X
}
/****************************************************************************/
VWS_text_angle(ang)
int ang;
{
X float degrees;
X degrees=90.*(up=ang);
X uis$set_text_slope (&vd_id, &TEXT_ATTR, &TEXT_ATTR, °rees);
return TRUE;
}
/****************************************************************************/
VWS_justify_text(mode)
int mode;
{ justify_mode=mode;
return TRUE;
}
/****************************************************************************/
VWS_point(x,y,point)
int x,y,point;
{
do_point(x,y,point);
}
/****************************************************************************/
VWS_arrow(sx,sy,ex,ey)
int sx,sy,ex,ey;
{
do_arrow(sx,sy,ex,ey);
}
SHAR_EOF
chmod 0644 gnuplot/term/vws.trm ||
echo 'restore of gnuplot/term/vws.trm failed'
Wc_c="`wc -c < 'gnuplot/term/vws.trm'`"
test 8014 -eq "$Wc_c" ||
echo 'gnuplot/term/vws.trm: original size 8014, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/x11.trm ==============
if test -f 'gnuplot/term/x11.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/x11.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/x11.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/x11.trm' &&
/*
X * x11.trm --- inboard terminal driver for X11
X */
X
#define X11_XMAX 4096
#define X11_YMAX 4096
X
/* approximations for typical font/screen sizes */
#define X11_VCHAR (X11_YMAX/25)
#define X11_HCHAR (X11_XMAX/100)
#define X11_VTIC (X11_YMAX/100)
#define X11_HTIC (X11_XMAX/150)
X
#define X11_nopts 22
char X11_opts[X11_nopts][20] = {
X "-iconic", "-rv", "-reverse", "+rv", "-synchronous",
X "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
X "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name",
X "-selectionTimeout", "-title", "-xnllanguage", "-xrm"
X };
int X11_optarg[X11_nopts] = {
X 0, 0, 0, 0, 0,
X 1, 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1, 1, 1,
X 1, 1, 1, 1
X };
X
FILE *X11_pipe, *popen();
char X11_command[1024]= "gnuplot_x11 -name gnuplot";
X
X
/* X11_args - scan gnuplot command line for standard X Toolkit options */
X
XX11_args(argc, argv) int argc; char *argv[]; {
X int nx11 = 0, n;
X
X while(++argv, --argc > 0) {
X for (n=0; n<X11_nopts; n++) {
X if (!strcmp(*argv, X11_opts[n])) {
X strcat(X11_command, " ");
X strcat(X11_command, *argv);
X if (X11_optarg[n]) {
X if (--argc <= 0) return(nx11);
X strcat(X11_command, " \"");
X strcat(X11_command, *++argv);
X strcat(X11_command, "\"");
X nx11++;
X }
X nx11++; break;
X }
X }
X if (n == X11_nopts) break;
X }
X return(nx11);
X }
X
#ifdef ULTRIX_KLUDGE
#define X11_ULTRIX_KLUDGE fprintf (X11_pipe, "E\n"); fflush (X11_pipe);
#else
#define X11_ULTRIX_KLUDGE
#endif
X
XX11_init() { X11_pipe = popen(X11_command, "w"); }
X
XX11_reset() { fprintf(X11_pipe, "R\n"); fflush(X11_pipe); pclose(X11_pipe); }
X
XX11_text() { fprintf(X11_pipe, "E\n"); fflush(X11_pipe); X11_ULTRIX_KLUDGE }
X
XX11_graphics() { fprintf(X11_pipe, "G\n"); }
X
XX11_move(x,y) unsigned int x,y; { fprintf(X11_pipe, "M%04d%04d\n", x, y); }
X
XX11_vector(x,y) unsigned int x,y; { fprintf(X11_pipe, "V%04d%04d\n", x, y); }
X
XX11_linetype(lt) int lt; { fprintf(X11_pipe, "L%04d\n", lt); }
X
XX11_put_text(x,y,str) unsigned int x,y; char str[]; {
X fprintf(X11_pipe, "T%04d%04d%s\n", x, y, str);
X }
XX11_justify_text(mode) enum JUSTIFY mode; {
X fprintf(X11_pipe, "J%04d\n", mode);
X return(TRUE);
X }
SHAR_EOF
chmod 0644 gnuplot/term/x11.trm ||
echo 'restore of gnuplot/term/x11.trm failed'
Wc_c="`wc -c < 'gnuplot/term/x11.trm'`"
test 2240 -eq "$Wc_c" ||
echo 'gnuplot/term/x11.trm: original size 2240, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/gpr.trm ==============
if test -f 'gnuplot/term/gpr.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/gpr.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/gpr.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/gpr.trm' &&
/* GNUPLOT - gpr.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 * APOLLO's GPR windowing system
X *
X * AUTHORS
X * Michael Aramini
X * Roque D Oliveira , oliv...@caen.engin.umich.edu
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
#include <apollo/base.h>
#include <apollo/error.h>
#include <apollo/gpr.h>
#include <apollo/pad.h>
/* landscape window */
/*
#define GPR_XMAX 720
#define GPR_YMAX 450
*/
/* portrait window */
#define GPR_XMAX 585
#define GPR_YMAX 735
X
#define GPR_XLAST (GPR_XMAX - 1)
#define GPR_YLAST (GPR_YMAX - 1)
X
#define GPR_VCHAR 19
#define GPR_HCHAR 10
#define GPR_VTIC (GPR_YMAX/80)
#define GPR_HTIC (GPR_XMAX/80)
X
gpr_$direction_t gpr_path=gpr_$right;
int gpr_ang=0; /* text angle, 0=horizontal, 1=vertical */
enum JUSTIFY gpr_justify=LEFT; /* text is flush left */
X
static status_$t status;
unsigned int DEBUG = 0; /* set it to 1 when debugging program */
X
X
static void check(messagex)
char *messagex;
{
X if (status.all = status_$ok)
X {
X error_$print(status);
X printf("Error occurred while %s.\n", messagex);
X }
}
X
/* return whether stdout is a DM pad . Called by term.c */
gpr_isa_pad()
{
X pad_$isa(1, &status);
X return (status.all == status_$ok);
}
X
X
GPR_init()
{
X gpr_$offset_t dm_bitmap_size;
X gpr_$bitmap_desc_t dm_bitmap_desc;
X pad_$window_desc_t window;
X short font_id;
X stream_$id_t stream_id;
X static gpr_$rgb_plane_t hi_plane;
X static gpr_$disp_char_t display_characteristics;
X static float screen_size_r_width,screen_size_r_height ;
X static short int disp_len = sizeof(gpr_$disp_char_t);
X static short int disp_len_returned;
X
X
X /* open a pad to do graphics in */
X window.top = 0;
X window.left = 0;
X window.width = GPR_XMAX + 10; /* 10 accounts for width of window border */
X window.height = GPR_YMAX + 35; /* 35 accounts for height of window border */
X pad_$create_window("",(short)0,pad_$transcript,(short)1,window,&stream_id,&status);
X check("pad_$create_window");
X
/* pad_$set_full_window(stream_id,(short) 1,&window, &status); */
/* pad_$set_border (stream_id,(short) 1, true, &status); */
X pad_$set_scale (stream_id,(short) 1,(short) 1, &status);
X pad_$set_auto_close(stream_id, (short) 1, true, &status );
X
X gpr_$inq_disp_characteristics(gpr_$direct,stream_id,disp_len,&display_characteristics,&disp_len_returned,&status);
X check("in gpr_$inq_display_characteristics");
X screen_size_r_width = (float) display_characteristics.x_window_size; /*x_window_size in pixels */
X screen_size_r_height = (float) display_characteristics.y_window_size; /*y_window_size in pixels */
X hi_plane = display_characteristics.n_planes - 1;
X if(DEBUG) printf("width=%f height=%f \n",screen_size_r_width,screen_size_r_height);
X
X dm_bitmap_size.x_size = 1280;
X dm_bitmap_size.y_size = 1024;
X gpr_$init(gpr_$direct,stream_id,dm_bitmap_size,hi_plane,&dm_bitmap_desc,&status);
X check("in gpr_$init");
/*
X gpr_$set_obscured_opt(gpr_$pop_if_obs, &status);
X check("in gpr_$set_obscured_opt");
*/
X gpr_$set_auto_refresh(true, &status);
X check("in gpr_$set_auto_refresh");
X
X /* load a font and make it current */
X gpr_$load_font_file("f7x13", 5, &font_id, &status);
X check("in gpr_$load_font_file");
X gpr_$set_text_font(font_id, &status);
X check("in gpr_$set_text_font");
X
X /* set up color values */
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_set_draw_value");
X gpr_$set_text_background_value((gpr_$pixel_value_t)(-1), &status); /* trans */
X check("in gpr_$set_text_background_value");
X gpr_$set_text_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_$set_text_value");
}
X
X
GPR_graphics()
{
X gpr_$coordinate_t locx,locy,marker_size;
X
X (void) gpr_$acquire_display(&status);
X check("in gpr_$acquire display");
X gpr_$clear((gpr_$pixel_value_t)0, &status); /* black */
X check("in gpr_$clear");
X
X if(DEBUG)
X {
X marker_size = (short) 10;
X
X locx = (short) 5;
X locy = (short) 5;
X gpr_$set_draw_value((gpr_$pixel_value_t)2, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) (GPR_XMAX -1 - 5);
X locy = (short) 5;
X gpr_$set_draw_value((gpr_$pixel_value_t)3, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) 5;
X locy = (short) (GPR_YMAX -1 - 5);
X gpr_$set_draw_value((gpr_$pixel_value_t)4, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X locx = (short) (GPR_XMAX -1 - 5);
X locy = (short) (GPR_YMAX -1 - 5);
X gpr_$set_draw_value((gpr_$pixel_value_t)5, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X check("in gpr_$set_draw_value");
X } /* end if(DEBUG) */
X
}
X
X
GPR_text()
{
X gpr_$release_display(&status);
X check("gpr_$release_display");
}
X
X
GPRold_linetype(linetype)
int linetype;
{
X static gpr_$line_pattern_t patterns[2+5] = {
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x3FFF }, /* very long dashed 0011111111111111 */
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x5555 }, /* dotted 0101010101010101 */
X { 0x3333 }, /* short dashed 0011001100110011 */
X { 0xB5AD }, /* dot short-dashed 1011010110101101 */
X { 0x3FFF } /* very long dashed 0011111111111111 */
X };
X if (linetype >= 5) linetype %= 5;
X gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
X check("in gpr_$set_line_pattern");
}
X
GPR_linetype(linetype)
int linetype;
{
X static gpr_$line_pattern_t patterns[2+7] = {
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x1111 }, /* long-spaced dotted 0001000100010001 */
X { 0xFFFF }, /* solid 1111111111111111 */
X { 0x5555 }, /* dotted 0101010101010101 */
X { 0x3333 }, /* short dashed 0011001100110011 */
X { 0x7777 }, /* medium dashed 0111011101110111 */
X { 0x3F3F }, /* long dashed 0011111100111111 */
X { 0x0F0F }, /* long-spaced dashed 0000111100001111 */
X { 0x5F5F } /* dot dashed 0101111101011111 */
X };
X if (linetype >= 7) linetype %= 7;
X gpr_$set_line_pattern((short)1, patterns[linetype+2], (short)16, &status);
X check("in gpr_$set_line_pattern");
X
/*
X gpr_$set_draw_value((gpr_$pixel_value_t)(linetype + 1), &status);
X check("in gpr_$set_draw_value");
*/
}
X
X
GPR_move(x, y)
unsigned int x, y;
{
X gpr_$move((short)x, (short)(GPR_YMAX -1 - y), &status);
X check("in gpr_$move");
}
X
X
GPR_vector(x, y)
unsigned int x, y;
{
X gpr_$line((short)x, (short)(GPR_YMAX -1 - y), &status);
X check("in gpr_$line");
}
X
X
GPR_put_text(x,y,str)
unsigned int x,y; /* reference point of string */
char str[]; /* the text */
{
X gpr_$coordinate_t xgpr,ygpr;
X gpr_$offset_t str_size_in_pixels;
X short int str_len;
X
X gpr_$coordinate_t locx,locy,marker_size;
X
X if(DEBUG)
X {
X locx = (short) x;
X locy = (short) (GPR_YMAX -1 - y);
X marker_size = (short) 20;
X gpr_$set_draw_value((gpr_$pixel_value_t)1, &status); /* white */
X gpr_$move( (locx - marker_size/2) ,locy,&status);
X gpr_$line( (locx + marker_size/2) ,locy,&status);
X gpr_$move( locx, (locy + marker_size/2),&status);
X gpr_$line( locx, (locy - marker_size/2),&status);
X gpr_$set_draw_value((gpr_$pixel_value_t)7, &status); /* white */
X }
X
X xgpr = (short) x;
X ygpr = (short) (GPR_YMAX -1 - y);
X gpr_$set_text_path(gpr_path, &status);
X check("gpr_$set_text_path");
X
X str_len = (short) strlen(str);
X gpr_$inq_text_extent(str,str_len,&str_size_in_pixels,&status); /* Calculate how much space (in pixels) the string requires */
X check("in gpr_$inq_text_extent");
X
X switch (gpr_justify)
X {
X case LEFT :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X if(DEBUG) printf("LEFT and up , str=%s\n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("LEFT and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X
X case CENTRE :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X xgpr = xgpr + str_size_in_pixels.x_size/2;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("CENTRE and up, str=%s \n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X xgpr = xgpr - str_size_in_pixels.x_size/2;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("CENTRE and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X case RIGHT :
X {
X switch (gpr_path)
X {
X case gpr_$up : /* vertical */
X {
X ygpr = ygpr + str_size_in_pixels.y_size;
X if(DEBUG) printf("RIGHT and up, str=%s \n",str);
X break;
X }
X case gpr_$right : /* horizontal */
X {
X xgpr = xgpr - str_size_in_pixels.x_size;
X ygpr = ygpr + str_size_in_pixels.y_size/2;
X if(DEBUG) printf("RIGHT and right, str=%s \n",str);
X break;
X }
X }
X break;
X }
X }
X
X gpr_$move(xgpr,ygpr,&status);
X check("in gpr_$move");
X gpr_$text(str, str_len, &status);
X check("in gpr_$text");
}
X
int GPR_text_angle(ang)
int ang;
{
X if (gpr_ang != ang)
X {
X gpr_ang = ang;
X gpr_path = (gpr_ang == 1 ? gpr_$up : gpr_$right);
X }
X return (TRUE);
}
X
int GPR_justify_text(mode)
enum JUSTIFY mode;
{
X gpr_justify = mode;
X return (TRUE);
}
X
GPR_reset()
{
X gpr_$terminate(false, &status);
X check("in gpr_$terminate");
}
SHAR_EOF
chmod 0644 gnuplot/term/gpr.trm ||
echo 'restore of gnuplot/term/gpr.trm failed'
Wc_c="`wc -c < 'gnuplot/term/gpr.trm'`"
test 11637 -eq "$Wc_c" ||
echo 'gnuplot/term/gpr.trm: original size 11637, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/dumb.trm ==============
if test -f 'gnuplot/term/dumb.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/dumb.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/dumb.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/dumb.trm' &&
/* GNUPLOT - dumb.trm */
/*
X * Copyright (C) 1991
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 * DUMB terminals
X *
X * AUTHORS
X * Francois Pinard, 91-04-03
X * INTERNET: pin...@iro.umontreal.ca
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#define DUMB_AXIS_CONST '\1'
#define DUMB_BORDER_CONST '\2'
X
#define DUMB_XMAX 79
#define DUMB_YMAX 24
X
static char *dumb_matrix = NULL; /* matrix of characters */
static char *dumb_priority = NULL; /* matrix of priority at each position */
static char dumb_pen; /* current character used to draw */
static int dumb_x; /* current X position */
static int dumb_y; /* current Y position */
static int dumb_xmax = DUMB_XMAX;
static int dumb_ymax = DUMB_YMAX;
X
#define DUMB_PIXEL(x,y) dumb_matrix[dumb_xmax*(y)+(x)]
X
X
dumb_set_pixel(x,y,v,p)
int x,y,v,p;
{
X if (p > dumb_priority[dumb_xmax*y+x])
X {
X dumb_matrix[dumb_xmax*y+x] = v;
X dumb_priority[dumb_xmax*y+x] = p;
X }
}
X
X
DUMB_options()
{
X int x,y;
X struct value a;
X extern struct value *const_express();
X extern double real();
X
X if (!END_OF_COMMAND) {
X x = (int) real(const_express(&a));
X if (!END_OF_COMMAND) {
X y = (int) real(const_express(&a));
X dumb_xmax = term_tbl[term].xmax = x;
X dumb_ymax = term_tbl[term].ymax = y;
X }
X }
X
X sprintf(term_options, "%d %d",dumb_xmax,dumb_ymax);
}
X
X
DUMB_init()
{
X if (dumb_matrix)
X free(dumb_matrix);
X
X dumb_matrix = alloc (dumb_xmax * dumb_ymax * 2, "dumb terminal");
X
X dumb_priority = dumb_matrix + dumb_xmax * dumb_ymax;
}
X
X
char *
DUMB_str_state()
{
X static char str[80];
X
X sprintf( str, "%d %d", dumb_xmax, dumb_ymax );
X
X return str;
}
X
X
DUMB_graphics ()
{
X int i;
X char *pm = dumb_matrix, *pp = dumb_priority;
X
X for ( i = dumb_xmax * dumb_ymax; i > 0; i-- ) {
X *pm++ = ' ';
X *pp++ = 0;
X }
}
X
X
DUMB_text ()
{
X int x, y, l;
X
X putc ('\f', outfile);
X for (y = dumb_ymax - 1; y >= 0; y--)
X {
X for (l = dumb_xmax; l > 0 && DUMB_PIXEL (l - 1, y) == ' '; l--)
X ;
X for (x = 0; x < l; x++)
X putc (DUMB_PIXEL (x, y), outfile);
X if (y > 0)
X putc ('\n', outfile);
X }
X fflush (outfile);
}
X
X
DUMB_reset()
{
X free (dumb_matrix);
X dumb_matrix = NULL;
}
X
X
DUMB_linetype(linetype)
int linetype;
{
X static char pen_type[7] = {'*', '#', '$', '%', '@', '&', '='};
X
X if (linetype == -2)
X dumb_pen = DUMB_BORDER_CONST;
X else if (linetype == -1)
X dumb_pen = DUMB_AXIS_CONST;
X else
X {
X linetype = linetype % 7;
X dumb_pen = pen_type[linetype];
X }
}
X
X
DUMB_move(x, y)
int x, y;
{
X dumb_x = x;
X dumb_y = y;
}
X
X
DUMB_point(x,y,point)
int x,y,point;
{
X dumb_set_pixel (x, y, point == -1 ? '.' : point % 26 + 'A', 4);
}
X
X
DUMB_vector(x,y)
int x,y;
{
X char pen, pen1;
X int priority;
X int delta;
X
X if (abs (y - dumb_y) > abs (x - dumb_x))
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST:
X pen = ':';
X pen1 = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST:
X pen = '|';
X pen1 = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X pen1 = dumb_pen;
X priority = 3;
X break;
X }
X dumb_set_pixel (dumb_x, dumb_y, pen1, priority);
X for (delta = 1; delta < abs (y - dumb_y); delta++)
X dumb_set_pixel (dumb_x
X + (int) ((double) (x - dumb_x) * delta / abs(y - dumb_y)
X + 0.5),
X dumb_y + delta * sign (y - dumb_y),
X pen, priority);
X dumb_set_pixel (x, y, pen1, priority);
X }
X else if (abs (x - dumb_x) > abs (y - dumb_y))
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST:
X pen = '.';
X pen1 = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST:
X pen = '-';
X pen1 = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X pen1 = dumb_pen;
X priority = 3;
X break;
X }
X dumb_set_pixel (dumb_x, dumb_y, pen1, priority);
X for (delta = 1; delta < abs (x - dumb_x); delta++)
X dumb_set_pixel (dumb_x + delta * sign (x - dumb_x),
X dumb_y +
X (int) ((double) (y - dumb_y) * delta / abs(x - dumb_x)
X + 0.5),
X pen, priority);
X dumb_set_pixel (x, y, pen1, priority);
X }
X else
X {
X switch (dumb_pen)
X {
X case DUMB_AXIS_CONST: /* zero length axis */
X pen = '+';
X priority = 1;
X break;
X
X case DUMB_BORDER_CONST: /* zero length border */
X pen = '+';
X priority = 2;
X break;
X
X default:
X pen = dumb_pen;
X priority = 3;
X break;
X }
X for (delta = 0; delta <= abs (x - dumb_x); delta++)
X dumb_set_pixel (dumb_x + delta * sign (x - dumb_x),
X dumb_y + delta * sign (y - dumb_y),
X pen, priority);
X }
X dumb_x = x;
X dumb_y = y;
}
X
X
DUMB_put_text(x,y,str)
int x, y;
char *str;
{
X int length;
X int delta;
X
X length = strlen(str);
X if (x + length > dumb_xmax)
X x = max (0, dumb_xmax - length);
X
X for (; x < dumb_xmax && *str; x++, str++)
X dumb_set_pixel (x, y, *str, 5);
}
X
X
DUMB_arrow (sx,sy,ex,ey)
int sx,sy,ex,ey;
{
X char saved_pen;
X char saved_x;
X char saved_y;
X
X saved_pen = dumb_pen;
X saved_x = dumb_x;
X saved_y = dumb_y;
X
X dumb_pen = '>';
X dumb_x = sx;
X dumb_y = sy;
X DUMB_vector (ex,ey);
X
X dumb_pen = saved_pen;
X dumb_x = saved_x;
X dumb_y = saved_y;
}
SHAR_EOF
chmod 0644 gnuplot/term/dumb.trm ||
echo 'restore of gnuplot/term/dumb.trm failed'
Wc_c="`wc -c < 'gnuplot/term/dumb.trm'`"
test 6235 -eq "$Wc_c" ||
echo 'gnuplot/term/dumb.trm: original size 6235, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/amiga.trm ==============
if test -f 'gnuplot/term/amiga.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/amiga.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/amiga.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/amiga.trm' &&
/* GNUPLOT - amiga.trm */
/*
X * Copyright (C) 1991
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 * Amiga Custom Screen
X *
X * AUTHORS
X * Carsten Steger
X *
X * Pat R. Empleo Slightly modified for Aztec C v5.2a (beta); sort of
X * 08/27/91 supports overscan; for large WB 2.0 virtual screens,
X * we limit the plot size so we don't have to scroll
X * around (not fun).
X *
X * Carsten Steger Modified to support Kickstart 2.0.
X * 09/11/91 Opens a text overscan screen when used with WB 2.0.
X * Discerns between NTSC and PAL Amigas when used with
X * WB 1.3 and lower.
X *
X * Pat R. Empleo Defined some 2.0 stuff in order to get Aztec C to
X * 09/20/91 work with Carsten's new code (see above). When
X * KS/WB 2.0 support gets implemented in Aztec C, this
X * kludge will get deleted!
X * (Aztec C release 5.2 beta)
X *
X * send your comments or suggestions to (pixar!info-g...@sun.com).
X *
X */
X
#ifdef AMIGA_AC_5
#include <intuition/intuitionbase.h>
#include <intuition/screens.h>
#include <graphics/text.h>
#include <graphics/gfxbase.h>
X
#define OSCAN_TEXT (1) /* */
#define SA_Dummy (TAG_USER + 32) /* This stuff is temporary */
#define SA_Overscan (SA_Dummy + 0x0014) /* until Aztec C implements */
#define STDSCREENWIDTH -1 /* KS/WB 2.0 support. */
#define TAG_DONE (0L) /* */
#define TAG_USER (1L<<31) /* */
X /* */
typedef ULONG Tag; /* */
X /* */
struct TagItem /* */
X { /* */
X Tag ti_Tag; /* */
X ULONG ti_Data; /* */
X }; /* */
X
#else
/* You will have to use the Kickstart 2.0 header files for this to compile */
#include <exec/types.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/exec.h>
#include <proto/diskfont.h>
#endif
X
extern char *getenv(),*strchr();
X
#define AMIGA_XMAX 640
#define AMIGA_YMAX 512
X
#define AMIGA_VCHAR (12)
#define AMIGA_HCHAR (8)
#define AMIGA_VTIC (AMIGA_YMAX/80)
#define AMIGA_HTIC (AMIGA_XMAX/80)
/* The origin is in the upper left hand corner, so we have to translate */
/* and flip the coordinates: */
#define AMIGA_VTF(y) (AMIGA_ymax-1-(y))
X
X
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *DiskfontBase;
static struct TextAttr AMIGA_Font = {
X "topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT
};
static struct TextFont *AMIGA_TextFont;
static struct NewScreen AMIGA_NewScreen = {
X 0,0,AMIGA_XMAX,AMIGA_YMAX,4,15,0,HIRES|LACE,
X CUSTOMSCREEN|SCREENBEHIND|SCREENQUIET,NULL,NULL,NULL,NULL
};
static struct Screen *AMIGA_Screen;
static UWORD AMIGA_Colors [] = {
X 0x000,0xfff,0xbbb,0x0f0,0xf00,0x00f,0x3ca,0xf0f,
X 0x94d,0x0ff,0x82f,0xff0,0x0af,0xc5e,0xfa2,0xf44
};
static int AMIGA_slinetype;
static enum JUSTIFY AMIGA_justify = LEFT;
static unsigned int AMIGA_ymax,AMIGA_xmax;
static WORD AMIGA_cwd,AMIGA_cht,AMIGA_bsl,AMIGA_vadj;
static struct TagItem AMIGA_ScrTagList[] = {
X {SA_Overscan,OSCAN_TEXT},{TAG_DONE,0}
};
X
X
AMIGA_reset()
{
X if (AMIGA_TextFont != NULL) CloseFont(AMIGA_TextFont);
X if (DiskfontBase != NULL) CloseLibrary(DiskfontBase);
X if (AMIGA_Screen != NULL) CloseScreen(AMIGA_Screen);
X if (IntuitionBase != NULL) CloseLibrary(IntuitionBase);
X if (GfxBase != NULL) CloseLibrary(GfxBase);
X AMIGA_TextFont = NULL;
X DiskfontBase = NULL;
X AMIGA_Screen = NULL;
X IntuitionBase = NULL;
X GfxBase = NULL;
}
X
X
AMIGA_init()
{
X static char fontname[80],*gnufont,*search;
X static int fsize;
X static char *test_str =
X " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
X static WORD test_len,test_pxl;
X
X
#ifdef AMIGA_LC_5_1
X /* Install exit trap in case of abnormal termination (see below). */
X int AMIGA_exit();
X if (!onexit(&AMIGA_exit)) {
X fprintf(stderr,"Couldn't set exit trap\n");
X exit(20);
X }
#endif
X GfxBase = OpenLibrary("graphics.library",0);
X if (GfxBase == NULL) {
X fprintf(stderr,"No Graphics-Library\n");
X AMIGA_reset();
X exit(20);
X }
X IntuitionBase = OpenLibrary("intuition.library",0);
X if (IntuitionBase == NULL) {
X fprintf(stderr,"No Intuition-Library\n");
X AMIGA_reset();
X exit(20);
X }
X if (IntuitionBase->LibNode.lib_Version <= 34) {
X /* We compute the vertical resolution for those poor NTSC-souls :-) */
X if (GfxBase->DisplayFlags && PAL) AMIGA_ymax = 512;
X else AMIGA_ymax = 400;
X AMIGA_xmax = 640;
X AMIGA_NewScreen.Width = AMIGA_xmax;
X AMIGA_NewScreen.Height = AMIGA_ymax;
X AMIGA_Screen = OpenScreen(&AMIGA_NewScreen);
X if (AMIGA_Screen == NULL) {
X fprintf(stderr,"No Screen\n");
X AMIGA_reset();
X exit(20);
X }
X } else {
X /* Kickstart 2.0 support */
X AMIGA_NewScreen.Width = STDSCREENWIDTH;
X AMIGA_NewScreen.Height = STDSCREENHEIGHT;
X /* I had to set TopEdge equal to 1 with my (probably outdated) software */
X /* version of Kickstart 2.0 in order for the last line to be displayed */
X /* correctly. Remove the next two lines and check if it still works */
X /* with newer ROM-versions of Kickstart 2.0 */
#ifdef AMIGA_LC_5_1
X AMIGA_NewScreen.TopEdge = 1;
X AMIGA_NewScreen.LeftEdge = 0;
#endif
X AMIGA_Screen = OpenScreenTagList(&AMIGA_NewScreen,AMIGA_ScrTagList);
X if (AMIGA_Screen == NULL) {
X fprintf(stderr,"No Screen\n");
X AMIGA_reset();
X exit(20);
X }
X AMIGA_xmax = AMIGA_Screen->Width;
X AMIGA_ymax = AMIGA_Screen->Height;
X }
X term_tbl[term].xmax = AMIGA_xmax;
X term_tbl[term].ymax = AMIGA_ymax;
X gnufont = getenv("GNUFONT");
X if (gnufont != NULL ) {
X search = strchr(gnufont,'/');
X if (search != NULL) {
X *search++ = '\0';
X strncpy(fontname,gnufont,74);
X strcat(fontname,".font");
X sscanf(search,"%d",&fsize);
X /* Avoid opening "diskfont.library" if a built-in font is desired */
X if ((strcmp("topaz.font",fontname) == 0) &&
X ((fsize == TOPAZ_EIGHTY) || (fsize == TOPAZ_SIXTY))) {
X AMIGA_Font.ta_Name = fontname;
X AMIGA_Font.ta_YSize = fsize;
X AMIGA_Font.ta_Style = FS_NORMAL;
X AMIGA_Font.ta_Flags = FPF_ROMFONT;
X AMIGA_TextFont = OpenFont(&AMIGA_Font);
X if (AMIGA_TextFont != NULL)
X SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
X } else {
X DiskfontBase = OpenLibrary("diskfont.library",0);
X if (DiskfontBase != NULL) {
X AMIGA_Font.ta_Name = fontname;
X AMIGA_Font.ta_YSize = fsize;
X AMIGA_Font.ta_Style = FS_NORMAL;
X AMIGA_Font.ta_Flags = FPF_ROMFONT|FPF_DISKFONT;
X AMIGA_TextFont = OpenDiskFont(&AMIGA_Font);
X if (AMIGA_TextFont != NULL)
X SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
X }
X }
X }
X }
X /* Width of characters: This works better for proportional fonts than */
X /* AMIGA_Screen->RastPort.TxWidth + AMIGA_Screen->RastPort.TxSpacing */
X test_len = strlen(test_str);
X test_pxl = TextLength(&AMIGA_Screen->RastPort,test_str,test_len);
X AMIGA_cwd = test_pxl / test_len;
X AMIGA_cht = AMIGA_Screen->RastPort.TxHeight; /* Height of characters */
X AMIGA_bsl = AMIGA_Screen->RastPort.TxBaseline; /* Reference line */
X /* Amount by which characters have to be shifted upwards to be */
X /* vertically justified: */
X AMIGA_vadj = AMIGA_bsl / 2;
X term_tbl[term].v_char = AMIGA_cht + 4; /* So lines won't be too close */
X term_tbl[term].h_char = AMIGA_cwd;
X LoadRGB4(&AMIGA_Screen->ViewPort,AMIGA_Colors,16);
X RemakeDisplay();
X AMIGA_slinetype = 1;
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
X SetDrMd(&AMIGA_Screen->RastPort,JAM1);
}
X
X
AMIGA_text()
{
X char c;
X
X c = getc(stdin); /* This is extremely ugly... Yuk !!!! >:-( */
X ungetc(c,stdin); /* Maybe someone else will find a better solution */
X ScreenToBack(AMIGA_Screen);
}
X
X
AMIGA_graphics()
{
X SetRast(&AMIGA_Screen->RastPort,0);
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
X ScreenToFront(AMIGA_Screen);
}
X
X
AMIGA_move(x,y)
unsigned int x,y;
{
X if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
X Move(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
}
X
X
AMIGA_vector(x,y)
unsigned int x,y;
{
X if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
X Draw(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
}
X
X
AMIGA_linetype(linetype)
int linetype;
{
X if (linetype >= 13) linetype %= 13;
X AMIGA_slinetype = linetype+3;
X SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
}
X
X
AMIGA_put_text(x,y,str)
unsigned int x,y;
char *str;
{
X LONG len,tx_len;
X WORD xmin,xmax,ymin,ymax;
X
X len = strlen(str);
X tx_len = TextLength(&AMIGA_Screen->RastPort,str,len);
X switch (AMIGA_justify) {
X case LEFT:
X xmin = x;
X xmax = x + tx_len;
X break;
X case CENTRE:
X xmin = x - tx_len / 2;
X xmax = x + tx_len - tx_len / 2; /* aviod roundoff errors ! */
X break;
X case RIGHT:
X xmin = x - tx_len;
X xmax = x;
X break;
X }
X ymin = AMIGA_VTF(y) - AMIGA_vadj;
X ymax = ymin + AMIGA_cht;
X /* Check if character-string lies completely within the screen: */
X if ((xmax >= AMIGA_xmax) || (ymin < 0) || (ymax >= AMIGA_ymax)) return;
X Move(&AMIGA_Screen->RastPort,xmin,ymin+AMIGA_bsl);
X Text(&AMIGA_Screen->RastPort,str,len);
}
X
X
int AMIGA_justify_text(mode)
enum JUSTIFY mode;
{
X AMIGA_justify = mode;
X return TRUE;
}
X
X
/* This function is mainly included if the program terminates abnormally */
/* and the screen and libraries are still open. It closes down all opened */
/* libraries and screens. This happens e.g. when loading "bivariat.demo" */
/* and the stack is smaller than 70000 bytes. */
#ifdef AMIGA_LC_5_1
int AMIGA_exit(rc)
int rc;
{
X AMIGA_reset();
X return rc;
}
#endif
SHAR_EOF
chmod 0644 gnuplot/term/amiga.trm ||
echo 'restore of gnuplot/term/amiga.trm failed'
Wc_c="`wc -c < 'gnuplot/term/amiga.trm'`"
test 10991 -eq "$Wc_c" ||
echo 'gnuplot/term/amiga.trm: original size 10991, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/apollo.trm ==============
if test -f 'gnuplot/term/apollo.trm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/apollo.trm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/apollo.trm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/apollo.trm' &&
/* GNUPLOT - apollo.trm */
/*
X Apollo terminal driver for GNUplot.
X
X Open a pad for the graphics, and use GPR routines. For additional
X speed, we do the graphics to a separate bitmap, and the blt the
X entire bitmap to the display. When the user specifies an output
X file name, however, we draw directly to the screen, so the graphics
X are written to the file correctly. Thus, the user can save the
X graphics in a file, to be viewed later. If we try the bitmap
X trick, it looks funny.
SHAR_EOF
true || echo 'restore of gnuplot/term/apollo.trm failed'
fi
echo 'End of part 19'
echo 'File gnuplot/term/apollo.trm is continued in part 20'
echo 20 > _shar_seq_.tmp
#!/bin/sh
# this is Part.20 (part 20 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term/apollo.trm continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 20; 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/apollo.trm'
else
echo 'x - continuing file gnuplot/term/apollo.trm'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term/apollo.trm' &&
X
X Ray Lischner (uunet!mntgfx!lisch)
X 4 October 1989 file created for GNUplot 1.1
X 26 March 1990 updated for GNUplot 2.0
*/
X
#include <apollo/base.h>
#include <apollo/error.h>
#include <apollo/pad.h>
#include <apollo/gpr.h>
X
/* default tick sizes for small windows */
#define APOLLO_VTIC 6
#define APOLLO_HTIC 6
X
/* issue an error message, using additional text "s" */
#define apollo_error(s) error_$print_name(status, (s), strlen(s))
X
/* if "status" indicates an error, then issue an error message */
#define apollo_check(s) if (status.all != status_$ok) apollo_error(s)
X
static ios_$id_t stream = -1; /* the stream for the pad */
static gpr_$bitmap_desc_t screen_desc; /* the screen's bitmap */
static gpr_$bitmap_desc_t bitmap_desc; /* the graphics bitmap */
static gpr_$attribute_desc_t attr; /* attribute block for saved bitmap */
static short draw_width; /* default GPR draw width */
static name_$long_pname_t font_name; /* font path name */
static int APOLLO_XMAX, APOLLO_YMAX; /* window size */
static boolean use_bitmap; /* use a separate bitmap? */
X
/* return whether stdout is a DM pad */
apollo_isa_pad()
{
X status_$t status;
X pad_$isa(1, &status);
X return (status.all == status_$ok);
}
X
/*
X Find out what the default font is for the pad, and save the
X character height and width information.
X
X Note that we must save the font file name because we need
X to reload the font file everytime the window changes size.
*/
static void apollo_font_info(struct termentry* tbl, char* fname)
{
X short fwidth, fheight, flen;
X status_$t status;
X
X /* get the font size & update the termentry table */
X pad_$inq_font(stream, &fwidth, &fheight, fname, name_$long_pnamlen_max,
X &flen, &status);
X apollo_check("inq_font");
X fname[flen] = '\0';
X
X tbl->v_char = fheight;
X tbl->h_char = fwidth;
}
X
/*
X Initialize all the GPR stuff. To save time, we draw into a separate
X bitmap, and then blt it onto the screen all at once. This results
X in 5-10 times speed-up in the graphics, with only a little
X complication. Most of the complication is right here, making sure
X we allocate the right bitmaps, etc., in the right order. The rest
X is in APOLLO_text(), where we actually BLT the bitmap onto the screen.
X Everything else is the same.
X
X The bitmaps have the same size as the window. If the window changes
X size, then the bitmaps retain the same size, so the user sees part
X of the plot or a lot of space around the plot. Drawing a new plot,
X or replotting the previous one causes APOLLO_graphics() to see if
X the window has changed size, in which case the GPR is terminated,
X and this routine is called again. Thus, make sure any changes
X preserve this ability. Anything that should only be done once
X to the pad should be handled by APOLLO_init().
X
X By the way, we save the current draw width, to be used later
X for drawing extra wide lines. This way we don't need to know
X anything about the current output device characteristics;
X we can just draw the default width, or twice the default width, etc.
*/
static void apollo_gpr_init(struct termentry* tbl, pad_$window_desc_t* window)
{
X gpr_$offset_t size;
X short fontid;
X status_$t status;
X
X size.x_size = APOLLO_XMAX = tbl->xmax = window->width;
X size.y_size = APOLLO_YMAX = tbl->ymax = window->height;
X
X /* now initialize GPR */
X gpr_$init(gpr_$frame, stream, size, 1, &screen_desc, &status);
X apollo_check("gpr_$init");
X
X if (use_bitmap)
X {
X /* allocate the bitmap and its attribute block */
X gpr_$allocate_attribute_block(&attr, &status);
X apollo_check("allocate_attribute_block");
X
X gpr_$allocate_bitmap(size, 1, attr, &bitmap_desc, &status);
X apollo_check("allocate_bitmap");
X
X gpr_$set_bitmap(bitmap_desc, &status);
X apollo_check("set_bitmap");
X }
X
X /* set the font file */
X gpr_$load_font_file(font_name, strlen(font_name), &fontid, &status);
X apollo_check(font_name);
X
X gpr_$set_text_font(fontid, &status);
X apollo_check("set_text_font");
X
X gpr_$inq_draw_width(&draw_width, &status);
X apollo_check("inq_draw_width");
}
X
/*
X Determine the tick sizes to be used for labelling borders.
X By default, we use 1/50 of the window size, which looks nice to me.
X If this makes the ticks too small, however, we use a minimum
X size, to make sure they are visible. The minimum size was also
X determined experimentally.
X
X Feel free to changes the sizes to something you feel looks better.
X
X This routine must be called after apollo_gpr_init(), because we
X need to know the window size, as stored in the termentry table.
*/
static void apollo_tic_sizes(struct termentry* tbl)
{
X /* base the tick size on the window size */
X tbl->v_tic = tbl->ymax / 50;
X if (tbl->v_tic < APOLLO_VTIC)
X tbl->v_tic = APOLLO_VTIC;
X tbl->h_tic = tbl->xmax / 50;
X if (tbl->v_tic < APOLLO_HTIC)
X tbl->v_tic = APOLLO_HTIC;
}
X
/*
X Terminate the GPR. This is called whenever the window size
X changes, and we need to reinitialize the GPR. I assume that
X calling gpr_$terminate() also deallocates the bitmaps and
X attribute blocks because deallocating the screen's bitmap
X causes terminate() to think GPR has already been terminated.
X
X Since this can be called many times, make sure nothing
X drastic is done here, like closing the stream to the pad.
X The only actions should be those that will be reinitialized
X by apollo_gpr_init().
*/
static void apollo_gpr_terminate()
{
X status_$t status;
X
X gpr_$terminate(false, &status);
X apollo_check("terminate");
}
X
/*
X Initialize the graphics. This is called once, so we do things
X here that should be done exactly once, such as opening the window.
X I like to give windows names, so it is obvious what the window's
X contents are, but this causes a transcript to be kept in a file
X whose name is the window's name. This might be nice in some
X circumstances, but to me it is a nuisance, so the file is
X deleted immediately. The name is unlikely to appear normally,
X so there should be little interference with users' normal files.
X If the user has explicitly set the output file, however, then
X we use that name, and do not delete the file. Thus, the
X user can get a metafile of the plot. We can tell if the
X output file has been set because outstr is "STDOUT". Otherwise,
X outstr is the filename, in single quotes. We need to strip
X the quotes to make the file name.
X
X The DM defaults are used for window sizes and positions. If
X the user doesn't like it, he or she can change is and issue
X a replot command (assuming a plot has already been generated).
X
X Note, also, that we must call pad_$set_scale() or else
X pad_$inq_windows() returns scaled values, which is not what
X we want. Setting the scale to one (1) turns off the scaling,
X so we get real pixel sizes.
X
X Finally, we get the name and size of the default font. The
X name is kept, as explained earlier. Then we can initialize
X the GPR stuff.
X
X Note that there is a way that APOLLO_init() gets called more
X than once. If the user issues the "set terminal apollo" command
X more than once, then this is called, so we need to make sure
X that we do not keep creating windows.
X
X An alternative strategy would be to interpret multiple "set term
X apollo"s to mean create multiple windows. The user could only
X access the most recent window because GNUplot has no concept of
X multiple terminals. The user would, in fact, have no way of
X removing old windows because they are still active. We could try
X catching keyboard events to see if the user presses EXIT, but I do
X not want to start getting into that mess. If the user really
X wants this kind of functionality, then he or she can run gnuplot
X multiple times. I think that is a lot cleaner, don't you?
*/
APOLLO_init()
{
X /* only initialize once */
X if (stream == -1)
X {
X extern char outstr[];
X struct termentry* tbl;
X pad_$window_desc_t window;
X name_$long_name_t wname;
X short wnum; /* junk needed by pad_$inq_windows() */
X boolean unlink_wname;
X status_$t status;
X
X tbl = &term_tbl[term];
X
X /* make the window name unique, with "gnuplot" in the label */
X if (strcmp(outstr, "STDOUT") == 0)
X {
X sprintf(wname, "gnuplot-%d", getpid());
X unlink_wname = true;
X }
X else
X {
X /* strip the single quotes around the file name */
X strcpy(wname, outstr + 1);
X wname[strlen(wname) - 1] = '\0';
X unlink_wname = false;
X }
X
X use_bitmap = unlink_wname;
X
X /* use the default window position and size */
X window.top = window.left = window.width = window.height = 0;
X pad_$create_window(wname, strlen(wname), pad_$transcript, 1, window,
X &stream, &status);
X apollo_check("create_window");
X
X /* if this is not the user's name, then delete the file */
X if (unlink_wname)
X unlink(wname);
X
X /* remove all scaling, to revert to pixel units, not char. units */
X pad_$set_scale(stream, 1, 1, &status);
X apollo_check("set_scale");
X
X /* get rid of the window when the program exits */
X pad_$set_auto_close(stream, 1, true, &status);
X apollo_check("set_auto_close");
X
X /* now determine the window size & update the termentry table */
X pad_$inq_windows(stream, &window, 1, &wnum, &status);
X apollo_check("inq_windows");
X
X /* the order of the next three calls is important */
X apollo_font_info(tbl, font_name);
X apollo_gpr_init(tbl, &window);
X apollo_tic_sizes(tbl);
X }
}
X
/*
X Prepare for graphics output. Since this is what the user wants to
X do when preparing a new plot, this is a meaningful time to see if
X the window has changed size. Thus, we avoid mucking about with
X asynchronous traps, and we avoid the bigger problem of dealing
X with a half-finished plot when the window changes size.
X
X Simply put, get the current window size, and if it has changed,
X then get rid of the old bitmaps, etc., and allocate new ones at
X the new size. We also need to update the termentry table.
X If the window stays the same size, then just clear it.
*/
static void apollo_redo_window(pad_$window_desc_t* window)
{
X struct termentry* tbl = &term_tbl[term];
X status_$t status;
X
X /* the order of the following calls is important */
X apollo_gpr_terminate();
X apollo_gpr_init(tbl, window);
X apollo_tic_sizes(tbl);
}
X
APOLLO_graphics()
{
X pad_$window_desc_t window;
X short wnum;
X status_$t status;
X
X pad_$inq_windows(stream, &window, 1, &wnum, &status);
X apollo_check("inq_windows");
X
X if (window.width != APOLLO_XMAX || window.height != APOLLO_YMAX)
X apollo_redo_window(&window);
X else
X {
X gpr_$clear(0, &status);
X apollo_check("clear");
X }
}
X
/* set a line type:
X -2 heavy, solid (border)
X -1 heavy, dotted (axis)
X 0 solid (normal)
X 1 dots (other curves)
X 2 short dash
X 3 long dash
X 4 dash dot
X
X Apparently, GPUplot draws a lot of short line segments, and each
X one starts a new pattern. This makes the patterns somewhat useless,
X but one can still tell the difference between solid, dotted, and
X dashed lines. The utility of fancier styles is limited, however.
X
X On a color workstation, we should use different colors, but I
X don't have one.
*/
X
/*
X To draw different line styles on an Apollo, we use two different
X parameters. One is a line thickness, which is just an integral
X multiple of the default line thickness. The second is a 16-bit
X pattern that is repeated. We could use fancier patterns, since
X GPR supports up to 64-bits, but, as I explained earlier, this
X really does not buy us anything.
X
X I used patterns that do not start with all bits on because
X GNUplot seems to use lots of short line segments to draw
X a curve, and this might make a very curvey plot seem like
X a solid line, regardless of pattern. I don't want to start
X with too many zeros, however, or else the curve might not
X appear at all! All the patterns, therefore, start with one
X bit on. The rest of the bits determine the true pattern.
X
X By examining graphics.c, we see that linetype -2 is used exclusively
X for the border, -1 for the axes, and the non-negative integers for
X the curves. We use heavy lines for the border and axes, and normal
X width lines for the curves.
X
X Since C arrays start at zero, make sure all the offsets are correct,
X so that it is easy to access the array with -2...n linetypes.
*/
X
typedef struct {
X short width;
X short pattern;
} APOLLO_LINE;
X
static APOLLO_LINE apollo_lines[] = {
X { 2, ~0 }, /* heavy, solid */
X { 2, 0x6666 }, /* heavy, dotted */
X { 1, ~0 }, /* normal */
X { 1, 0xAAAA }, /* dotted */
X { 1, 0xC3C3 }, /* short dash */
X { 1, 0xE01F }, /* long dash */
X { 1, 0x87F8 }, /* dash dot */
X { 1, 0x6666 }, /* big dots */
};
X
#define BITS_PER_LINETYPE 16
X
/* apollo_line(-2) is the border style, etc. */
#define apollo_line(x) apollo_lines[(x)+2]
#define apollo_pattern(x) &apollo_line(x).pattern
#define apollo_width(x) apollo_line(x).width
X
#define APOLLO_MIN_LINE (-2)
#define APOLLO_MAX_LINE (sizeof(apollo_lines)/sizeof(*apollo_lines)-2)
X
/* set the line style */
APOLLO_linetype(ltype)
int ltype;
{
X status_$t status;
X
X if (ltype < APOLLO_MIN_LINE)
X ltype = APOLLO_MIN_LINE;
X if (ltype >= APOLLO_MAX_LINE)
X ltype %= APOLLO_MAX_LINE;
X
X gpr_$set_line_pattern(1, apollo_pattern(ltype), BITS_PER_LINETYPE, &status);
X apollo_check("set_line_pattern");
X
X gpr_$set_draw_width(draw_width * apollo_width(ltype), &status);
X apollo_check("set_draw_width");
}
X
/* issue an error message that includes an (x, y) coordinate */
static void apollo_xy_error(char* s, int x, int y, status_$t status)
{
X char buffer[128];
X
X sprintf(buffer, "%s(%d, %d)", s, x, y);
X apollo_error(buffer);
}
X
#define apollo_xy_check(s) \
X if (status.all != status_$ok) apollo_xy_error((s), x, y, status)
X
/*
X Note that GNUplot and GPR have reversed ideas of where the Y origin is.
X This means subtracting the Y coordinate from Y max.
*/
#define plot_to_gpr(y) (APOLLO_YMAX - (y))
X
/* move to a new position */
APOLLO_move(unsigned int x, unsigned int y)
{
X status_$t status;
X
X gpr_$move((gpr_$coordinate_t) x, plot_to_gpr(y), &status);
X apollo_xy_check("move");
}
X
/* draw a line to a new position */
APOLLO_vector(unsigned int x, unsigned int y)
{
X status_$t status;
X
X gpr_$line((gpr_$coordinate_t) x, plot_to_gpr(y), &status);
X apollo_xy_check("line");
}
X
/*
X On terminals, this switches to text mode. The real meaning,
X however, is that the graphics are finished. This means we can
X now display the saved bitmap.
*/
APOLLO_text()
{
X if (use_bitmap)
X {
X static gpr_$position_t pos; /* always zero */
X gpr_$window_t window;
X status_$t status;
X
X /* bitblt the entire bitmap to the entire window */
X window.window_base.x_coord = 0;
X window.window_base.y_coord = 0;
X window.window_size.x_size = APOLLO_XMAX;
X window.window_size.y_size = APOLLO_YMAX;
X
X gpr_$set_bitmap(screen_desc, &status);
X apollo_check("set_bitmap(screen_desc)");
X
X gpr_$pixel_blt(bitmap_desc, window, pos, &status);
X apollo_check("bitblt");
X
X gpr_$set_bitmap(bitmap_desc, &status);
X apollo_check("set_bitmap(bitmap_desc)");
X }
}
X
APOLLO_text_angle(ang)
int ang;
{
X status_$t status;
X
X gpr_$set_text_path(ang ? gpr_$up : gpr_$right, &status);
X apollo_check("set_text_path");
X return TRUE;
}
X
static enum JUSTIFY apollo_text_mode;
X
APOLLO_justify_text(mode)
enum JUSTIFY mode;
{
X apollo_text_mode = mode;
X return TRUE;
}
X
/*
X Write "str" right justified on row "row". A row is assumed to
X have whatever height the current text has. Make sure the
X text does not cover the tick marks.
*/
APOLLO_put_text(x, y, str)
unsigned int x, y;
char str[];
{
X gpr_$offset_t size;
X status_$t status;
X
X gpr_$inq_text_extent(str, strlen(str), &size, &status);
X apollo_check("inq_text_extent");
X
X y -= size.y_size / 2; /* center around "y" */
X switch (apollo_text_mode)
X {
X case LEFT:
X break;
X case CENTRE:
X x -= size.x_size / 2;
X break;
X case RIGHT:
X x -= size.x_size;
X break;
X }
X APOLLO_move(x, y);
X
X gpr_$text(str, strlen(str), &status);
X apollo_check("put_text");
}
X
/* reset the graphics state and terminate */
APOLLO_reset()
{
X if (stream != -1)
X {
X apollo_gpr_terminate();
X stream = -1;
X }
}
SHAR_EOF
echo 'File gnuplot/term/apollo.trm is complete' &&
chmod 0644 gnuplot/term/apollo.trm ||
echo 'restore of gnuplot/term/apollo.trm failed'
Wc_c="`wc -c < 'gnuplot/term/apollo.trm'`"
test 17013 -eq "$Wc_c" ||
echo 'gnuplot/term/apollo.trm: original size 17013, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term/impcodes.h ==============
if test -f 'gnuplot/term/impcodes.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term/impcodes.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term/impcodes.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term/impcodes.h' &&
/*
X * Copyright (c) 1985 Regents of the University of California.
X * All rights reserved. The Berkeley software License Agreement
X * specifies the terms and conditions for redistribution.
X *
X * @(#)imPcodes.h 5.1 (Berkeley) 9/21/85
X */
X
#define imP_SP 128
#define imP_SP1 129
#define imP_OLD_MMOVE 130
#define imP_MPLUS 131
#define imP_MMINUS 132
#define imP_MMOVE 133
#define imP_SMOVE 134
X
#define imP_SET_ABS_H 135
#define imP_SET_REL_H 136
#define imP_SET_ABS_V 137
#define imP_SET_REL_V 138
X
#define imP_SRULE 192
#define imP_BRULE 193
X
#define imP_SET_HPOS 195
#define imP_SET_VPOS 196
#define imP_CRLF 197
#define imP_SGLY 198
#define imP_BGLY 199
#define imP_DELG 200
#define imP_DELC 201
#define imP_DELF 202
X
#define imP_SET_HV_SYSTEM 205
#define imP_SET_ADV_DIRS 206
#define imP_SET_FAMILY 207
#define imP_SET_IL 208
#define imP_SET_BOL 209
#define imP_SET_SP 210
#define imP_PUSH 211
#define imP_POP 212
#define imP_PAGE 213
#define imP_SET_PUSH_MASK 214
#define imP_ENDPAGE 219
X
#define imP_CREATE_FAMILY_TABLE 221
#define imP_CREATE_MAP 222
X
#define imP_CREATE_PATH 230
#define imP_SET_TEXTURE 231
#define imP_SET_PEN 232
#define imP_FILL_PATH 233
#define imP_DRAW_PATH 234
#define imP_BITMAP 235
#define imP_SET_MAGN 236
X
#define imP_EOF 255
X
X
SHAR_EOF
chmod 0666 gnuplot/term/impcodes.h ||
echo 'restore of gnuplot/term/impcodes.h failed'
Wc_c="`wc -c < 'gnuplot/term/impcodes.h'`"
test 1260 -eq "$Wc_c" ||
echo 'gnuplot/term/impcodes.h: original size 1260, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/parse.c ==============
if test -f 'gnuplot/parse.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/parse.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/parse.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/parse.c' &&
/* GNUPLOT - parse.c */
#include <setjmp.h>
#include <signal.h>
#include <errno.h>
#include <math.h>
#include "plot.h"
X
#ifndef vms
#ifndef __ZTC__
extern int errno;
#endif
#endif
X
extern int num_tokens,c_token;
extern struct lexical_unit token[];
extern char c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1]; /* name of current dummy vars */
extern struct udft_entry *dummy_func; /* pointer to dummy variable's func */
X
struct value *pop(),*integer(),*complex();
struct at_type *temp_at(), *perm_at();
struct udft_entry *add_udf();
struct udvt_entry *add_udv();
union argument *add_action();
X
struct at_type at;
static jmp_buf fpe_env;
X
#define dummy (struct value *) 0
X
#ifdef __TURBOC__
void fpe()
#else
#ifdef __ZTC__
void fpe(an_int)
int an_int;
#else
#ifdef _CRAY
void fpe(an_int)
int an_int;
#else
fpe()
#endif
#endif
#endif
{
#ifdef PC /* thanks to lo...@wjh12.UUCP for telling us about this */
X _fpreset();
#endif
X (void) signal(SIGFPE, fpe);
X undefined = TRUE;
X longjmp(fpe_env, TRUE);
}
X
X
#ifdef apollo
#include <apollo/base.h>
#include <apollo/pfm.h>
#include <apollo/fault.h>
X
/*
X On an Apollo, the OS can signal a couple errors that are not mapped
X into SIGFPE, namely signalling NaN and branch on an unordered
X comparison. I suppose there are others, but none of these are documented,
X so I handle them as they arise.
X
X Anyway, we need to catch these faults and signal SIGFPE.
*/
X
pfm_$fh_func_val_t apollo_sigfpe(pfm_$fault_rec_t& fault_rec)
{
X kill(getpid(), SIGFPE);
X return pfm_$continue_fault_handling;
}
X
apollo_pfm_catch()
{
X status_$t status;
X pfm_$establish_fault_handler(fault_$fp_bsun, pfm_$fh_backstop,
X apollo_sigfpe, &status);
X pfm_$establish_fault_handler(fault_$fp_sig_nan, pfm_$fh_backstop,
X apollo_sigfpe, &status);
}
#endif
X
X
evaluate_at(at_ptr,val_ptr)
struct at_type *at_ptr;
struct value *val_ptr;
{
X double temp, real();
X
X undefined = FALSE;
X errno = 0;
X reset_stack();
X if (setjmp(fpe_env))
X return; /* just bail out */
X (void) signal(SIGFPE, fpe); /* catch core dumps on FPEs */
X
X execute_at(at_ptr);
X
X (void) signal(SIGFPE, SIG_DFL);
X
X if (errno == EDOM || errno == ERANGE) {
X undefined = TRUE;
X } else {
X (void) pop(val_ptr);
X check_stack();
X }
/* At least one machine (ATT 3b1) computes Inf without a SIGFPE */
X temp = real(val_ptr);
X if (temp > VERYLARGE || temp < -VERYLARGE) {
X undefined = TRUE;
X }
}
X
X
struct value *
const_express(valptr)
struct value *valptr;
{
register int tkn = c_token;
X if (END_OF_COMMAND)
X int_error("constant expression required",c_token);
X evaluate_at(temp_at(),valptr); /* run it and send answer back */
X if (undefined) {
X int_error("undefined value",tkn);
X }
X return(valptr);
}
X
X
struct at_type *
temp_at() /* build a static action table and return its pointer */
{
X at.a_count = 0; /* reset action table !!! */
X express();
X return(&at);
}
X
X
/* build an action table, put it in dynamic memory, and return its pointer */
X
struct at_type *
perm_at()
{
register struct at_type *at_ptr;
register unsigned int len;
X
X (void) temp_at();
X len = sizeof(struct at_type) -
X (MAX_AT_LEN - at.a_count)*sizeof(struct at_entry);
X at_ptr = (struct at_type *) alloc(len, "action table");
X (void) memcpy(at_ptr,&at,len);
X return(at_ptr);
}
X
X
#ifdef NOCOPY
/*
X * cheap and slow version of memcpy() in case you don't have one
X */
memcpy(dest,src,len)
char *dest,*src;
unsigned int len;
{
X while (len--)
X *dest++ = *src++;
}
#endif /* NOCOPY */
X
X
express() /* full expressions */
{
X xterm();
X xterms();
}
X
xterm() /* ? : expressions */
{
X aterm();
X aterms();
}
X
X
aterm()
{
X bterm();
X bterms();
}
X
X
bterm()
{
X cterm();
X cterms();
}
X
X
cterm()
{
X dterm();
X dterms();
}
X
X
dterm()
{
X eterm();
X eterms();
}
X
X
eterm()
{
X fterm();
X fterms();
}
X
X
fterm()
{
X gterm();
X gterms();
}
X
X
gterm()
{
X hterm();
X hterms();
}
X
X
hterm()
{
X unary(); /* - things */
X iterms(); /* * / % */
}
X
X
factor()
{
register int value;
X
X if (equals(c_token,"(")) {
X c_token++;
X express();
X if (!equals(c_token,")"))
X int_error("')' expected",c_token);
X c_token++;
X }
X else if (isnumber(c_token)) {
X convert(&(add_action(PUSHC)->v_arg),c_token);
X c_token++;
X }
X else if (isletter(c_token)) {
X if ((c_token+1 < num_tokens) && equals(c_token+1,"(")) {
X value = standard(c_token);
X if (value) { /* it's a standard function */
X c_token += 2;
X express();
X if (!equals(c_token,")"))
X int_error("')' expected",c_token);
X c_token++;
X (void) add_action(value);
X }
X else {
X int call_type = (int )CALL;
X value = c_token;
X c_token += 2;
X express();
X if (equals(c_token, ",")) {
X c_token += 1;
X express();
X call_type = (int )CALL2;
X }
X if (!equals(c_token,")"))
X int_error("')' expected",c_token);
X c_token++;
X add_action(call_type)->udf_arg = add_udf(value);
X }
X }
X else {
X if (equals(c_token,c_dummy_var[0])) {
X c_token++;
X add_action(PUSHD1)->udf_arg = dummy_func;
X }
X else if (equals(c_token,c_dummy_var[1])) {
X c_token++;
X add_action(PUSHD2)->udf_arg = dummy_func;
X }
X else {
X add_action(PUSH)->udv_arg = add_udv(c_token);
X c_token++;
X }
X }
X } /* end if letter */
X else
X int_error("invalid expression ",c_token);
X
X /* add action code for ! (factorial) operator */
X while (equals(c_token,"!")) {
X c_token++;
X (void) add_action(FACTORIAL);
X }
X /* add action code for ** operator */
X if (equals(c_token,"**")) {
X c_token++;
X unary();
X (void) add_action(POWER);
X }
X
}
X
X
X
xterms()
{ /* create action code for ? : expressions */
X
X if (equals(c_token,"?")) {
X register int savepc1, savepc2;
X register union argument *argptr1,*argptr2;
X c_token++;
X savepc1 = at.a_count;
X argptr1 = add_action(JTERN);
X express();
X if (!equals(c_token,":"))
X int_error("expecting ':'",c_token);
X c_token++;
X savepc2 = at.a_count;
X argptr2 = add_action(JUMP);
X argptr1->j_arg = at.a_count - savepc1;
X express();
X argptr2->j_arg = at.a_count - savepc2;
X }
}
X
X
aterms()
{ /* create action codes for || operator */
X
X while (equals(c_token,"||")) {
X register int savepc;
X register union argument *argptr;
X c_token++;
X savepc = at.a_count;
X argptr = add_action(JUMPNZ); /* short-circuit if already TRUE */
X aterm();
X argptr->j_arg = at.a_count - savepc;/* offset for jump */
#if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
X (void) add_action(ABOOL);
#else
X (void) add_action(BOOL);
#endif
X }
}
X
X
bterms()
{ /* create action code for && operator */
X
X while (equals(c_token,"&&")) {
X register int savepc;
X register union argument *argptr;
X c_token++;
X savepc = at.a_count;
X argptr = add_action(JUMPZ); /* short-circuit if already FALSE */
X bterm();
X argptr->j_arg = at.a_count - savepc;/* offset for jump */
#if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
X (void) add_action(ABOOL);
#else
X (void) add_action(BOOL);
#endif
X }
}
X
X
cterms()
{ /* create action code for | operator */
X
X while (equals(c_token,"|")) {
X c_token++;
X cterm();
X (void) add_action(BOR);
X }
}
X
X
dterms()
{ /* create action code for ^ operator */
X
X while (equals(c_token,"^")) {
X c_token++;
X dterm();
X (void) add_action(XOR);
X }
}
X
X
eterms()
{ /* create action code for & operator */
X
X while (equals(c_token,"&")) {
X c_token++;
X eterm();
X (void) add_action(BAND);
X }
}
X
X
fterms()
{ /* create action codes for == and != operators */
X
X while (TRUE) {
X if (equals(c_token,"==")) {
X c_token++;
X fterm();
X (void) add_action(EQ);
X }
X else if (equals(c_token,"!=")) {
X c_token++;
X fterm();
X (void) add_action(NE);
X }
X else break;
X }
}
X
X
gterms()
{ /* create action code for < > >= or <= operators */
X
X while (TRUE) {
X /* I hate "else if" statements */
X if (equals(c_token,">")) {
X c_token++;
X gterm();
X (void) add_action(GT);
X }
X else if (equals(c_token,"<")) {
X c_token++;
X gterm();
X (void) add_action(LT);
X }
X else if (equals(c_token,">=")) {
X c_token++;
X gterm();
X (void) add_action(GE);
X }
X else if (equals(c_token,"<=")) {
X c_token++;
X gterm();
X (void) add_action(LE);
X }
X else break;
X }
X
}
X
X
X
hterms()
{ /* create action codes for + and - operators */
X
X while (TRUE) {
X if (equals(c_token,"+")) {
X c_token++;
X hterm();
X (void) add_action(PLUS);
X }
X else if (equals(c_token,"-")) {
X c_token++;
X hterm();
X (void) add_action(MINUS);
X }
X else break;
X }
}
X
X
iterms()
{ /* add action code for * / and % operators */
X
X while (TRUE) {
X if (equals(c_token,"*")) {
X c_token++;
X unary();
X (void) add_action(MULT);
X }
X else if (equals(c_token,"/")) {
X c_token++;
X unary();
X (void) add_action(DIV);
X }
X else if (equals(c_token,"%")) {
X c_token++;
X unary();
X (void) add_action(MOD);
X }
X else break;
X }
}
X
X
unary()
{ /* add code for unary operators */
X if (equals(c_token,"!")) {
X c_token++;
X unary();
X (void) add_action(LNOT);
X }
X else if (equals(c_token,"~")) {
X c_token++;
X unary();
X (void) add_action(BNOT);
X }
X else if (equals(c_token,"-")) {
X c_token++;
X unary();
X (void) add_action(UMINUS);
X }
X else
X factor();
}
SHAR_EOF
chmod 0644 gnuplot/parse.c ||
echo 'restore of gnuplot/parse.c failed'
Wc_c="`wc -c < 'gnuplot/parse.c'`"
test 10144 -eq "$Wc_c" ||
echo 'gnuplot/parse.c: original size 10144, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.msc ==============
if test -f 'gnuplot/makefile.msc' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.msc (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.msc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.msc' &&
# Make file for use with Microsoft C Version 5.10
# and Microsoft Program Maintenance Utility Version 4.07
#
X
# where to place gnuplot.gih helpfile
HELPFILE = gnuplot.gih
X
# /c means don't link
# /AL means large memory model (large code, large data)
# /DPC means define symbol PC
CFLAGS = /c /AL /DPC #/DMSDOS #/Zi #/Od
X
# see other terminal defines in term.h
TERMFLAGS =
X
# /NOE means NO EXTernal Dictionary
# /EX means pack EXE file
# /ST:10000 means stack size 10000 bytes
LINKFLAGS = /NOE /EX /ST:10000 #/codeview
X
OBJS = bitmap.obj command.obj contour.obj eval.obj graphics.obj graph3d.obj \
X help.obj internal.obj misc.obj parse.obj plot.obj readline.obj \
X scanner.obj setshow.obj standard.obj term.obj util.obj version.obj \
X pcgraph.obj hrcgraph.obj corgraph.obj
X
CSOURCE5 = term\aed.trm term\cgi.trm term/dumb.trm term/dxf.trm term\dxy.trm \
X term\eepic.trm term\epson.trm term\fig.trm term\hp26.trm \
X term\hp2648.trm term\hpgl.trm term\hpljii.trm
CSOURCE6 = term\impcodes.h term\imagen.trm term\object.h \
X term\iris4d.trm term\kyo.trm term\latex.trm term\pc.trm
CSOURCE7 = term\post.trm term\qms.trm term\regis.trm term\sun.trm \
X term\t410x.trm term\tek.trm term\unixpc.trm term\unixplot.trm \
X term\v384.trm term\x11.trm
CSOURCE8 = contour.c
X
# default rules
.c.obj:
X cl $(CFLAGS) $*.c
X
.asm.obj:
X masm $*;
X
pcgraph.obj: pcgraph.asm header.mac lineproc.mac
X
corgraph.obj: corgraph.asm header.mac lineproc.mac
X
hrcgraph.obj: hrcgraph.asm header.mac lineproc.mac
X
bitmap.obj: bitmap.c bitmap.h plot.h
X
command.obj: command.c plot.h setshow.h help.h
X cl $(CFLAGS) /DHELPFILE=\"$(HELPFILE)\" command.c
X
contour.obj: contour.c plot.h
X
eval.obj: eval.c plot.h
X
graphics.obj: graphics.c plot.h setshow.h
X
graph3d.obj: graphics.c plot.h setshow.h
X
help.obj: help.c plot.h help.h
X
internal.obj: internal.c plot.h
X
misc.obj: misc.c plot.h setshow.h
X
parse.obj: parse.c plot.h
X
plot.obj: plot.c plot.h setshow.h
X
readline.obj: readline.c
X
scanner.obj: scanner.c plot.h
X
setshow.obj: setshow.c plot.h setshow.h
X
standard.obj: standard.c plot.h
X
term.obj: term.c term.h plot.h setshow.h bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X cl $(CFLAGS) $(TERMFLAGS) /Iterm term.c
X
util.obj: util.c plot.h
X
version.obj: version.c
X
# convert gnuplot.doc to gnuplot.gih
doc2gih.exe: docs\doc2gih.c
X cl docs\doc2gih.c
X
$(HELPFILE): doc2gih.exe docs\gnuplot.doc
X doc2gih docs\gnuplot.doc $(HELPFILE)
X
# Object files in link command line are ordered to avoid far jumps.
# use linkopt.msc to avoid command-line overflow
X
gnuplot.exe: $(OBJS)
X link $(LINKFLAGS) @linkopt.msc
SHAR_EOF
chmod 0644 gnuplot/makefile.msc ||
echo 'restore of gnuplot/makefile.msc failed'
Wc_c="`wc -c < 'gnuplot/makefile.msc'`"
test 2572 -eq "$Wc_c" ||
echo 'gnuplot/makefile.msc: original size 2572, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/copyright ==============
if test -f 'gnuplot/copyright' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/copyright (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/copyright (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/copyright' &&
/*
SHAR_EOF
chmod 0644 gnuplot/copyright ||
echo 'restore of gnuplot/copyright failed'
Wc_c="`wc -c < 'gnuplot/copyright'`"
test 1114 -eq "$Wc_c" ||
echo 'gnuplot/copyright: original size 1114, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/graph3d.c ==============
if test -f 'gnuplot/graph3d.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/graph3d.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/graph3d.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/graph3d.c' &&
/* GNUPLOT - graph3d.c */
/*
X * Copyright (C) 1986, 1987, 1990, 1991 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 * Gershon Elber and many others.
X *
X * Send your comments or suggestions to
X * pixar!info-g...@sun.com.
X * This is a mailing list; to join it send a note to
X * pixar!info-gnupl...@sun.com.
X * Send bug reports to
X * pixar!bug-g...@sun.com.
X */
X
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <time.h>
#include "plot.h"
#include "setshow.h"
X
extern char *strcpy(),*strncpy(),*strcat(),*ctime(),*tdate;
#ifdef AMIGA_AC_5
extern time_t dated;
#else
#ifdef VMS
extern time_t dated,time();
#else
extern long dated,time();
#endif
#endif
X
static plot3d_impulses();
static plot3d_lines();
static plot3d_points();
static plot3d_dots();
static cntr3d_impulses();
static cntr3d_lines();
static cntr3d_points();
static cntr3d_dots();
static update_extrema_pts();
static draw_parametric_grid();
static draw_non_param_grid();
static draw_bottom_grid();
static draw_3dxtics();
static draw_3dytics();
static draw_3dztics();
static draw_series_3dxtics();
static draw_series_3dytics();
static draw_series_3dztics();
static draw_set_3dxtics();
static draw_set_3dytics();
static draw_set_3dztics();
static xtick();
static ytick();
static ztick();
X
#ifndef max /* Lattice C has max() in math.h, but shouldn't! */
#define max(a,b) ((a > b) ? a : b)
#endif
X
#ifndef min
#define min(a,b) ((a < b) ? a : b)
#endif
X
#define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
X
#define apx_eq(x,y) (fabs(x-y) < 0.001)
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define sqr(x) ((x) * (x))
X
/* Define the boundary of the plot
X * These are computed at each call to do_plot, and are constant over
X * the period of one do_plot. They actually only change when the term
X * type changes and when the 'set size' factors change.
X */
static int xleft, xright, ybot, ytop, xmiddle, ymiddle, xscaler, yscaler;
X
/* Boundary and scale factors, in user coordinates */
/* x_min3d, x_max3d, y_min3d, y_max3d, z_min3d, z_max3d are local to this
X * file and are not the same as variables of the same names in other files
X */
static double x_min3d, x_max3d, y_min3d, y_max3d, z_min3d, z_max3d;
static double xscale3d, yscale3d, zscale3d;
static double real_z_min3d, real_z_max3d;
static double min_sy_ox,min_sy_oy; /* obj. coords. for xy tics placement. */
static double min_sx_ox,min_sx_oy; /* obj. coords. for z tics placement. */
X
typedef double transform_matrix[4][4];
static transform_matrix trans_mat;
X
/* (DFK) Watch for cancellation error near zero on axes labels */
#define SIGNIF (0.01) /* less than one hundredth of a tic mark */
#define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x))
#define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF))
X
/* And the functions to map from user to terminal coordinates */
#define map_x(x) (int)(x+0.5) /* maps floating point x to screen */
#define map_y(y) (int)(y+0.5) /* same for y */
X
/* And the functions to map from user 3D space into normalized -1..1 */
#define map_x3d(x) ((x-x_min3d)*xscale3d-1.0)
#define map_y3d(y) ((y-y_min3d)*yscale3d-1.0)
#define map_z3d(z) ((z-z_min3d)*zscale3d-1.0)
X
static mat_unit(mat)
transform_matrix mat;
{
X int i, j;
X
X for (i = 0; i < 4; i++) for (j = 0; j < 4; j++)
X if (i == j)
X mat[i][j] = 1.0;
X else
X mat[i][j] = 0.0;
}
X
static mat_trans(tx, ty, tz, mat)
double tx, ty, tz;
transform_matrix mat;
{
X mat_unit(mat); /* Make it unit matrix. */
X mat[3][0] = tx;
X mat[3][1] = ty;
X mat[3][2] = tz;
}
X
static mat_scale(sx, sy, sz, mat)
double sx, sy, sz;
transform_matrix mat;
{
X mat_unit(mat); /* Make it unit matrix. */
X mat[0][0] = sx;
X mat[1][1] = sy;
X mat[2][2] = sz;
}
X
static mat_rot_x(teta, mat)
double teta;
transform_matrix mat;
{
X double cos_teta, sin_teta;
X
X teta *= Pi / 180.0;
X cos_teta = cos(teta);
X sin_teta = sin(teta);
X
X mat_unit(mat); /* Make it unit matrix. */
X mat[1][1] = cos_teta;
X mat[1][2] = -sin_teta;
X mat[2][1] = sin_teta;
X mat[2][2] = cos_teta;
}
X
static mat_rot_y(teta, mat)
double teta;
transform_matrix mat;
{
X double cos_teta, sin_teta;
X
X teta *= Pi / 180.0;
X cos_teta = cos(teta);
X sin_teta = sin(teta);
X
X mat_unit(mat); /* Make it unit matrix. */
X mat[0][0] = cos_teta;
X mat[0][2] = -sin_teta;
X mat[2][0] = sin_teta;
X mat[2][2] = cos_teta;
}
X
static mat_rot_z(teta, mat)
double teta;
transform_matrix mat;
{
X double cos_teta, sin_teta;
X
X teta *= Pi / 180.0;
X cos_teta = cos(teta);
X sin_teta = sin(teta);
X
X mat_unit(mat); /* Make it unit matrix. */
X mat[0][0] = cos_teta;
X mat[0][1] = -sin_teta;
X mat[1][0] = sin_teta;
X mat[1][1] = cos_teta;
}
X
/* Multiply two transform_matrix. Result can be one of two operands. */
void mat_mult(mat_res, mat1, mat2)
transform_matrix mat_res, mat1, mat2;
{
X int i, j, k;
X transform_matrix mat_res_temp;
X
X for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) {
X mat_res_temp[i][j] = 0;
X for (k = 0; k < 4; k++) mat_res_temp[i][j] += mat1[i][k] * mat2[k][j];
X }
X for (i = 0; i < 4; i++) for (j = 0; j < 4; j++)
X mat_res[i][j] = mat_res_temp[i][j];
}
X
/* And the functions to map from user 3D space to terminal coordinates */
static int map3d_xy(x, y, z, xt, yt)
double x, y, z;
int *xt, *yt;
{
X int i,j;
X double v[4], res[4], /* Homogeneous coords. vectors. */
X w = trans_mat[3][3];
X
X v[0] = map_x3d(x); /* Normalize object space to -1..1 */
X v[1] = map_y3d(y);
X v[2] = map_z3d(z);
X v[3] = 1.0;
X
X for (i = 0; i < 2; i++) { /* Dont use the third axes (z). */
X res[i] = trans_mat[3][i]; /* Initiate it with the weight factor. */
X for (j = 0; j < 3; j++) res[i] += v[j] * trans_mat[j][i];
X }
X
X for (i = 0; i < 3; i++) w += v[i] * trans_mat[i][3];
X if (w == 0) w = 1e-5;
X
X *xt = ((int) (res[0] * xscaler / w)) + xmiddle;
X *yt = ((int) (res[1] * yscaler / w)) + ymiddle;
}
X
/* Test a single point to be within the xleft,xright,ybot,ytop bbox.
X * Sets the returned integers 4 l.s.b. as follows:
X * bit 0 if to the left of xleft.
X * bit 1 if to the right of xright.
X * bit 2 if above of ytop.
X * bit 3 if below of ybot.
X * 0 is returned if inside.
X */
static int clip_point(x, y)
int x, y;
{
X int ret_val = 0;
X
X if (x < xleft) ret_val |= 0x01;
X if (x > xright) ret_val |= 0x02;
X if (y < ybot) ret_val |= 0x04;
X if (y > ytop) ret_val |= 0x08;
X
X return ret_val;
}
X
/* Clip the given line to drawing coords defined as xleft,xright,ybot,ytop.
X * This routine uses the cohen & sutherland bit mapping for fast clipping -
X * see "Principles of Interactive Computer Graphics" Newman & Sproull page 65.
X */
static void draw_clip_line(x1, y1, x2, y2)
int x1, y1, x2, y2;
{
X int x, y, dx, dy, x_intr[2], y_intr[2], count, pos1, pos2;
X register struct termentry *t = &term_tbl[term];
X
X pos1 = clip_point(x1, y1);
X pos2 = clip_point(x2, y2);
X if (pos1 || pos2) {
X if (pos1 & pos2) return; /* segment is totally out. */
X
X /* Here part of the segment MAY be inside. test the intersection
X * of this segment with the 4 boundaries for hopefully 2 intersections
X * in. If non found segment is totaly out.
X */
X count = 0;
X dx = x2 - x1;
X dy = y2 - y1;
X
X /* Find intersections with the x parallel bbox lines: */
X if (dy != 0) {
X x = (ybot - y2) * dx / dy + x2; /* Test for ybot boundary. */
X if (x >= xleft && x <= xright) {
X x_intr[count] = x;
X y_intr[count++] = ybot;
X }
X x = (ytop - y2) * dx / dy + x2; /* Test for ytop boundary. */
X if (x >= xleft && x <= xright) {
X x_intr[count] = x;
X y_intr[count++] = ytop;
X }
X }
X
X /* Find intersections with the y parallel bbox lines: */
X if (dx != 0) {
X y = (xleft - x2) * dy / dx + y2; /* Test for xleft boundary. */
X if (y >= ybot && y <= ytop) {
X x_intr[count] = xleft;
X y_intr[count++] = y;
X }
X y = (xright - x2) * dy / dx + y2; /* Test for xright boundary. */
X if (y >= ybot && y <= ytop) {
X x_intr[count] = xright;
X y_intr[count++] = y;
X }
X }
X
X if (count == 2) {
X int x_max, x_min, y_max, y_min;
X
X x_min = min(x1, x2);
X x_max = max(x1, x2);
X y_min = min(y1, y2);
X y_max = max(y1, y2);
X
X if (pos1 && pos2) { /* Both were out - update both */
X x1 = x_intr[0];
X y1 = y_intr[0];
X x2 = x_intr[1];
X y2 = y_intr[1];
X }
X else if (pos1) { /* Only x1/y1 was out - update only it */
X if (dx * (x2 - x_intr[0]) + dy * (y2 - y_intr[0]) > 0) {
X x1 = x_intr[0];
X y1 = y_intr[0];
X }
X else {
X x1 = x_intr[1];
X y1 = y_intr[1];
X }
X }
X else { /* Only x2/y2 was out - update only it */
X if (dx * (x_intr[0] - x1) + dy * (y_intr[0] - x1) > 0) {
X x2 = x_intr[0];
X y2 = y_intr[0];
X }
X else {
X x2 = x_intr[1];
X y2 = y_intr[1];
X }
X }
X
X if (x1 < x_min || x1 > x_max ||
X x2 < x_min || x2 > x_max ||
X y1 < y_min || y1 > y_max ||
X y2 < y_min || y2 > y_max) return;
X }
X else
X return;
X }
X
X (*t->move)(x1,y1);
X (*t->vector)(x2,y2);
}
X
/* Two routine to emulate move/vector sequence using line drawing routine. */
static int move_pos_x, move_pos_y;
X
static void clip_move(x,y)
int x,y;
{
X move_pos_x = x;
X move_pos_y = y;
}
X
static void clip_vector(x,y)
int x,y;
{
X draw_clip_line(move_pos_x,move_pos_y, x, y);
X move_pos_x = x;
X move_pos_y = y;
}
X
/* And text clipping routine. */
static void clip_put_text(x, y, str)
int x,y;
char *str;
{
X register struct termentry *t = &term_tbl[term];
X
X if (clip_point(x, y)) return;
X
X (*t->put_text)(x,y,str);
}
X
/* (DFK) For some reason, the Sun386i compiler screws up with the CheckLog
X * macro, so I write it as a function on that machine.
X */
#ifndef sun386
/* (DFK) Use 10^x if logscale is in effect, else x */
#define CheckLog(log, x) ((log) ? pow(10., (x)) : (x))
#else
static double
CheckLog(log, x)
X BOOLEAN log;
X double x;
{
X if (log)
X return(pow(10., x));
X else
X return(x);
}
#endif /* sun386 */
X
static double
LogScale(coord, islog, what, axis)
X double coord; /* the value */
X BOOLEAN islog; /* is this axis in logscale? */
X char *what; /* what is the coord for? */
X char *axis; /* which axis is this for ("x" or "y")? */
{
X if (islog) {
X if (coord <= 0.0) {
X char errbuf[100]; /* place to write error message */
X (void) sprintf(errbuf,"%s has %s coord of %g; must be above 0 for log scale!",
X what, axis, coord);
X (*term_tbl[term].text)();
X (void) fflush(outfile);
X int_error(errbuf, NO_CARET);
X } else
X return(log10(coord));
X }
X return(coord);
}
X
/* borders of plotting area */
/* computed once on every call to do_plot */
static boundary3d(scaling)
X BOOLEAN scaling; /* TRUE if terminal is doing the scaling */
{
X register struct termentry *t = &term_tbl[term];
X xleft = (t->h_char)*2 + (t->h_tic);
X xright = (scaling ? 1 : xsize) * (t->xmax) - (t->h_char)*2 - (t->h_tic);
X ybot = (t->v_char)*5/2 + 1;
X ytop = (scaling ? 1 : ysize) * (t->ymax) - (t->v_char)*5/2 - 1;
X xmiddle = (xright + xleft) / 2;
X ymiddle = (ytop + ybot) / 2;
X xscaler = (xright - xleft) / 2;
X yscaler = (ytop - ybot) / 2;
}
X
static double dbl_raise(x,y)
double x;
int y;
{
register int i;
double val;
X
X val = 1.0;
X for (i=0; i < abs(y); i++)
X val *= x;
X if (y < 0 ) return (1.0/val);
X return(val);
}
X
X
SHAR_EOF
true || echo 'restore of gnuplot/graph3d.c failed'
fi
echo 'End of part 20'
echo 'File gnuplot/graph3d.c is continued in part 21'
echo 21 > _shar_seq_.tmp
#!/bin/sh
# this is Part.21 (part 21 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/graph3d.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 21; 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/graph3d.c'
else
echo 'x - continuing file gnuplot/graph3d.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/graph3d.c' &&
static double make_3dtics(tmin,tmax,axis,logscale)
double tmin,tmax;
int axis;
BOOLEAN logscale;
{
int len,x1,y1,x2,y2;
register double xr,xnorm,tics,tic,l10;
X
X xr = fabs(tmin-tmax);
X
X /* Compute length of axis in screen space coords. */
X switch (axis) {
X case 'x':
X map3d_xy(tmin,0.0,0.0,&x1,&y1);
X map3d_xy(tmax,0.0,0.0,&x2,&y2);
X break;
X case 'y':
X map3d_xy(0.0,tmin,0.0,&x1,&y1);
X map3d_xy(0.0,tmax,0.0,&x2,&y2);
X break;
X case 'z':
X map3d_xy(0.0,0.0,tmin,&x1,&y1);
X map3d_xy(0.0,0.0,tmax,&x2,&y2);
X break;
X }
X
X if (((long) (x1-x2))*(x1-x2) + ((long) (y1-y2))*(y1-y2) <
X sqr(3L * term_tbl[term].h_char))
X return -1.0; /* No tics! */
X
X l10 = log10(xr);
X if (logscale) {
X tic = dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
X if (tic < 1.0)
X tic = 1.0;
X } else {
X xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)));
X if (xnorm <= 5)
X tics = 0.5;
X else tics = 1.0;
X tic = tics * dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
X }
X return(tic);
}
X
do_3dplot(plots, pcount, min_x, max_x, min_y, max_y, min_z, max_z)
struct surface_points *plots;
int pcount; /* count of plots in linked list */
double min_x, max_x;
double min_y, max_y;
double min_z, max_z;
{
register struct termentry *t = &term_tbl[term];
register int surface, xaxis_y, yaxis_x;
register struct surface_points *this_plot;
int xl, yl;
X /* only a Pyramid would have this many registers! */
double xtemp, ytemp, ztemp, temp;
struct text_label *this_label;
struct arrow_def *this_arrow;
BOOLEAN scaling;
transform_matrix mat;
X
/* Initiate transformation matrix using the global view variables. */
X mat_rot_z(surface_rot_z, trans_mat);
X mat_rot_x(surface_rot_x, mat);
X mat_mult(trans_mat, trans_mat, mat);
X mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat);
X mat_mult(trans_mat, trans_mat, mat);
X
/* modify min_z/max_z so it will zscale properly. */
X ztemp = (max_z - min_z) / (2.0 * surface_zscale);
X temp = (max_z + min_z) / 2.0;
X min_z = temp - ztemp;
X max_z = temp + ztemp;
X
/* store these in variables global to this file */
/* otherwise, we have to pass them around a lot */
X x_min3d = min_x;
X x_max3d = max_x;
X y_min3d = min_y;
X y_max3d = max_y;
X z_min3d = min_z;
X z_max3d = max_z;
X
X if (polar)
X int_error("Can not splot in polar coordinate system.", NO_CARET);
X
X if (z_min3d == VERYLARGE || z_max3d == -VERYLARGE ||
X x_min3d == VERYLARGE || x_max3d == -VERYLARGE ||
X y_min3d == VERYLARGE || y_max3d == -VERYLARGE)
X int_error("all points undefined!", NO_CARET);
X
X /* If we are to draw the bottom grid make sure zmin is updated properly. */
X if (xtics || ytics || grid)
X z_min3d -= (max_z - min_z) * ticslevel;
X
/* This used be x_max3d == x_min3d, but that caused an infinite loop once. */
X if (fabs(x_max3d - x_min3d) < zero)
X int_error("x_min3d should not equal x_max3d!",NO_CARET);
X if (fabs(y_max3d - y_min3d) < zero)
X int_error("y_min3d should not equal y_max3d!",NO_CARET);
X if (fabs(z_max3d - z_min3d) < zero)
X int_error("z_min3d should not equal z_max3d!",NO_CARET);
X
/* INITIALIZE TERMINAL */
X if (!term_init) {
X (*t->init)();
X term_init = TRUE;
X }
X screen_ok = FALSE;
X scaling = (*t->scale)(xsize, ysize);
X (*t->graphics)();
X
X /* now compute boundary for plot (xleft, xright, ytop, ybot) */
X boundary3d(scaling);
X
/* SCALE FACTORS */
X zscale3d = 2.0/(z_max3d - z_min3d);
X yscale3d = 2.0/(y_max3d - y_min3d);
X xscale3d = 2.0/(x_max3d - x_min3d);
X
X (*t->linetype)(-2); /* border linetype */
/* PLACE TITLE */
X if (*title != 0) {
X int x, y;
X
X x = title_xoffset * t->h_char;
X y = title_yoffset * t->v_char;
X
X if ((*t->justify_text)(CENTRE))
X (*t->put_text)(x+(xleft+xright)/2,
X y+ytop+(t->v_char), title);
X else
X (*t->put_text)(x+(xleft+xright)/2 - strlen(title)*(t->h_char)/2,
X y+ytop+(t->v_char), title);
X }
X
/* PLACE TIMEDATE */
X if (timedate) {
X int x, y;
X
X x = time_xoffset * t->h_char;
X y = time_yoffset * t->v_char;
X dated = time( (long *) 0);
X tdate = ctime( &dated);
X tdate[24]='\0';
X if ((*t->text_angle)(1)) {
X if ((*t->justify_text)(CENTRE)) {
X (*t->put_text)(x+(t->v_char),
X y+ybot+4*(t->v_char), tdate);
X }
X else {
X (*t->put_text)(x+(t->v_char),
X y+ybot+4*(t->v_char)-(t->h_char)*strlen(ylabel)/2,
X tdate);
X }
X }
X else {
X (void)(*t->justify_text)(LEFT);
X (*t->put_text)(x,
X y+ybot-3*(t->v_char), tdate);
X }
X (void)(*t->text_angle)(0);
X }
X
/* PLACE LABELS */
X for (this_label = first_label; this_label!=NULL;
X this_label=this_label->next ) {
X int x,y;
X
X xtemp = LogScale(this_label->x, log_x, "label", "x");
X ytemp = LogScale(this_label->y, log_y, "label", "y");
X ztemp = LogScale(this_label->z, log_z, "label", "z");
X map3d_xy(xtemp,ytemp,ztemp, &x, &y);
X
X if ((*t->justify_text)(this_label->pos)) {
X (*t->put_text)(x,y,this_label->text);
X }
X else {
X switch(this_label->pos) {
X case LEFT:
X (*t->put_text)(x,y,this_label->text);
X break;
X case CENTRE:
X (*t->put_text)(x -
X (t->h_char)*strlen(this_label->text)/2,
X y, this_label->text);
X break;
X case RIGHT:
X (*t->put_text)(x -
X (t->h_char)*strlen(this_label->text),
X y, this_label->text);
X break;
X }
X }
X }
X
/* PLACE ARROWS */
X (*t->linetype)(0); /* arrow line type */
X for (this_arrow = first_arrow; this_arrow!=NULL;
X this_arrow = this_arrow->next ) {
X int sx,sy,ex,ey;
X
X xtemp = LogScale(this_arrow->sx, log_x, "arrow", "x");
X ytemp = LogScale(this_arrow->sy, log_y, "arrow", "y");
X ztemp = LogScale(this_arrow->sz, log_y, "arrow", "z");
X map3d_xy(xtemp,ytemp,ztemp, &sx, &sy);
X
X xtemp = LogScale(this_arrow->ex, log_x, "arrow", "x");
X ytemp = LogScale(this_arrow->ey, log_y, "arrow", "y");
X ztemp = LogScale(this_arrow->ez, log_y, "arrow", "z");
X map3d_xy(xtemp,ytemp,ztemp, &ex, &ey);
X
X (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
X }
X
X
/* DRAW SURFACES AND CONTOURS */
X real_z_min3d = min_z;
X real_z_max3d = max_z;
X if (key == -1) {
X xl = xright - (t->h_tic) - (t->h_char)*5;
X yl = ytop - (t->v_tic) - (t->v_char);
X }
X if (key == 1) {
X xtemp = LogScale(key_x, log_x, "key", "x");
X ytemp = LogScale(key_y, log_y, "key", "y");
X ztemp = LogScale(key_z, log_z, "key", "z");
X map3d_xy(xtemp,ytemp,ztemp, &xl, &yl);
X }
X
X this_plot = plots;
X for (surface = 0;
X surface < pcount;
X this_plot = this_plot->next_sp, surface++) {
X (*t->linetype)(this_plot->line_type+1);
X
X if (draw_contour && this_plot->contours != NULL) {
X struct gnuplot_contours *cntrs = this_plot->contours;
X
X if (key != 0) {
X if ((*t->justify_text)(RIGHT)) {
X clip_put_text(xl,
X yl,this_plot->title);
X }
X else {
X if (inrange(xl-(t->h_char)*strlen(this_plot->title),
X xleft, xright))
X clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
X yl,this_plot->title);
X }
X switch(this_plot->plot_style) {
X case IMPULSES:
X clip_move(xl+(t->h_char),yl);
X clip_vector(xl+4*(t->h_char),yl);
X break;
X case LINES:
X clip_move(xl+(int)(t->h_char),yl);
X clip_vector(xl+(int)(4*(t->h_char)),yl);
X break;
X case ERRORBARS: /* ignored; treat like points */
X case POINTS:
X if (!clip_point(xl+2*(t->h_char),yl)) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X break;
X case LINESPOINTS:
X clip_move(xl+(int)(t->h_char),yl);
X clip_vector(xl+(int)(4*(t->h_char)),yl);
X break;
X case DOTS:
X if (!clip_point(xl+2*(t->h_char),yl)) {
X (*t->point)(xl+2*(t->h_char),yl, -1);
X }
X break;
X }
X }
X
X while (cntrs) {
X switch(this_plot->plot_style) {
X case IMPULSES:
X cntr3d_impulses(cntrs, this_plot);
X break;
X case LINES:
X cntr3d_lines(cntrs);
X break;
X case ERRORBARS: /* ignored; treat like points */
X case POINTS:
X cntr3d_points(cntrs, this_plot);
X break;
X case LINESPOINTS:
X cntr3d_lines(cntrs);
X cntr3d_points(cntrs, this_plot);
X break;
X case DOTS:
X cntr3d_dots(cntrs);
X break;
X }
X cntrs = cntrs->next;
X }
X if (key != 0) yl = yl - (t->v_char);
X }
X
X if ( surface == 0 )
X draw_bottom_grid(this_plot,real_z_min3d,real_z_max3d);
X
X if (!draw_surface) continue;
X (*t->linetype)(this_plot->line_type);
X
X if (key != 0) {
X if ((*t->justify_text)(RIGHT)) {
X clip_put_text(xl,
X yl,this_plot->title);
X }
X else {
X if (inrange(xl-(t->h_char)*strlen(this_plot->title),
X xleft, xright))
X clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
X yl,this_plot->title);
X }
X }
X
X switch(this_plot->plot_style) {
X case IMPULSES: {
X if (key != 0) {
X clip_move(xl+(t->h_char),yl);
X clip_vector(xl+4*(t->h_char),yl);
X }
X plot3d_impulses(this_plot);
X break;
X }
X case LINES: {
X if (key != 0) {
X clip_move(xl+(int)(t->h_char),yl);
X clip_vector(xl+(int)(4*(t->h_char)),yl);
X }
X plot3d_lines(this_plot);
X break;
X }
X case ERRORBARS: /* ignored; treat like points */
X case POINTS: {
X if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X plot3d_points(this_plot);
X break;
X }
X case LINESPOINTS: {
X /* put lines */
X if (key != 0) {
X clip_move(xl+(t->h_char),yl);
X clip_vector(xl+4*(t->h_char),yl);
X }
X plot3d_lines(this_plot);
X
X /* put points */
X if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X plot3d_points(this_plot);
X break;
X }
X case DOTS: {
X if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
X (*t->point)(xl+2*(t->h_char),yl, -1);
X }
X plot3d_dots(this_plot);
X break;
X }
X }
X yl = yl - (t->v_char);
X }
X (*t->text)();
X (void) fflush(outfile);
}
X
/* plot3d_impulses:
X * Plot the surfaces in IMPULSES style
X */
static plot3d_impulses(plot)
X struct surface_points *plot;
{
X int i; /* point index */
X int x,y,x0,y0; /* point in terminal coordinates */
X struct termentry *t = &term_tbl[term];
X struct iso_curve *icrvs = plot->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; i++) {
X if (real_z_max3d<points[i].z)
X real_z_max3d=points[i].z;
X if (real_z_min3d>points[i].z)
X real_z_min3d=points[i].z;
X
X map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
X map3d_xy(points[i].x, points[i].y, z_min3d, &x0, &y0);
X
X clip_move(x0,y0);
X clip_vector(x,y);
X }
X
X icrvs = icrvs->next;
X }
}
X
/* plot3d_lines:
X * Plot the surfaces in LINES style
X */
static plot3d_lines(plot)
X struct surface_points *plot;
{
X int i;
X int x,y; /* point in terminal coordinates */
X struct termentry *t = &term_tbl[term];
X struct iso_curve *icrvs = plot->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; i++) {
X if (real_z_max3d<points[i].z)
X real_z_max3d=points[i].z;
X if (real_z_min3d>points[i].z)
X real_z_min3d=points[i].z;
X
X map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
X
X if (i > 0)
X clip_vector(x,y);
X else
X clip_move(x,y);
X }
X
X icrvs = icrvs->next;
X }
}
X
/* plot3d_points:
X * Plot the surfaces in POINTS style
X */
static plot3d_points(plot)
X struct surface_points *plot;
{
X int i,x,y;
X struct termentry *t = &term_tbl[term];
X struct iso_curve *icrvs = plot->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; i++) {
X if (real_z_max3d<points[i].z)
X real_z_max3d=points[i].z;
X if (real_z_min3d>points[i].z)
X real_z_min3d=points[i].z;
X
X map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, plot->point_type);
X }
X
X icrvs = icrvs->next;
X }
}
X
/* plot3d_dots:
X * Plot the surfaces in DOTS style
X */
static plot3d_dots(plot)
X struct surface_points *plot;
{
X int i,x,y;
X struct termentry *t = &term_tbl[term];
X struct iso_curve *icrvs = plot->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; i++) {
X if (real_z_max3d<points[i].z)
X real_z_max3d=points[i].z;
X if (real_z_min3d>points[i].z)
X real_z_min3d=points[i].z;
X
X map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, -1);
X }
X
X icrvs = icrvs->next;
X }
}
X
/* cntr3d_impulses:
X * Plot a surface contour in IMPULSES style
X */
static cntr3d_impulses(cntr, plot)
X struct gnuplot_contours *cntr;
X struct surface_points *plot;
{
X int i,j,k; /* point index */
X int x,y,x0,y0; /* point in terminal coordinates */
X struct termentry *t = &term_tbl[term];
X
X if (draw_contour == CONTOUR_SRF || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, cntr->coords[i].z,
X &x, &y);
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, z_min3d,
X &x0, &y0);
X
X clip_move(x0,y0);
X clip_vector(x,y);
X }
X }
X else
X cntr3d_points(cntr, plot); /* Must be on base grid, so do points. */
}
X
/* cntr3d_lines:
X * Plot a surface contour in LINES style
X */
static cntr3d_lines(cntr)
X struct gnuplot_contours *cntr;
{
X int i,j,k; /* point index */
X int x,y; /* point in terminal coordinates */
X struct termentry *t = &term_tbl[term];
X
X if (draw_contour == CONTOUR_SRF || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, cntr->coords[i].z,
X &x, &y);
X
X if (i > 0)
X clip_vector(x,y);
X else
X clip_move(x,y);
X }
X }
X
X if (draw_contour == CONTOUR_BASE || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, z_min3d,
X &x, &y);
X
X if (i > 0)
X clip_vector(x,y);
X else
X clip_move(x,y);
X }
X }
}
X
/* cntr3d_points:
X * Plot a surface contour in POINTS style
X */
static cntr3d_points(cntr, plot)
X struct gnuplot_contours *cntr;
X struct surface_points *plot;
{
X int i,j,k;
X int x,y;
X struct termentry *t = &term_tbl[term];
X
X if (draw_contour == CONTOUR_SRF || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, cntr->coords[i].z,
X &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, plot->point_type);
X }
X }
X
X if (draw_contour == CONTOUR_BASE || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, z_min3d,
X &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, plot->point_type);
X }
X }
}
X
/* cntr3d_dots:
X * Plot a surface contour in DOTS style
X */
static cntr3d_dots(cntr)
X struct gnuplot_contours *cntr;
{
X int i,j,k;
X int x,y;
X struct termentry *t = &term_tbl[term];
X
X if (draw_contour == CONTOUR_SRF || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, cntr->coords[i].z,
X &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, -1);
X }
X }
X
X if (draw_contour == CONTOUR_BASE || draw_contour == CONTOUR_BOTH) {
X for (i = 0; i < cntr->num_pts; i++) {
X if (real_z_max3d<cntr->coords[i].z)
X real_z_max3d=cntr->coords[i].z;
X if (real_z_min3d>cntr->coords[i].z)
X real_z_min3d=cntr->coords[i].z;
X
X map3d_xy(cntr->coords[i].x, cntr->coords[i].y, z_min3d,
X &x, &y);
X
X if (!clip_point(x,y))
X (*t->point)(x,y, -1);
X }
X }
}
X
static update_extrema_pts(ix, iy, min_sx_x, min_sx_y, min_sy_x, min_sy_y,
X x, y)
X int ix, iy, *min_sx_x, *min_sx_y, *min_sy_x, *min_sy_y;
X double x, y;
{
X
X if (*min_sx_x > ix + 2 || /* find (bottom) left corner of grid */
X (abs(*min_sx_x - ix) <= 2 && *min_sx_y > iy)) {
X *min_sx_x = ix;
X *min_sx_y = iy;
X min_sx_ox = x;
X min_sx_oy = y;
X }
X if (*min_sy_y > iy + 2 || /* find bottom (right) corner of grid */
X (abs(*min_sy_y - iy) <= 2 && *min_sy_x < ix)) {
X *min_sy_x = ix;
X *min_sy_y = iy;
X min_sy_ox = x;
X min_sy_oy = y;
X }
}
X
/* Draw the bottom grid for the parametric case. */
static draw_parametric_grid(plot)
X struct surface_points *plot;
{
X int i,ix,iy, /* point in terminal coordinates */
X min_sx_x = 10000,min_sx_y = 10000,min_sy_x = 10000,min_sy_y = 10000,
X grid_iso = plot->plot_type == DATA3D && plot->has_grid_topology ?
X plot->num_iso_read : iso_samples;
X double x,y,dx,dy;
X struct termentry *t = &term_tbl[term];
X
X if (grid && plot->has_grid_topology) {
X x = x_min3d;
X y = y_min3d;
X
X dx = (x_max3d-x_min3d) / (grid_iso-1);
X dy = (y_max3d-y_min3d) / (grid_iso-1);
X
X for (i = 0; i < grid_iso; i++) {
X if (i == 0 || i == grid_iso-1)
X (*t->linetype)(-2);
X else
X (*t->linetype)(-1);
X map3d_xy(x_min3d, y, z_min3d, &ix, &iy);
X clip_move(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_min3d,y);
X
X map3d_xy(x_max3d, y, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_max3d,y);
X
X y += dy;
X }
X
X for (i = 0; i < grid_iso; i++) {
X if (i == 0 || i == grid_iso-1)
X (*t->linetype)(-2);
X else
X (*t->linetype)(-1);
X map3d_xy(x, y_min3d, z_min3d, &ix, &iy);
X clip_move(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x,y_min3d);
X
X map3d_xy(x, y_max3d, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x,y_max3d);
X
X x += dx;
X }
X }
X else {
X (*t->linetype)(-2);
X
X map3d_xy(x_min3d, y_min3d, z_min3d, &ix, &iy);
X clip_move(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_min3d,y_min3d);
X
X map3d_xy(x_max3d, y_min3d, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_max3d,y_min3d);
X
X map3d_xy(x_max3d, y_max3d, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_max3d,y_max3d);
X
X map3d_xy(x_min3d, y_max3d, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
X &min_sy_x,&min_sy_y,x_min3d,y_max3d);
X
X
X map3d_xy(x_min3d, y_min3d, z_min3d, &ix, &iy);
X clip_vector(ix,iy);
X }
}
X
/* Draw the bottom grid for non parametric case. */
static draw_non_param_grid(plot)
X struct surface_points *plot;
{
X int i,is_boundary=TRUE,crv_count=0,
X x,y, /* point in terminal coordinates */
X min_sx_x = 10000,min_sx_y = 10000,min_sy_x = 10000,min_sy_y = 10000,
X grid_samples = plot->plot_type == DATA3D && plot->has_grid_topology ?
X plot->iso_crvs->p_count : samples,
X grid_iso = plot->plot_type == DATA3D && plot->has_grid_topology ?
X plot->num_iso_read : iso_samples;
X struct termentry *t = &term_tbl[term];
X struct iso_curve *icrvs = plot->iso_crvs;
X
X while ( icrvs ) {
X struct coordinate *points = icrvs->points;
X
X for (i = 0; i < icrvs->p_count; i += icrvs->p_count-1) {
X map3d_xy(points[i].x, points[i].y, z_min3d, &x, &y);
X if (is_boundary) {
X (*t->linetype)(-2);
X }
X else {
X (*t->linetype)(-1);
X }
X
X if (i > 0) {
X clip_vector(x,y);
X }
X else {
X clip_move(x,y);
X }
X
X if (draw_surface &&
X is_boundary &&
X (i == 0 || i == icrvs->p_count-1)) {
X int x1,y1; /* point in terminal coordinates */
X
X /* Draw a vertical line to surface corner from grid corner. */
X map3d_xy(points[i].x, points[i].y, points[i].z, &x1, &y1);
X clip_vector(x1,y1);
X clip_move(x,y);
X update_extrema_pts(x,y,&min_sx_x,&min_sx_y, &min_sy_x,&min_sy_y,
X points[i].x,points[i].y);
X }
X }
X
X if (grid) {
X crv_count++;
X icrvs = icrvs->next;
X is_boundary = crv_count == grid_iso - 1 ||
X crv_count == grid_iso ||
X (icrvs && icrvs->next == NULL);
X }
X else {
X switch (crv_count++) {
X case 0:
X for (i = 0; i < grid_iso - 1; i++)
X icrvs = icrvs->next;
X break;
X case 1:
X icrvs = icrvs->next;
X break;
X case 2:
X while (icrvs->next)
X icrvs = icrvs->next;
X break;
X case 3:
X icrvs = NULL;
X break;
X }
X }
X }
}
X
/* Draw the bottom grid that hold the tic marks for 3d surface. */
static draw_bottom_grid(plot, min_z, max_z)
X struct surface_points *plot;
X double min_z, max_z;
{
X int i,j,k; /* point index */
X int x,y,min_x = 10000,min_y = 10000;/* point in terminal coordinates */
X double xtic,ytic,ztic;
X struct termentry *t = &term_tbl[term];
X
X xtic = make_3dtics(x_min3d,x_max3d,'x',log_x);
X ytic = make_3dtics(y_min3d,y_max3d,'y',log_y);
X ztic = make_3dtics(min_z,max_z,'z',log_z);
X
X if (draw_border)
X if (parametric || !plot->has_grid_topology)
X draw_parametric_grid(plot);
X else
X draw_non_param_grid(plot);
X
X (*t->linetype)(-2); /* border linetype */
X
/* label x axis tics */
X if (xtics && xtic > 0.0) {
X switch (xticdef.type) {
X case TIC_COMPUTED:
X if (x_min3d < x_max3d)
X draw_3dxtics(xtic * floor(x_min3d/xtic),
X xtic,
X xtic * ceil(x_max3d/xtic),
X min_sy_oy);
X else
X draw_3dxtics(xtic * floor(x_max3d/xtic),
X xtic,
X xtic * ceil(x_min3d/xtic),
X min_sy_oy);
X break;
X case TIC_SERIES:
X draw_series_3dxtics(xticdef.def.series.start,
X xticdef.def.series.incr,
X xticdef.def.series.end,
X min_sy_oy);
X break;
X case TIC_USER:
X draw_set_3dxtics(xticdef.def.user,
X min_sy_oy);
X break;
X default:
X (*t->text)();
X (void) fflush(outfile);
X int_error("unknown tic type in xticdef in do_3dplot", NO_CARET);
X break; /* NOTREACHED */
X }
X }
/* label y axis tics */
X if (ytics && ytic > 0.0) {
X switch (yticdef.type) {
X case TIC_COMPUTED:
X if (y_min3d < y_max3d)
X draw_3dytics(ytic * floor(y_min3d/ytic),
X ytic,
X ytic * ceil(y_max3d/ytic),
X min_sy_ox);
X else
X draw_3dytics(ytic * floor(y_max3d/ytic),
X ytic,
X ytic * ceil(y_min3d/ytic),
X min_sy_ox);
X break;
X case TIC_SERIES:
X draw_series_3dytics(yticdef.def.series.start,
X yticdef.def.series.incr,
X yticdef.def.series.end,
X min_sy_ox);
X break;
X case TIC_USER:
X draw_set_3dytics(yticdef.def.user,
X min_sy_ox);
X break;
X default:
X (*t->text)();
X (void) fflush(outfile);
X int_error("unknown tic type in yticdef in do_3dplot", NO_CARET);
X break; /* NOTREACHED */
X }
X }
/* label z axis tics */
X if (ztics && ztic > 0.0 && (draw_surface ||
X draw_contour == CONTOUR_SRF ||
X draw_contour == CONTOUR_BOTH)) {
X switch (zticdef.type) {
X case TIC_COMPUTED:
X if (min_z < max_z)
X draw_3dztics(ztic * floor(min_z/ztic),
X ztic,
X ztic * ceil(max_z/ztic),
X min_sx_ox,
X min_sx_oy,
X min_z,
X max_z);
X else
X draw_3dztics(ztic * floor(max_z/ztic),
X ztic,
X ztic * ceil(min_z/ztic),
X min_sx_ox,
X min_sx_oy,
X max_z,
X min_z);
X break;
X case TIC_SERIES:
X draw_series_3dztics(zticdef.def.series.start,
X zticdef.def.series.incr,
X zticdef.def.series.end,
X min_sx_ox,
X min_sx_oy,
X min_z,
X max_z);
X
X break;
X case TIC_USER:
X draw_set_3dztics(zticdef.def.user,
X min_sx_ox,
X min_sx_oy,
X min_z,
X max_z);
X break;
X default:
X (*t->text)();
X (void) fflush(outfile);
X int_error("unknown tic type in zticdef in do_3dplot", NO_CARET);
X break; /* NOTREACHED */
X }
X }
X
/* PLACE XLABEL - along the middle grid X axis */
X if (strlen(xlabel) > 0) {
X int x1,y1;
X double step = apx_eq( min_sy_oy, y_min3d ) ? (y_max3d-y_min3d)/4
X : (y_min3d-y_max3d)/4;
X map3d_xy((x_min3d+x_max3d)/2,min_sy_oy-step, z_min3d,&x1,&y1);
X x1 += xlabel_xoffset * t->h_char;
X y1 += xlabel_yoffset * t->v_char;
X if ((*t->justify_text)(CENTRE))
X clip_put_text(x1,y1,xlabel);
X else
X clip_put_text(x1 - strlen(xlabel)*(t->h_char)/2,y1,xlabel);
X }
X
/* PLACE YLABEL - along the middle grid Y axis */
X if (strlen(ylabel) > 0) {
X int x1,y1;
X double step = apx_eq( min_sy_ox, x_min3d ) ? (x_max3d-x_min3d)/4
X : (x_min3d-x_max3d)/4;
X map3d_xy(min_sy_ox-step,(y_min3d+y_max3d)/2,z_min3d,&x1,&y1);
X x1 += ylabel_xoffset * t->h_char;
X y1 += ylabel_yoffset * t->v_char;
X if ((*t->justify_text)(CENTRE))
X clip_put_text(x1,y1,ylabel);
X else
X clip_put_text(x1 - strlen(ylabel)*(t->h_char)/2,y1,ylabel);
X }
X
/* PLACE ZLABEL - along the middle grid Z axis */
X if (strlen(zlabel) > 0 &&
X (draw_surface ||
X draw_contour == CONTOUR_SRF ||
X draw_contour == CONTOUR_BOTH)) {
X map3d_xy(min_sx_ox,min_sx_oy,max_z + (max_z-min_z)/4, &x, &y);
X
X x += zlabel_xoffset * t->h_char;
X y += zlabel_yoffset * t->v_char;
X if ((*t->justify_text)(CENTRE))
X clip_put_text(x,y,zlabel);
X else
X clip_put_text(x - strlen(zlabel)*(t->h_char)/2,y,zlabel);
X }
}
X
/* DRAW_3DXTICS: draw a regular tic series, x axis */
static draw_3dxtics(start, incr, end, ypos)
X double start, incr, end, ypos; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace;
X int ltic; /* for mini log tics */
X double lticplace; /* for mini log tics */
X
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X if (ticplace < x_min3d || ticplace > x_max3d) continue;
X xtick(ticplace, xformat, incr, 1.0, ypos);
X if (log_x && incr == 1.0) {
X /* add mini-ticks to log scale ticmarks */
X for (ltic = 2; ltic <= 9; ltic++) {
X lticplace = ticplace+log10((double)ltic);
X xtick(lticplace, "\0", incr, 0.5, ypos);
X }
X }
X }
}
X
/* DRAW_3DYTICS: draw a regular tic series, y axis */
static draw_3dytics(start, incr, end, xpos)
X double start, incr, end, xpos; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace;
X int ltic; /* for mini log tics */
X double lticplace; /* for mini log tics */
X
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X if (ticplace < y_min3d || ticplace > y_max3d) continue;
X ytick(ticplace, yformat, incr, 1.0, xpos);
X if (log_y && incr == 1.0) {
X /* add mini-ticks to log scale ticmarks */
X for (ltic = 2; ltic <= 9; ltic++) {
X lticplace = ticplace+log10((double)ltic);
X ytick(lticplace, "\0", incr, 0.5, xpos);
X }
X }
X }
}
X
/* DRAW_3DZTICS: draw a regular tic series, z axis */
static draw_3dztics(start, incr, end, xpos, ypos, z_min, z_max)
X double start, incr, end, xpos, ypos, z_min, z_max;
X /* assume start < end, incr > 0 */
{
X int x, y;
X double ticplace;
X int ltic; /* for mini log tics */
X double lticplace; /* for mini log tics */
X register struct termentry *t = &term_tbl[term];
X
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X if (ticplace < z_min || ticplace > z_max) continue;
X
X ztick(ticplace, zformat, incr, 1.0, xpos, ypos);
X if (log_z && incr == 1.0) {
X /* add mini-ticks to log scale ticmarks */
X for (ltic = 2; ltic <= 9; ltic++) {
X lticplace = ticplace+log10((double)ltic);
X ztick(lticplace, "\0", incr, 0.5, xpos, ypos);
X }
X }
X }
X
X /* Make sure the vertical line is fully drawn. */
X (*t->linetype)(-2); /* axis line type */
X
X map3d_xy(xpos, ypos, z_min3d, &x, &y);
X clip_move(x,y);
X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
X clip_vector(x,y);
X
X (*t->linetype)(-1); /* border linetype */
}
X
/* DRAW_SERIES_3DXTICS: draw a user tic series, x axis */
static draw_series_3dxtics(start, incr, end, ypos)
X double start, incr, end, ypos; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace, place;
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X double spacing = log_x ? log10(incr) : incr;
X
X if (end == VERYLARGE)
X end = max(CheckLog(log_x, x_min3d), CheckLog(log_x, x_max3d));
X else
X /* limit to right side of plot */
X end = min(end, max(CheckLog(log_x, x_min3d), CheckLog(log_x, x_max3d)));
X
X /* to allow for rounding errors */
X ticmin = min(x_min3d,x_max3d) - SIGNIF*incr;
X ticmax = max(x_min3d,x_max3d) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X place = (log_x ? log10(ticplace) : ticplace);
X if ( inrange(place,ticmin,ticmax) )
X xtick(place, xformat, spacing, 1.0, ypos);
X }
}
X
/* DRAW_SERIES_3DYTICS: draw a user tic series, y axis */
static draw_series_3dytics(start, incr, end, xpos)
X double start, incr, end, xpos; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace, place;
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X double spacing = log_y ? log10(incr) : incr;
X
X if (end == VERYLARGE)
X end = max(CheckLog(log_y, y_min3d), CheckLog(log_y, y_max3d));
X else
X /* limit to right side of plot */
X end = min(end, max(CheckLog(log_y, y_min3d), CheckLog(log_y, y_max3d)));
X
X /* to allow for rounding errors */
X ticmin = min(y_min3d,y_max3d) - SIGNIF*incr;
X ticmax = max(y_min3d,y_max3d) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X place = (log_y ? log10(ticplace) : ticplace);
X if ( inrange(place,ticmin,ticmax) )
X ytick(place, xformat, spacing, 1.0, xpos);
X }
}
X
/* DRAW_SERIES_3DZTICS: draw a user tic series, z axis */
static draw_series_3dztics(start, incr, end, xpos, ypos, z_min, z_max)
X double start, incr, end; /* tic series definition */
X double xpos, ypos, z_min, z_max;
X /* assume start < end, incr > 0 */
{
X int x, y;
X double ticplace, place;
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X double spacing = log_x ? log10(incr) : incr;
X register struct termentry *t = &term_tbl[term];
X
X if (end == VERYLARGE)
X end = max(CheckLog(log_z, z_min), CheckLog(log_z, z_max));
X else
X /* limit to right side of plot */
X end = min(end, max(CheckLog(log_z, z_min), CheckLog(log_z, z_max)));
X
X /* to allow for rounding errors */
X ticmin = min(z_min,z_max) - SIGNIF*incr;
X ticmax = max(z_min,z_max) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X place = (log_z ? log10(ticplace) : ticplace);
X if ( inrange(place,ticmin,ticmax) )
X ztick(place, zformat, spacing, 1.0, xpos, ypos);
X }
X
X /* Make sure the vertical line is fully drawn. */
X (*t->linetype)(-2); /* axis line type */
X
X map3d_xy(xpos, ypos, z_min3d, &x, &y);
X clip_move(x,y);
X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
X clip_vector(x,y);
X
X (*t->linetype)(-1); /* border linetype */
}
X
/* DRAW_SET_3DXTICS: draw a user tic set, x axis */
static draw_set_3dxtics(list, ypos)
X struct ticmark *list; /* list of tic marks */
X double ypos;
{
X double ticplace;
X double incr = (x_max3d - x_min3d) / 10;
X /* global x_min3d, x_max3d, xscale, y_min3d, y_max3d, yscale */
X
X while (list != NULL) {
X ticplace = (log_x ? log10(list->position) : list->position);
X if ( inrange(ticplace, x_min3d, x_max3d) /* in range */
X || NearlyEqual(ticplace, x_min3d, incr) /* == x_min */
X || NearlyEqual(ticplace, x_max3d, incr)) /* == x_max */
X xtick(ticplace, list->label, incr, 1.0, ypos);
X
X list = list->next;
X }
}
X
/* DRAW_SET_3DYTICS: draw a user tic set, y axis */
static draw_set_3dytics(list, xpos)
X struct ticmark *list; /* list of tic marks */
X double xpos;
{
X double ticplace;
X double incr = (y_max3d - y_min3d) / 10;
X /* global x_min3d, x_max3d, xscale, y_min3d, y_max3d, yscale */
X
X while (list != NULL) {
X ticplace = (log_y ? log10(list->position) : list->position);
X if ( inrange(ticplace, y_min3d, y_max3d) /* in range */
X || NearlyEqual(ticplace, y_min3d, incr) /* == y_min3d */
X || NearlyEqual(ticplace, y_max3d, incr)) /* == y_max3d */
X ytick(ticplace, list->label, incr, 1.0, xpos);
X
X list = list->next;
X }
}
X
/* DRAW_SET_3DZTICS: draw a user tic set, z axis */
static draw_set_3dztics(list, xpos, ypos, z_min, z_max)
X struct ticmark *list; /* list of tic marks */
X double xpos, ypos, z_min, z_max;
{
X int x, y;
X double ticplace;
X double incr = (z_max - z_min) / 10;
X register struct termentry *t = &term_tbl[term];
X
X while (list != NULL) {
X ticplace = (log_z ? log10(list->position) : list->position);
X if ( inrange(ticplace, z_min, z_max) /* in range */
X || NearlyEqual(ticplace, z_min, incr) /* == z_min */
X || NearlyEqual(ticplace, z_max, incr)) /* == z_max */
X ztick(ticplace, list->label, incr, 1.0, xpos, ypos);
X
X list = list->next;
X }
X
X /* Make sure the vertical line is fully drawn. */
X (*t->linetype)(-2); /* axis line type */
X
X map3d_xy(xpos, ypos, z_min, &x, &y);
X clip_move(x,y);
X map3d_xy(xpos, ypos, z_max+(log_z ? incr : 0.0), &x, &y);
X clip_vector(x,y);
X
X (*t->linetype)(-1); /* border linetype */
}
X
/* draw and label a x-axis ticmark */
static xtick(place, text, spacing, ticscale, ypos)
X double place; /* where on axis to put it */
X char *text; /* optional text label */
X double spacing; /* something to use with checkzero */
X double ticscale; /* scale factor for tic mark (0..1] */
X double ypos;
{
X register struct termentry *t = &term_tbl[term];
X char ticlabel[101];
X int x0,y0,x1,y1,x2,y2,x3,y3;
X int ticsize = (int)((t->h_tic) * ticscale);
X double v[2], len;
X
X place = CheckZero(place,spacing); /* to fix rounding error near zero */
X
X if (place > x_max3d || place < x_min3d) return;
X
X map3d_xy(place, ypos, z_min3d, &x0, &y0);
X /* need to figure out which is in. pick the middle point along the */
X /* axis as in. */
X map3d_xy(place, (y_max3d + y_min3d) / 2, z_min3d, &x1, &y1);
X
X /* compute a vector of length 1 into the grid: */
X v[0] = x1 - x0;
X v[1] = y1 - y0;
X len = sqrt(v[0] * v[0] + v[1] * v[1]);
X v[0] /= len;
X v[1] /= len;
X
X if (tic_in) {
X x1 = x0;
X y1 = y0;
X x2 = x1 + ((int) (v[0] * ticsize));
X y2 = y1 + ((int) (v[1] * ticsize));
X x3 = x0 - ((int) (v[0] * ticsize * 3)); /* compute text position */
X y3 = y0 - ((int) (v[1] * ticsize * 3));
X } else {
X x1 = x0;
X y1 = y0;
X x2 = x0 - ((int) (v[0] * ticsize));
X y2 = y0 - ((int) (v[1] * ticsize));
X x3 = x0 - ((int) (v[0] * ticsize * 4)); /* compute text position */
X y3 = y0 - ((int) (v[1] * ticsize * 4));
X }
X clip_move(x1,y1);
X clip_vector(x2,y2);
X
X /* label the ticmark */
X if (text == NULL)
X text = xformat;
X
X (void) sprintf(ticlabel, text, CheckLog(log_x, place));
X if (apx_eq(v[0], 0.0)) {
X if ((*t->justify_text)(CENTRE)) {
X clip_put_text(x3,y3,ticlabel);
X } else {
X clip_put_text(x3-(t->h_char)*strlen(ticlabel)/2,y3,ticlabel);
X }
X }
X else if (v[0] > 0) {
X if ((*t->justify_text)(RIGHT)) {
X clip_put_text(x3,y3,ticlabel);
X } else {
X clip_put_text(x3-(t->h_char)*strlen(ticlabel),y3,ticlabel);
X }
X } else {
X (*t->justify_text)(LEFT);
X clip_put_text(x3,y3,ticlabel);
X }
}
X
/* draw and label a y-axis ticmark */
static ytick(place, text, spacing, ticscale, xpos)
X double place; /* where on axis to put it */
X char *text; /* optional text label */
X double spacing; /* something to use with checkzero */
X double ticscale; /* scale factor for tic mark (0..1] */
X double xpos;
{
X register struct termentry *t = &term_tbl[term];
X char ticlabel[101];
X int x0,y0,x1,y1,x2,y2,x3,y3;
X int ticsize = (int)((t->h_tic) * ticscale);
X double v[2], len;
X
X place = CheckZero(place,spacing); /* to fix rounding error near zero */
X
X if (place > y_max3d || place < y_min3d) return;
X
X map3d_xy(xpos, place, z_min3d, &x0, &y0);
X /* need to figure out which is in. pick the middle point along the */
X /* axis as in. */
X map3d_xy((x_max3d + x_min3d) / 2, place, z_min3d, &x1, &y1);
X
X /* compute a vector of length 1 into the grid: */
X v[0] = x1 - x0;
X v[1] = y1 - y0;
X len = sqrt(v[0] * v[0] + v[1] * v[1]);
X v[0] /= len;
X v[1] /= len;
X
X if (tic_in) {
X x1 = x0;
X y1 = y0;
X x2 = x1 + ((int) (v[0] * ticsize));
X y2 = y1 + ((int) (v[1] * ticsize));
X x3 = x0 - ((int) (v[0] * ticsize * 3)); /* compute text position */
X y3 = y0 - ((int) (v[1] * ticsize * 3));
X } else {
X x1 = x0;
X y1 = y0;
X x2 = x0 - ((int) (v[0] * ticsize));
X y2 = y0 - ((int) (v[1] * ticsize));
X x3 = x0 - ((int) (v[0] * ticsize * 4)); /* compute text position */
X y3 = y0 - ((int) (v[1] * ticsize * 4));
X }
X clip_move(x1,y1);
X clip_vector(x2,y2);
X
X /* label the ticmark */
X if (text == NULL)
X text = yformat;
X
X (void) sprintf(ticlabel, text, CheckLog(log_y, place));
X if (apx_eq(v[0], 0.0)) {
X if ((*t->justify_text)(CENTRE)) {
X clip_put_text(x3,y3,ticlabel);
X } else {
X clip_put_text(x3-(t->h_char)*strlen(ticlabel)/2,y3,ticlabel);
X }
X }
X else if (v[0] > 0) {
X if ((*t->justify_text)(RIGHT)) {
X clip_put_text(x3,y3,ticlabel);
X } else {
X clip_put_text(x3-(t->h_char)*strlen(ticlabel),y3,ticlabel);
X }
X } else {
X (*t->justify_text)(LEFT);
X clip_put_text(x3,y3,ticlabel);
X }
}
X
/* draw and label a z-axis ticmark */
static ztick(place, text, spacing, ticscale, xpos, ypos)
X double place; /* where on axis to put it */
X char *text; /* optional text label */
X double spacing; /* something to use with checkzero */
X double ticscale; /* scale factor for tic mark (0..1] */
X double xpos, ypos;
{
X register struct termentry *t = &term_tbl[term];
X char ticlabel[101];
X int x0,y0,x1,y1,x2,y2,x3,y3;
X int ticsize = (int)((t->h_tic) * ticscale);
X
X place = CheckZero(place,spacing); /* to fix rounding error near zero */
X
X map3d_xy(xpos, ypos, place, &x0, &y0);
X
X if (tic_in) {
X x1 = x0;
X y1 = y0;
X x2 = x0 + ticsize;
X y2 = y0;
X x3 = x0 - ticsize;
X y3 = y0;
X } else {
X x1 = x0;
X y1 = y0;
X x2 = x0 - ticsize;
X y2 = y0;
X x3 = x0 - ticsize * 2; /* compute text position */
X y3 = y0;
X }
X clip_move(x1,y1);
X clip_vector(x2,y2);
X
X /* label the ticmark */
X if (text == NULL)
X text = zformat;
X
X (void) sprintf(ticlabel, text, CheckLog(log_z, place));
X if ((*t->justify_text)(RIGHT)) {
X clip_put_text(x3,y3,ticlabel);
X } else {
X clip_put_text(x3-(t->h_char)*(strlen(ticlabel)+1),y3,ticlabel);
X }
}
SHAR_EOF
echo 'File gnuplot/graph3d.c is complete' &&
chmod 0644 gnuplot/graph3d.c ||
echo 'restore of gnuplot/graph3d.c failed'
Wc_c="`wc -c < 'gnuplot/graph3d.c'`"
test 52166 -eq "$Wc_c" ||
echo 'gnuplot/graph3d.c: original size 52166, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.vms ==============
if test -f 'gnuplot/makefile.vms' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.vms (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.vms (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.vms' &&
#
# GNUPLOT Makefile
# for VMS
#
# use with the MAKE that was posted by Tony Ivanov (to...@gvgpvd.GVG.TEK.COM)
# in comp.os.vms on 5 December 1988
#
X
# NOOP NO Optimiser
CFLAGS = /NOOP/define=(NOGAMMA,MEMSET)
X
# /define=(<terminal>) in TERMFLAGS iff you wish to support <terminal>
# see other terminal defines in term.h
X
TERMFLAGS =
X
OBJS = bitmap.obj,command.obj,contour.obj,eval.obj,graphics.obj,graph3d.obj, \
X internal.obj,misc.obj,parse.obj,plot.obj,scanner.obj,setshow.obj, \
X standard.obj,term.obj,util.obj,version.obj
X
CSOURCE1 = command.c setshow.c
CSOURCE2 = help.c graphics.c graph3d.c internal.c
CSOURCE3 = misc.c eval.c parse.c plot.c scanner.c standard.c
CSOURCE4 = bitmap.c term.c util.c version.c
CSOURCE5 = [.term]aed.trm [.term]cgi.trm [.term]dumb.trm [.term]dxf.trm [.term]dxy.trm \
X [.term]eepic.trm [.term]epson.trm [.term]fig.trm [.term]hp26.trm \
X [.term]hp2648.trm [.term]hpgl.trm [.term]hpljii.trm
CSOURCE6 = [.term]impcodes.h [.term]imagen.trm [.term]object.h \
X [.term]iris4d.trm [.term]kyo.trm [.term]latex.trm [.term]pc.trm
CSOURCE7 = [.term]post.trm [.term]qms.trm [.term]regis.trm [.term]sun.trm \
X [.term]t410x.trm [.term]tek.trm [.term]unixpc.trm [.term]unixplot.trm \
X [.term]v384.trm [.term]x11.trm gnuplot_x11.c
CSOURCE8 = contour.c
X
all : gnuplot.exe gnuplot.hlp gnuplot.hlb
X
X
gnuplot.exe : $(OBJS)
X link /exe=gnuplot $(OBJS) ,linkopt.vms/opt
X
gnuplot.hlp : doc2hlp.exe [.docs]gnuplot.doc [.docs]doc2hlp.com
X $$@[.docs]doc2hlp.com
X
gnuplot.hlb : gnuplot.hlp
X library/create/help gnuplot.hlb gnuplot.hlp
X
doc2hlp.exe: [.docs]doc2hlp.c
X cc [.docs]doc2hlp.c
X link doc2hlp,linkopt.vms/opt
X
term.obj: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X $(CC) $(CFLAGS) $(TERMFLAGS) term.c
X
$(OBJS): plot.h
X
command.obj help.obj misc.obj: help.h
X
command.obj graphics.obj graph3d.obj misc.obj plot.obj setshow.obj term.obj: setshow.h
X
bitmap.obj term.obj: bitmap.h
X
clean :
X purge/log
X del/log *.obj;*
SHAR_EOF
chmod 0644 gnuplot/makefile.vms ||
echo 'restore of gnuplot/makefile.vms failed'
Wc_c="`wc -c < 'gnuplot/makefile.vms'`"
test 1998 -eq "$Wc_c" ||
echo 'gnuplot/makefile.vms: original size 1998, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/util.c ==============
if test -f 'gnuplot/util.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/util.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/util.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/util.c' &&
/* GNUPLOT - util.c */
#include <ctype.h>
#include <setjmp.h>
#include <stdio.h>
#include <errno.h>
#include "plot.h"
X
BOOLEAN screen_ok;
X /* TRUE if command just typed; becomes FALSE whenever we
X send some other output to screen. If FALSE, the command line
X will be echoed to the screen before the ^ error message. */
X
#ifndef vms
#ifndef __ZTC__
extern int errno;
extern int sys_nerr;
extern char *sys_errlist[];
#endif
#endif /* vms */
X
extern char input_line[];
extern struct lexical_unit token[];
extern jmp_buf env; /* from plot.c */
extern int inline_num; /* from command.c */
extern BOOLEAN interactive; /* from plot.c */
extern char *infile_name; /* from plot.c */
X
extern char *strchr();
X
#ifndef AMIGA_AC_5
extern double sqrt(), atan2();
#endif
X
/*
X * chr_in_str() compares the characters in the string of token number t_num
X * with c, and returns TRUE if a match was found.
X */
chr_in_str(t_num, c)
int t_num;
char c;
{
register int i;
X
X if (!token[t_num].is_token)
X return(FALSE); /* must be a value--can't be equal */
X for (i = 0; i < token[t_num].length; i++) {
X if (input_line[token[t_num].start_index+i] == c)
X return(TRUE);
X }
X return FALSE;
}
X
X
/*
X * equals() compares string value of token number t_num with str[], and
X * returns TRUE if they are identical.
X */
equals(t_num, str)
int t_num;
char *str;
{
register int i;
X
X if (!token[t_num].is_token)
X return(FALSE); /* must be a value--can't be equal */
X for (i = 0; i < token[t_num].length; i++) {
X if (input_line[token[t_num].start_index+i] != str[i])
X return(FALSE);
X }
X /* now return TRUE if at end of str[], FALSE if not */
X return(str[i] == '\0');
}
X
X
X
/*
X * almost_equals() compares string value of token number t_num with str[], and
X * returns TRUE if they are identical up to the first $ in str[].
X */
almost_equals(t_num, str)
int t_num;
char *str;
{
register int i;
register int after = 0;
register start = token[t_num].start_index;
register length = token[t_num].length;
X
X if (!token[t_num].is_token)
X return(FALSE); /* must be a value--can't be equal */
X for (i = 0; i < length + after; i++) {
X if (str[i] != input_line[start + i]) {
X if (str[i] != '$')
X return(FALSE);
SHAR_EOF
true || echo 'restore of gnuplot/util.c failed'
fi
echo 'End of part 21'
echo 'File gnuplot/util.c is continued in part 22'
echo 22 > _shar_seq_.tmp
#!/bin/sh
# this is Part.22 (part 22 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/util.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 22; 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/util.c'
else
echo 'x - continuing file gnuplot/util.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/util.c' &&
X else {
X after = 1;
X start--; /* back up token ptr */
X }
X }
X }
X
X /* i now beyond end of token string */
X
X return(after || str[i] == '$' || str[i] == '\0');
}
X
X
X
isstring(t_num)
int t_num;
{
X
X return(token[t_num].is_token &&
X (input_line[token[t_num].start_index] == '\'' ||
X input_line[token[t_num].start_index] == '\"'));
}
X
X
isnumber(t_num)
int t_num;
{
X return(!token[t_num].is_token);
}
X
X
isletter(t_num)
int t_num;
{
X return(token[t_num].is_token &&
X (isalpha(input_line[token[t_num].start_index])));
}
X
X
/*
X * is_definition() returns TRUE if the next tokens are of the form
X * identifier =
X * -or-
X * identifier ( identifer ) =
X */
is_definition(t_num)
int t_num;
{
X return (isletter(t_num) &&
X (equals(t_num+1,"=") || /* variable */
X (equals(t_num+1,"(") && /* function */
X isletter(t_num+2) &&
X equals(t_num+3,")") &&
X equals(t_num+4,"=") ) ||
X (equals(t_num+1,"(") && /* function with */
X isletter(t_num+2) && /* two variables */
X equals(t_num+3,",") &&
X isletter(t_num+4) &&
X equals(t_num+5,")") &&
X equals(t_num+6,"=") )
X ));
}
X
X
X
/*
X * copy_str() copies the string in token number t_num into str, appending
X * a null. No more than MAX_ID_LEN chars are copied.
X */
copy_str(str, t_num)
char str[];
int t_num;
{
register int i = 0;
register int start = token[t_num].start_index;
register int count;
X
X if ((count = token[t_num].length) > MAX_ID_LEN)
X count = MAX_ID_LEN;
X do {
X str[i++] = input_line[start++];
X } while (i != count);
X str[i] = '\0';
}
X
X
/*
X * quote_str() does the same thing as copy_str, except it ignores the
X * quotes at both ends. This seems redundant, but is done for
X * efficency.
X */
quote_str(str, t_num)
char str[];
int t_num;
{
register int i = 0;
register int start = token[t_num].start_index + 1;
register int count;
X
X if ((count = token[t_num].length - 2) > MAX_ID_LEN)
X count = MAX_ID_LEN;
X if (count>0) {
X do {
X str[i++] = input_line[start++];
X } while (i != count);
X }
X str[i] = '\0';
}
X
X
/*
X * quotel_str() does the same thing as quote_str, except it uses
X * MAX_LINE_LEN instead of MAX_ID_LEN.
X */
quotel_str(str, t_num)
char str[];
int t_num;
{
register int i = 0;
register int start = token[t_num].start_index + 1;
register int count;
X
X if ((count = token[t_num].length - 2) > MAX_LINE_LEN)
X count = MAX_LINE_LEN;
X if (count>0) {
X do {
X str[i++] = input_line[start++];
X } while (i != count);
X }
X str[i] = '\0';
}
X
X
/*
X * capture() copies into str[] the part of input_line[] which lies between
X * the begining of token[start] and end of token[end].
X */
capture(str,start,end)
char str[];
int start,end;
{
register int i,e;
X
X e = token[end].start_index + token[end].length;
X for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
X *str++ = input_line[i];
X *str = '\0';
}
X
X
/*
X * m_capture() is similar to capture(), but it mallocs storage for the
X * string.
X */
m_capture(str,start,end)
char **str;
int start,end;
{
register int i,e;
register char *s;
X
X if (*str) /* previous pointer to malloc'd memory there */
X free(*str);
X e = token[end].start_index + token[end].length;
X *str = alloc((unsigned int)(e - token[start].start_index + 1), "string");
X s = *str;
X for (i = token[start].start_index; i < e && input_line[i] != '\0'; i++)
X *s++ = input_line[i];
X *s = '\0';
}
X
X
/*
X * m_quote_capture() is similar to m_capture(), but it removes
X quotes from either end if the string.
X */
m_quote_capture(str,start,end)
char **str;
int start,end;
{
register int i,e;
register char *s;
X
X if (*str) /* previous pointer to malloc'd memory there */
X free(*str);
X e = token[end].start_index + token[end].length-1;
X *str = alloc((unsigned int)(e - token[start].start_index + 1), "string");
X s = *str;
X for (i = token[start].start_index + 1; i < e && input_line[i] != '\0'; i++)
X *s++ = input_line[i];
X *s = '\0';
}
X
X
convert(val_ptr, t_num)
struct value *val_ptr;
int t_num;
{
X *val_ptr = token[t_num].l_val;
}
X
static char *num_to_str(r)
double r;
{
X static i = 0;
X static char s[4][20];
X int j = i++;
X
X if ( i > 3 ) i = 0;
X
X sprintf( s[j], "%g", r );
X if ( strchr( s[j], '.' ) == NULL &&
X strchr( s[j], 'e' ) == NULL &&
X strchr( s[j], 'E' ) == NULL )
X strcat( s[j], ".0" );
X
X return s[j];
}
X
disp_value(fp,val)
FILE *fp;
struct value *val;
{
X switch(val->type) {
X case INT:
X fprintf(fp,"%d",val->v.int_val);
X break;
X case CMPLX:
X if (val->v.cmplx_val.imag != 0.0 )
X fprintf(fp,"{%s, %s}",
X num_to_str(val->v.cmplx_val.real),
X num_to_str(val->v.cmplx_val.imag));
X else
X fprintf(fp,"%s",
X num_to_str(val->v.cmplx_val.real));
X break;
X default:
X int_error("unknown type in disp_value()",NO_CARET);
X }
}
X
X
double
real(val) /* returns the real part of val */
struct value *val;
{
X switch(val->type) {
X case INT:
X return((double) val->v.int_val);
X case CMPLX:
X return(val->v.cmplx_val.real);
X }
X int_error("unknown type in real()",NO_CARET);
X /* NOTREACHED */
X return((double)0.0);
}
X
X
double
imag(val) /* returns the imag part of val */
struct value *val;
{
X switch(val->type) {
X case INT:
X return(0.0);
X case CMPLX:
X return(val->v.cmplx_val.imag);
X }
X int_error("unknown type in imag()",NO_CARET);
X /* NOTREACHED */
X return((double)0.0);
}
X
X
X
double
magnitude(val) /* returns the magnitude of val */
struct value *val;
{
X switch(val->type) {
X case INT:
X return((double) abs(val->v.int_val));
X case CMPLX:
X return(sqrt(val->v.cmplx_val.real*
X val->v.cmplx_val.real +
X val->v.cmplx_val.imag*
X val->v.cmplx_val.imag));
X }
X int_error("unknown type in magnitude()",NO_CARET);
X /* NOTREACHED */
X return((double)0.0);
}
X
X
X
double
angle(val) /* returns the angle of val */
struct value *val;
{
X switch(val->type) {
X case INT:
X return((val->v.int_val > 0) ? 0.0 : Pi);
X case CMPLX:
X if (val->v.cmplx_val.imag == 0.0) {
X if (val->v.cmplx_val.real >= 0.0)
X return(0.0);
X else
X return(Pi);
X }
X return(atan2(val->v.cmplx_val.imag,
X val->v.cmplx_val.real));
X }
X int_error("unknown type in angle()",NO_CARET);
X /* NOTREACHED */
X return((double)0.0);
}
X
X
struct value *
complex(a,realpart,imagpart)
struct value *a;
double realpart, imagpart;
{
X a->type = CMPLX;
X a->v.cmplx_val.real = realpart;
X a->v.cmplx_val.imag = imagpart;
X return(a);
}
X
X
struct value *
integer(a,i)
struct value *a;
int i;
{
X a->type = INT;
X a->v.int_val = i;
X return(a);
}
X
X
X
os_error(str,t_num)
char str[];
int t_num;
{
#ifdef vms
static status[2] = {1, 0}; /* 1 is count of error msgs */
#endif
X
register int i;
X
X /* reprint line if screen has been written to */
X
X if (t_num != NO_CARET) { /* put caret under error */
X if (!screen_ok)
X fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
X
X for (i = 0; i < sizeof(PROMPT) - 1; i++)
X (void) putc(' ',stderr);
X for (i = 0; i < token[t_num].start_index; i++) {
X (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
X }
X (void) putc('^',stderr);
X (void) putc('\n',stderr);
X }
X
X for (i = 0; i < sizeof(PROMPT) - 1; i++)
X (void) putc(' ',stderr);
X fprintf(stderr,"%s\n",str);
X
X for (i = 0; i < sizeof(PROMPT) - 1; i++)
X (void) putc(' ',stderr);
X if (!interactive)
X if (infile_name != NULL)
X fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
X else
X fprintf(stderr,"line %d: ", inline_num);
X
X
#ifdef vms
X status[1] = vaxc$errno;
X sys$putmsg(status);
X (void) putc('\n',stderr);
#else
#ifdef __ZTC__
X fprintf(stderr,"error number %d\n\n",errno);
#else
X if (errno >= sys_nerr)
X fprintf(stderr, "unknown errno %d\n\n", errno);
X else
X fprintf(stderr,"(%s)\n\n",sys_errlist[errno]);
#endif
#endif
X
X longjmp(env, TRUE); /* bail out to command line */
}
X
X
int_error(str,t_num)
char str[];
int t_num;
{
register int i;
X
X /* reprint line if screen has been written to */
X
X if (t_num != NO_CARET) { /* put caret under error */
X if (!screen_ok)
X fprintf(stderr,"\n%s%s\n", PROMPT, input_line);
X
X for (i = 0; i < sizeof(PROMPT) - 1; i++)
X (void) putc(' ',stderr);
X for (i = 0; i < token[t_num].start_index; i++) {
X (void) putc((input_line[i] == '\t') ? '\t' : ' ',stderr);
X }
X (void) putc('^',stderr);
X (void) putc('\n',stderr);
X }
X
X for (i = 0; i < sizeof(PROMPT) - 1; i++)
X (void) putc(' ',stderr);
X if (!interactive)
X if (infile_name != NULL)
X fprintf(stderr,"\"%s\", line %d: ", infile_name, inline_num);
X else
X fprintf(stderr,"line %d: ", inline_num);
X fprintf(stderr,"%s\n\n", str);
X
X longjmp(env, TRUE); /* bail out to command line */
}
X
/* Lower-case the given string (DFK) */
/* Done in place. */
void
lower_case(s)
X char *s;
{
X register char *p = s;
X
X while (*p != '\0') {
X if (isupper(*p))
X *p = tolower(*p);
X p++;
X }
}
X
/* Squash spaces in the given string (DFK) */
/* That is, reduce all multiple white-space chars to single spaces */
/* Done in place. */
void
squash_spaces(s)
X char *s;
{
X register char *r = s; /* reading point */
X register char *w = s; /* writing point */
X BOOLEAN space = FALSE; /* TRUE if we've already copied a space */
X
X for (w = r = s; *r != '\0'; r++) {
X if (isspace(*r)) {
X /* white space; only copy if we haven't just copied a space */
X if (!space) {
X space = TRUE;
X *w++ = ' ';
X } /* else ignore multiple spaces */
X } else {
X /* non-space character; copy it and clear flag */
X *w++ = *r;
X space = FALSE;
X }
X }
X *w = '\0'; /* null terminate string */
}
X
SHAR_EOF
echo 'File gnuplot/util.c is complete' &&
chmod 0644 gnuplot/util.c ||
echo 'restore of gnuplot/util.c failed'
Wc_c="`wc -c < 'gnuplot/util.c'`"
test 12714 -eq "$Wc_c" ||
echo 'gnuplot/util.c: original size 12714, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.unx ==============
if test -f 'gnuplot/makefile.unx' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.unx (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.unx (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.unx' &&
############################################################
#
# GNUPLOT 3.0 Makefile (Unix X11 Motif/Athena support) for
# Apollo/Sun/Dec5000/IBMrs6000/HP9000/SGI/3B1/386IX
#
# Original version by:
# oliv...@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA)
# Wed, 3 Jul 91 14:31:37 -0400
#
#>>> Customizing: You must customize part of this makefile for your site.
#>>> Then type 'make' for further instructions.
#>>> Customization instructions look like these lines do (#>>>).
#
X
TARGET = All # What to make by default
X
############################################################
#>>> Decide where the binaries and manuals will go.
# directory where to install executables on 'make install'
DEST=/usr/local/bin
# directory for installing man page on 'make man_install'.
MANDEST=/usr/man/manl
# where to install help file gnuplot.gih
HELPDEST=/usr/local/lib/gnuplot.gih
#HELPDEST=docs/gnuplot.gih
# Where to send email about bugs and comments (locally)
EMAIL=bug-gnuplot%pixar...@sun.com
X
############################################################
#>>> Choose your C compiler and basic compiler flags.
CC = cc # the C compiler
COPTS = -O # -O if you trust your compiler's optimizer
LD =$(CC) $(CFLAGS) # default loading command
X
############################################################
#>>> Choose some optional features.
#>>> At this point there are only two optional features:
# READLINE:
# If READLINE is defined, then command-line editing is supported.
# Otherwise, your normal terminal editing is all you get.
# Some machines will not support this, and they will turn this
# option off (for example, apollos running SR10.2 or SR10.3 and
# loaded with BSD4.3 instead of SYS5).
# NOCWDRC:
# If NOCWDRC is defined, then any .gnuplot in the current directory
# is not read on startup. This is a security consideration
# especially for root users ( we recommend you define -DNOCWDRC ).
OPTIONS = -DREADLINE -DNOCWDRC
X
#>>> Optionally install the lasergnu script.
# Lasergnu is a handy shell script for creating a plot from the
# command line and sending it directly to the printer. It currently
# supports postscript and imagen printers, and probably would need
# tailoring to your site.
# Use lasergnu_install to install lasergnu.
# Use lasergnu_noinstall to not install lasergnu (default).
LASERGNU = lasergnu_noinstall
X
############################################################
# X11 support
#
X
#>>> List your X11 libraries#
# standard MIT X11 R4: -lXaw -lXmu -lXt -lXext -lX11
# Apollo DomainOS 10.3 (R3/Athena): -L/usr/lib/X11 -lXaw -lXmu -lXt -lX11
# Apollo DomainOS 10.3 (R3/Motif): -L/usr/lib/X11 -lXm -lXtm -lX11
# IBM RS/6000 AIX 3.1 (R3/Athena): -L/usr/lpp/X11/Xamples/lib/Xmu \
# -L/usr/lpp/X11/Xamples/lib/Xaw \
# -lXaw -lXmu -lXt -lXext -lX11
# IBM RS/6000 AIX 3.1 (R3/Motif): -lXm -lXt -lX11
# HP 9000/375 HP-UX 6.5 and 7.0 (R3/Motif): -lXm -lXt -lX11
# Interactive 386/ix with T.Roell X386 and network support:
# -lXaw -lXm -lXt -lXext -lX11 -linet -lpt
XX11LIBS = -lXaw -lXmu -lXt -lXext -lX11
X
#>>> List your X11 include directories
# standard MIT X11 R4: -I/usr/include/X11 -I/usr/include/X11/Xaw
# Apollo DomainOS 10.3 (R3/Athena): -I/usr/include/X11
# Apollo DomainOS 10.3 (R3/Motif): -I/usr/include/Xm
# IBM RS/6000 AIX 3.1 (R3/Athena): -I/usr/include/X11 \
# -I/usr/lpp/X11/Xamples/lib/Xaw \
# -I/usr/lpp/X11/Xamples/lib/Xaw/X11
# IBM RS/6000 AIX 3.1 (R3/Motif): -I/usr/include/Xm
# HP 9000/375 HP-UX 6.5 and 7.0 (R3/Motif): -I/usr/include/Xm
# HP 9000/700 HP-UX 8.0 (R4): -I/usr/include/X11R4 \
# -I/usr/include/X11R4/X11/Xaw
XX11INCLUDES = -I/usr/include/X11 -I/usr/include/X11/Xaw
X
#>>> You shouldn't have to change these, since they are controlled by
#>>> Machine dependent definitions below.
# Compile option for plot.c and TERMFLAGS, to include X11 support
PLOTXFLAG = -DX11
# this can add to CFLAGS for X11 compilations. Probably needs no change.
XX11FLAGS =
# make gnuplot_x11 by default
GNUPLOT_X11 = gnuplot_x11
# install gnuplot_x11 by default
XX11INSTALL = x11_install
X
############################################################
#>>> Okay, you've changed enough. Now type 'make'.
X
############################################################
# This is used to pass many of the above definitions to make
# subprocesses. Don't change this.
MY_FLAGS = CC="$(CC)" COPTS="$(COPTS)" DEST="$(DEST)" \
X MANDEST="$(MANDEST)" HELPDEST="$(HELPDEST)" \
X EMAIL="$(EMAIL)" LASERGNU="$(LASERGNU)"
X
############################################################
# Explanations of CFLAGS definitions.
# These should not need to be changed by you.
# They are set correctly for each machine below. If your machine
# doesn't fit the one of the patterns, override on the make command
# line or make a new target for it and a new _FLAGS definition.
# -DNOVFORK if you're unix and you have don't have vfork()
# -DMEMSET if you need to use memset() instead of bzero()
# -DMEMCPY if your bcopy() is called memcpy()
# -DNOCOPY if you don't have a memcpy() by any name
# -DGAMMA=foo if your gamma function is called foo(). Apollos have
# lgamma(3m). If you don't have gamma(), use -DNOGAMMA.
# The default is -DGAMMA=gamma.
# -DGETCWD if your unix uses getcwd() instead of getcd()
# this is needed by HP-UX and Cray Unicos systems.
# -DULTRIX_KLUDGE if you run X windows on Ultrix and experience the
# "every other plot" problem.
# -Dunix is required to explicitly define "unix" for SCO and IBM
# RS/6000 running AIX 3.1
# -fswitch if you are compiling on a Sun3 (or even -f68881)
# (but -fswitch is buggy on some systems, so watch out)
X
# Defaults in case the user types 'make All' directly
# Should match X11R4_FLAGS's CFLAGS definition
CFLAGS = $(COPTS) $(OPTIONS)
X
############################################################
# Terminal (device) support
#
# All devices available to a given machine are compiled in by default.
# This documents the flags available in TERMFLAGS, although TERMFLAGS
# is usually controlled by the machine-dependent definitions below.
# See other terminal defines in term.h.
# Define ULTRIX_KLUDGE if you have the every-other plot problem in Ultrix X11.
#
# -DAPOLLO Apollo Graphics Primitive Resource (window resize after replot)
# -DGPR Apollo Graphics Primitive Resource (fixed-size window)
# -DCGI SCO CGI
# -DIRIS4D IRIS4D series computer
# -DSUN Sun Microsystems Workstation
# -DUNIXPC unixpc (ATT 3b1 or ATT 7300)
# -DUNIXPLOT unixplot
# -DX11 X11 Window System (This is $(PLOTXFLAG))
TERMFLAGS = -Iterm -DUNIXPLOT $(PLOTXFLAG)
X
############################################################
# Library explanations.
# You shouldn't need to adjust this; again, it is handled by the
# machine-dependent definitions below.
#
# -lplot if you have -DUNIXPLOT in TERMFLAGS
# -lsuntool -lsunwindow -lpixrect if you have -DSUN in TERMFLAGS
# -lgl_s if -DIRIS4D in TERMFLAGS
# -lccgi if -DCGI in TERMFLAGS
LIBS = -lm -lplot
X
############################################################
# Machine-dependent settings.
#
XX11R4_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
X X11LIBS="$(X11LIBS)" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS)"
X
XX11R4_M_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="$(LIBS)" X11FLAGS="-DMOTIF -D_NO_PROTO" \
X X11INCLUDES="-I/usr/include/Xm" \
X X11LIBS="-lXm -lXt -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS)"
X
DEC_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) " \
X LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
X X11LIBS="$(X11LIBS)" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS) -DULTRIX_KLUDGE"
X
DEC_M_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="$(LIBS)" X11FLAGS="-DMOTIF -D_NO_PROTO" \
X X11INCLUDES="-I/usr/include/Xm" \
X X11LIBS="-lXm -lXt -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS) -DULTRIX_KLUDGE"
X
APOLLO_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=lgamma" \
X LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" \
X X11INCLUDES="-I/usr/include/X11" \
X X11LIBS="-L/usr/lib/X11 -lXaw -lXmu -lXt -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS) -DAPOLLO -DGPR"
X
APOLLO_M_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DGAMMA=lgamma" \
X LIBS="$(LIBS)" X11FLAGS="-DMOTIF" X11INCLUDES="-I/usr/include/Xm" \
X X11LIBS="-L/usr/lib/X11 -lXm -lXt -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X TERMFLAGS="$(TERMFLAGS) -DAPOLLO -DGPR"
X
HP_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DMEMSET -DMEMCPY -DGETCWD" \
X LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
X X11INCLUDES="-I/usr/include/X11R4 -I/usr/include/X11R4/X11/Xaw" \
X X11LIBS="-L/usr/lib/X11R4 -lXaw -lXmu -lXt -lXext -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="-Iterm -DX11"
X
SUN_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="-lsuntool -lsunwindow -lpixrect $(LIBS)" \
X X11FLAGS=" " X11INCLUDES=" " \
X X11LIBS=" " \
X PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
X TERMFLAGS="-Iterm -DUNIXPLOT -DSUN"
X
SUN_X11_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="-lsuntool -lsunwindow -lpixrect $(LIBS)" \
X X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
X X11LIBS="$(X11LIBS)" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS) -DSUN"
X
SGI_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="-lgl_s -lm" X11FLAGS=" " X11INCLUDES=" " \
X X11LIBS=" " \
X PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
X TERMFLAGS="-Iterm -DIRIS4D"
X
SGIX11_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS)" \
X LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
X X11INCLUDES="-I/usr/include/X11 -I/usr/include/X11/Xaw" \
X X11LIBS="-L/usr/lib/X11 -lXaw -lXmu -lXt -lXext -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="-Iterm -DX11"
X
CGI_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -Dunix" \
X LIBS="-lccgi $(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
X X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
X TERMFLAGS="-Iterm -DUNIXPLOT -DCGI"
X
3B1_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK" \
X LIBS="$(LIBS)" X11FLAGS=" " X11INCLUDES=" " \
X X11LIBS=" " \
X PLOTXFLAG=" " GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
X LD="ld /lib/crt0s.o /lib/shlib.ifile" \
X TERMFLAGS="-Iterm -DUNIXPC"
X
386IX_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
X LIBS="$(LIBS) -lcposix" X11FLAGS=" " X11INCLUDES=" " \
X X11LIBS=" " PLOTXFLAG=" " GNUPLOT_X11=" " \
X X11INSTALL=x11_noinstall \
X TERMFLAGS="-Iterm -DUNIXPLOT"
386IX_X11_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -DGETCWD -DMEMSET -DMEMCPY -DNOVFORK -DTCSETSW -DTCGETS" \
X LIBS="$(LIBS) -lcposix" X11FLAGS="$(X11FLAGS)" X11INCLUDES="$(X11INCLUDES)" \
X X11LIBS="$(X11LIBS)" PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11="$(GNUPLOT_X11)" \
X X11INSTALL= "$(X11INSTALL)" \
X TERMFLAGS="-Iterm -DUNIXPLOT -DX11"
X
AIX_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -Dunix -DNOVFORK" \
X LIBS="$(LIBS)" X11FLAGS="$(X11FLAGS)" \
X X11INCLUDES="-I/usr/include/X11 -I/usr/lpp/X11/Xamples/lib/Xaw -I/usr/lpp/X11/Xamples/lib/Xaw/X11" \
X X11LIBS="-L/usr/lpp/X11/Xamples/lib/Xmu -L/usr/lpp/X11/Xamples/lib/Xaw -lXaw -lXmu -lXt -lXext -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS)"
X
AIX_M_FLAGS = \
X CFLAGS="$(COPTS) $(OPTIONS) -Dunix -DNOVFORK" \
X LIBS="$(LIBS)" X11FLAGS="-DMOTIF" X11INCLUDES="-I/usr/include/Xm" \
X X11LIBS="-lXm -lXt -lX11" \
X PLOTXFLAG="$(PLOTXFLAG)" GNUPLOT_X11=$(GNUPLOT_X11) \
X X11INSTALL="$(X11INSTALL)" \
X TERMFLAGS="$(TERMFLAGS)"
X
NEXT_FLAGS = \
X CFLAGS="$(COPTS) -DNOCWDRC -DGAMMA=lgamma -DNEXT" \
X LIBS="-lm" X11FLAGS="$(X11FLAGS)" \
X X11INCLUDES=" " X11LIBS=" " PLOTXFLAG=" " \
X GNUPLOT_X11=" " X11INSTALL=x11_noinstall \
X TERMFLAGS="-Iterm"
X
####################################################################
# List of object files except version.o
OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
X internal.o misc.o parse.o plot.o readline.o scanner.o \
X setshow.o standard.o term.o util.o
####################################################################
# List of source files
# Used for makeing shar files, lint, and some dependencies.
DIRS = term demo docs docs/latextut
X
CSOURCE1 = command.c setshow.c
CSOURCE2 = help.c graphics.c graph3d.c internal.c
CSOURCE3 = misc.c eval.c parse.c plot.c readline.c scanner.c standard.c
CSOURCE4 = bitmap.c term.c util.c version.c
CSOURCE5 = term/amiga.trm term/aed.trm term/cgi.trm term/dumb.trm term/dxf.trm \
X term/dxy.trm term/eepic.trm term/epson.trm term/fig.trm \
X term/hp26.trm term/hp2648.trm term/hpgl.trm term/hpljii.trm \
X term/apollo.trm term/gpr.trm
CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
X term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm
CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
X term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
X term/v384.trm term/x11.trm term/bigfig.trm term/vws.trm gnuplot_x11.c
CSOURCE8 = contour.c
# not C code, but still needed
X
DEMOS = demo/1.dat demo/2.dat demo/3.dat demo/contours.demo demo/controls.demo \
X demo/electron.demo demo/glass.dat demo/param.demo demo/polar.demo \
X demo/simple.demo demo/surface1.demo demo/surface2.demo demo/using.dat \
X demo/using.demo demo/world.cor demo/world.dat demo/world.demo \
X demo/err.dat demo/poldat.demo demo/polar.dat demo/errorbar.demo \
X demo/antenna.dat demo/all.demo demo/bivariat.demo
X
ETC = Copyright README README.gnutex README.amiga makefile.unx makefile.vms \
X linkopt.amg makefile.amg makefile.ami linkopt.vms buildvms.com \
X plot.h help.h setshow.h bitmap.h term.h lasergnu \
X term/README History gnuplot.el Intergraph.x11 README.Install
X
#BETA files (not standard distribution files)
BETA = BETA10
# PC-specific files
PC = corgraph.asm corplot.c header.mac hrcgraph.asm lineproc.mac \
X linkopt.msc linkopt.tc linkopt.tco makefile.msc makefile.tc \
X pcgraph.asm
X
# Documentation and help files
DOCS1 = docs/Makefile docs/README docs/checkdoc.c docs/doc2gih.c \
X docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
X docs/gnuplot.1 docs/lasergnu.1 docs/toc_entry.sty \
X docs/titlepage.ms docs/titlepage.tex docs/Makefile.ami
DOCS2 = docs/gnuplot.doc
DOCS3 = docs/latextut/Makefile docs/latextut/eg1.plt \
X docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
X docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
X docs/latextut/header.tex docs/latextut/tutorial.tex \
X docs/latextut/linepoint.plt
X
#########################################################################
# Default target (informational)
info:
X @echo "Please do a 'make <MACHINE>' where <MACHINE> is one of the following:"
X @echo
X @echo "apollo, apollo_motif for Apollo running SR10.3 with Apollo's X11R3"
X @echo "dec, dec_motif for Dec3100/5000 running Ultrix 3.1d with MIT's X11R4"
X @echo "hp for HP/9000 700 series running HP/UX 8.0 with MIT's X11R4"
X @echo "sun for Sun sparcstation running SunOS 4.1 with suntools (no X11R4) "
X @echo "sun_x11 for Sun sparcstation running SunOS 4.1 with suntools and X11R4 "
X @echo "sgi for Silicon Graphics IRIS4D machines (no X11R4) "
X @echo "sgix11 for Silicon Graphics IRIS4D machines (X11R4) "
X @echo "next for NeXT Cube and Slab running NeXTOS 2.0+ (no X11R4) "
X @echo "3b1 for ATT 3b1 machines (no X11R4) "
X @echo "386ix for 386 machines running 386/ix (no X11)"
X @echo "386ix_x11 for 386 machines running 386/ix with T.Roell X386"
X @echo "ibmrs6000, ibmrs6000_motif for IBM RS/6000 running Aix 3.1 with IBM's X11R3"
X @echo "x11r4, x11r4_motif for a generic machine (like a sun or dec) with MIT's X11R4"
X @echo
X @echo "Examples:"
X @echo
X @echo " make x11r4"
X @echo " make x11r4_motif"
X @echo " make apollo"
X @echo " make apollo OPTIONS='-DNOCWDRC' "
X @echo " make apollo_motif DEST='/usr/um/misc/bin' "
X @echo " make dec"
X @echo " make hp"
X @echo " make next"
X @echo " make sun HELPDEST='/usr/um/misc/lib/gnuplot.gih' "
X @echo " make sun X11INCLUDES='-I/usr/local/include -I/usr/local/include/X11 -I/usr/local/include/X11/Xaw' "
X @echo " make sun_x11"
X @echo " make sgi"
X @echo " make 3b1"
X @echo " make 386ix"
X @echo " make ibmrs6000 MANDEST='/usr/usr/misc/man/man1' COPTS='-O' "
X @echo
X @echo "If you just type 'make All' , it will build gnuplot for Unix X11R4/Athena"
X @echo "and the following variables will be used as default:"
X @echo
X @echo " DEST " $(DEST)
X @echo " MANDEST " $(MANDEST)
X @echo " HELPDEST " $(HELPDEST)
X @echo " EMAIL " $(EMAIL)
X @echo " CC " $(CC)
X @echo " COPTS " $(COPTS)
X @echo " OPTIONS " $(OPTIONS)
X @echo " CFLAGS " $(CFLAGS)
X @echo " LIBS " $(LIBS)
X @echo " X11FLAGS " $(X11FLAGS)
X @echo " X11LIBS " $(X11LIBS)
X @echo " X11INCLUDES " $(X11INCLUDES)
X @echo " TERMFLAGS " $(TERMFLAGS)
X @echo " LASERGNU " $(LASERGNU)
X @echo
X @echo "If you are not familiar with makefiles or just want to know what"
X @echo " 'make <MACHINE>' would do without actually doing anything, then type"
X @echo " 'make <MACHINE> -n' "
X @echo
X
###############################################################
# Targets for each machine
X
x11r4:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(X11R4_FLAGS) $(TARGET)
X
x11r4_motif:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(X11R4_M_FLAGS) $(TARGET)
X
dec:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_FLAGS) $(TARGET)
X
dec_motif:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(DEC_M_FLAGS) $(TARGET)
X
apollo:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(APOLLO_FLAGS) $(TARGET)
X
apollo_motif:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(APOLLO_M_FLAGS) $(TARGET)
X
hp:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(HP_FLAGS) $(TARGET)
X
next:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(NEXT_FLAGS) $(TARGET)
X
sun:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_FLAGS) $(TARGET)
X
sun_x11:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SUN_X11_FLAGS) $(TARGET)
X
sgi:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGI_FLAGS) $(TARGET)
X
sgix11:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(SGIX11_FLAGS) $(TARGET)
X
cgi:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(CGI_FLAGS) $(TARGET)
X
3b1:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(3B1_FLAGS) $(TARGET)
X
386ix:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_FLAGS) $(TARGET)
X
386ix_x11:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(386IX_X11_FLAGS) $(TARGET)
X
ibmrs6000:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIX_FLAGS) $(TARGET)
X
ibmrs6000_motif:
X $(MAKE) $(MFLAGS) $(MY_FLAGS) $(AIX_M_FLAGS) $(TARGET)
X
#############################################################
# Targets that really do something
X
all:
X @echo "Please just type 'make' in order to get some information on "
X @echo "how to build gnuplot under Unix and the X Window System."
X
All: gnuplot $(GNUPLOT_X11) doc
X
gnuplot: $(OBJS) version.o
X $(LD) $(OBJS) version.o $(LIBS) -o gnuplot
X
doc:
X ( cd docs; make $(MFLAGS) gnuplot.gih )
X
gnuplot_x11: gnuplot_x11.c
X $(CC) $(CFLAGS) $(X11FLAGS) $(X11INCLUDES) -o gnuplot_x11 gnuplot_x11.c $(X11LIBS)
X
################################################################
# Installation instructions
X
install:
X @echo
X @echo "Please do a 'make <MACHINE> TARGET=Install' where <MACHINE> is one of the following:"
X @echo
X @echo "apollo, apollo_motif, dec, dec_motif, hp, sun, sun_x11, sgi, sgix11"
X @echo "next, 3b1, 386ix, ibmrs6000, ibmrs6000_motif, x11r4, x11r4_motif"
X @echo
X @echo "Examples:"
X @echo
X @echo " make x11r4 TARGET=Install "
X @echo " make apollo TARGET=Install "
X @echo " make apollo_motif TARGET=Install DEST='/usr/um/misc/bin' "
X @echo " make dec TARGET=Install "
X @echo " make hp TARGET=Install "
X @echo " make sun TARGET=Install HELPDEST='/usr/um/misc/lib/gnuplot.gih' "
X @echo " make ibmrs6000 TARGET=Install MANDEST='/usr/um/misc/man/man1' COPTS='-O' "
X @echo
################################################################
# Installation targets
X
Install: All man_install $(X11INSTALL) $(LASERGNU)
X cp gnuplot $(DEST)
X strip $(DEST)/gnuplot
X (cd docs; make $(MFLAGS) install-unix HELPDEST=$(HELPDEST))
X
x11_install: gnuplot_x11
X cp gnuplot_x11 $(DEST)
X strip $(DEST)/gnuplot_x11
X
x11_noinstall:
X @echo "X11 not requested, so gnuplot_x11 program not installed"
X
man_install: docs/gnuplot.1
X cp docs/gnuplot.1 $(MANDEST)
X
lasergnu_install: lasergnu docs/lasergnu.1
X cp lasergnu $(DEST)
X chmod 755 $(DEST)/lasergnu
X cp docs/lasergnu.1 $(MANDEST)
X
lasergnu_noinstall:
X @echo
X @echo "Lasergnu will not be installed by default."
X @echo "If you think you need the lasergnu script to print"
X @echo " files on the imagen or postscript printers, then"
X @echo " type"
X @echo " 'make <MACHINE> TARGET=Install LASERGNU='lasergnu_install' "
X @echo
X @echo "Lasergnu is really not needed since within gnuplot you can"
X @echo " can create files (in impress or postscript language) and"
X @echo " print them through your favorite print command (lpr, lp, prf, ipr)."
X @echo
X
################################################################
# Dependencies
X
plot.o: plot.c
X $(CC) $(CFLAGS) $(PLOTXFLAG) -c plot.c
X
term.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X $(CC) $(CFLAGS) $(TERMFLAGS) -c term.c
X
version.o:
X $(CC) $(CFLAGS) -DCONTACT=\"$(EMAIL)\" -c version.c
X
$(OBJS): plot.h
X
command.o:
X $(CC) $(CFLAGS) -c command.c -DHELPFILE=\"$(HELPDEST)\"
X
command.o help.o misc.o: help.h
X
command.o graphics.o graph3d.o misc.o plot.o setshow.o term.o: setshow.h
X
bitmap.o term.o: bitmap.h
X
################################################################
# Miscellaneous targets
X
SOURCES=plot.h help.h setshow.h bitmap.h term.h $(CSOURCE1) $(CSOURCE2) \
X $(CSOURCE3) $(CSOURCE4) $(CSOURCE5) $(CSOURCE6) $(CSOURCE7) $(CSOURCE8)
X
lint:
X lint -hx $(SOURCES)
X
clean:
X rm -f *.o *~ *.bak term/*~ term/*.bak
X (cd docs; make $(MFLAGS) clean)
X (cd docs/latextut; make $(MFLAGS) clean)
X
spotless:
X rm -f *.o *~ *.bak term/*~ term/*.bak TAGS gnuplot gnuplot_x11
X (cd docs; make $(MFLAGS) clean)
X (cd docs/latextut; make $(MFLAGS) spotless)
X
################################################################
# Making shar files for mailing gnuplot
X
shar: gnuplot.sh00 gnuplot.sh01 gnuplot.sh02 gnuplot.sh03 gnuplot.sh04 \
X gnuplot.sh05 gnuplot.sh06 gnuplot.sh07 gnuplot.sh08 \
X gnuplot.sh09 gnuplot.sh10 gnuplot.sh11 gnuplot.sh12 \
X gnuplot.sh13 gnuplot.sh14 gnuplot.sh15
X
gnuplot.sh00:
X echo '#!/bin/sh' > gnuplot.sh00
X echo '# This is a shell file to make directories' >> gnuplot.sh00
X echo mkdir $(DIRS) >> gnuplot.sh00
X
gnuplot.sh01: $(ETC)
X shar $(ETC) > gnuplot.sh01
X
gnuplot.sh02: $(DOCS1)
X shar $(DOCS1) > gnuplot.sh02
X
gnuplot.sh03: $(DOCS2)
X shar $(DOCS2) > gnuplot.sh03
X
gnuplot.sh04: $(DOCS3)
X shar $(DOCS3) > gnuplot.sh04
X
gnuplot.sh05: $(CSOURCE1)
X shar $(CSOURCE1) > gnuplot.sh05
X
gnuplot.sh06: $(CSOURCE2)
X shar $(CSOURCE2) > gnuplot.sh06
X
gnuplot.sh07: $(CSOURCE3)
X shar $(CSOURCE3) > gnuplot.sh07
X
gnuplot.sh08: $(CSOURCE4)
X shar $(CSOURCE4) > gnuplot.sh08
X
gnuplot.sh09: $(CSOURCE5)
X shar $(CSOURCE5) > gnuplot.sh09
X
gnuplot.sh10: $(CSOURCE6)
X shar $(CSOURCE6) > gnuplot.sh10
X
gnuplot.sh11: $(CSOURCE7)
X shar $(CSOURCE7) > gnuplot.sh11
X
gnuplot.sh12: $(PC)
X shar $(PC) > gnuplot.sh12
X
gnuplot.sh13: $(CSOURCE8)
X shar $(CSOURCE8) > gnuplot.sh13
X
gnuplot.sh14: $(DEMOS)
X shar $(DEMOS) > gnuplot.sh14
X
gnuplot.sh15: $(BETA)
X shar $(BETA) > gnuplot.sh15
X
SHAR_EOF
chmod 0644 gnuplot/makefile.unx ||
echo 'restore of gnuplot/makefile.unx failed'
Wc_c="`wc -c < 'gnuplot/makefile.unx'`"
test 25357 -eq "$Wc_c" ||
echo 'gnuplot/makefile.unx: original size 25357, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/pcgraph.asm ==============
if test -f 'gnuplot/pcgraph.asm' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/pcgraph.asm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/pcgraph.asm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/pcgraph.asm' &&
TITLE PC graphics module
; uses LINEPROC.MAC
X
; Michael Gordon - 8-Dec-86
;
; Certain routines were taken from the Hercules BIOS of Dave Tutelman - 8/86
; Others came from pcgraph.asm included in GNUPLOT by Colin Kelley
;
; modified slightly by Colin Kelley - 22-Dec-86
; added header.mac, parameterized declarations
; added dgroup: in HVmodem to reach HCh_Parms and HGr_Parms - 30-Jan-87
;
; modified and added to for use in plot(3) routines back end.
; Gil Webster.
;
; Assemble with masm ver. 4.
X
include header.mac
X
if1
include lineproc.mac
endif
X
GPg1_Base equ 0B800h ; Graphics page 1 base address
X
X extrn _inter:far
X
_text segment
X
X public _PC_line, _PC_color, _PC_mask, _PC_curloc, _PC_puts, _Vmode
X public _erase, _save_stack, _ss_interrupt
X
pcpixel proc near
X ror word ptr linemask,1
X jc cont
X ret
cont:
X push ax
X push bx
X push cx
X push dx
X push bp
X mov cx,ax ; x
X mov dx,bx ; y
X mov ah,0ch ; ah = write pixel
X mov al,byte ptr color
X
X mov bh, 0 ; page 0
X int 10h
X pop bp
X pop dx
X pop cx
X pop bx
X pop ax
X ret
pcpixel endp
X
lineproc _PC_line, pcpixel
X
;
; erase - clear page 1 of the screen buffer to zero (effectively, blank
; the screen)
;
beginproc _erase
X push es
X push ax
X push cx
X push di
X mov ax, GPg1_Base
X mov es, ax
X xor di, di
X mov cx, 4000h
X xor ax, ax
X cld
X rep stosw ; zero out screen page
X pop di
X pop cx
X pop ax
X pop es
X ret
_erase endp
X
beginproc _PC_color
X push bp
X mov bp,sp
X mov al,[bp+X] ; color
X mov byte ptr color,al
X pop bp
X ret
_PC_color endp
X
beginproc _PC_mask
X push bp
X mov bp,sp
X mov ax,[bp+X] ; mask
X mov word ptr linemask,ax
X pop bp
X ret
_PC_mask endp
X
beginproc _Vmode
X push bp
X mov bp,sp
X push si
X push di
X mov ax,[bp+X]
X int 10h
X pop di
X pop si
X pop bp
X ret
_Vmode endp
X
beginproc _PC_curloc
X push bp
X mov bp,sp
X mov dh, byte ptr [bp+X] ; row number
X mov dl, byte ptr [bp+X+2] ; col number
X mov bh, 0
X mov ah, 2
X int 10h
X pop bp
X ret
_PC_curloc endp
X
;
; thanks to watale!broehl for finding a bug here--I wasn't pushing BP
; and reloading AH before INT 10H, which is necessary on genuine IBM
; boards...
;
beginproc _PC_puts
X push bp
X mov bp,sp
X push si
X mov bl,byte ptr color
X mov si,[bp+X] ; offset
X
ifdef LARGE_DATA
X mov es,[bp+X+2] ; segment if large or compact data model
endif
X
puts2:
X
ifdef LARGE_DATA
X mov al,es:[si]
else
X mov al,[si]
endif
X or al,al
X jz puts3
X mov ah,0eh ; write TTY char
X int 10h
X inc si
X jmp short puts2
puts3: pop si
X pop bp
X ret
_PC_puts endp
X
X
; int kbhit();
; for those without MSC 4.0
; Use BIOS interrupt 16h to determine if a key is waiting in the buffer.
; Return nonzero if so.
;
X
beginproc _kbhit
X mov ah, 1 ; function code 1 is keyboard test
X int 16h ; keyboard functions
X jnz kbfin ; Exit if char available
X xor ax, ax ; No char: return zero.
kbfin: ret
_kbhit endp
X
X
; _save_stack and _ss_interrupt are needed due to a bug in the MSC 4.0
; code when run under MS-DOS 3.x. Starting with 3.0, MS-DOS automatically
; switches to an internal stack during system calls. This leaves SS:SP
; pointing at MS-DOS's stack when the ^C interrupt (INT 23H) is triggered.
; MSC should restore its own stack before calling the user signal() routine,
; but it doesn't.
;
; Presumably this code will be unnecessary in later releases of the compiler.
;
X
; _save_stack saves the current SS:SP to be loaded later by _ss_interrupt.
;
X
beginproc _save_stack
X mov ax,ss
X mov cs:save_ss,ax
X mov ax,sp
X mov cs:save_sp,ax
X ret
_save_stack endp
X
X
; _ss_interrupt is called on ^C (INT 23H). It restores SS:SP as saved in
; _save_stack and then jumps to the C routine interrupt().
;
beginproc _ss_interrupt
X cli ; no interrupts while the stack is changed!
X mov ax,-1 ; self-modifying code again
save_ss equ this word - 2
X mov ss,ax
X mov sp,-1 ; here too
save_sp equ this word - 2
X sti
X jmp far ptr _inter; now it's safe to call the real routine
_ss_interrupt endp
X
X
_text ends
X
X
const segment
linemask dw -1
color db 1
const ends
X
X end
SHAR_EOF
chmod 0666 gnuplot/pcgraph.asm ||
echo 'restore of gnuplot/pcgraph.asm failed'
Wc_c="`wc -c < 'gnuplot/pcgraph.asm'`"
test 3925 -eq "$Wc_c" ||
echo 'gnuplot/pcgraph.asm: original size 3925, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/plot.c ==============
if test -f 'gnuplot/plot.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/plot.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/plot.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/plot.c' &&
/* GNUPLOT - plot.c */
#include <setjmp.h>
#include <signal.h>
#include "plot.h"
#include "setshow.h"
#ifdef MSDOS
#include <io.h>
#endif
#ifdef vms
#include <unixio.h>
#include <smgdef.h>
extern int vms_vkid;
extern smg$create_virtual_keyboard();
unsigned int status[2] = {1, 0};
#endif
#ifdef AMIGA_LC_5_1
#include <proto/dos.h>
#endif
X
#ifdef __TURBOC__
#include <graphics.h>
#endif
X
extern char *getenv(),*strcat(),*strcpy(),*strncpy();
X
extern char input_line[];
extern int c_token;
extern FILE *outfile;
extern int term;
X
BOOLEAN interactive = TRUE; /* FALSE if stdin not a terminal */
char *infile_name = NULL; /* name of command file; NULL if terminal */
X
#ifndef STDOUT
#define STDOUT 1
#endif
X
jmp_buf env;
X
struct value *integer(),*complex();
X
X
extern f_push(),f_pushc(),f_pushd1(),f_pushd2(),f_call(),f_call2(),f_lnot(),f_bnot(),f_uminus()
X ,f_lor(),f_land(),f_bor(),f_xor(),f_band(),f_eq(),f_ne(),f_gt(),f_lt(),
X f_ge(),f_le(),f_plus(),f_minus(),f_mult(),f_div(),f_mod(),f_power(),
X f_factorial(),f_bool(),f_jump(),f_jumpz(),f_jumpnz(),f_jtern();
X
extern f_real(),f_imag(),f_arg(),f_conjg(),f_sin(),f_cos(),f_tan(),f_asin(),
X f_acos(),f_atan(),f_sinh(),f_cosh(),f_tanh(),f_int(),f_abs(),f_sgn(),
X f_sqrt(),f_exp(),f_log10(),f_log(),f_besj0(),f_besj1(),f_besy0(),f_besy1(),
#ifdef GAMMA
X f_gamma(),
#endif
X f_floor(),f_ceil();
X
X
struct ft_entry ft[] = { /* built-in function table */
X
/* internal functions: */
X {"push", f_push}, {"pushc", f_pushc},
X {"pushd1", f_pushd1}, {"pushd2", f_pushd2},
X {"call", f_call}, {"call2", f_call2}, {"lnot", f_lnot},
X {"bnot", f_bnot}, {"uminus", f_uminus}, {"lor", f_lor},
X {"land", f_land}, {"bor", f_bor}, {"xor", f_xor},
X {"band", f_band}, {"eq", f_eq}, {"ne", f_ne},
X {"gt", f_gt}, {"lt", f_lt}, {"ge", f_ge},
X {"le", f_le}, {"plus", f_plus}, {"minus", f_minus},
X {"mult", f_mult}, {"div", f_div}, {"mod", f_mod},
X {"power", f_power}, {"factorial", f_factorial},
X {"bool", f_bool}, {"jump", f_jump}, {"jumpz", f_jumpz},
X {"jumpnz",f_jumpnz},{"jtern", f_jtern},
X
/* standard functions: */
X {"real", f_real}, {"imag", f_imag}, {"arg", f_arg},
X {"conjg", f_conjg}, {"sin", f_sin}, {"cos", f_cos},
X {"tan", f_tan}, {"asin", f_asin}, {"acos", f_acos},
X {"atan", f_atan}, {"sinh", f_sinh}, {"cosh", f_cosh},
X {"tanh", f_tanh}, {"int", f_int}, {"abs", f_abs},
X {"sgn", f_sgn}, {"sqrt", f_sqrt}, {"exp", f_exp},
X {"log10", f_log10}, {"log", f_log}, {"besj0", f_besj0},
X {"besj1", f_besj1}, {"besy0", f_besy0}, {"besy1", f_besy1},
#ifdef GAMMA
X {"gamma", f_gamma},
#endif
X {"floor", f_floor}, {"ceil", f_ceil},
X {NULL, NULL}
};
X
static struct udvt_entry udv_pi = {NULL, "pi",FALSE};
X /* first in linked list */
struct udvt_entry *first_udv = &udv_pi;
struct udft_entry *first_udf = NULL;
X
X
X
#ifdef vms
X
#define HOME "sys$login:"
X
#else /* vms */
#ifdef MSDOS
X
#define HOME "GNUPLOT"
X
#else /* MSDOS */
X
#if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
X
#define HOME "GNUPLOT"
#else /* AMIGA */
X
#define HOME "HOME"
X
#endif /* AMIGA */
#endif /* MSDOS */
#endif /* vms */
X
#ifdef unix
#define PLOTRC ".gnuplot"
#else /* unix */
#if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
#define PLOTRC ".gnuplot"
#else /* AMIGA */
#define PLOTRC "gnuplot.ini"
#endif /* AMIGA */
#endif /* unix */
X
#ifdef __TURBOC__
void tc_interrupt()
#else
#ifdef _CRAY
void inter(an_int)
int an_int;
#else
inter()
#endif
#endif
{
#ifdef MSDOS
#ifdef __TURBOC__
X (void) signal(SIGINT, tc_interrupt);
#else
X void ss_interrupt();
X (void) signal(SIGINT, ss_interrupt);
#endif
#else /* MSDOS */
X (void) signal(SIGINT, inter);
#endif /* MSDOS */
X (void) signal(SIGFPE, SIG_DFL); /* turn off FPE trapping */
X if (term && term_init)
X (*term_tbl[term].text)(); /* hopefully reset text mode */
X (void) fflush(outfile);
X (void) putc('\n',stderr);
X longjmp(env, TRUE); /* return to prompt */
}
X
X
main(argc, argv)
X int argc;
X char **argv;
{
/* Register the Borland Graphics Interface drivers. If they have been */
/* included by the linker. */
X
#ifdef __TURBOC__
registerfarbgidriver(EGAVGA_driver_far);
registerfarbgidriver(CGA_driver_far);
registerfarbgidriver(Herc_driver_far);
registerfarbgidriver(ATT_driver_far);
#endif
#ifdef X11
X { int n = X11_args(argc, argv); argv += n; argc -= n; }
#endif
X
#ifdef apollo
X apollo_pfm_catch();
#endif
X
X setbuf(stderr,(char *)NULL);
X outfile = stdout;
X (void) complex(&udv_pi.udv_value, Pi, 0.0);
X
X interactive = FALSE;
X init_terminal(); /* can set term type if it likes */
X
#ifdef AMIGA_LC_5_1
X if (IsInteractive(Input()) == DOSTRUE) interactive = TRUE;
X else interactive = FALSE;
#else
X interactive = isatty(fileno(stdin));
#endif
X if (argc > 1)
X interactive = FALSE;
X
X if (interactive)
X show_version();
#ifdef vms /* initialise screen management routines for command recall */
X if (status[1] = smg$create_virtual_keyboard(&vms_vkid) != SS$_NORMAL)
X done(status[1]);
#endif
X
X if (!setjmp(env)) {
X /* first time */
X interrupt_setup();
X load_rcfile();
X
X if (interactive && term != 0) /* not unknown */
X fprintf(stderr, "\nTerminal type set to '%s'\n",
X term_tbl[term].name);
X } else {
X /* come back here from int_error() */
X load_file_error(); /* if we were in load_file(), cleanup */
#ifdef vms
X /* after catching interrupt */
SHAR_EOF
true || echo 'restore of gnuplot/plot.c failed'
fi
echo 'End of part 22'
echo 'File gnuplot/plot.c is continued in part 23'
echo 23 > _shar_seq_.tmp
#!/bin/sh
# this is Part.23 (part 23 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/plot.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 23; 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/plot.c'
else
echo 'x - continuing file gnuplot/plot.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/plot.c' &&
X /* VAX stuffs up stdout on SIGINT while writing to stdout,
X so reopen stdout. */
X if (outfile == stdout) {
X if ( (stdout = freopen("SYS$OUTPUT","w",stdout)) == NULL) {
X /* couldn't reopen it so try opening it instead */
X if ( (stdout = fopen("SYS$OUTPUT","w")) == NULL) {
X /* don't use int_error here - causes infinite loop! */
X fprintf(stderr,"Error opening SYS$OUTPUT as stdout\n");
X }
X }
X outfile = stdout;
X }
#endif /* VMS */
X if (!interactive)
X done(IO_ERROR); /* exit on non-interactive error */
X }
X
X if (argc > 1) {
X /* load filenames given as arguments */
X while (--argc > 0) {
X ++argv;
X c_token = NO_CARET; /* in case of file not found */
X load_file(fopen(*argv,"r"), *argv);
X }
X } else {
X /* take commands from stdin */
X while(TRUE)
X com_line();
X }
X
X done(IO_SUCCESS);
}
X
/* Set up to catch interrupts */
interrupt_setup()
{
#ifdef MSDOS
#ifdef __TURBOC__
X (void) signal(SIGINT, tc_interrupt); /* go there on interrupt char */
#else
X void ss_interrupt();
X save_stack(); /* work-around for MSC 4.0/MSDOS 3.x bug */
X (void) signal(SIGINT, ss_interrupt);
#endif
#else /* MSDOS */
X (void) signal(SIGINT, inter); /* go there on interrupt char */
#endif /* MSDOS */
}
X
X
/* Look for a gnuplot start-up file */
load_rcfile()
{
X register FILE *plotrc;
X static char home[80];
X static char rcfile[sizeof(PLOTRC)+80];
X
X /* Look for a gnuplot init file in . or home directory */
#ifdef vms
X (void) strcpy(home,HOME);
#else /* vms */
#if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
X strcpy(home,getenv(HOME));
X {
X int h;
X h = strlen(home) - 1;
X if (h >= 0) {
X if ((home[h] != ':') && (home[h] != '/')) {
X home[h] = '/';
X home[h+1] = '\0';
X }
X }
X }
#else /* AMIGA */
X (void) strcat(strcpy(home,getenv(HOME)),"/");
#endif /* AMIGA */
#endif /* vms */
#ifdef NOCWDRC
X /* inhibit check of init file in current directory for security reasons */
X {
#else
X (void) strcpy(rcfile, PLOTRC);
X plotrc = fopen(rcfile,"r");
X if (plotrc == (FILE *)NULL) {
#endif
X (void) sprintf(rcfile, "%s%s", home, PLOTRC);
X plotrc = fopen(rcfile,"r");
X }
X if (plotrc)
X load_file(plotrc, rcfile);
}
SHAR_EOF
echo 'File gnuplot/plot.c is complete' &&
chmod 0644 gnuplot/plot.c ||
echo 'restore of gnuplot/plot.c failed'
Wc_c="`wc -c < 'gnuplot/plot.c'`"
test 8795 -eq "$Wc_c" ||
echo 'gnuplot/plot.c: original size 8795, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/plot.h ==============
if test -f 'gnuplot/plot.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/plot.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/plot.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/plot.h' &&
/* GNUPLOT - plot.h */
#define PROGRAM "G N U P L O T"
#define PROMPT "gnuplot> "
#if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
#define SHELL "NewShell"
#else /* AMIGA */
#define SHELL "/bin/sh" /* used if SHELL env variable not set */
#endif /* AMIGA */
X
#define SAMPLES 100 /* default number of samples for a plot */
#define ISO_SAMPLES 10 /* default number of isolines per splot */
#define ZERO 1e-8 /* default for 'zero' set option */
X
#ifndef TERM
/* default terminal is "unknown"; but see init_terminal */
#define TERM "unknown"
#endif
X
#define TRUE 1
#define FALSE 0
X
X
#define Pi 3.141592653589793
#define DEG2RAD (Pi / 180.0)
X
X
#define MIN_CRV_POINTS 100 /* minimum size of points[] in curve_points */
#define MIN_SRF_POINTS 1000 /* minimum size of points[] in surface_points */
X
#define MAX_LINE_LEN 1024 /* maximum number of chars allowed on line */
#define MAX_TOKENS 200
#define MAX_ID_LEN 50 /* max length of an identifier */
X
X
#define MAX_AT_LEN 150 /* max number of entries in action table */
#define STACK_DEPTH 100
#define NO_CARET (-1)
X
X
#define MAX_NUM_VAR 2 /* Ploting projection of func. of max. two vars. */
X
#define MAP3D_CARTESIAN 0 /* 3D Data mapping. */
#define MAP3D_SPHERICAL 1
#define MAP3D_CYLINDRICAL 2
X
#define CONTOUR_NONE 0 /* Where to place contour maps if at all. */
#define CONTOUR_BASE 1
#define CONTOUR_SRF 2
#define CONTOUR_BOTH 3
X
#define CONTOUR_KIND_LINEAR 0 /* See contour.h in contours subdirectory. */
#define CONTOUR_KIND_CUBIC_SPL 1
#define CONTOUR_KIND_BSPLINE 2
X
#define ANGLES_RADIANS 0
#define ANGLES_DEGREES 1
X
X
#if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
#define OS "Amiga "
#endif
X
X
#ifdef vms
#define OS "VMS "
#endif
X
X
#ifdef unix
#define OS "unix "
#endif
X
X
#ifdef MSDOS
#define OS "MS-DOS "
#endif
X
X
#ifndef OS
#define OS ""
#endif
X
X
/*
X * Note about VERYLARGE: This is the upper bound double (or float, if PC)
X * numbers. This flag indicates very large numbers. It doesn't have to
X * be the absolutely biggest number on the machine.
X * If your machine doesn't have HUGE, or float.h,
X * define VERYLARGE here.
X *
X * example:
#define VERYLARGE 1e38
X */
X
#ifdef PC
#include <float.h>
#define VERYLARGE FLT_MAX
#else
#if defined( vms ) || defined( _CRAY ) || defined( NEXT )
#include <float.h>
#define VERYLARGE DBL_MAX
#else
#if defined(AMIGA_AC_5) || defined(AMIGA_LC_5_1)
#include <math.h>
#define VERYLARGE HUGE
#else
#define VERYLARGE HUGE
#endif
#endif
#endif
X
X
#define END_OF_COMMAND (c_token >= num_tokens || equals(c_token,";"))
X
#ifdef vms
X
X
#define is_comment(c) ((c) == '#' || (c) == '!')
#define is_system(c) ((c) == '$')
X
X
#else /* vms */
X
X
#define is_comment(c) ((c) == '#')
#define is_system(c) ((c) == '!')
X
X
#endif /* vms */
X
/* If you don't have vfork, then undefine this */
#if defined(NOVFORK) || defined(MSDOS)
# undef VFORK
#else
# ifdef unix
# define VFORK
# endif
#endif
X
/*
X * memcpy() comes by many names. The default is now to assume bcopy,
X * since it is the most common case. Define
X * MEMCPY to use memcpy(),
X * vms to use the vms function,
X * NOCOPY to use a handwritten version in parse.c
X */
#ifdef vms
# define memcpy(dest,src,len) lib$movc3(&len,src,dest)
#else
# if defined(MEMCPY) || defined(MSDOS)
X /* use memcpy directly */
# else
# ifdef NOCOPY
X /* use the handwritten memcpy in parse.c */
# else
X /* assume bcopy is in use */
# define memcpy(dest,src,len) bcopy(src,dest,len)
# endif /* NOCOPY */
# endif /* MEMCPY || MSDOS */
#endif /* vms */
X
/*
X * In case you have MEMSET instead of BZERO. If you have something
X * else, define bzero to that something.
X */
#if defined(MEMSET) || defined(MSDOS)
#define bzero(dest,len) (void)(memset(dest, (char)NULL, len))
#endif /* MEMSET || MSDOS */
X
/* Give the name of your gamma function, or undefine it if you have none. */
#if defined(NOGAMMA) || defined(MSDOS)
# undef GAMMA
#else
# ifndef GAMMA
# define GAMMA gamma
# endif /* GAMMA */
#endif /* NOGAMMA ||MSDOS */
X
#define top_of_stack stack[s_p]
X
typedef int BOOLEAN;
X
#ifdef __ZTC__
typedef int (*FUNC_PTR)(...);
#else
typedef int (*FUNC_PTR)();
#endif
X
#if defined(AMIGA_LC_5_1) || defined(AMIGA_AC_5)
enum operators {
X PUSH, PUSHC, PUSHD1, PUSHD2, CALL, CALL2, LNOT, BNOT, UMINUS, LOR, LAND,
X BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT, DIV,
X MOD, POWER, FACTORIAL, ABOOL, JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
};
#else
enum operators {
X PUSH, PUSHC, PUSHD1, PUSHD2, CALL, CALL2, LNOT, BNOT, UMINUS, LOR, LAND,
X BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT, DIV,
X MOD, POWER, FACTORIAL, BOOL, JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
};
#endif
X
X
#define is_jump(operator) ((operator) >=(int)JUMP && (operator) <(int)SF_START)
X
X
enum DATA_TYPES {
X INT, CMPLX
};
X
X
enum PLOT_TYPE {
X FUNC, DATA, FUNC3D, DATA3D
};
X
X
enum PLOT_STYLE {
X LINES, POINTS, IMPULSES, LINESPOINTS, DOTS, ERRORBARS
};
X
enum JUSTIFY {
X LEFT, CENTRE, RIGHT
};
X
struct cmplx {
X double real, imag;
};
X
X
struct value {
X enum DATA_TYPES type;
X union {
X int int_val;
X struct cmplx cmplx_val;
X } v;
};
X
X
struct lexical_unit { /* produced by scanner */
X BOOLEAN is_token; /* true if token, false if a value */
X struct value l_val;
X int start_index; /* index of first char in token */
X int length; /* length of token in chars */
};
X
X
struct ft_entry { /* standard/internal function table entry */
X char *f_name; /* pointer to name of this function */
X FUNC_PTR func; /* address of function to call */
};
X
X
struct udft_entry { /* user-defined function table entry */
X struct udft_entry *next_udf; /* pointer to next udf in linked list */
X char udf_name[MAX_ID_LEN+1]; /* name of this function entry */
X struct at_type *at; /* pointer to action table to execute */
X char *definition; /* definition of function as typed */
X struct value dummy_values[MAX_NUM_VAR]; /* current value of dummy variables */
};
X
X
struct udvt_entry { /* user-defined value table entry */
X struct udvt_entry *next_udv; /* pointer to next value in linked list */
X char udv_name[MAX_ID_LEN+1]; /* name of this value entry */
X BOOLEAN udv_undef; /* true if not defined yet */
X struct value udv_value; /* value it has */
};
X
X
union argument { /* p-code argument */
X int j_arg; /* offset for jump */
X struct value v_arg; /* constant value */
X struct udvt_entry *udv_arg; /* pointer to dummy variable */
X struct udft_entry *udf_arg; /* pointer to udf to execute */
};
X
X
struct at_entry { /* action table entry */
X enum operators index; /* index of p-code function */
X union argument arg;
};
X
X
struct at_type {
X int a_count; /* count of entries in .actions[] */
X struct at_entry actions[MAX_AT_LEN];
X /* will usually be less than MAX_AT_LEN is malloc()'d copy */
};
X
X
/* Defines the type of a coordinate */
/* INRANGE and OUTRANGE points have an x,y point associated with them */
enum coord_type {
X INRANGE, /* inside plot boundary */
X OUTRANGE, /* outside plot boundary, but defined */
X UNDEFINED /* not defined at all */
};
X
#ifdef PC
typedef float coordval; /* memory is tight on PCs! */
#else
typedef double coordval;
#endif
X
struct coordinate {
X enum coord_type type; /* see above */
X coordval x, y, z;
X coordval ylow, yhigh; /* ignored in 3d */
};
X
struct curve_points {
X struct curve_points *next_cp; /* pointer to next plot in linked list */
X enum PLOT_TYPE plot_type;
X enum PLOT_STYLE plot_style;
X char *title;
X int line_type;
X int point_type;
X int p_max; /* how many points are allocated */
X int p_count; /* count of points in points */
X struct coordinate *points;
};
X
struct gnuplot_contours {
X struct gnuplot_contours *next;
X struct coordinate *coords;
X int num_pts;
};
X
struct iso_curve {
X struct iso_curve *next;
X int p_max; /* how many points are allocated */
X int p_count; /* count of points in points */
X struct coordinate *points;
};
X
struct surface_points {
X struct surface_points *next_sp; /* pointer to next plot in linked list */
X enum PLOT_TYPE plot_type;
X enum PLOT_STYLE plot_style;
X char *title;
X int line_type;
X int point_type;
X int has_grid_topology;
X int num_iso_read; /* Data files only - num of isolines read from file. */
X struct gnuplot_contours *contours; /* Not NULL If have contours. */
X struct iso_curve *iso_crvs;
};
X
struct termentry {
X char *name;
X char *description;
X unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
X FUNC_PTR options,init,reset,text,scale,graphics,move,vector,linetype,
X put_text,text_angle,justify_text,point,arrow;
};
X
X
struct text_label {
X struct text_label *next; /* pointer to next label in linked list */
X int tag; /* identifies the label */
X double x,y,z;
X enum JUSTIFY pos;
X char text[MAX_LINE_LEN+1];
};
X
struct arrow_def {
X struct arrow_def *next; /* pointer to next arrow in linked list */
X int tag; /* identifies the arrow */
X double sx,sy,sz; /* start position */
X double ex,ey,ez; /* end position */
X BOOLEAN head; /* arrow has a head or not */
};
X
/* Tic-mark labelling definition; see set xtics */
struct ticdef {
X int type; /* one of three values below */
#define TIC_COMPUTED 1 /* default; gnuplot figures them */
#define TIC_SERIES 2 /* user-defined series */
#define TIC_USER 3 /* user-defined points */
X union {
X struct { /* for TIC_SERIES */
X double start, incr;
X double end; /* ymax, if VERYLARGE */
X } series;
X struct ticmark *user; /* for TIC_USER */
X } def;
};
X
/* Defines one ticmark for TIC_USER style.
X * If label==NULL, the value is printed with the usual format string.
X * else, it is used as the format string (note that it may be a constant
X * string, like "high" or "low").
X */
struct ticmark {
X double position; /* where on axis is this */
X char *label; /* optional (format) string label */
X struct ticmark *next; /* linked list */
};
X
/*
X * SS$_NORMAL is "normal completion", STS$M_INHIB_MSG supresses
X
X * printing a status message.
X * SS$_ABORT is the general abort status code.
X from: Martin Minow
X decvax!minow
X */
#ifdef vms
#include <ssdef.h>
#include <stsdef.h>
#define IO_SUCCESS (SS$_NORMAL | STS$M_INHIB_MSG)
#define IO_ERROR SS$_ABORT
#endif /* vms */
X
X
#ifndef IO_SUCCESS /* DECUS or VMS C will have defined these already */
#define IO_SUCCESS 0
#endif
#ifndef IO_ERROR
#define IO_ERROR 1
#endif
X
/* Some key global variables */
extern BOOLEAN screen_ok;
extern BOOLEAN term_init;
extern BOOLEAN undefined;
extern struct termentry term_tbl[];
X
extern char *alloc();
/* allocating and managing curve_points structures */
extern struct curve_points *cp_alloc();
extern int cp_extend();
extern int cp_free();
/* allocating and managing surface_points structures */
extern struct surface_points *sp_alloc();
extern int sp_replace();
extern int sp_free();
/* allocating and managing is_curve structures */
extern struct iso_curve *iso_alloc();
extern int iso_extend();
extern int iso_free();
SHAR_EOF
chmod 0644 gnuplot/plot.h ||
echo 'restore of gnuplot/plot.h failed'
Wc_c="`wc -c < 'gnuplot/plot.h'`"
test 11940 -eq "$Wc_c" ||
echo 'gnuplot/plot.h: original size 11940, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/README.amiga ==============
if test -f 'gnuplot/README.amiga' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/README.amiga (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/README.amiga (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.amiga' &&
SOME NOTES ON GNUPLOT ON THE AMIGA ...
X
X
X
Environment Variables:
X
X GNUFONT You can say "setenv GNUFONT <Fontname>/<Pointsize>" to get the font
X of your liking on the screen, e.g. "setenv GNUFONT sapphire/14".
X Otherwise gnuplot will select the default-font you chose with
X "Preferences".
X
X GNUHELP Allows you to define a pathname for the GNUPlot help file. For
X example, "setenv GNUHELP TEX:gnuplot.gih"
X
X GNUPLOT Your current directory is searched for the file ".gnuplot".
X If you say "setenv GNUPLOT <Path>" (without the filename!)
X GNUPlot will look for it there.
X
X GNUTERM You can define a default driver with "setenv GNUTERM <driver>".
X A good choice is "setenv GNUTERM amiga" :^)
X
X SHELL If you don't like "NewShell" as your shell, you can say
X "setenv SHELL <Shell>".
X
X
Stack Size:
X
X Set your stack to at least 20000 and you'll be fine (I hope).
X If you're using the integral feature, a stack size of at least 70000
X is necessary (at least it is for "bivariat.demo" to execute).
X
X
X
-------------------------- LATTICE C VERSION ------------------------------
X
X
Default paths/directories:
X
X Gnuplot looks for the file "gnuplot.gih" in your "S:"-directory unless you
X specify the full pathname including the filename via "setenv GNUHELP".
X
X
Bugs/deficiencies:
X
X The SAS/C 5.1 library routine [fs]scanf will not correctly handle
X format-strings like "%[^\n]s". Maybe this will be fixed by SAS in future
X versions.
X
X When using "%g" as format-string, SAS/C 5.1 [fs]printf will incorrectly
X output "0" as "0.". This looks rather ugly as a axis-label.
X
X
SAS/C 5.1 bugs:
X
X SAS/C 5.1 [fs]scanf will count parameters overread with the "%*s" format-
X string as properly matched. I included a fix for this by counting the
X "%*"-sequences in the given format-string. Therfore the "*" must immediately
X follow the "%" (I don't know if it's legal to put something in-between
X these two characters anyway...).
X
X If you start a shell via the gnuplot "shell"-command you won't be able to
X close your CLI/Shell again. This is probably due to an error in the
X SAS/C "system"-call.
X
X "isatty(fileno(stdin))" did not work correctly. A fix is included.
X
X SAS/C does not seem to handle float-parameters in function-calls and
X -declarations correctly. (This cost me at least 2 hours to figure out >:-( ).
X See the latex- and eepic-drivers for details.
X
X
X
X
--------------------------- AZTEC C VERSION -------------------------------
X
X
Default paths/directories:
X
X GNUPlot looks for the "gnuplot.gih" file in "GNUPLOT:docs/gnuplot.gih" if
X GNUHELP is not defined. This is defined in the makefile (makefile.ami).
X
X
Terminal Drivers:
X
X The Aztec C version can now use the "amiga.trm" driver written by
X Carsten Steger. Under KS/WB 2.0, a custom screen will be used with a size
X specified by the Prefs/Overscan program.
SHAR_EOF
chmod 0644 gnuplot/README.amiga ||
echo 'restore of gnuplot/README.amiga failed'
Wc_c="`wc -c < 'gnuplot/README.amiga'`"
test 2981 -eq "$Wc_c" ||
echo 'gnuplot/README.amiga: original size 2981, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/scanner.c ==============
if test -f 'gnuplot/scanner.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/scanner.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/scanner.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/scanner.c' &&
/* GNUPLOT - scanner.c */
#include <ctype.h>
#include "plot.h"
X
#ifdef AMIGA_AC_5
#define O_RDONLY 0
int open(const char * _name, int _mode, ...);
int close(int);
#endif
X
#ifdef vms
X
#include stdio
#include descrip
#include errno
X
#define MAILBOX "PLOT$MAILBOX"
#define pclose(f) fclose(f)
X
#endif /* vms */
X
X
#define isident(c) (isalnum(c) || (c) == '_')
X
#ifndef STDOUT
#define STDOUT 1
#endif
X
#define LBRACE '{'
#define RBRACE '}'
X
#define APPEND_TOKEN {token[t_num].length++; current++;}
X
#define SCAN_IDENTIFIER while (isident(expression[current + 1]))\
X APPEND_TOKEN
X
extern struct lexical_unit token[MAX_TOKENS];
X
static int t_num; /* number of token I'm working on */
X
char *strcat(), *strcpy(), *strncpy();
X
/*
X * scanner() breaks expression[] into lexical units, storing them in token[].
X * The total number of tokens found is returned as the function value.
X * Scanning will stop when '\0' is found in expression[], or when token[]
X * is full.
X *
X * Scanning is performed by following rules:
X *
X * Current char token should contain
X * ------------- -----------------------
X * 1. alpha all following alpha-numerics
X * 2. digit 0 or more following digits, 0 or 1 decimal point,
X * 0 or more digits, 0 or 1 'e' or 'E',
X * 0 or more digits.
X * 3. ^,+,-,/ only current char
X * %,~,(,)
X * [,],;,:,
X * ?,comma
X * 4. &,|,=,* current char; also next if next is same
X * 5. !,<,> current char; also next if next is =
X * 6. ", ' all chars up until matching quote
X * 7. # this token cuts off scanning of the line (DFK).
X *
X * white space between tokens is ignored
X */
scanner(expression)
char expression[];
{
register int current; /* index of current char in expression[] */
register int quote;
char brace;
X
X for (current = t_num = 0;
X t_num < MAX_TOKENS && expression[current] != '\0';
X current++) {
again:
X if (isspace(expression[current]))
X continue; /* skip the whitespace */
X token[t_num].start_index = current;
X token[t_num].length = 1;
X token[t_num].is_token = TRUE; /* to start with...*/
X
X if (expression[current] == '`') {
X substitute(&expression[current],MAX_LINE_LEN - current);
X goto again;
X }
X if (isalpha(expression[current])) {
X SCAN_IDENTIFIER;
X } else if (isdigit(expression[current]) || expression[current] == '.'){
X token[t_num].is_token = FALSE;
X token[t_num].length = get_num(&expression[current]);
X current += (token[t_num].length - 1);
X } else if (expression[current] == LBRACE) {
X token[t_num].is_token = FALSE;
X token[t_num].l_val.type = CMPLX;
X if ((sscanf(&expression[++current],"%lf , %lf %c",
X &token[t_num].l_val.v.cmplx_val.real,
X &token[t_num].l_val.v.cmplx_val.imag,
X &brace) != 3) || (brace != RBRACE))
X int_error("invalid complex constant",t_num);
X token[t_num].length += 2;
X while (expression[++current] != RBRACE) {
X token[t_num].length++;
X if (expression[current] == '\0') /* { for vi % */
X int_error("no matching '}'", t_num);
X }
X } else if (expression[current] == '\'' || expression[current] == '\"'){
X token[t_num].length++;
X quote = expression[current];
X while (expression[++current] != quote) {
X if (!expression[current]) {
X expression[current] = quote;
X expression[current+1] = '\0';
X break;
X } else
X token[t_num].length++;
X }
X } else switch (expression[current]) {
X case '#': /* DFK: add comments to gnuplot */
X goto endline; /* ignore the rest of the line */
X case '^':
X case '+':
X case '-':
X case '/':
X case '%':
X case '~':
X case '(':
X case ')':
X case '[':
X case ']':
X case ';':
X case ':':
X case '?':
X case ',':
X break;
X case '&':
X case '|':
X case '=':
X case '*':
X if (expression[current] == expression[current + 1])
X APPEND_TOKEN;
X break;
X case '!':
X case '<':
X case '>':
X if (expression[current + 1] == '=')
X APPEND_TOKEN;
X break;
X default:
X int_error("invalid character",t_num);
X }
X ++t_num; /* next token if not white space */
X }
X
endline: /* comments jump here to ignore line */
X
/* Now kludge an extra token which points to '\0' at end of expression[].
X This is useful so printerror() looks nice even if we've fallen off the
X line. */
X
X token[t_num].start_index = current;
X token[t_num].length = 0;
X return(t_num);
}
X
X
get_num(str)
char str[];
{
double atof();
register int count = 0;
long atol();
register long lval;
X
X token[t_num].is_token = FALSE;
X token[t_num].l_val.type = INT; /* assume unless . or E found */
X while (isdigit(str[count]))
X count++;
X if (str[count] == '.') {
X token[t_num].l_val.type = CMPLX;
X while (isdigit(str[++count])) /* swallow up digits until non-digit */
X ;
X /* now str[count] is other than a digit */
X }
X if (str[count] == 'e' || str[count] == 'E') {
X token[t_num].l_val.type = CMPLX;
/* modified if statement to allow + sign in exponent
X rjl 26 July 1988 */
X count++;
X if (str[count] == '-' || str[count] == '+')
X count++;
X if (!isdigit(str[count])) {
X token[t_num].start_index += count;
X int_error("expecting exponent",t_num);
X }
X while (isdigit(str[++count]))
X ;
X }
X if (token[t_num].l_val.type == INT) {
X lval = atol(str);
X if ((token[t_num].l_val.v.int_val = lval) != lval)
X int_error("integer overflow; change to floating point",t_num);
X } else {
X token[t_num].l_val.v.cmplx_val.imag = 0.0;
X token[t_num].l_val.v.cmplx_val.real = atof(str);
X }
X return(count);
}
X
X
#ifdef MSDOS
X
#ifdef __ZTC__
substitute(char *str,int max)
#else
substitute()
#endif
{
X int_error("substitution not supported by MS-DOS!",t_num);
}
X
#else /* MSDOS */
#ifdef AMIGA_LC_5_1
substitute()
{
X int_error("substitution not supported by AmigaDOS!",t_num);
}
X
#else /* AMIGA_LC_5_1 */
X
substitute(str,max) /* substitute output from ` ` */
char *str;
int max;
{
register char *last;
register int i,c;
register FILE *f;
#ifdef AMIGA_AC_5
int fd;
#else
FILE *popen();
#endif
static char pgm[MAX_LINE_LEN+1],output[MAX_LINE_LEN+1];
X
#ifdef vms
int chan;
static $DESCRIPTOR(pgmdsc,pgm);
static $DESCRIPTOR(lognamedsc,MAILBOX);
#endif /* vms */
X
X i = 0;
X last = str;
X while (*(++last) != '`') {
X if (*last == '\0')
X int_error("unmatched `",t_num);
X pgm[i++] = *last;
X }
X pgm[i] = '\0'; /* end with null */
X max -= strlen(last); /* max is now the max length of output sub. */
X
#ifdef vms
X pgmdsc.dsc$w_length = i;
X if (!((vaxc$errno = sys$crembx(0,&chan,0,0,0,0,&lognamedsc)) & 1))
X os_error("sys$crembx failed",NO_CARET);
X
X if (!((vaxc$errno = lib$spawn(&pgmdsc,0,&lognamedsc,&1)) & 1))
X os_error("lib$spawn failed",NO_CARET);
X
X if ((f = fopen(MAILBOX,"r")) == NULL)
X os_error("mailbox open failed",NO_CARET);
#else /* vms */
#ifdef AMIGA_AC_5
X if ((fd = open(pgm,"O_RDONLY")) == -1)
#else
X if ((f = popen(pgm,"r")) == NULL)
#endif
X os_error("popen failed",NO_CARET);
#endif /* vms */
X
X i = 0;
X while ((c = getc(f)) != EOF) {
X output[i++] = ((c == '\n') ? ' ' : c); /* newlines become blanks*/
X if (i == max) {
#ifdef AMIGA_AC_5
X (void) close(fd);
#else
X (void) pclose(f);
#endif
X int_error("substitution overflow", t_num);
X }
X }
#ifdef AMIGA_AC_5
X (void) close(fd);
#else
X (void) pclose(f);
#endif
X if (i + strlen(last) > max)
X int_error("substitution overflowed rest of line", t_num);
X (void) strncpy(output+i,last+1,MAX_LINE_LEN-i);
X /* tack on rest of line to output */
X (void) strcpy(str,output); /* now replace ` ` with output */
X screen_ok = FALSE;
}
#endif /* AMIGA_LC_5_1 */
#endif /* MS-DOS */
SHAR_EOF
chmod 0644 gnuplot/scanner.c ||
echo 'restore of gnuplot/scanner.c failed'
Wc_c="`wc -c < 'gnuplot/scanner.c'`"
test 8676 -eq "$Wc_c" ||
echo 'gnuplot/scanner.c: original size 8676, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/version.c ==============
if test -f 'gnuplot/version.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/version.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/version.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/version.c' &&
/* GNUPLOT - version.c */
char version[] = "3.0 ";
char patchlevel[] = "0, Sep 29 91";
char date[] = "Sun Sep 29 16:56:36 1991";
X
/* override in Makefile */
#ifndef CONTACT
# define CONTACT "pixar!bug-g...@sun.com"
#endif
char bug_email[] = CONTACT;
SHAR_EOF
chmod 0644 gnuplot/version.c ||
echo 'restore of gnuplot/version.c failed'
Wc_c="`wc -c < 'gnuplot/version.c'`"
test 1368 -eq "$Wc_c" ||
echo 'gnuplot/version.c: original size 1368, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/setshow.h ==============
if test -f 'gnuplot/setshow.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/setshow.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/setshow.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/setshow.h' &&
/* GNUPLOT - setshow.h */
/*
X * global variables to hold status of 'set' options
X *
X */
extern BOOLEAN autoscale_r;
extern BOOLEAN autoscale_t;
extern BOOLEAN autoscale_u;
extern BOOLEAN autoscale_v;
extern BOOLEAN autoscale_x;
extern BOOLEAN autoscale_y;
extern BOOLEAN autoscale_z;
extern BOOLEAN autoscale_lt;
extern BOOLEAN autoscale_lu;
extern BOOLEAN autoscale_lv;
extern BOOLEAN autoscale_lx;
extern BOOLEAN autoscale_ly;
extern BOOLEAN autoscale_lz;
extern BOOLEAN clip_points;
extern BOOLEAN clip_lines1;
extern BOOLEAN clip_lines2;
extern BOOLEAN draw_border;
extern BOOLEAN draw_surface;
extern BOOLEAN timedate;
extern char dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1];
extern char xformat[];
extern char yformat[];
extern char zformat[];
extern enum PLOT_STYLE data_style, func_style;
extern BOOLEAN grid;
extern int key;
extern double key_x, key_y, key_z; /* user specified position for key */
extern BOOLEAN log_x, log_y, log_z;
extern FILE* outfile;
extern char outstr[];
extern BOOLEAN parametric;
extern BOOLEAN polar;
extern int angles_format;
extern int mapping3d;
extern int samples;
extern int iso_samples;
extern float xsize; /* scale factor for size */
extern float ysize; /* scale factor for size */
extern float zsize; /* scale factor for size */
extern float surface_rot_z;
extern float surface_rot_x;
extern float surface_scale;
extern float surface_zscale;
extern int term; /* unknown term is 0 */
extern char term_options[];
extern char title[];
extern char xlabel[];
extern char ylabel[];
extern char zlabel[];
extern int time_xoffset;
extern int time_yoffset;
extern int title_xoffset;
extern int title_yoffset;
extern int xlabel_xoffset;
extern int xlabel_yoffset;
extern int ylabel_xoffset;
extern int ylabel_yoffset;
extern int zlabel_xoffset;
extern int zlabel_yoffset;
extern double rmin, rmax;
extern double tmin, tmax, umin, umax, vmin, vmax;
extern double xmin, xmax, ymin, ymax, zmin, zmax;
extern double loff, roff, toff, boff;
extern int draw_contour;
extern int contour_pts;
extern int contour_kind;
extern int contour_order;
extern int contour_levels;
extern double zero; /* zero threshold, not 0! */
X
extern BOOLEAN xzeroaxis;
extern BOOLEAN yzeroaxis;
X
extern BOOLEAN xtics;
extern BOOLEAN ytics;
extern BOOLEAN ztics;
X
extern float ticslevel;
X
extern struct ticdef xticdef;
extern struct ticdef yticdef;
extern struct ticdef zticdef;
X
extern BOOLEAN tic_in;
X
extern struct text_label *first_label;
extern struct arrow_def *first_arrow;
X
/* The set and show commands, in setshow.c */
extern void set_command();
extern void show_command();
/* and some accessible support functions */
extern enum PLOT_STYLE get_style();
extern BOOLEAN load_range();
extern void show_version();
SHAR_EOF
chmod 0644 gnuplot/setshow.h ||
echo 'restore of gnuplot/setshow.h failed'
Wc_c="`wc -c < 'gnuplot/setshow.h'`"
test 3968 -eq "$Wc_c" ||
echo 'gnuplot/setshow.h: original size 3968, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/standard.c ==============
if test -f 'gnuplot/standard.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/standard.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/standard.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/standard.c' &&
/* GNUPLOT - standard.c */
#include <math.h>
#include <stdio.h>
#include "plot.h"
X
#ifdef vms
#include <errno.h>
#else
extern int errno;
#endif /* vms */
X
X
extern struct value stack[STACK_DEPTH];
extern int s_p;
extern double zero;
X
struct value *pop(), *complex(), *integer();
X
double magnitude(), angle(), real(), imag();
X
/* The bessel function approximations here are from
X * "Computer Approximations"
X * by Hart, Cheney et al.
X * John Wiley & Sons, 1968
X */
X
/* There appears to be a mistake in Hart, Cheney et al. on page 149.
X * Where it list Qn(x)/x ~ P(z*z)/Q(z*z), z = 8/x, it should read
X * Qn(x)/z ~ P(z*z)/Q(z*z), z = 8/x
X * In the functions below, Qn(x) is implementated using the later
X * equation.
X * These bessel functions are accurate to about 1e-13
X */
X
#define PI_ON_FOUR 0.78539816339744830961566084581987572
#define PI_ON_TWO 1.57079632679489661923131269163975144
#define THREE_PI_ON_FOUR 2.35619449019234492884698253745962716
#define TWO_ON_PI 0.63661977236758134307553505349005744
X
static double dzero = 0.0;
X
/* jzero for x in [0,8]
X * Index 5849, 19.22 digits precision
X */
static double pjzero[] = {
X 0.4933787251794133561816813446e+21,
X -0.11791576291076105360384408e+21,
X 0.6382059341072356562289432465e+19,
X -0.1367620353088171386865416609e+18,
X 0.1434354939140346111664316553e+16,
X -0.8085222034853793871199468171e+13,
X 0.2507158285536881945555156435e+11,
X -0.4050412371833132706360663322e+8,
X 0.2685786856980014981415848441e+5
};
X
static double qjzero[] = {
X 0.4933787251794133562113278438e+21,
X 0.5428918384092285160200195092e+19,
X 0.3024635616709462698627330784e+17,
X 0.1127756739679798507056031594e+15,
X 0.3123043114941213172572469442e+12,
X 0.669998767298223967181402866e+9,
X 0.1114636098462985378182402543e+7,
X 0.1363063652328970604442810507e+4,
X 0.1e+1
};
X
/* pzero for x in [8,inf]
X * Index 6548, 18.16 digits precision
X */
static double ppzero[] = {
X 0.2277909019730468430227002627e+5,
X 0.4134538663958076579678016384e+5,
X 0.2117052338086494432193395727e+5,
X 0.348064864432492703474453111e+4,
X 0.15376201909008354295771715e+3,
X 0.889615484242104552360748e+0
};
X
static double qpzero[] = {
X 0.2277909019730468431768423768e+5,
X 0.4137041249551041663989198384e+5,
X 0.2121535056188011573042256764e+5,
X 0.350287351382356082073561423e+4,
X 0.15711159858080893649068482e+3,
X 0.1e+1
};
X
/* qzero for x in [8,inf]
X * Index 6948, 18.33 digits precision
X */
static double pqzero[] = {
X -0.8922660020080009409846916e+2,
X -0.18591953644342993800252169e+3,
X -0.11183429920482737611262123e+3,
X -0.2230026166621419847169915e+2,
X -0.124410267458356384591379e+1,
X -0.8803330304868075181663e-2,
};
X
static double qqzero[] = {
X 0.571050241285120619052476459e+4,
X 0.1195113154343461364695265329e+5,
X 0.726427801692110188369134506e+4,
X 0.148872312322837565816134698e+4,
X 0.9059376959499312585881878e+2,
X 0.1e+1
};
X
X
/* yzero for x in [0,8]
X * Index 6245, 18.78 digits precision
X */
static double pyzero[] = {
X -0.2750286678629109583701933175e+20,
X 0.6587473275719554925999402049e+20,
X -0.5247065581112764941297350814e+19,
X 0.1375624316399344078571335453e+18,
X -0.1648605817185729473122082537e+16,
X 0.1025520859686394284509167421e+14,
X -0.3436371222979040378171030138e+11,
X 0.5915213465686889654273830069e+8,
X -0.4137035497933148554125235152e+5
};
X
static double qyzero[] = {
X 0.3726458838986165881989980739e+21,
X 0.4192417043410839973904769661e+19,
X 0.2392883043499781857439356652e+17,
X 0.9162038034075185262489147968e+14,
X 0.2613065755041081249568482092e+12,
X 0.5795122640700729537380087915e+9,
X 0.1001702641288906265666651753e+7,
X 0.1282452772478993804176329391e+4,
X 0.1e+1
};
X
X
/* jone for x in [0,8]
X * Index 6050, 20.98 digits precision
X */
static double pjone[] = {
X 0.581199354001606143928050809e+21,
X -0.6672106568924916298020941484e+20,
X 0.2316433580634002297931815435e+19,
X -0.3588817569910106050743641413e+17,
X 0.2908795263834775409737601689e+15,
X -0.1322983480332126453125473247e+13,
X 0.3413234182301700539091292655e+10,
X -0.4695753530642995859767162166e+7,
X 0.270112271089232341485679099e+4
};
X
static double qjone[] = {
X 0.11623987080032122878585294e+22,
X 0.1185770712190320999837113348e+20,
X 0.6092061398917521746105196863e+17,
X 0.2081661221307607351240184229e+15,
X 0.5243710262167649715406728642e+12,
X 0.1013863514358673989967045588e+10,
X 0.1501793594998585505921097578e+7,
X 0.1606931573481487801970916749e+4,
X 0.1e+1
};
X
X
/* pone for x in [8,inf]
X * Index 6749, 18.11 digits precision
X */
static double ppone[] = {
X 0.352246649133679798341724373e+5,
X 0.62758845247161281269005675e+5,
X 0.313539631109159574238669888e+5,
X 0.49854832060594338434500455e+4,
X 0.2111529182853962382105718e+3,
X 0.12571716929145341558495e+1
};
X
static double qpone[] = {
X 0.352246649133679798068390431e+5,
X 0.626943469593560511888833731e+5,
X 0.312404063819041039923015703e+5,
X 0.4930396490181088979386097e+4,
X 0.2030775189134759322293574e+3,
X 0.1e+1
};
X
/* qone for x in [8,inf]
X * Index 7149, 18.28 digits precision
X */
static double pqone[] = {
X 0.3511751914303552822533318e+3,
X 0.7210391804904475039280863e+3,
X 0.4259873011654442389886993e+3,
X 0.831898957673850827325226e+2,
X 0.45681716295512267064405e+1,
X 0.3532840052740123642735e-1
};
X
static double qqone[] = {
X 0.74917374171809127714519505e+4,
X 0.154141773392650970499848051e+5,
X 0.91522317015169922705904727e+4,
X 0.18111867005523513506724158e+4,
X 0.1038187585462133728776636e+3,
X 0.1e+1
};
X
X
/* yone for x in [0,8]
X * Index 6444, 18.24 digits precision
X */
static double pyone[] = {
X -0.2923821961532962543101048748e+20,
X 0.7748520682186839645088094202e+19,
X -0.3441048063084114446185461344e+18,
X 0.5915160760490070618496315281e+16,
X -0.4863316942567175074828129117e+14,
X 0.2049696673745662182619800495e+12,
X -0.4289471968855248801821819588e+9,
X 0.3556924009830526056691325215e+6
};
X
static double qyone[] = {
X 0.1491311511302920350174081355e+21,
X 0.1818662841706134986885065935e+19,
X 0.113163938269888452690508283e+17,
X 0.4755173588888137713092774006e+14,
X 0.1500221699156708987166369115e+12,
X 0.3716660798621930285596927703e+9,
X 0.726914730719888456980191315e+6,
X 0.10726961437789255233221267e+4,
X 0.1e+1
};
X
X
f_real()
{
struct value a;
X push( complex(&a,real(pop(&a)), 0.0) );
}
X
f_imag()
{
struct value a;
X push( complex(&a,imag(pop(&a)), 0.0) );
}
X
f_arg()
{
struct value a;
X push( complex(&a,angle(pop(&a)), 0.0) );
}
X
f_conjg()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,real(&a),-imag(&a) ));
}
X
f_sin()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,sin(real(&a))*cosh(imag(&a)), cos(real(&a))*sinh(imag(&a))) );
}
X
f_cos()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,cos(real(&a))*cosh(imag(&a)), -sin(real(&a))*sinh(imag(&a))));
}
X
f_tan()
{
struct value a;
register double den;
X (void) pop(&a);
X if (imag(&a) == 0.0)
X push( complex(&a,tan(real(&a)),0.0) );
X else {
X den = cos(2*real(&a))+cosh(2*imag(&a));
X if (den == 0.0) {
X undefined = TRUE;
X push( &a );
X }
X else
X push( complex(&a,sin(2*real(&a))/den, sinh(2*imag(&a))/den) );
X }
}
X
f_asin()
{
struct value a;
register double alpha, beta, x, y;
X (void) pop(&a);
X x = real(&a); y = imag(&a);
X if (y == 0.0) {
X if (fabs(x) > 1.0) {
X undefined = TRUE;
X push(complex(&a,0.0, 0.0));
X } else
X push( complex(&a,asin(x),0.0) );
X } else {
X beta = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
X alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
X push( complex(&a,asin(beta), log(alpha + sqrt(alpha*alpha-1))) );
X }
}
X
f_acos()
{
struct value a;
register double alpha, beta, x, y;
X (void) pop(&a);
X x = real(&a); y = imag(&a);
X if (y == 0.0) {
X if (fabs(x) > 1.0) {
X undefined = TRUE;
X push(complex(&a,0.0, 0.0));
X } else
X push( complex(&a,acos(x),0.0) );
X } else {
X alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
X beta = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
X push( complex(&a,acos(beta), log(alpha + sqrt(alpha*alpha-1))) );
X }
}
X
f_atan()
{
struct value a;
register double x, y;
X (void) pop(&a);
X x = real(&a); y = imag(&a);
X if (y == 0.0)
X push( complex(&a,atan(x), 0.0) );
X else if (x == 0.0 && fabs(y) == 1.0) {
X undefined = TRUE;
X push(complex(&a,0.0, 0.0));
X } else
X push( complex(&a,atan(2*x/(1-x*x-y*y)),
X log((x*x+(y+1)*(y+1))/(x*x+(y-1)*(y-1)))/4) );
}
X
f_sinh()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,sinh(real(&a))*cos(imag(&a)), cosh(real(&a))*sin(imag(&a))) );
}
X
f_cosh()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,cosh(real(&a))*cos(imag(&a)), sinh(real(&a))*sin(imag(&a))) );
}
X
f_tanh()
{
struct value a;
register double den;
X (void) pop(&a);
X den = cosh(2*real(&a)) + cos(2*imag(&a));
X push( complex(&a,sinh(2*real(&a))/den, sin(2*imag(&a))/den) );
}
X
f_int()
{
struct value a;
X push( integer(&a,(int)real(pop(&a))) );
}
X
X
f_abs()
{
struct value a;
X (void) pop(&a);
X switch (a.type) {
X case INT:
X push( integer(&a,abs(a.v.int_val)) );
X break;
X case CMPLX:
X push( complex(&a,magnitude(&a), 0.0) );
X }
}
X
f_sgn()
{
struct value a;
X (void) pop(&a);
X switch(a.type) {
X case INT:
X push( integer(&a,(a.v.int_val > 0) ? 1 :
X (a.v.int_val < 0) ? -1 : 0) );
X break;
X case CMPLX:
X push( integer(&a,(a.v.cmplx_val.real > 0.0) ? 1 :
X (a.v.cmplx_val.real < 0.0) ? -1 : 0) );
X break;
X }
}
X
X
f_sqrt()
{
struct value a;
register double mag, ang;
X (void) pop(&a);
X mag = sqrt(magnitude(&a));
X if (imag(&a) == 0.0 && real(&a) < 0.0)
X push( complex(&a,0.0,mag) );
X else
X {
X if ( (ang = angle(&a)) < 0.0)
X ang += 2*Pi;
X ang /= 2;
X push( complex(&a,mag*cos(ang), mag*sin(ang)) );
X }
}
X
X
f_exp()
{
struct value a;
register double mag, ang;
X (void) pop(&a);
X mag = exp(real(&a));
X ang = imag(&a);
X push( complex(&a,mag*cos(ang), mag*sin(ang)) );
}
X
X
f_log10()
{
struct value a;
register double l10;;
X (void) pop(&a);
X l10 = log(10.0); /***** replace with a constant! ******/
X push( complex(&a,log(magnitude(&a))/l10, angle(&a)/l10) );
}
X
X
f_log()
{
struct value a;
X (void) pop(&a);
X push( complex(&a,log(magnitude(&a)), angle(&a)) );
}
X
X
f_floor()
{
struct value a;
X
X (void) pop(&a);
X switch (a.type) {
X case INT:
X push( integer(&a,(int)floor((double)a.v.int_val)));
X break;
X case CMPLX:
X push( integer(&a,(int)floor(a.v.cmplx_val.real)));
X }
}
X
X
f_ceil()
{
struct value a;
X
X (void) pop(&a);
X switch (a.type) {
X case INT:
X push( integer(&a,(int)ceil((double)a.v.int_val)));
X break;
X case CMPLX:
X push( integer(&a,(int)ceil(a.v.cmplx_val.real)));
X }
}
X
#ifdef GAMMA
X
f_gamma()
{
extern int signgam;
register double y;
struct value a;
X
X y = GAMMA(real(pop(&a)));
X if (y > 88.0) {
X undefined = TRUE;
X push( integer(&a,0) );
X }
X else
X push( complex(&a,signgam * exp(y),0.0) );
}
X
#endif /* GAMMA */
X
X
/* bessel function approximations */
double jzero(x)
double x;
{
double p, q, x2;
int n;
X
X x2 = x * x;
X p = pjzero[8];
X q = qjzero[8];
X for (n=7; n>=0; n--) {
X p = p*x2 + pjzero[n];
X q = q*x2 + qjzero[n];
X }
X return(p/q);
}
X
double pzero(x)
double x;
{
double p, q, z, z2;
int n;
X
X z = 8.0 / x;
X z2 = z * z;
X p = ppzero[5];
X q = qpzero[5];
X for (n=4; n>=0; n--) {
X p = p*z2 + ppzero[n];
SHAR_EOF
true || echo 'restore of gnuplot/standard.c failed'
fi
echo 'End of part 23'
echo 'File gnuplot/standard.c is continued in part 24'
echo 24 > _shar_seq_.tmp
#!/bin/sh
# this is Part.24 (part 24 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/standard.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 24; 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/standard.c'
else
echo 'x - continuing file gnuplot/standard.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/standard.c' &&
X q = q*z2 + qpzero[n];
X }
X return(p/q);
}
X
double qzero(x)
double x;
{
double p, q, z, z2;
int n;
X
X z = 8.0 / x;
X z2 = z * z;
X p = pqzero[5];
X q = qqzero[5];
X for (n=4; n>=0; n--) {
X p = p*z2 + pqzero[n];
X q = q*z2 + qqzero[n];
X }
X return(p/q);
}
X
double yzero(x)
double x;
{
double p, q, x2;
int n;
X
X x2 = x * x;
X p = pyzero[8];
X q = qyzero[8];
X for (n=7; n>=0; n--) {
X p = p*x2 + pyzero[n];
X q = q*x2 + qyzero[n];
X }
X return(p/q);
}
X
double rj0(x)
double x;
{
X if ( x <= 0.0 )
X x = -x;
X if ( x < 8.0 )
X return(jzero(x));
X else
X return( sqrt(TWO_ON_PI/x) *
X (pzero(x)*cos(x-PI_ON_FOUR) - 8.0/x*qzero(x)*sin(x-PI_ON_FOUR)) );
X
}
X
double ry0(x)
double x;
{
X if ( x < 0.0 )
X return(dzero/dzero); /* error */
X if ( x < 8.0 )
X return( yzero(x) + TWO_ON_PI*rj0(x)*log(x) );
X else
X return( sqrt(TWO_ON_PI/x) *
X (pzero(x)*sin(x-PI_ON_FOUR) +
X (8.0/x)*qzero(x)*cos(x-PI_ON_FOUR)) );
X
}
X
X
double jone(x)
double x;
{
double p, q, x2;
int n;
X
X x2 = x * x;
X p = pjone[8];
X q = qjone[8];
X for (n=7; n>=0; n--) {
X p = p*x2 + pjone[n];
X q = q*x2 + qjone[n];
X }
X return(p/q);
}
X
double pone(x)
double x;
{
double p, q, z, z2;
int n;
X
X z = 8.0 / x;
X z2 = z * z;
X p = ppone[5];
X q = qpone[5];
X for (n=4; n>=0; n--) {
X p = p*z2 + ppone[n];
X q = q*z2 + qpone[n];
X }
X return(p/q);
}
X
double qone(x)
double x;
{
double p, q, z, z2;
int n;
X
X z = 8.0 / x;
X z2 = z * z;
X p = pqone[5];
X q = qqone[5];
X for (n=4; n>=0; n--) {
X p = p*z2 + pqone[n];
X q = q*z2 + qqone[n];
X }
X return(p/q);
}
X
double yone(x)
double x;
{
double p, q, x2;
int n;
X
X x2 = x * x;
X p = 0.0;
X q = qyone[8];
X for (n=7; n>=0; n--) {
X p = p*x2 + pyone[n];
X q = q*x2 + qyone[n];
X }
X return(p/q);
}
X
double rj1(x)
double x;
{
double v,w;
X v = x;
X if ( x < 0.0 )
X x = -x;
X if ( x < 8.0 )
X return(v*jone(x));
X else {
X w = sqrt(TWO_ON_PI/x) *
X (pone(x)*cos(x-THREE_PI_ON_FOUR) -
X 8.0/x*qone(x)*sin(x-THREE_PI_ON_FOUR)) ;
X if (v < 0.0)
X w = -w;
X return( w );
X }
}
X
double ry1(x)
double x;
{
X if ( x <= 0.0 )
X return(dzero/dzero); /* error */
X if ( x < 8.0 )
X return( x*yone(x) + TWO_ON_PI*(rj1(x)*log(x) - 1.0/x) );
X else
X return( sqrt(TWO_ON_PI/x) *
X (pone(x)*sin(x-THREE_PI_ON_FOUR) +
X (8.0/x)*qone(x)*cos(x-THREE_PI_ON_FOUR)) );
}
X
X
f_besj0()
{
struct value a;
double x;
X (void) pop(&a);
X if (imag(&a) > zero)
X int_error("can only do bessel functions of reals",NO_CARET);
X push( complex(&a,rj0(real(&a)),0.0) );
}
X
X
f_besj1()
{
struct value a;
double x;
X (void) pop(&a);
X if (imag(&a) > zero)
X int_error("can only do bessel functions of reals",NO_CARET);
X push( complex(&a,rj1(real(&a)),0.0) );
}
X
X
f_besy0()
{
struct value a;
double x;
X (void) pop(&a);
X if (imag(&a) > zero)
X int_error("can only do bessel functions of reals",NO_CARET);
X if (real(&a) > 0.0)
X push( complex(&a,ry0(real(&a)),0.0) );
X else {
X push( complex(&a,0.0,0.0) );
X undefined = TRUE ;
X }
}
X
X
f_besy1()
{
struct value a;
double x;
X (void) pop(&a);
X if (imag(&a) > zero)
X int_error("can only do bessel functions of reals",NO_CARET);
X if (real(&a) > 0.0)
X push( complex(&a,ry1(real(&a)),0.0) );
X else {
X push( complex(&a,0.0,0.0) );
X undefined = TRUE ;
X }
}
X
SHAR_EOF
echo 'File gnuplot/standard.c is complete' &&
chmod 0666 gnuplot/standard.c ||
echo 'restore of gnuplot/standard.c failed'
Wc_c="`wc -c < 'gnuplot/standard.c'`"
test 15347 -eq "$Wc_c" ||
echo 'gnuplot/standard.c: original size 15347, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term.c ==============
if test -f 'gnuplot/term.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term.c' &&
/* GNUPLOT - term.c */
#include "plot.h"
#include "setshow.h"
#include "term.h"
#include "bitmap.h"
X
/* for use by all drivers */
#define sign(x) ((x) >= 0 ? 1 : -1)
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))
X
BOOLEAN term_init; /* true if terminal has been initialized */
X
extern FILE *outfile;
extern char outstr[];
extern BOOLEAN term_init;
extern int term;
extern float xsize, ysize;
X
extern char input_line[];
extern struct lexical_unit token[];
extern int num_tokens, c_token;
extern struct value *const_express();
X
extern BOOLEAN interactive;
X
/*
X * instead of <strings.h>
X */
extern char *strcpy();
extern int strlen(), strcmp(), strncmp();
#ifndef AMIGA_AC_5
extern double sqrt();
#endif
X
char *getenv();
X
#ifdef __TURBOC__
char *turboc_init();
#endif
#ifdef PC
void reopen_binary();
#endif
#ifdef vms
char *vms_init();
void vms_reset();
void term_mode_tek();
void term_mode_native();
void term_pasthru();
void term_nopasthru();
void reopen_binary();
void fflush_binary();
#endif
X
/* This is needed because the unixplot library only writes to stdout. */
#ifdef UNIXPLOT
FILE save_stdout;
#endif
int unixplot=0;
X
#define NICE_LINE 0
#define POINT_TYPES 6
X
X
do_point(x,y,number)
int x,y;
int number;
{
register int htic,vtic;
register struct termentry *t = &term_tbl[term];
X
X if (number < 0) { /* do dot */
X (*t->move)(x,y);
X (*t->vector)(x,y);
X return;
X }
X
X number %= POINT_TYPES;
X htic = (t->h_tic/2); /* should be in term_tbl[] in later version */
X vtic = (t->v_tic/2);
X
X switch(number) {
X case 0: /* do diamond */
X (*t->move)(x-htic,y);
X (*t->vector)(x,y-vtic);
X (*t->vector)(x+htic,y);
X (*t->vector)(x,y+vtic);
X (*t->vector)(x-htic,y);
X (*t->move)(x,y);
X (*t->vector)(x,y);
X break;
X case 1: /* do plus */
X (*t->move)(x-htic,y);
X (*t->vector)(x-htic,y);
X (*t->vector)(x+htic,y);
X (*t->move)(x,y-vtic);
X (*t->vector)(x,y-vtic);
X (*t->vector)(x,y+vtic);
X break;
X case 2: /* do box */
X (*t->move)(x-htic,y-vtic);
X (*t->vector)(x-htic,y-vtic);
X (*t->vector)(x+htic,y-vtic);
X (*t->vector)(x+htic,y+vtic);
X (*t->vector)(x-htic,y+vtic);
X (*t->vector)(x-htic,y-vtic);
X (*t->move)(x,y);
X (*t->vector)(x,y);
X break;
X case 3: /* do X */
X (*t->move)(x-htic,y-vtic);
X (*t->vector)(x-htic,y-vtic);
X (*t->vector)(x+htic,y+vtic);
X (*t->move)(x-htic,y+vtic);
X (*t->vector)(x-htic,y+vtic);
X (*t->vector)(x+htic,y-vtic);
X break;
X case 4: /* do triangle */
X (*t->move)(x,y+(4*vtic/3));
X (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
X (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
X (*t->vector)(x,y+(4*vtic/3));
X (*t->move)(x,y);
X (*t->vector)(x,y);
X break;
X case 5: /* do star */
X (*t->move)(x-htic,y);
X (*t->vector)(
x-htic,y);
X (*t->vector)(x+htic,y);
X (*t->move)(x,y-vtic);
X (*t->vector)(x,y-vtic);
X (*t->vector)(x,y+vtic);
X (*t->move)(x-htic,y-vtic);
X (*t->vector)(x-htic,y-vtic);
X (*t->vector)(x+htic,y+vtic);
X (*t->move)(x-htic,y+vtic);
X (*t->vector)(x-htic,y+vtic);
X (*t->vector)(x+htic,y-vtic);
X break;
X }
}
X
X
/*
X * general point routine
X */
line_and_point(x,y,number)
int x,y,number;
{
X /* temporary(?) kludge to allow terminals with bad linetypes
X to make nice marks */
X
X (*term_tbl[term].linetype)(NICE_LINE);
X do_point(x,y,number);
}
X
/*
X * general arrow routine
X */
#define ROOT2 (1.41421) /* sqrt of 2 */
X
do_arrow(sx, sy, ex, ey, head)
X int sx,sy; /* start point */
X int ex, ey; /* end point (point of arrowhead) */
X BOOLEAN head;
{
X register struct termentry *t = &term_tbl[term];
X int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
X
X /* draw the line for the arrow. That's easy. */
X (*t->move)(sx, sy);
X (*t->vector)(ex, ey);
X
X if (head) {
X /* now draw the arrow head. */
X /* we put the arrowhead marks at 45 degrees to line */
X if (sx == ex) {
X /* vertical line, special case */
X int delta = ((float)len / ROOT2 + 0.5);
X if (sy < ey)
X delta = -delta; /* up arrow goes the other way */
X (*t->move)(ex - delta, ey + delta);
X (*t->vector)(ex,ey);
X (*t->vector)(ex + delta, ey + delta);
X } else {
X int dx = sx - ex;
X int dy = sy - ey;
X double coeff = len / sqrt(2.0*((double)dx*(double)dx
X + (double)dy*(double)dy));
X int x,y; /* one endpoint */
X
X x = (int)( ex + (dx + dy) * coeff );
X y = (int)( ey + (dy - dx) * coeff );
X (*t->move)(x,y);
X (*t->vector)(ex,ey);
X
X x = (int)( ex + (dx - dy) * coeff );
X y = (int)( ey + (dy + dx) * coeff );
X (*t->vector)(x,y);
X }
X }
}
X
#ifdef DUMB /* paper or glass dumb terminal */
#include "term/dumb.trm"
#endif
X
X
#ifdef PC /* all PC types */
#include "term/pc.trm"
#endif
X
/*
X all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
X but most require various TEK routines. Hence TEK must be defined for
X the others to compile.
*/
#ifdef BITGRAPH
# ifndef TEK
# define TEK
# endif
#endif
X
#ifdef SELENAR
# ifndef TEK
# define TEK
# endif
#endif
X
#ifdef KERMIT
# ifndef TEK
# define TEK
# endif
#endif
X
#ifdef LN03P
# ifndef TEK
# define TEK
# endif
#endif
X
#ifdef VTTEK
# ifndef TEK
# define TEK
# endif
#endif
X
#ifdef T410X /* Tektronix 4106, 4107, 4109 and 420x terminals */
#include "term/t410x.trm"
#endif
X
#ifdef TEK /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
#include "term/tek.trm"
#endif
X
#ifdef EPSONP /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
#include "term/epson.trm"
#endif
X
#ifdef HPLJII /* HP LaserJet II */
#include "term/hpljii.trm"
#endif
X
#ifdef HPLJII /* HP LaserJet III in HPGL mode */
# ifndef HPGL
# define HPGL
# endif
#endif
X
#ifdef FIG /* Fig 1.4FS Interactive graphics program */
#include "term/fig.trm"
#include "term/bigfig.trm"
#endif
X
#ifdef GPR /* Apollo Graphics Primitive Resource (fixed-size window) */
#include "term/gpr.trm"
#endif /* GPR */
X
#ifdef APOLLO /* Apollo Graphics Primitive Resource (resizable window) */
#include "term/apollo.trm"
#endif /* APOLLO */
X
#ifdef IMAGEN /* IMAGEN printer */
#include "term/imagen.trm"
#endif
X
#ifdef EEPIC /* EEPIC (LATEX) type */
#include "term/eepic.trm"
# ifndef LATEX
# define LATEX
# endif
#endif
X
#ifdef EMTEX /* EMTEX (LATEX for PC) type */
# ifndef LATEX
# define LATEX
# endif
#endif
X
#ifdef LATEX /* LATEX type */
#include "term/latex.trm"
#endif
X
#ifdef POSTSCRIPT /* POSTSCRIPT type */
#include "term/post.trm"
#endif
X
#ifdef PRESCRIBE /* PRESCRIBE type */
#include "term/kyo.trm"
#endif
X
#ifdef UNIXPC /* unix-PC ATT 7300 or 3b1 machine */
#include "term/unixpc.trm"
#endif /* UNIXPC */
X
#ifdef AED
#include "term/aed.trm"
#endif /* AED */
X
#ifdef CGI
#include "term/cgi.trm"
#endif /* CGI */
X
#ifdef HP2648
/* also works for HP2647 */
#include "term/hp2648.trm"
#endif /* HP2648 */
X
#ifdef HP26
#include "term/hp26.trm"
#endif /* HP26 */
X
#ifdef HP75
#ifndef HPGL
#define HPGL
#endif
#endif
X
/* HPGL - includes HP75 and HPLJIII in HPGL mode */
#ifdef HPGL
#include "term/hpgl.trm"
#endif /* HPGL */
X
/* Roland DXY800A plotter driver by Martin Yii, eln...@monu3.OZ
X and Russell Lang, r...@monu1.cc.monash.oz */
#ifdef DXY800A
#include "term/dxy.trm"
#endif /* DXY800A */
X
#ifdef IRIS4D
#include "term/iris4d.trm"
#endif /* IRIS4D */
X
#ifdef QMS
#include "term/qms.trm"
#endif /* QMS */
X
#ifdef REGIS
#include "term/regis.trm"
#endif /* REGIS */
X
#ifdef SUN
#include "term/sun.trm"
#endif /* SUN */
X
#ifdef VWS
#include "term/vws.trm"
#endif /* VWS */
X
#ifdef V384
#include "term/v384.trm"
#endif /* V384 */
X
#ifdef UNIXPLOT
#include "term/unixplot.trm"
#endif /* UNIXPLOT */
X
#ifdef X11
#include "term/x11.trm"
#endif /* X11 */
X
#ifdef DXF
#include "term/dxf.trm"
#endif /* DXF */
X
#ifdef AMIGASCREEN
#include "term/amiga.trm"
#endif
X
X
/* Dummy functions for unavailable features */
X
/* change angle of text. 0 is horizontal left to right.
* 1 is vertical bottom to top (90 deg rotate)
*/
static int null_text_angle()
{
return FALSE ; /* can't be done */
}
X
/* change justification of text.
X * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
X */
static int null_justify_text()
{
return FALSE ; /* can't be done */
}
X
X
/* Change scale of plot.
X * Parameters are x,y scaling factors for this plot.
X * Some terminals (eg latex) need to do scaling themselves.
X */
static int null_scale()
{
return FALSE ; /* can't be done */
}
X
static int do_scale()
{
return TRUE ; /* can be done */
}
X
options_null()
{
X term_options[0] = '\0'; /* we have no options */
}
X
static UNKNOWN_null()
{
}
X
/*
X * term_tbl[] contains an entry for each terminal. "unknown" must be the
X * first, since term is initialized to 0.
X */
struct termentry term_tbl[] = {
X {"unknown", "Unknown terminal type - not a plotting device",
X 100, 100, 1, 1,
X 1, 1, options_null, UNKNOWN_null, UNKNOWN_null,
X UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null,
X UNKNOWN_null, UNKNOWN_null, null_text_angle,
X null_justify_text, UNKNOWN_null, UNKNOWN_null}
X
#ifdef AMIGASCREEN
X ,{"amiga", "Amiga Custom Screen",
X AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR,
X AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset,
X AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
X AMIGA_linetype, AMIGA_put_text, null_text_angle,
X AMIGA_justify_text, do_point, do_arrow}
#endif
X
#ifdef DUMB
X ,{"dumb", "printer or glass dumb terminal",
X DUMB_XMAX, DUMB_YMAX, 1, 1,
X 1, 1, DUMB_options, DUMB_init, DUMB_reset,
X DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
X DUMB_linetype, DUMB_put_text, null_text_angle,
X null_justify_text, DUMB_point, DUMB_arrow}
#endif
X
#ifdef PC
#ifdef __TURBOC__
X
X ,{"egalib", "IBM PC/Clone with EGA graphics board",
X EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
X EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
X EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
X EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle,
X EGALIB_justify_text, do_point, do_arrow}
X
X ,{"vgalib", "IBM PC/Clone with VGA graphics board",
X VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
X VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
X VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
X VGA_linetype, VGA_put_text, VGA_text_angle,
X VGA_justify_text, do_point, do_arrow}
X
X ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
X VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
X VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
X VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
X VGAMONO_linetype, VGA_put_text, VGA_text_angle,
X VGA_justify_text, line_and_point, do_arrow}
X
X ,{"svga", "IBM PC/Clone with Super VGA graphics board",
X SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
X SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
X SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
X SVGA_linetype, SVGA_put_text, SVGA_text_angle,
X SVGA_justify_text, do_point, do_arrow}
X
X ,{"mcga", "IBM PC/Clone with MCGA graphics board",
X MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
X MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
X MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
X MCGA_linetype, MCGA_put_text, MCGA_text_angle,
X MCGA_justify_text, line_and_point, do_arrow}
X
X ,{"cga", "IBM PC/Clone with CGA graphics board",
X CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
X CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
X CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
X CGA_linetype, CGA_put_text, MCGA_text_angle,
X CGA_justify_text, line_and_point, do_arrow}
X
X ,{"hercules", "IBM PC/Clone with Hercules graphics board",
X HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
X HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
X HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
X HERC_linetype, HERC_put_text, MCGA_text_angle,
X HERC_justify_text, line_and_point, do_arrow}
#ifdef ATT6300
X ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
X ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
X ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
X ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
X ATT_linetype, ATT_put_text, ATT_text_angle,
X ATT_justify_text, line_and_point, do_arrow}
#endif
#else /* TURBO */
X
X ,{"cga", "IBM PC/Clone with CGA graphics board",
X CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
X CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
X CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
X CGA_linetype, CGA_put_text, CGA_text_angle,
X null_justify_text, line_and_point, do_arrow}
X
X ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
X EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
X EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
X EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
X EGA_linetype, EGA_put_text, EGA_text_angle,
X null_justify_text, do_point, do_arrow}
X
X ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
X VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
X VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
X VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
X VGA_linetype, VGA_put_text, VGA_text_angle,
X null_justify_text, do_point, do_arrow}
X
#ifdef EGALIB
X ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
X EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
X EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
X EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
X EGALIB_linetype, EGALIB_put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef HERCULES
X ,{"hercules", "IBM PC/Clone with Hercules graphics board",
X HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
X HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
X HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
X HERC_linetype, HERC_put_text, HERC_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif /* HERCULES */
X
#ifdef ATT6300
X ,{"att", "AT&T PC/6300 graphics",
X ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
X ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
X ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
X ATT_linetype, ATT_put_text, ATT_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef CORONA
X ,{"corona325", "Corona graphics ???",
X COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
X COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
X COR_text, null_scale, COR_graphics, COR_move, COR_vector,
X COR_linetype, COR_put_text, COR_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif /* CORONA */
#endif /* TURBO */
#endif /* PC */
X
#ifdef AED
X ,{"aed512", "AED 512 Terminal",
X AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
X AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset,
X AED_text, null_scale, AED_graphics, AED_move, AED_vector,
X AED_linetype, AED_put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
X ,{"aed767", "AED 767 Terminal",
X AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
X AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset,
X AED_text, null_scale, AED_graphics, AED_move, AED_vector,
X AED_linetype, AED_put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef APOLLO
X ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
X 0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
X APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
X APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
X APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
X APOLLO_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef GPR
X ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
X GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
X GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
X GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
X GPR_linetype, GPR_put_text, GPR_text_angle,
X GPR_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef BITGRAPH
X ,{"bitgraph", "BBN Bitgraph Terminal",
X BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR,
X BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset,
X BG_text, null_scale, BG_graphics, BG_move, BG_vector,
X BG_linetype, BG_put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef CGI
X ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
X CGI_XMAX, CGI_YMAX, 0, 0,
X CGI_VTIC, 0, options_null, CGI_init, CGI_reset,
X CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector,
X CGI_linetype, CGI_put_text, CGI_text_angle,
X CGI_justify_text, CGI_point, do_arrow}
X
X ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
X CGI_XMAX, CGI_YMAX, 0, 0,
X CGI_VTIC, 0, options_null, HCGI_init, CGI_reset,
X CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector,
X CGI_linetype, CGI_put_text, CGI_text_angle,
X CGI_justify_text, CGI_point, do_arrow}
#endif
X
#ifdef DXF
X ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
X DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
X DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
X DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
X DXF_linetype, DXF_put_text, DXF_text_angle,
X DXF_justify_text, do_point, do_arrow}
#endif
X
#ifdef DXY800A
X ,{"dxy800a", "Roland DXY800A plotter",
X DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
X DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
X DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
X DXY_linetype, DXY_put_text, DXY_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef EEPIC
X ,{"eepic", "EEPIC -- extended LaTeX picture environment",
X EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR,
X EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset,
X EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector,
X EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle,
X EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
#endif
X
#ifdef EMTEX
X
X ,{"emtex", "LATEX picture environment with emTeX specials",
X LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR,
X LATEX_VTIC, LATEX_HTIC, options_null, EMTEX_init, EMTEX_reset,
X EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector,
X LATEX_linetype, LATEX_put_text, LATEX_text_angle,
X LATEX_justify_text, LATEX_point, LATEX_arrow}
#endif
X
#ifdef EPS60
X ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
X EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
X EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
X EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
X EPSONlinetype, EPSONput_text, EPSON_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef EPSONP
X ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
X EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR,
X EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
X EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector,
X EPSONlinetype, EPSONput_text, EPSON_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef FIG
X ,{"fig", "FIG graphics language: SunView or X graphics editor",
X FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR,
X FIG_VTIC, FIG_HTIC, options_null, FIG_init, FIG_reset,
X FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector,
X FIG_linetype, FIG_put_text, FIG_text_angle,
X FIG_justify_text, do_point, FIG_arrow}
X ,{"bfig", "FIG graphics language: SunView or X graphics editor. Large Graph",
X BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR,
X BFIG_VTIC, BFIG_HTIC, options_null, FIG_init, FIG_reset,
X FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector,
X FIG_linetype, BFIG_put_text, FIG_text_angle,
X FIG_justify_text, do_point, BFIG_arrow}
#endif
X
#ifdef HP26
X ,{"hp2623A", "HP2623A and maybe others",
X HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
X HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
X HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
X HP26_linetype, HP26_put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef HP2648
X ,{"hp2648", "HP2648 and HP2647",
X HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR,
X HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset,
X HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector,
X HP2648linetype, HP2648put_text, HP2648_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef HP75
X ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
X HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
X HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
X HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
X HP75_linetype, HPGL_put_text, HPGL_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef HPGL
X ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
X HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
X HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
X HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
X HPGL_linetype, HPGL_put_text, HPGL_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef HPLJII
X ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
X HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
X HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
X HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
X HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
X HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
X do_arrow}
X ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
X HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
X HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
X HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
X HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
X HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
X do_arrow}
#endif
X
#ifdef HPLJIII
X ,{"hpljiii_port", "HP laserjet iii (using HPGL plot vectors), portrait mode",
X HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
X HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_PORT_init, HPLJIII_reset,
X HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
X HPGL_linetype, HPGL_put_text, HPGL_text_angle,
X null_justify_text, do_point, do_arrow}
X ,{"hpljiii_land", "HP laserjet iii (using HPGL plot vectors), landscape mode",
X HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
X HPGL_VTIC, HPGL_HTIC, options_null, HPLJIII_LAND_init, HPLJIII_reset,
X HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
X HPGL_linetype, HPGL_put_text, HPGL_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef IMAGEN
X ,{"imagen", "Imagen laser printer",
X IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR,
X IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset,
X IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move,
X IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
X IMAGEN_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef IRIS4D
X ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
X IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR,
X IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset,
X IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
X IRIS4D_linetype, IRIS4D_put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef KERMIT
X ,{"kc_tek40xx", "Kermit-MS tek40xx terminal emulator - color",
X TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset,
X KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector,
X KTEK40Clinetype, TEK40put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
X ,{"km_tek40xx", "Kermit-MS tek40xx terminal emulator - monochrome",
X TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset,
X TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector,
X KTEK40Mlinetype, TEK40put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef LATEX
X ,{"latex", "LaTeX picture environment",
X LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR,
X LATEX_VTIC, LATEX_HTIC, options_null, LATEX_init, LATEX_reset,
X LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector,
X LATEX_linetype, LATEX_put_text, LATEX_text_angle,
X LATEX_justify_text, LATEX_point, LATEX_arrow}
#endif
X
#ifdef LN03P
X ,{"ln03", "LN03-plus laser printer in tektronix mode",
X TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, LN03Pinit, LN03Preset,
X TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
X TEK40linetype, TEK40put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef NEC
X ,{"nec_cp6m", "NEC printer CP6, Epson LQ-800 Monochrome",
X NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
X NECVTIC, NECHTIC, options_null, NECinit, NECreset,
X NECtext, null_scale, NECMgraphics, NECmove, NECvector,
X NECMlinetype, NECput_text, NEC_text_angle,
X null_justify_text, line_and_point, do_arrow}
X ,{"nec_cp6c", "NEC printer CP6 Color",
X NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
X NECVTIC, NECHTIC, options_null, NECinit, NECreset,
X NECtext, null_scale, NECCgraphics, NECmove, NECvector,
X NECClinetype, NECput_text, NEC_text_angle,
X null_justify_text, do_point, do_arrow}
X ,{"nec_cp6d", "NEC printer CP6, Epson LQ-800 Draft monochrome",
X NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
X NECVTIC, NECHTIC, options_null, NECinit, NECreset,
X NECdraft_text, null_scale, NECMgraphics, NECmove, NECvector,
X NECMlinetype, NECput_text, NEC_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef POSTSCRIPT
X ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
X PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR,
X PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset,
X PS_text, do_scale, PS_graphics, PS_move, PS_vector,
X PS_linetype, PS_put_text, PS_text_angle,
X PS_justify_text, PS_point, do_arrow}
#endif
X
#ifdef PRESCRIBE
X ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
X PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR,
X PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset,
X PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector,
X PRE_linetype, PRE_put_text, null_text_angle,
X PRE_justify_text, line_and_point, do_arrow}
X ,{"kyo", "Kyocera Laser Printer with Courier font",
X PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR,
X PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset,
X PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector,
X PRE_linetype, PRE_put_text, null_text_angle,
X PRE_justify_text, line_and_point, do_arrow}
#endif /* PRESCRIBE */
X
#ifdef QMS
X ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
X QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR,
X QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset,
X QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
X QMS_linetype,QMS_put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef REGIS
X ,{"regis", "REGIS graphics language",
X REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR,
X REGISVTIC, REGISHTIC, options_null, REGISinit, REGISreset,
X REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
X REGISlinetype, REGISput_text, REGIStext_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
X
#ifdef SELANAR
X ,{"selanar", "Selanar",
X TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset,
X SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector,
X TEK40linetype, TEK40put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef STARC
X ,{"starc", "Star Color Printer",
X STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR,
X STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset,
X STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector,
X STARClinetype, STARCput_text, STARC_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef SUN
X ,{"sun", "SunView window system",
X SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR,
X SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset,
X SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
X SUN_linetype, SUN_put_text, null_text_angle,
X SUN_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef VWS
X ,{"VWS", "VAX Windowing System (UIS)",
X VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
X VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
X VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
X VWS_linetype, VWS_put_text, VWS_text_angle,
X VWS_justify_text, do_point, do_arrow}
#endif
X
#ifdef TANDY60
X ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
X EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
X EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
X TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
X EPSONlinetype, EPSONput_text, EPSON_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef T410X
X ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
X T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR,
X T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset,
X T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
X T410X_linetype, T410X_put_text, T410X_text_angle,
X null_justify_text, T410X_point, do_arrow}
#endif
X
#ifdef TEK
X ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
X TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset,
X TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
X TEK40linetype, TEK40put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef UNIXPLOT
X ,{"unixplot", "Unix plotting standard (see plot(1))",
X UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
X UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset,
X UP_text, null_scale, UP_graphics, UP_move, UP_vector,
X UP_linetype, UP_put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef UNIXPC
X ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
X uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR,
X uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset,
X uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
X uPC_linetype, uPC_put_text, uPC_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef V384
X ,{"vx384", "Vectrix 384 and Tandy color printer",
X V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR,
X V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset,
X V384_text, null_scale, V384_graphics, V384_move, V384_vector,
X V384_linetype, V384_put_text, null_text_angle,
X null_justify_text, do_point, do_arrow}
#endif
X
#ifdef VTTEK
X ,{"vttek", "VT-like tek40xx terminal emulator",
X TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
X TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
X TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
X VTTEK40linetype, VTTEK40put_text, null_text_angle,
X null_justify_text, line_and_point, do_arrow}
#endif
X
#ifdef X11
X ,{"x11", "X11 Window System",
X X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
X X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset,
X X11_text, null_scale, X11_graphics, X11_move, X11_vector,
X X11_linetype, X11_put_text, null_text_angle,
X X11_justify_text, line_and_point, do_arrow}
X ,{"X11", "X11 Window System - multi-color points",
X X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
X X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset,
X X11_text, null_scale, X11_graphics, X11_move, X11_vector,
X X11_linetype, X11_put_text, null_text_angle,
X X11_justify_text, do_point, do_arrow}
#endif
};
X
#define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
X
X
list_terms()
{
register int i;
X
X fprintf(stderr,"\nAvailable terminal types:\n");
X for (i = 0; i < TERMCOUNT; i++)
X fprintf(stderr," %15s %s\n",
X term_tbl[i].name, term_tbl[i].description);
X (void) putc('\n',stderr);
}
X
X
/* set_term: get terminal number from name on command line */
/* will change 'term' variable if successful */
int /* term number */
set_term(c_token)
int c_token;
{
X register int t;
X char *input_name;
X
X if (!token[c_token].is_token)
X int_error("terminal name expected",c_token);
X t = -1;
X input_name = input_line + token[c_token].start_index;
X t = change_term(input_name, token[c_token].length);
X if (t == -1)
X int_error("unknown terminal type; type just 'set terminal' for a list",
X c_token);
X if (t == -2)
X int_error("ambiguous terminal name; type just 'set terminal' for a list",
X c_token);
X
X /* otherwise the type was changed */
X
X return(t);
}
X
/* change_term: get terminal number from name and set terminal type */
/* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
int
change_term(name, length)
X char *name;
X int length;
{
X int i, t = -1;
X
X for (i = 0; i < TERMCOUNT; i++) {
X if (!strncmp(name,term_tbl[i].name,length)) {
X if (t != -1)
X return(-2); /* ambiguous */
X t = i;
X }
X }
X
X if (t == -1) /* unknown */
X return(t);
X
X /* Success: set terminal type now */
X
X term = t;
X term_init = FALSE;
X name = term_tbl[term].name;
X
X /* Special handling for unixplot term type */
X if (!strncmp("unixplot",name,8)) {
X UP_redirect (2); /* Redirect actual stdout for unixplots */
X } else if (unixplot) {
X UP_redirect (3); /* Put stdout back together again. */
X }
X
X if (interactive)
X fprintf(stderr, "Terminal type set to '%s'\n", name);
X
X return(t);
}
X
/*
X Routine to detect what terminal is being used (or do anything else
X that would be nice). One anticipated (or allowed for) side effect
X is that the global ``term'' may be set.
X The environment variable GNUTERM is checked first; if that does
X not exist, then the terminal hardware is checked, if possible,
X and finally, we can check $TERM for some kinds of terminals.
*/
/* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
init_terminal()
{
X char *term_name = NULL;
X int t;
X char *term = NULL; /* from TERM environment var */
#ifdef X11
X char *display = NULL;
#endif
X char *gnuterm = NULL;
X
X /* GNUTERM environment variable is primary */
X gnuterm = getenv("GNUTERM");
X if (gnuterm != (char *)NULL)
X term_name = gnuterm;
X else {
#ifdef __TURBOC__
X term_name = turboc_init();
X term = (char *)NULL; /* shut up turbo C */
#endif
X
#ifdef vms
X term_name = vms_init();
#endif
X
#ifdef SUN
X term = getenv("TERM"); /* try $TERM */
X if (term_name == (char *)NULL
X && term != (char *)NULL && strcmp(term, "sun") == 0)
X term_name = "sun";
#endif /* sun */
X
#ifdef GPR
X if (gpr_isa_pad()) term_name = "gpr"; /* find out whether stdout is a DM pad. See term/gpr.trm */
#else
#ifdef APOLLO
X if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
#endif /* APOLLO */
#endif /* GPR */
X
#ifdef X11
X term = getenv("TERM"); /* try $TERM */
X if (term_name == (char *)NULL
X && term != (char *)NULL && strcmp(term, "xterm") == 0)
X term_name = "x11";
X display = getenv("DISPLAY");
X if (term_name == (char *)NULL && display != (char *)NULL)
X term_name = "x11";
#endif /* x11 */
X
#ifdef AMIGASCREEN
X term_name = "amiga";
#endif
X
#ifdef UNIXPC
X if (iswind() == 0) {
X term_name = "unixpc";
X }
#endif /* unixpc */
X
#ifdef CGI
X if (getenv("CGIDISP") || getenv("CGIPRNT"))
X term_name = "cgi";
#endif /*CGI */
X }
X
X /* We have a name, try to set term type */
X if (term_name != NULL && *term_name != '\0') {
X t = change_term(term_name, strlen(term_name));
X if (t == -1)
X fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
X else if (t == -2)
X fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
X else /* successful */
X ;
X }
}
X
X
#ifdef __TURBOC__
char *
turboc_init()
{
X int g_driver,g_mode;
X char far *c1,*c2;
X char *term_name = NULL;
X struct text_info tinfo; /* So we can restore starting text mode. */
X
/* Some of this code including BGI drivers is copyright Borland Intl. */
X g_driver=DETECT;
X get_path();
X gettextinfo(&tinfo);
X initgraph(&g_driver,&g_mode,path);
X c1=getdrivername();
X c2=getmodename(g_mode);
X switch (g_driver){
X case -2: fprintf(stderr,"Graphics card not detected.\n");
X break;
X case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
X break;
X case -4: fprintf(stderr,"Invalid BGI driver file.\n");
X break;
X case -5: fprintf(stderr,"Insufficient memory to load ",
X "graphics driver.");
X break;
X case 1 : term_name = "cga";
X break;
X case 2 : term_name = "mcga";
X break;
X case 3 :
X case 4 : term_name = "egalib";
X break;
X case 7 : term_name = "hercules";
X break;
X case 8 : term_name = "att";
X break;
X case 9 : term_name = "vgalib";
X break;
X }
X closegraph();
X textmode(tinfo.currmode);
X clrscr();
X fprintf(stderr,"\tTC Graphics, driver %s mode %s\n",c1,c2);
X return(term_name);
}
#endif /* __TURBOC__ */
X
/*
X This is always defined so we don't have to have command.c know if it
X is there or not.
*/
#ifndef UNIXPLOT
UP_redirect(caller) int caller;
{
X caller = caller; /* to stop Turbo C complaining
X * about caller not being used */
}
#else
UP_redirect (caller)
int caller;
/*
X Unixplot can't really write to outfile--it wants to write to stdout.
X This is normally ok, but the original design of gnuplot gives us
X little choice. Originally users of unixplot had to anticipate
X their needs and redirect all I/O to a file... Not very gnuplot-like.
X
X caller: 1 - called from SET OUTPUT "FOO.OUT"
X 2 - called from SET TERM UNIXPLOT
X 3 - called from SET TERM other
X 4 - called from SET OUTPUT
*/
{
X switch (caller) {
X case 1:
X /* Don't save, just replace stdout w/outfile (save was already done). */
X if (unixplot)
X *(stdout) = *(outfile); /* Copy FILE structure */
X break;
X case 2:
X if (!unixplot) {
X fflush(stdout);
X save_stdout = *(stdout);
X *(stdout) = *(outfile); /* Copy FILE structure */
X unixplot = 1;
X }
X break;
X case 3:
X /* New terminal in use--put stdout back to original. */
X closepl();
X fflush(stdout);
X *(stdout) = save_stdout; /* Copy FILE structure */
X unixplot = 0;
X break;
X case 4:
X /* User really wants to go to normal output... */
X if (unixplot) {
X fflush(stdout);
X *(stdout) = save_stdout; /* Copy FILE structure */
X }
X break;
X }
}
#endif
X
X
/* test terminal by drawing border and text */
/* called from command test */
test_term()
{
X register struct termentry *t = &term_tbl[term];
X char *str;
X int x,y, xl,yl, i;
X unsigned int xmax, ymax;
X char label[MAX_ID_LEN];
X int scaling;
X
X if (!term_init) {
X (*t->init)();
X term_init = TRUE;
X }
X screen_ok = FALSE;
X scaling = (*t->scale)(xsize, ysize);
X xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
X ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
X (*t->graphics)();
X /* border linetype */
X (*t->linetype)(-2);
X (*t->move)(0,0);
X (*t->vector)(xmax-1,0);
X (*t->vector)(xmax-1,ymax-1);
X (*t->vector)(0,ymax-1);
X (*t->vector)(0,0);
X (void) (*t->justify_text)(LEFT);
X (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
X /* axis linetype */
X (*t->linetype)(-1);
X (*t->move)(xmax/2,0);
X (*t->vector)(xmax/2,ymax-1);
X (*t->move)(0,ymax/2);
X (*t->vector)(xmax-1,ymax/2);
X /* test width and height of characters */
X (*t->linetype)(-2);
X (*t->move)( xmax/2-t->h_char*10,ymax/2+t->v_char/2);
X (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
X (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
X (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
X (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
X (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
X "12345678901234567890");
X /* test justification */
X (void) (*t->justify_text)(LEFT);
X (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
X str = "centre+d text";
X if ((*t->justify_text)(CENTRE))
X (*t->put_text)(xmax/2,
X ymax/2+t->v_char*5,str);
X else
X (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
X ymax/2+t->v_char*5,str);
X str = "right justified";
X if ((*t->justify_text)(RIGHT))
X (*t->put_text)(xmax/2,
X ymax/2+t->v_char*4,str);
X else
X (*t->put_text)(xmax/2-strlen(str)*t->h_char,
X ymax/2+t->v_char*4,str);
X /* test text angle */
X str = "rotated ce+ntred text";
X if ((*t->text_angle)(1)) {
X if ((*t->justify_text)(CENTRE))
X (*t->put_text)(t->v_char,
X ymax/2,str);
X else
X (*t->put_text)(t->v_char,
X ymax/2-strlen(str)*t->h_char/2,str);
X }
X else {
X (void) (*t->justify_text)(LEFT);
X (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
SHAR_EOF
true || echo 'restore of gnuplot/term.c failed'
fi
echo 'End of part 24'
echo 'File gnuplot/term.c is continued in part 25'
echo 25 > _shar_seq_.tmp
#!/bin/sh
# this is Part.25 (part 25 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/term.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 25; 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.c'
else
echo 'x - continuing file gnuplot/term.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/term.c' &&
X }
X (void) (*t->justify_text)(LEFT);
X (void) (*t->text_angle)(0);
X /* test tic size */
X (*t->move)(xmax/2+t->h_tic*2,0);
X (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
X (*t->move)(xmax/2,t->v_tic*2);
X (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
X (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
X /* test line and point types */
X x = xmax - t->h_char*4 - t->h_tic*4;
X y = ymax - t->v_char;
X for ( i = -2; y > t->v_char; i++ ) {
X (*t->linetype)(i);
X (void) sprintf(label,"%d",i);
X if ((*t->justify_text)(RIGHT))
X (*t->put_text)(x,y,label);
X else
X (*t->put_text)(x-strlen(label)*t->h_char,y,label);
X (*t->move)(x+t->h_char,y);
X (*t->vector)(x+t->h_char*4,y);
X if ( i >= -1 )
X (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
X y -= t->v_char;
X }
X /* test some arrows */
X (*t->linetype)(0);
X x = xmax/4;
X y = ymax/4;
X xl = t->h_tic*5;
X yl = t->v_tic*5;
X (*t->arrow)(x,y,x+xl,y,TRUE);
X (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
X (*t->arrow)(x,y,x,y+yl,TRUE);
X (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
X (*t->arrow)(x,y,x-xl,y,TRUE);
X (*t->arrow)(x,y,x-xl,y-yl,TRUE);
X (*t->arrow)(x,y,x,y-yl,TRUE);
X (*t->arrow)(x,y,x+xl,y-yl,TRUE);
X /* and back into text mode */
X (*t->text)();
}
X
X
#ifdef PC
/* output for some terminal types must be binary to stop non Unix computers
X changing \n to \r\n.
X If the output is not STDOUT, the following code reopens outfile
X with binary mode. */
void
reopen_binary()
{
char filename[MAX_ID_LEN+1];
X
X if (strcmp(outstr,"STDOUT")) {
X (void) fclose(outfile);
X (void) strcpy(filename,outstr+1); /* remove quotes */
X filename[strlen(filename)-1] = '\0';
X if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
X os_error("cannot reopen file with binary type; output unknown",
X NO_CARET);
X }
X else {
X os_error("cannot reopen file with binary type; output reset to ascii",
X NO_CARET);
X }
X }
X }
}
#endif
X
#ifdef vms
/* these are needed to modify terminal characteristics */
#include <descrip.h>
#include <iodef.h>
#include <ttdef.h>
#include <tt2def.h>
#include <dcdef.h>
#include <ssdef.h>
#include <stat.h>
#include <fab.h>
static unsigned short chan;
static int old_char_buf[3], cur_char_buf[3];
$DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
X
char *vms_init()
/*
X * Determine if we have a regis terminal
X * and save terminal characteristics
*/
{
X /* Save terminal characteristics in old_char_buf and
X initialise cur_char_buf to current settings. */
X int i;
X sys$assign(&sysoutput_desc,&chan,0,0);
X sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
X sys$dassgn(chan);
X
X /* Test if terminal is regis */
X if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
X return(NULL);
}
X
void
vms_reset()
/* set terminal to original state */
{
X int i;
X sys$assign(&sysoutput_desc,&chan,0,0);
X sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
X sys$dassgn(chan);
}
X
void
term_mode_tek()
/* set terminal mode to tektronix */
{
X long status;
X if (outfile != stdout) return; /* don't modify if not stdout */
X sys$assign(&sysoutput_desc,&chan,0,0);
X cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
X cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
X
X cur_char_buf[1] &= ~TT$M_CRFILL;
X cur_char_buf[1] &= ~TT$M_ESCAPE;
X cur_char_buf[1] &= ~TT$M_HALFDUP;
X cur_char_buf[1] &= ~TT$M_LFFILL;
X cur_char_buf[1] &= ~TT$M_MECHFORM;
X cur_char_buf[1] &= ~TT$M_NOBRDCST;
X cur_char_buf[1] &= ~TT$M_NOECHO;
X cur_char_buf[1] &= ~TT$M_READSYNC;
X cur_char_buf[1] &= ~TT$M_REMOTE;
X cur_char_buf[1] |= TT$M_LOWER;
X cur_char_buf[1] |= TT$M_TTSYNC;
X cur_char_buf[1] |= TT$M_WRAP;
X cur_char_buf[1] &= ~TT$M_EIGHTBIT;
X cur_char_buf[1] &= ~TT$M_MECHTAB;
X cur_char_buf[1] &= ~TT$M_SCOPE;
X cur_char_buf[1] |= TT$M_HOSTSYNC;
X
X cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
X cur_char_buf[2] &= ~TT2$M_BLOCK;
X cur_char_buf[2] &= ~TT2$M_DECCRT3;
X cur_char_buf[2] &= ~TT2$M_LOCALECHO;
X cur_char_buf[2] &= ~TT2$M_PASTHRU;
X cur_char_buf[2] &= ~TT2$M_REGIS;
X cur_char_buf[2] &= ~TT2$M_SIXEL;
X cur_char_buf[2] |= TT2$M_BRDCSTMBX;
X cur_char_buf[2] |= TT2$M_EDITING;
X cur_char_buf[2] |= TT2$M_INSERT;
X cur_char_buf[2] |= TT2$M_PRINTER;
X cur_char_buf[2] &= ~TT2$M_ANSICRT;
X cur_char_buf[2] &= ~TT2$M_AVO;
X cur_char_buf[2] &= ~TT2$M_DECCRT;
X cur_char_buf[2] &= ~TT2$M_DECCRT2;
X cur_char_buf[2] &= ~TT2$M_DRCS;
X cur_char_buf[2] &= ~TT2$M_EDIT;
X cur_char_buf[2] |= TT2$M_FALLBACK;
X
X status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
X if (status == SS$_BADPARAM) {
X /* terminal fallback utility not installed on system */
X cur_char_buf[2] &= ~TT2$M_FALLBACK;
X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
X }
X else {
X if (status != SS$_NORMAL)
X lib$signal(status,0,0);
X }
X sys$dassgn(chan);
}
X
void
term_mode_native()
/* set terminal mode back to native */
{
X int i;
X if (outfile != stdout) return; /* don't modify if not stdout */
X sys$assign(&sysoutput_desc,&chan,0,0);
X sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
X for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
X sys$dassgn(chan);
}
X
void
term_pasthru()
/* set terminal mode pasthru */
{
X if (outfile != stdout) return; /* don't modify if not stdout */
X sys$assign(&sysoutput_desc,&chan,0,0);
X cur_char_buf[2] |= TT2$M_PASTHRU;
X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
X sys$dassgn(chan);
}
X
void
term_nopasthru()
/* set terminal mode nopasthru */
{
X if (outfile != stdout) return; /* don't modify if not stdout */
X sys$assign(&sysoutput_desc,&chan,0,0);
X cur_char_buf[2] &= ~TT2$M_PASTHRU;
X sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
X sys$dassgn(chan);
}
X
void
reopen_binary()
/* close the file outfile outfile and reopen it with binary type
X if not already done or outfile == stdout */
{
X stat_t stat_buf;
X char filename[MAX_ID_LEN+1];
X if (outfile != stdout) { /* don't modify if not stdout */
X if (!fstat(fileno(outfile),&stat_buf)) {
X if (stat_buf.st_fab_rfm != FAB$C_FIX) {
X /* modify only if not already done */
X (void) fclose(outfile);
X (void) strcpy(filename,outstr+1); /* remove quotes */
X filename[strlen(filename)-1] = '\0';
X (void) delete(filename);
X if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
X == (FILE *)NULL ) {
X if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
X os_error("cannot reopen file with binary type; output unknown",
X NO_CARET);
X }
X else {
X os_error("cannot reopen file with binary type; output reset to ascii",
X NO_CARET);
X }
X }
X }
X }
X else{
X os_error("cannot reopen file with binary type; output remains ascii",
X NO_CARET);
X }
X }
}
X
void
fflush_binary()
{
X typedef short int INT16; /* signed 16-bit integers */
X register INT16 k; /* loop index */
X if (outfile != stdout) {
X /* Stupid VMS fflush() raises error and loses last data block
X unless it is full for a fixed-length record binary file.
X Pad it here with NULL characters. */
X for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
X putc('\0',outfile);
X fflush(outfile);
X }
}
#endif
SHAR_EOF
echo 'File gnuplot/term.c is complete' &&
chmod 0644 gnuplot/term.c ||
echo 'restore of gnuplot/term.c failed'
Wc_c="`wc -c < 'gnuplot/term.c'`"
test 50685 -eq "$Wc_c" ||
echo 'gnuplot/term.c: original size 50685, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/Intergraph.x11 ==============
if test -f 'gnuplot/Intergraph.x11' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/Intergraph.x11 (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/Intergraph.x11 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/Intergraph.x11' &&
#!/bin/sh
mv gnuplot_x11.c gnuplot_x11.c_x
mv corplot.c corplot.c_pc
acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
-DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw *.c \
-lbsd -lplot -lm -o gnuplot.intergraph
mv gnuplot_x11.c_x gnuplot_x11.c
acc -knr -DSYSV -DUSG -DVFORK -DNOCOPY -DGAMMA=gamma -DGETCWD -DX11 \
-DUNIXPLOT -I/usr/include/X11 -I/usr/include/X11/Xaw gnuplot_x11.c \
-lXaw -lXmu -lXt -lXext -lX11 -lbsd -lm -o gnuplot_x11.intergraph
SHAR_EOF
chmod 0644 gnuplot/Intergraph.x11 ||
echo 'restore of gnuplot/Intergraph.x11 failed'
Wc_c="`wc -c < 'gnuplot/Intergraph.x11'`"
test 475 -eq "$Wc_c" ||
echo 'gnuplot/Intergraph.x11: original size 475, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/linkopt.amg ==============
if test -f 'gnuplot/linkopt.amg' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/linkopt.amg (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/linkopt.amg (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/linkopt.amg' &&
FROM LIB:c.o
X bitmap.o command.o eval.o graphics.o help.o internal.o misc.o parse.o
X plot.o scanner.o setshow.o standard.o term.o util.o version.o contour.o
X graph3d.o
TO gnuplot
LIB LIB:lcmieee.lib LIB:lcnb.lib
VERBOSE
SHAR_EOF
chmod 0666 gnuplot/linkopt.amg ||
echo 'restore of gnuplot/linkopt.amg failed'
Wc_c="`wc -c < 'gnuplot/linkopt.amg'`"
test 232 -eq "$Wc_c" ||
echo 'gnuplot/linkopt.amg: original size 232, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/README.Install ==============
if test -f 'gnuplot/README.Install' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/README.Install (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/README.Install (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.Install' &&
The GNUPLOT source code and executables may be copied and/or modified
freely as long as the copyright messages are left intact.
X
See the History file for changes to GNUPLOT.
X
Compilation instructions are near the end of this file.
X
GNUPLOT has been tested on Sun3's and Sun4's (SunOS 4.0.3 and 4.1.1),
a VAX 6410 (VMS 5.2), Commodore Amiga's (KS/WB 1.3 and 2.0, Lattice C
and Aztec C beta 5.2a), IBM PC XT's and AT's (MS-DOS 3.3/5.0 BC++ 2.0/TC++
1.0), IRIS 4D/70G and 4D/25G with MIPS C, NeXT with gnu C 1.34,
DECStation 5000/200PXG (ULTRIX V4.1),
AT&T 3B1 (version 3.51m with cc and gcc 1.39),
and Apollo's (DomainOS SR10.3 BSD4.3 with C compiler 68K Rev 6.7(316)).
The code is written with portability in mind.
GNUPLOT has not been tested on Pyramid 90x and IBM PC Microsoft C.
X
Send your comments, suggestions, or modifications to
X pixar!info-g...@sun.com
This is a mailing list; to join it send a note to
X pixar!info-gnupl...@sun.com
Send bug reports to
X pixar!bug-g...@sun.com
X
X PREPROCESSOR #DEFINES
X
These #defines should be checked before compilation (see the makefiles):
define file note
------ ---- --------
NOVFORK Makefile define if you don't have the vfork() system call
GAMMA Makefile define if you've got gamma(3)
MEMCPY Makefile define if your bcopy() is called memcpy()
MEMSET Makefile define if you have memset() but not bzero()
NOCOPY Makefile define if you've don't have a memcpy() by any name
bcopy() plot.h define if you've got a memcpy() by some OTHER name
X (see example in plot.h)
PC Makefile define if compiling on a PClone
MSDOS Makefile define if compiling under MSDOS;
X automatically defined by Microsoft C 5.10
HELPFILE Makefile name including path of gnuplot.gih file.
VERYLARGE plot.h define to be largest coordinate number.
SHELL plot.h default shell to spawn if SHELL environment
X variable not found at run-time
NOCWDRC Makefile define to inhibit check of ./.gnuplot
READLINE Makefile define if you want command-line editing
X
Valid TERMFLAGS defines. These defines are used to include the
various plotting terminals, printers, and protocols that a given version
of gnuplot can access:
X
define file note
------ ---- --------
TERMFLAGS Makefile the set of terminals you want, from below
X or term.h
X
X AED AED 512 and AED 767
X AMIGASCREEN Amiga custom screen
X APOLLO Apollo Graphics Primitive Resource (resizable window)
X ATT6300 PC with AT&T 6300 graphics
X BITGRAPH BBN BitGraph
X CGI SCO CGI
X CORONA PC with Corona graphics 325
X DXY800A Roland DXY800A plotter
X DUMB Printer or glass dumb terminal
X DXF AutoCad (Release 10.x) dxf file format
X EEPIC EEPIC-extended LaTeX driver, for EEPIC users
X EGALIB PC with EGA/VGA graphics.
X EMTEX LATEX picture environment with emTeX specials
X EPS60 Epson-style 60-dot per inch printers
X EPSONP Epson LX-800, Star NL-10, NX-1000 and lots of others
X FIG Fig graphics language (requires object.h from TransFig)
X GPR Apollo Graphics Primitive Resource (fixed-size window)
X HERCULES IBM PC/Clone with Hercules graphics board
X HP2648 HP2648, HP2647
X HP26 HP2623A and maybe others
X HP75 HP7580, and probably other HPs
X HPGL HP7475 and (hopefully) lots of others
X HPLJII HP Laserjet II
X IMAGEN Imagen laser printers (300dpi) (requires -Iterm also)
X IRIS4D IRIS4D series computer
X KERMIT MS-Kermit Tektronix 4010 emulator
X LATEX LATEX picture environment
X NEC NEC CP6 pinwriter printer
X POSTSCRIPT Postscript
X PRESCRIBE Kyocera Laser printer
X QMS QMS/QUIC laserprinter (Talaris 1200 and others)
X REGIS ReGis graphics (vt125, vt220, vt240, Gigis...)
X SELANAR Selanar
X STARC Star Color Printer
X SUN Sun Microsystems Workstation
X T410X Tektronix 4106, 4107, 4109 and 420x terminals
X TANDY60 Tandy DMP-130 series 60-dot per inch graphics
X TEK Tektronix 4010, and probably others
X UNIXPC unixpc (ATT 3b1 or ATT 7300)
X UNIXPLOT unixplot
X V384 Vectrix 384 and tandy color printer
X VTTEK VT like Tektronix 4010 emulator
X X11 X11R4 window system
X
X
These #defines are defined automatically by various compilers, some
gnuplot routines check these defines to implement features found in the
various environments:
X
define note
------ --------
AMIGA_AC_5 defined for Manx Aztec C 5.2a on the Amiga
AMIGA_LC_5_1 defined for Lattice C 5.01 on the Amiga
apollo defined by Apollo's C compilers.
_CRAY defined by CRAY's C compiler.
__TURBOC__ defined automatically by Turbo C 2.0, C++ 1.0, Borland C++ 2.0
unix defined by most unix C compilers.
vms (and VMS) defined by VAX-11 C under VMS.
__ZTC__ Zortech C compiler under MSDOS.
X
X
X TO COMPILE
X
under UNIX:
To compile do:
X Copy makefile.unx to Makefile
X cp makefile.unx Makefile
X Look through the Makefile to see if you need to make any changes.
X See especially the HELPDEST and TERMFLAGS variables. Edit if needed.
X Alternatively, all these variables may be set as command line arguments to
X 'make'. For example:
X
X make <MACHINE> HELPDEST='/usr/um/misc/lib/gnuplot.gih' \
X DEST='/usr/um/misc/bin' READLINE=
X
X Edit term.h, to include/exclude terminals
X Type
X make
X For further instructions.
X If that works, try
X make install
X For further instructions.
X
under VMS:
X To compile:
X copy makefile.vms makefile.
X make
X Or if you don't have a suitable make:
X @buildvms
X To tell gnuplot where to find the help library:
X $ define gnuplot$help disk:[directory]gnuplot.hlb
X Alternatively (and preferably) put the help in the main system help library.
X
under AmigaDOS:
Using Aztec C 5.2a
X make -f makefile.ami
Using Lattice C 5.1
X lmk -f makefile.amg
X
under MSDOS:
Using Microsoft C 5.10.
X copy makefile.msc makefile
X make makefile
X
Using Borland C++ 2.0, Turbo C++ 1.0
X copy makefile.tc makefile
X Edit makefile to change TC, BIN, BGI, BGIOBJ. You may also want to turn
X on overlays (See manual for more on overlays).
X Edit linkopt.tc (linkopt.tco if overlays on) to change location of
X libraries.
X make
X
Using Turbo C 2.0.
X As per Borland C++ 2.0. Edit linkopt.tc to change location of libraries.
X
X
The file gnuplot.gih is needed for help on the PC.
If the file gnuplot.gih is not in the default directory, then use:
X set GNUHELP={full path name of gnuplot.gih}
X
X
X ENVIRONMENT VARIABLES
X
See 'help environment'.
X
If the environment variable GNUTERM is found, it is used as the terminal
type. Otherwise, in some cases the variable TERM will be used, or the
hardware may be automatically detected.
X
The PC version looks for the environment variable GNUPLOT to contain
the name of the directory from which to load the initialization file
GNUPLOT.INI. See the help on 'start_up' for more information.
X
HOME is examined as a directory where a .gnuplot startup file might be
found. See help on "start-up".
X
If defined, the environment variable GNUHELP is used for the name
of the .gih help file, otherwise HELPFILE (defined in makefile or
plot.c) is used.
X
The VMS version looks for the logical name GNUPLOT$HELP to locate
the help library.
SHAR_EOF
chmod 0644 gnuplot/README.Install ||
echo 'restore of gnuplot/README.Install failed'
Wc_c="`wc -c < 'gnuplot/README.Install'`"
test 7729 -eq "$Wc_c" ||
echo 'gnuplot/README.Install: original size 7729, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/History ==============
if test -f 'gnuplot/History' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/History (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/History (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/History' &&
X
X GNUPLOT 3.0 RELEASE NOTES
X
This describes changes to gnuplot since version 2.02 (ie, 2.0
patchlevel 2).
X
Highlights:
-----------
Gnuplot now handles surfaces as well. A new command names 'splot' (for
surface plot) has been added for that purpose. A number of new 'set'
options for surfaces have also been added and include: isosamples,
view, contour, cntrparam, mapping and surface. All tic/label/range
setting for x and y axes were extended for z as well.
X
The size of data file for both curves and surfaces is now independent
of the samples (and iso_samples) variables. Data structures will
automatically be extended to hold the entire data file.
X
New features:
-------------
3-d plotting with 'splot', and many auxiliary options.
X
New 'errorbars' plot style.
X
New 'using x:y{:z}' format (NOT COMPATIBLE WITH GNUPLOT 2.02).
X
Data file plotting (for both curves and surfaces) does not require
setting samples (and isosamples for surfaces) any more. Size is
increased on the fly, without affecting the sample rate of functions.
X
New makefile scheme for unix, that supports lots of flavors.
X
Command-line editing and history.
X
Adjustable display of plot border ('set border').
X
Set-commands 'x/y/zlabel' can now position the label.
X
Set-command 'title' can now position the title.
X
New time display command ('set time').
X
All PostScript devices were rewritten and merged into one (Color
Postscript is supported). Due to this many of the old postscript
terminal driver names are not supported; only 'postscript' is
recognized. Use 'help set terminal postscript' to find out how to get
your old favorite back, and more.
X
A 'gnuplot' mode for emacs in the file gnuplot.el.
X
SGI device was improved.
X
New option to 'set arrow' called 'nohead'.
X
List of all new commands:
-------------------------
splot
X
List of all new set-show commands:
---------------------------------
border, cntrparam, contour, isosamples, mapping, rrange, surface,
time, view, zlabel, ztics, zrange.
X
List of changed set-show commands:
----------------------------------
arrow, terminal, title, xlabel, ylabel, zlabel
X
New terminal drivers:
---------------------
vws, apollo, gpr apollo, dumb, BigFig, Super
VGA, ln03/hplj/hpdj, dxf.
X
Deletions:
----------
The gnut2p translator (translating gnutex to gnuplot) has been removed
from the standard distribution. It is available for ftp separately at
cs.duke.edu as dist/sources/gnuplot/gnut2p.tar.Z
X
Bug fixes include:
------------------
Fix a bug in parametric type hangup.
X
Add a .sty file to fix indexing problem in manual.
X
Fix a bug in hpljii.
X
Fix a bug in FIG arrows.
X
X
X ACKNOWLEDGEMENTS
X
- New PostScript device by Russell Lang (r...@monu1.cc.monash.edu.au).
- Several bug fixes, manual proofing, World Map by John Campbell
(camp...@nauvax.ucc.nau.edu).
- Eliminating samples from data files, lasergnu, and errorbars by
David Kotz (David...@Dartmouth.edu).
- New history and line editing capability for Unix and MSDOS, bivariate
X functions and some bug fixes by Tom Tkacik (tka...@hobbes.cs.gmr.com).
- New using x:y{:z} format by Dennis Linse (djl...@phoenix.princeton.edu).
- Some polar enhancements, time display and some bug fixes by
Alex Woo (w...@ra-next.arc.nasa.gov).
- Dumb terminal by Francois Pinard (pin...@iro.umontreal.ca).
- VWS device by Walter Speth (sp...@dbnpib5.bitnet).
- BigFig device by (i...@augean.ua.oz.au).
- XDF device by Florian Hiss (fhis...@w204zrz.zrz.tu-berlin.de).
- HP Desk Jet device, overlay support for BCC and more efficient help
and pc.trm for MSDOS by Maurice Castro and Russell Lang
(r...@monu1.cc.monash.edu.au).
- New makefile scheme by Roque Donizete De Oliveira and David Kotz
(oliv...@caen.engin.umich.edu and David...@Dartmouth.edu).
- The 3d extensions, contouring, Super VGA device, and bringing this new
version up by Gershon Elber (ger...@cs.utah.edu).
X
Other bug fixes/improvments:
= Tom Bopp (tb...@uhunix.uhcc.hawaii.edu)
= Kenneth H. Carpenter (k...@eece.ksu.edu)
= Mark Christopher (chr...@bnr.ca)
= Henk de Haan (ha...@irimcf.tudelft.nl)
= David Gillespie (da...@csvax.cs.caltech.edu)
X
Beta testers:
+ John Campbell (camp...@nauvax.ucc.nau.edu)
+ Kenneth H. Carpenter (k...@eece.ksu.edu)
+ Gershon Elber (ger...@cs.utah.edu)
+ Pat Empleo (emp...@afal-edwards.af.mil)
+ David Kotz (d...@moose.dartmouth.edu)
+ Russell Lang (r...@monu1.cc.monash.edu.au)
+ Tom Tkacik (tka...@hobbes.cs.gmr.com)
+ Roque Donizete De Oliveira (oliv...@caen.engin.umich.edu)
+ Walter Speth (Sp...@dbnpib5.bitnet)
+ Carsten Steger (ste...@gshalle2.informatik.tu-muenchen.de)
X
============================================================================
X
X GNUPLOT 2.0 RELEASE NOTES
X
New terminal drivers: ATT6300, Roland DXY800A, EEPIC, emTeX, EPSON LX-800,
EPSON 60dpi, Fig, HP2648, HPGL, HP LaserJet, Imagen, Kermit-MS Tektronix
emulator, LaTeX, MCGA, NEC CP6 pinwriter, POSTSCRIPT, Proprinter, Star color
printer, Tandy DMP-130, Tektronix 410x, SUN, VGA, X11.
X
Additions:
X
Command-line arguments are accepted. They are treated as names of
files containing gnuplot commands. Gnuplot loads them, one by one, and
then exits.
X
Command 'plot' now has a 'title' option to change the information in
the key. The 'with' option can now specify line type and point type.
X
Command 'pause'.
X
Command 'replot' allows the addition of extra plots.
X
Command 'save' now saves all the 'set' options, including the last
plot command.
X
Command 'set autoscale' now accepts autoscaling on the x axis for data
files. The default is autoscaling on both axes.
X
Command 'set noclip' disables clipping of points near the border. 'set
clip' reenables clipping. The default used to be 'clip', and is now
'noclip'. Clipping has also been extended to clip lines that extend
outside the borders: line plots are now clipped at the plot boundary.
Formerly, the line stopped at the last in-range data point.
X
Numerical labelling at tic marks on x and y axes. Command 'set
format' allows the format of the tic mark labels to be altered.
Commands 'set xtics' and 'set ytics' allow for alphanumeric labels and
arbitrary tic positions.
X
Command 'set grid' adds a grid between the tic marks.
X
Improved key gives sample point or line types. Key can be disabled
with the 'set nokey'. Key can be positioned anywhere.
X
Command 'set label' allows the placement of arbitrary text labels and
arrows.
X
Command 'set polar' for polar plots.
X
Command 'set offsets' for reducing the plotted area. Useful for polar
plots.
X
Command 'set size' scales the displayed size of the plot.
X
Command 'set tics out' causes the tics to be drawn outwards from the
border. Useful for impulse plots.
X
Command 'set title' places a text label above the plot.
X
Commands 'set xlabel' and 'set ylabel' place text labels on the x and
y axes respectively. Some terminals will place the y label vertically
upwards on the left of the plot, others place the label horizontally
at the left of the plot.
X
Improved tics on log scales.
X
Extended comments: comments are allowed anywhere reasonable in the
input line, and continue to the end of the input line.
X
Line continuation (with \) is added.
X
Non-interactive use, through redirection or "load" command, is
improved. Error messages expanded to include file name and line
number, and to reprint command line if not interactive.
X
New plotting styles 'linespoints' and 'dots'.
X
Blank lines in data files denote "breaks". In lines and linespoints
plot styles, this breaks the curve being drawn and begins at the next
point, without changing the line or point types.
X
Completely new interactive help system that is similar to VMS help
system. A printed manual can be obtained in LaTeX, troff, or nroff and
is based on the same information as the interactive help.
X
PC version now compiles with the large model so that gnuplot will
compile with the above additions!
X
Bug fixes include:
------------------
Bug involving functions plotted on a logarithmic x axis is fixed.
X
Errors inside of loaded files now clean up and close files properly.
X
Numbers of the form xxxxe+nn are now acceptable (+ sign caused error).
X
Tics are now place inside the borders (some were outside).
X
Reverse axes now work properly.
X
Command 'set output ""' used to crash.
X
VMS was closing stdout, so 'set output' code changed to avoid closing
it. VMS version of gnuplot now performs a SET TERM/NOWRAP itself.
X
Terminal is now reset before closing output file, changing terminal
type or exiting gnuplot.
X
Several old bugs have been superseded by new ones.
X
X
X ACKNOWLEDGEMENTS
X
The Unix PC, polar, pause, and offset additions were by John Campbell.
(CAMP...@NAUVAX.bitnet)
The Turbo C additions were by Bill Wilson.
(WIL...@NAUVAX.bitnet)
Some of the labelling improvements and combining of these additions
were by Russell Lang.
(r...@monu1.cc.monash.oz.au)
The LaTeX driver, the help system, and some of the labelling
improvements were by David Kotz.
(David...@Dartmouth.edu)
And of course, the vast majority of the program is by Colin Kelley
and Thomas Williams.
(pixar!info-g...@sun.com)
X
=======================================================================
X
X GNUPLOT 1.1 RELEASE NOTES
X
New terminal drivers: AED 512, BBN BitGraph, HP2623, POSTSCRIPT,
Selanar, Vectrix 384. The PC version now supports Hercules and ATT
6300 monochrome graphics. Thanks to those who sent these drivers in.
X
New commands: 'set dummy' and 'show dummy' to select the dummy
variable name; 'replot' to repeat the last 'plot' command.
X
The exclamation point (!) is now accepted as postfix factorial
operator. The gamma() function is also included, if your C library
has gamma(). See GAMMA below.
X
Logical AND (&&) and OR (||) now short-circuit the way they do in C.
That is, the second && operand is not evaluated if the first is false;
the second || operand is not evaluated if the first is true. The
ternary operator (?:) also does not evaluate the unused operand. This
change allows for the definition of recursive functions, e.g. a
synonym for the ! factorial operator:
X
X fact(x) = (x<=1) ? 1 : x*fact(x-1)
X
GNUPLOT now has a much better memory allocation scheme, replacing most
fixed-size arrays with malloc()'d linked lists. There is no longer
any artificial maximum on the number of simultaneous plots, number of
points in those plots, or the number of user-defined functions or
variables. All these are limited only by the memory available to
malloc(). This is a big improvement for memory-starved machines like
PDP-11s or PCs.
X
Lines beginning with # (also ! in VMS) are treated as comments. Only
the $ may now be used for a shell escape in VMS, since ! is a comment.
X
Several old bugs have been superseded by new ones.
SHAR_EOF
chmod 0644 gnuplot/History ||
echo 'restore of gnuplot/History failed'
Wc_c="`wc -c < 'gnuplot/History'`"
test 10762 -eq "$Wc_c" ||
echo 'gnuplot/History: original size 10762, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/README.gnutex ==============
if test -f 'gnuplot/README.gnutex' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/README.gnutex (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/README.gnutex (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/README.gnutex' &&
A note to former Gnutex users, from David Kotz (David...@Dartmouth.edu).
--------------------------------------------------------------------------
X
May 30, 1991
X
GNUTeX was merged with GNUPLOT beginning with GNUPLOT 2.0. Many
aspects of gnutex 1.6 made it into GNUPLOT 2.0. Unfortunately for
those of us who have a lot of gnutex input files around, not
everything from gnutex is supported by GNUPLOT. To help gnutex users
with the process of adapting to GNUPLOT (and I recommend it), I have
included a section in the LaTeX/GNUPLOT tutorial (in ./docs/latextut/)
about the differences, and written a translator program. Please read
the LaTeX/GNUPLOT tutorial.
X
The translator was available as part of the GNUPLOT 2.0 release, but
has been removed from the standard distribution of GNUPLOT. The
translator is now available for anonymous ftp from cs.duke.edu as
dist/sources/gnuplot/gnut2p.tar.Z. It has not changed since GNUPLOT
2.01 (ie, GNUPLOT 2.0 patchlevel 1).
X
Users of gnutex that did not use the LaTeX driver will probably have
little difficulty adapting.
X
Please send all comments, complaints, and suggestions on this subject
to David...@Dartmouth.edu.
SHAR_EOF
chmod 0644 gnuplot/README.gnutex ||
echo 'restore of gnuplot/README.gnutex failed'
Wc_c="`wc -c < 'gnuplot/README.gnutex'`"
test 1170 -eq "$Wc_c" ||
echo 'gnuplot/README.gnutex: original size 1170, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.amg ==============
if test -f 'gnuplot/makefile.amg' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.amg (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.amg (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.amg' &&
# Makefile for SAS/C 5.10 on the Amiga
X
CC = lc
X
# Remove '-fi' if you don't want to use the better Commodore math-routines.
# If you do so, you'll have to change 'lcmieee.lib' to 'lcm.lib' in
# "linkopt.amg"
CFLAGS = -b0 -dAMIGA_LC_5_1 -dNOGAMMA -dMEMSET -dMEMCPY -j85i -j88i -fi
X
.c.o:
X $(CC) $(CFLAGS) $<
X
OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
X internal.o misc.o parse.o plot.o scanner.o setshow.o \
X standard.o term.o util.o version.o
X
CSOURCE1 = command.c setshow.c
CSOURCE2 = help.c graphics.c graph3d.o internal.c
CSOURCE3 = misc.c eval.c parse.c plot.c scanner.c standard.c
CSOURCE4 = bitmap.c term.c util.c version.c
CSOURCE5 = term/aed.trm term/cgi.trm term/dumb.trm term/dxy.trm \
X term/eepic.trm term/epson.trm term/fig.trm term/hp26.trm \
X term/hp2648.trm term/hpgl.trm term/hpljii.trm term/vws.trm
CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
X term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm \
X term/amiga.trm
CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
X term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
X term/v384.trm term/x11.trm gnuplot_x11.c
CSOURCE8 = contour.c
X
gnuplot: $(OBJS)
X blink with linkopt.amg
X
bitmap.o: bitmap.c bitmap.h plot.h
command.o: command.c plot.h setshow.h help.h
contour.o: contour.c plot.h
eval.o: eval.c plot.h
graph3d.o: graph3d.c plot.h setshow.h
graphics.o: graphics.c plot.h setshow.h
help.o: help.c plot.h help.h
internal.o: internal.c plot.h
misc.o: misc.c plot.h setshow.h help.h
parse.o: parse.c plot.h
plot.o: plot.c plot.h setshow.h
scanner.o: scanner.c plot.h
setshow.o: setshow.c plot.h setshow.h
standard.o: standard.c plot.h
term.o: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
util.o: util.c plot.h
version.o: version.c
SHAR_EOF
chmod 0644 gnuplot/makefile.amg ||
echo 'restore of gnuplot/makefile.amg failed'
Wc_c="`wc -c < 'gnuplot/makefile.amg'`"
test 1808 -eq "$Wc_c" ||
echo 'gnuplot/makefile.amg: original size 1808, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/graphics.c ==============
if test -f 'gnuplot/graphics.c' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/graphics.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/graphics.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/graphics.c' &&
/* GNUPLOT - graphics.c */
#include <assert.h>
#include <time.h>
#include "plot.h"
#include "setshow.h"
X
extern char *strcpy(),*strncpy(),*strcat(),*ctime();
char *tdate;
#ifdef AMIGA_AC_5
time_t dated;
#else
#ifdef VMS
time_t dated,time();
#else
long dated,time();
#endif
#endif
X
void plot_impulses();
void plot_lines();
void plot_points();
void plot_dots();
void plot_bars();
void edge_intersect();
BOOLEAN two_edge_intersect();
X
/* for plotting error bars */
#define ERRORBARTIC (t->h_tic/2) /* half the width of error bar tic mark */
X
#ifndef max /* Lattice C has max() in math.h, but shouldn't! */
#define max(a,b) ((a > b) ? a : b)
#endif
X
#ifndef min
#define min(a,b) ((a < b) ? a : b)
#endif
X
#define inrange(z,min,max) ((min<max) ? ((z>=min)&&(z<=max)) : ((z>=max)&&(z<=min)) )
X
/* True if a and b have the same sign or zero (positive or negative) */
#define samesign(a,b) ((a) * (b) >= 0)
X
/* Define the boundary of the plot
X * These are computed at each call to do_plot, and are constant over
X * the period of one do_plot. They actually only change when the term
X * type changes and when the 'set size' factors change.
X */
static int xleft, xright, ybot, ytop;
X
/* Boundary and scale factors, in user coordinates */
/* x_min, x_max, y_min, y_max are local to this file and
X * are not the same as variables of the same names in other files
X */
static double x_min, x_max, y_min, y_max;
static double xscale, yscale;
X
/* And the functions to map from user to terminal coordinates */
#define map_x(x) (int)(xleft+(x-x_min)*xscale+0.5) /* maps floating point x to screen */
#define map_y(y) (int)(ybot+(y-y_min)*yscale+0.5) /* same for y */
X
/* (DFK) Watch for cancellation error near zero on axes labels */
#define SIGNIF (0.01) /* less than one hundredth of a tic mark */
#define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x))
#define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF))
X
/* (DFK) For some reason, the Sun386i compiler screws up with the CheckLog
X * macro, so I write it as a function on that machine.
X */
#ifndef sun386
/* (DFK) Use 10^x if logscale is in effect, else x */
#define CheckLog(log, x) ((log) ? pow(10., (x)) : (x))
#else
static double
CheckLog(log, x)
X BOOLEAN log;
X double x;
{
X if (log)
X return(pow(10., x));
X else
X return(x);
}
#endif /* sun386 */
X
double
LogScale(coord, islog, what, axis)
X double coord; /* the value */
X BOOLEAN islog; /* is this axis in logscale? */
X char *what; /* what is the coord for? */
X char *axis; /* which axis is this for ("x" or "y")? */
{
X if (islog) {
X if (coord <= 0.0) {
X char errbuf[100]; /* place to write error message */
X (void) sprintf(errbuf,"%s has %s coord of %g; must be above 0 for log scale!",
X what, axis, coord);
X (*term_tbl[term].text)();
X (void) fflush(outfile);
X int_error(errbuf, NO_CARET);
X } else
X return(log10(coord));
X }
X return(coord);
}
X
/* borders of plotting area */
/* computed once on every call to do_plot */
boundary(scaling)
X BOOLEAN scaling; /* TRUE if terminal is doing the scaling */
{
X register struct termentry *t = &term_tbl[term];
X xleft = (t->h_char)*12;
X xright = (scaling ? 1 : xsize) * (t->xmax) - (t->h_char)*2 - (t->h_tic);
X ybot = (t->v_char)*7/2 + 1;
X ytop = (scaling ? 1 : ysize) * (t->ymax) - (t->v_char)*5/2 - 1;
}
X
X
double dbl_raise(x,y)
double x;
int y;
{
register int i;
double val;
X
X val = 1.0;
X for (i=0; i < abs(y); i++)
X val *= x;
X if (y < 0 ) return (1.0/val);
X return(val);
}
X
X
double make_tics(tmin,tmax,logscale)
double tmin,tmax;
BOOLEAN logscale;
{
register double xr,xnorm,tics,tic,l10;
X
X xr = fabs(tmin-tmax);
X
X l10 = log10(xr);
X if (logscale) {
X tic = dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
X if (tic < 1.0)
X tic = 1.0;
X } else {
X xnorm = pow(10.0,l10-(double)((l10 >= 0.0 ) ? (int)l10 : ((int)l10-1)));
X if (xnorm <= 2)
X tics = 0.2;
X else if (xnorm <= 5)
X tics = 0.5;
X else tics = 1.0;
X tic = tics * dbl_raise(10.0,(l10 >= 0.0 ) ? (int)l10 : ((int)l10-1));
X }
X return(tic);
}
X
X
do_plot(plots, pcount, min_x, max_x, min_y, max_y)
struct curve_points *plots;
int pcount; /* count of plots in linked list */
double min_x, max_x;
double min_y, max_y;
{
register struct termentry *t = &term_tbl[term];
register int curve, xaxis_y, yaxis_x;
register struct curve_points *this_plot;
register double ytic, xtic;
register int xl, yl;
X /* only a Pyramid would have this many registers! */
double xtemp, ytemp;
struct text_label *this_label;
struct arrow_def *this_arrow;
BOOLEAN scaling;
X
/* store these in variables global to this file */
/* otherwise, we have to pass them around a lot */
X x_min = min_x;
X x_max = max_x;
X y_min = min_y;
X y_max = max_y;
X
X if (polar) {
X /* will possibly change x_min, x_max, y_min, y_max */
X polar_xform(plots,pcount);
X }
X
X if (y_min == VERYLARGE || y_max == -VERYLARGE ||
X x_min == VERYLARGE || x_max == -VERYLARGE)
X int_error("all points undefined!", NO_CARET);
X
/* Apply the desired viewport offsets. */
X if (y_min < y_max) {
X y_min -= boff;
X y_max += toff;
X } else {
X y_max -= boff;
X y_min += toff;
X }
X if (x_min < x_max) {
X x_min -= loff;
X x_max += roff;
X } else {
X x_max -= loff;
X x_min += roff;
X }
X
/* SETUP RANGES, SCALES AND TIC PLACES */
X if (ytics && yticdef.type == TIC_COMPUTED) {
X ytic = make_tics(y_min,y_max,log_y);
X
X if (autoscale_ly) {
X if (y_min < y_max) {
X y_min = ytic * floor(y_min/ytic);
X y_max = ytic * ceil(y_max/ytic);
X }
X else { /* reverse axis */
X y_min = ytic * ceil(y_min/ytic);
X y_max = ytic * floor(y_max/ytic);
X }
X }
X }
X
X if (xtics && xticdef.type == TIC_COMPUTED) {
X xtic = make_tics(x_min,x_max,log_x);
X
X if (autoscale_lx) {
X if (x_min < x_max) {
X x_min = xtic * floor(x_min/xtic);
X x_max = xtic * ceil(x_max/xtic);
X } else {
X x_min = xtic * ceil(x_min/xtic);
X x_max = xtic * floor(x_max/xtic);
X }
X }
X }
X
/* This used be x_max == x_min, but that caused an infinite loop once. */
X if (fabs(x_max - x_min) < zero)
X int_error("x_min should not equal x_max!",NO_CARET);
X if (fabs(y_max - y_min) < zero)
X int_error("y_min should not equal y_max!",NO_CARET);
X
/* INITIALIZE TERMINAL */
X if (!term_init) {
X (*t->init)();
X term_init = TRUE;
X }
X screen_ok = FALSE;
#ifdef AMIGA_LC_5_1
X scaling = (*t->scale)((double)xsize, (double)ysize);
#else
X scaling = (*t->scale)(xsize, ysize);
#endif
X (*t->graphics)();
X
X /* now compute boundary for plot (xleft, xright, ytop, ybot) */
X boundary(scaling);
X
/* SCALE FACTORS */
X yscale = (ytop - ybot)/(y_max - y_min);
X xscale = (xright - xleft)/(x_max - x_min);
X
/* DRAW AXES */
X (*t->linetype)(-1); /* axis line type */
X xaxis_y = map_y(0.0);
X yaxis_x = map_x(0.0);
X
X if (xaxis_y < ybot)
X xaxis_y = ybot; /* save for impulse plotting */
X else if (xaxis_y >= ytop)
X xaxis_y = ytop ;
X else if (xzeroaxis && !log_y) {
X (*t->move)(xleft,xaxis_y);
X (*t->vector)(xright,xaxis_y);
X }
X
X if (yzeroaxis && !log_x && yaxis_x >= xleft && yaxis_x < xright ) {
X (*t->move)(yaxis_x,ybot);
X (*t->vector)(yaxis_x,ytop);
X }
X
/* DRAW TICS */
X (*t->linetype)(-2); /* border linetype */
X
X /* label y axis tics */
X if (ytics) {
X switch (yticdef.type) {
X case TIC_COMPUTED: {
X if (y_min < y_max)
X draw_ytics(ytic * floor(y_min/ytic),
X ytic,
X ytic * ceil(y_max/ytic));
X else
X draw_ytics(ytic * floor(y_max/ytic),
X ytic,
X ytic * ceil(y_min/ytic));
X
X break;
X }
X case TIC_SERIES: {
X draw_series_ytics(yticdef.def.series.start,
X yticdef.def.series.incr,
X yticdef.def.series.end);
X break;
X }
X case TIC_USER: {
X draw_set_ytics(yticdef.def.user);
X break;
X }
X default: {
X (*t->text)();
X (void) fflush(outfile);
X int_error("unknown tic type in yticdef in do_plot", NO_CARET);
X break; /* NOTREACHED */
X }
X }
X }
X
X /* label x axis tics */
X if (xtics) {
X switch (xticdef.type) {
X case TIC_COMPUTED: {
X if (x_min < x_max)
X draw_xtics(xtic * floor(x_min/xtic),
X xtic,
X xtic * ceil(x_max/xtic));
X else
X draw_xtics(xtic * floor(x_max/xtic),
X xtic,
X xtic * ceil(x_min/xtic));
X
X break;
X }
X case TIC_SERIES: {
X draw_series_xtics(xticdef.def.series.start,
X xticdef.def.series.incr,
X xticdef.def.series.end);
X break;
X }
X case TIC_USER: {
X draw_set_xtics(xticdef.def.user);
X break;
X }
X default: {
X (*t->text)();
X (void) fflush(outfile);
X int_error("unknown tic type in xticdef in do_plot", NO_CARET);
X break; /* NOTREACHED */
X }
X }
X }
X
/* DRAW PLOT BORDER */
X (*t->linetype)(-2); /* border linetype */
X if (draw_border) {
X (*t->move)(xleft,ybot);
X (*t->vector)(xright,ybot);
X (*t->vector)(xright,ytop);
X (*t->vector)(xleft,ytop);
X (*t->vector)(xleft,ybot);
X }
X
/* PLACE YLABEL */
X if (strlen(ylabel) > 0) {
X int x, y;
X
X x = ylabel_xoffset * t->h_char;
X y = ylabel_yoffset * t->v_char;
X if ((*t->text_angle)(1)) {
X if ((*t->justify_text)(CENTRE)) {
X (*t->put_text)(x+(t->v_char),
X y+(ytop+ybot)/2, ylabel);
X }
X else {
X (*t->put_text)(x+(t->v_char),
X y+(ytop+ybot)/2-(t->h_char)*strlen(ylabel)/2,
X ylabel);
X }
X }
X else {
X (void)(*t->justify_text)(LEFT);
X (*t->put_text)(x,y+ytop+(t->v_char), ylabel);
X }
X (void)(*t->text_angle)(0);
X }
X
/* PLACE XLABEL */
X if (strlen(xlabel) > 0) {
X int x, y;
X
X x = xlabel_xoffset * t->h_char;
X y = xlabel_yoffset * t->v_char;
X
X if ((*t->justify_text)(CENTRE))
X (*t->put_text)(x+(xleft+xright)/2,
X y+ybot-2*(t->v_char), xlabel);
X else
X (*t->put_text)(x+(xleft+xright)/2 - strlen(xlabel)*(t->h_char)/2,
X y+ybot-2*(t->v_char), xlabel);
X }
X
/* PLACE TITLE */
X if (strlen(title) > 0) {
X int x, y;
X
X x = title_xoffset * t->h_char;
X y = title_yoffset * t->v_char;
X
X if ((*t->justify_text)(CENTRE))
X (*t->put_text)(x+(xleft+xright)/2,
X y+ytop+(t->v_char), title);
X else
X (*t->put_text)(x+(xleft+xright)/2 - strlen(title)*(t->h_char)/2,
X y+ytop+(t->v_char), title);
X }
X
X
/* PLACE TIMEDATE */
X if (timedate) {
X int x, y;
X
X x = time_xoffset * t->h_char;
X y = time_yoffset * t->v_char;
X dated = time( (long *) 0);
X tdate = ctime( &dated);
X tdate[24]='\0';
X if ((*t->text_angle)(1)) {
X if ((*t->justify_text)(CENTRE)) {
X (*t->put_text)(x+(t->v_char),
X y+ybot+4*(t->v_char), tdate);
X }
X else {
X (*t->put_text)(x+(t->v_char),
X y+ybot+4*(t->v_char)-(t->h_char)*strlen(ylabel)/2,
X tdate);
X }
X }
X else {
X (void)(*t->justify_text)(LEFT);
X (*t->put_text)(x,
X y+ybot-3*(t->v_char), tdate);
X }
X (void)(*t->text_angle)(0);
X }
X
/* PLACE LABELS */
X for (this_label = first_label; this_label!=NULL;
X this_label=this_label->next ) {
X xtemp = LogScale(this_label->x, log_x, "label", "x");
X ytemp = LogScale(this_label->y, log_y, "label", "y");
X if ((*t->justify_text)(this_label->pos)) {
X (*t->put_text)(map_x(xtemp),map_y(ytemp),this_label->text);
X }
X else {
X switch(this_label->pos) {
X case LEFT:
X (*t->put_text)(map_x(xtemp),map_y(ytemp),
X this_label->text);
X break;
X case CENTRE:
X (*t->put_text)(map_x(xtemp)-
X (t->h_char)*strlen(this_label->text)/2,
X map_y(ytemp), this_label->text);
X break;
X case RIGHT:
X (*t->put_text)(map_x(xtemp)-
X (t->h_char)*strlen(this_label->text),
X map_y(ytemp), this_label->text);
X break;
X }
X }
X }
X
/* PLACE ARROWS */
X (*t->linetype)(0); /* arrow line type */
X for (this_arrow = first_arrow; this_arrow!=NULL;
X this_arrow = this_arrow->next ) {
X int sx = map_x(LogScale(this_arrow->sx, log_x, "arrow", "x"));
X int sy = map_y(LogScale(this_arrow->sy, log_y, "arrow", "y"));
X int ex = map_x(LogScale(this_arrow->ex, log_x, "arrow", "x"));
X int ey = map_y(LogScale(this_arrow->ey, log_y, "arrow", "y"));
X
X (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
SHAR_EOF
true || echo 'restore of gnuplot/graphics.c failed'
fi
echo 'End of part 25'
echo 'File gnuplot/graphics.c is continued in part 26'
echo 26 > _shar_seq_.tmp
#!/bin/sh
# this is Part.26 (part 26 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnuplot/graphics.c continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 26; 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/graphics.c'
else
echo 'x - continuing file gnuplot/graphics.c'
sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/graphics.c' &&
X }
X
X
/* DRAW CURVES */
X if (key == -1) {
X xl = xright - (t->h_tic) - (t->h_char)*5;
X yl = ytop - (t->v_tic) - (t->v_char);
X }
X if (key == 1) {
X xl = map_x( LogScale(key_x, log_x, "key", "x") );
X yl = map_y( LogScale(key_y, log_y, "key", "y") );
X }
X
X this_plot = plots;
X for (curve = 0; curve < pcount; this_plot = this_plot->next_cp, curve++) {
X (*t->linetype)(this_plot->line_type);
X if (key != 0) {
X if ((*t->justify_text)(RIGHT)) {
X (*t->put_text)(xl,
X yl,this_plot->title);
X }
X else {
X if (inrange(xl-(t->h_char)*strlen(this_plot->title),
X xleft, xright))
X (*t->put_text)(xl-(t->h_char)*strlen(this_plot->title),
X yl,this_plot->title);
X }
X }
X
X switch(this_plot->plot_style) {
X case IMPULSES: {
X if (key != 0) {
X (*t->move)(xl+(t->h_char),yl);
X (*t->vector)(xl+4*(t->h_char),yl);
X }
X plot_impulses(this_plot, yaxis_x, xaxis_y);
X break;
X }
X case LINES: {
X if (key != 0) {
X (*t->move)(xl+(int)(t->h_char),yl);
X (*t->vector)(xl+(int)(4*(t->h_char)),yl);
X }
X plot_lines(this_plot);
X break;
X }
X case POINTS: {
X if (key != 0) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X plot_points(this_plot);
X break;
X }
X case LINESPOINTS: {
X /* put lines */
X if (key != 0) {
X (*t->move)(xl+(t->h_char),yl);
X (*t->vector)(xl+4*(t->h_char),yl);
X }
X plot_lines(this_plot);
X
X /* put points */
X if (key != 0) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X plot_points(this_plot);
X break;
X }
X case DOTS: {
X if (key != 0) {
X (*t->point)(xl+2*(t->h_char),yl, -1);
X }
X plot_dots(this_plot);
X break;
X }
X case ERRORBARS: {
X if (key != 0) {
X (*t->point)(xl+2*(t->h_char),yl,
X this_plot->point_type);
X }
X plot_points(this_plot);
X
X /* for functions, just like POINTS */
X if (this_plot->plot_type == DATA) {
X if (key != 0) {
X (*t->move)(xl+(t->h_char),yl);
X (*t->vector)(xl+4*(t->h_char),yl);
X (*t->move)(xl+(t->h_char),yl+ERRORBARTIC);
X (*t->vector)(xl+(t->h_char),yl-ERRORBARTIC);
X (*t->move)(xl+4*(t->h_char),yl+ERRORBARTIC);
X (*t->vector)(xl+4*(t->h_char),yl-ERRORBARTIC);
X }
X plot_bars(this_plot);
X }
X break;
X }
X }
X yl = yl - (t->v_char);
X }
X (*t->text)();
X (void) fflush(outfile);
}
X
/* plot_impulses:
X * Plot the curves in IMPULSES style
X */
void
plot_impulses(plot, yaxis_x, xaxis_y)
X struct curve_points *plot;
X int yaxis_x, xaxis_y;
{
X int i;
X int x,y;
X struct termentry *t = &term_tbl[term];
X
X for (i = 0; i < plot->p_count; i++) {
X switch (plot->points[i].type) {
X case INRANGE: {
X x = map_x(plot->points[i].x);
X y = map_y(plot->points[i].y);
X break;
X }
X case OUTRANGE: {
X if (!inrange(plot->points[i].x, x_min,x_max))
X continue;
X x = map_x(plot->points[i].x);
X if ((y_min < y_max
X && plot->points[i].y < y_min)
X || (y_max < y_min
X && plot->points[i].y > y_min))
X y = map_y(y_min);
X if ((y_min < y_max
X && plot->points[i].y > y_max)
X || (y_max<y_min
X && plot->points[i].y < y_max))
X y = map_y(y_max);
X break;
X }
X default: /* just a safety */
X case UNDEFINED: {
X continue;
X }
X }
X
X if (polar)
X (*t->move)(yaxis_x,xaxis_y);
X else
X (*t->move)(x,xaxis_y);
X (*t->vector)(x,y);
X }
X
}
X
/* plot_lines:
X * Plot the curves in LINES style
X */
void
plot_lines(plot)
X struct curve_points *plot;
{
X int i; /* point index */
X int x,y; /* point in terminal coordinates */
X struct termentry *t = &term_tbl[term];
X enum coord_type prev = UNDEFINED; /* type of previous point */
X double ex, ey; /* an edge point */
X double lx[2], ly[2]; /* two edge points */
X
X for (i = 0; i < plot->p_count; i++) {
X switch (plot->points[i].type) {
X case INRANGE: {
X x = map_x(plot->points[i].x);
X y = map_y(plot->points[i].y);
X
X if (prev == INRANGE) {
X (*t->vector)(x,y);
X } else if (prev == OUTRANGE) {
X /* from outrange to inrange */
X if (!clip_lines1) {
X (*t->move)(x,y);
X } else {
X edge_intersect(plot->points, i, &ex, &ey);
X (*t->move)(map_x(ex), map_y(ey));
X (*t->vector)(x,y);
X }
X } else { /* prev == UNDEFINED */
X (*t->move)(x,y);
X (*t->vector)(x,y);
X }
X
X break;
X }
X case OUTRANGE: {
X if (prev == INRANGE) {
X /* from inrange to outrange */
X if (clip_lines1) {
X edge_intersect(plot->points, i, &ex, &ey);
X (*t->vector)(map_x(ex), map_y(ey));
X }
X } else if (prev == OUTRANGE) {
X /* from outrange to outrange */
X if (clip_lines2) {
X if (two_edge_intersect(plot->points, i, lx, ly)) {
X (*t->move)(map_x(lx[0]), map_y(ly[0]));
X (*t->vector)(map_x(lx[1]), map_y(ly[1]));
X }
X }
X }
X break;
X }
X default: /* just a safety */
X case UNDEFINED: {
X break;
X }
X }
X prev = plot->points[i].type;
X }
}
X
/* plot_bars:
X * Plot the curves in ERRORBARS style
X * we just plot the bars; the points are plotted in plot_points
X */
void
plot_bars(plot)
X struct curve_points *plot;
{
X int i; /* point index */
X struct termentry *t = &term_tbl[term];
X double x; /* position of the bar */
X double ylow, yhigh; /* the ends of the bars */
X unsigned int xM, ylowM, yhighM; /* the mapped version of above */
X BOOLEAN low_inrange, high_inrange;
X int tic = ERRORBARTIC;
X
X for (i = 0; i < plot->p_count; i++) {
X /* undefined points don't count */
X if (plot->points[i].type == UNDEFINED)
X continue;
X
X /* check to see if in xrange */
X x = plot->points[i].x;
X if (! inrange(x, x_min, x_max))
X continue;
X xM = map_x(x);
X
X /* find low and high points of bar, and check yrange */
X yhigh = plot->points[i].yhigh;
X ylow = plot->points[i].ylow;
X
X high_inrange = inrange(yhigh, y_min,y_max);
X low_inrange = inrange(ylow, y_min,y_max);
X
X /* compute the plot position of yhigh */
X if (high_inrange)
X yhighM = map_y(yhigh);
X else if (samesign(yhigh-y_max, y_max-y_min))
X yhighM = map_y(y_max);
X else
X yhighM = map_y(y_min);
X
X /* compute the plot position of ylow */
X if (low_inrange)
X ylowM = map_y(ylow);
X else if (samesign(ylow-y_max, y_max-y_min))
X ylowM = map_y(y_max);
X else
X ylowM = map_y(y_min);
X
X if (!high_inrange && !low_inrange && ylowM == yhighM)
X /* both out of range on the same side */
X continue;
X
X /* by here everything has been mapped */
X (*t->move)(xM, ylowM);
X (*t->vector)(xM, yhighM); /* draw the main bar */
X (*t->move)(xM-tic, ylowM); /* draw the bottom tic */
X (*t->vector)(xM+tic, ylowM);
X (*t->move)(xM-tic, yhighM); /* draw the top tic */
X (*t->vector)(xM+tic, yhighM);
X }
}
X
/* plot_points:
X * Plot the curves in POINTS style
X */
void
plot_points(plot)
X struct curve_points *plot;
{
X int i;
X int x,y;
X struct termentry *t = &term_tbl[term];
X
X for (i = 0; i < plot->p_count; i++) {
X if (plot->points[i].type == INRANGE) {
X x = map_x(plot->points[i].x);
X y = map_y(plot->points[i].y);
X /* do clipping if necessary */
X if (!clip_points ||
X ( x >= xleft + t->h_tic && y >= ybot + t->v_tic
X && x <= xright - t->h_tic && y <= ytop - t->v_tic))
X (*t->point)(x,y, plot->point_type);
X }
X }
}
X
/* plot_dots:
X * Plot the curves in DOTS style
X */
void
plot_dots(plot)
X struct curve_points *plot;
{
X int i;
X int x,y;
X struct termentry *t = &term_tbl[term];
X
X for (i = 0; i < plot->p_count; i++) {
X if (plot->points[i].type == INRANGE) {
X x = map_x(plot->points[i].x);
X y = map_y(plot->points[i].y);
X /* point type -1 is a dot */
X (*t->point)(x,y, -1);
X }
X }
}
X
/* single edge intersection algorithm */
/* Given two points, one inside and one outside the plot, return
X * the point where an edge of the plot intersects the line segment defined
X * by the two points.
X */
void
edge_intersect(points, i, ex, ey)
X struct coordinate *points; /* the points array */
X int i; /* line segment from point i-1 to point i */
X double *ex, *ey; /* the point where it crosses an edge */
{
X /* global x_min, x_max, y_min, x_max */
X double ax = points[i-1].x;
X double ay = points[i-1].y;
X double bx = points[i].x;
X double by = points[i].y;
X double x, y; /* possible intersection point */
X
X if (by == ay) {
X /* horizontal line */
X /* assume inrange(by, y_min, y_max) */
X *ey = by; /* == ay */
X
X if (inrange(x_max, ax, bx))
X *ex = x_max;
X else if (inrange(x_min, ax, bx))
X *ex = x_min;
X else {
X (*term_tbl[term].text)();
X (void) fflush(outfile);
X int_error("error in edge_intersect", NO_CARET);
X }
X return;
X } else if (bx == ax) {
X /* vertical line */
X /* assume inrange(bx, x_min, x_max) */
X *ex = bx; /* == ax */
X
X if (inrange(y_max, ay, by))
X *ey = y_max;
X else if (inrange(y_min, ay, by))
X *ey = y_min;
X else {
X (*term_tbl[term].text)();
X (void) fflush(outfile);
X int_error("error in edge_intersect", NO_CARET);
X }
X return;
X }
X
X /* slanted line of some kind */
X
X /* does it intersect y_min edge */
X if (inrange(y_min, ay, by) && y_min != ay && y_min != by) {
X x = ax + (y_min-ay) * ((bx-ax) / (by-ay));
X if (inrange(x, x_min, x_max)) {
X *ex = x;
X *ey = y_min;
X return; /* yes */
X }
X }
X
X /* does it intersect y_max edge */
X if (inrange(y_max, ay, by) && y_max != ay && y_max != by) {
X x = ax + (y_max-ay) * ((bx-ax) / (by-ay));
X if (inrange(x, x_min, x_max)) {
X *ex = x;
X *ey = y_max;
X return; /* yes */
X }
X }
X
X /* does it intersect x_min edge */
X if (inrange(x_min, ax, bx) && x_min != ax && x_min != bx) {
X y = ay + (x_min-ax) * ((by-ay) / (bx-ax));
X if (inrange(y, y_min, y_max)) {
X *ex = x_min;
X *ey = y;
X return;
X }
X }
X
X /* does it intersect x_max edge */
X if (inrange(x_max, ax, bx) && x_max != ax && x_max != bx) {
X y = ay + (x_max-ax) * ((by-ay) / (bx-ax));
X if (inrange(y, y_min, y_max)) {
X *ex = x_max;
X *ey = y;
X return;
X }
X }
X
X /* It is possible for one or two of the [ab][xy] values to be -VERYLARGE.
X * If ax=bx=-VERYLARGE or ay=by=-VERYLARGE we have already returned
X * FALSE above. Otherwise we fall through all the tests above.
X * If two are -VERYLARGE, it is ax=ay=-VERYLARGE or bx=by=-VERYLARGE
X * since either a or b must be INRANGE.
X * Note that for ax=ay=-VERYLARGE or bx=by=-VERYLARGE we can do nothing.
X * Handle them carefully here. As yet we have no way for them to be
X * +VERYLARGE.
X */
X if (ax == -VERYLARGE) {
X if (ay != -VERYLARGE) {
X *ex = min(x_min, x_max);
X *ey = by;
X return;
X }
X } else if (bx == -VERYLARGE) {
X if (by != -VERYLARGE) {
X *ex = min(x_min, x_max);
X *ey = ay;
X return;
X }
X } else if (ay == -VERYLARGE) {
X /* note we know ax != -VERYLARGE */
X *ex = bx;
X *ey = min(y_min, y_max);
X return;
X } else if (by == -VERYLARGE) {
X /* note we know bx != -VERYLARGE */
X *ex = ax;
X *ey = min(y_min, y_max);
X return;
X }
X
X /* If we reach here, then either one point is (-VERYLARGE,-VERYLARGE),
X * or the inrange point is on the edge, and
X * the line segment from the outrange point does not cross any
X * other edges to get there. In either case, we return the inrange
X * point as the 'edge' intersection point. This will basically draw
X * line.
X */
X if (points[i].type == INRANGE) {
X *ex = bx;
X *ey = by;
X } else {
X *ex = ax;
X *ey = ay;
X }
X return;
}
X
/* double edge intersection algorithm */
/* Given two points, both outside the plot, return
X * the points where an edge of the plot intersects the line segment defined
X * by the two points. There may be zero, one, two, or an infinite number
X * of intersection points. (One means an intersection at a corner, infinite
X * means overlaying the edge itself). We return FALSE when there is nothing
X * to draw (zero intersections), and TRUE when there is something to
X * draw (the one-point case is a degenerate of the two-point case and we do
X * not distinguish it - we draw it anyway).
X */
BOOLEAN /* any intersection? */
two_edge_intersect(points, i, lx, ly)
X struct coordinate *points; /* the points array */
X int i; /* line segment from point i-1 to point i */
X double *lx, *ly; /* lx[2], ly[2]: points where it crosses edges */
{
X /* global x_min, x_max, y_min, x_max */
X double ax = points[i-1].x;
X double ay = points[i-1].y;
X double bx = points[i].x;
X double by = points[i].y;
X double x, y; /* possible intersection point */
X BOOLEAN intersect = FALSE;
X
X if (by == ay) {
X /* horizontal line */
X /* y coord must be in range, and line must span both x_min and x_max */
X /* note that spanning x_min implies spanning x_max */
X if (inrange(by, y_min, y_max) && inrange(x_min, ax, bx)) {
X *lx++ = x_min;
X *ly++ = by;
X *lx++ = x_max;
X *ly++ = by;
X return(TRUE);
X } else
X return(FALSE);
X } else if (bx == ax) {
X /* vertical line */
X /* x coord must be in range, and line must span both y_min and y_max */
X /* note that spanning y_min implies spanning y_max */
X if (inrange(bx, x_min, x_max) && inrange(y_min, ay, by)) {
X *lx++ = bx;
X *ly++ = y_min;
X *lx++ = bx;
X *ly++ = y_max;
X return(TRUE);
X } else
X return(FALSE);
X }
X
X /* slanted line of some kind */
X /* there can be only zero or two intersections below */
X
X /* does it intersect y_min edge */
X if (inrange(y_min, ay, by)) {
X x = ax + (y_min-ay) * ((bx-ax) / (by-ay));
X if (inrange(x, x_min, x_max)) {
X *lx++ = x;
X *ly++ = y_min;
X intersect = TRUE;
X }
X }
X
X /* does it intersect y_max edge */
X if (inrange(y_max, ay, by)) {
X x = ax + (y_max-ay) * ((bx-ax) / (by-ay));
X if (inrange(x, x_min, x_max)) {
X *lx++ = x;
X *ly++ = y_max;
X intersect = TRUE;
X }
X }
X
X /* does it intersect x_min edge */
X if (inrange(x_min, ax, bx)) {
X y = ay + (x_min-ax) * ((by-ay) / (bx-ax));
X if (inrange(y, y_min, y_max)) {
X *lx++ = x_min;
X *ly++ = y;
X intersect = TRUE;
X }
X }
X
X /* does it intersect x_max edge */
X if (inrange(x_max, ax, bx)) {
X y = ay + (x_max-ax) * ((by-ay) / (bx-ax));
X if (inrange(y, y_min, y_max)) {
X *lx++ = x_max;
X *ly++ = y;
X intersect = TRUE;
X }
X }
X
X if (intersect)
X return(TRUE);
X
X /* It is possible for one or more of the [ab][xy] values to be -VERYLARGE.
X * If ax=bx=-VERYLARGE or ay=by=-VERYLARGE we have already returned
X * FALSE above.
X * Note that for ax=ay=-VERYLARGE or bx=by=-VERYLARGE we can do nothing.
X * Otherwise we fall through all the tests above.
X * Handle them carefully here. As yet we have no way for them to be +VERYLARGE.
X */
X if (ax == -VERYLARGE) {
X if (ay != -VERYLARGE
X && inrange(by, y_min, y_max) && inrange(x_max, ax, bx)) {
X *lx++ = x_min;
X *ly = by;
X *lx++ = x_max;
X *ly = by;
X intersect = TRUE;
X }
X } else if (bx == -VERYLARGE) {
X if (by != -VERYLARGE
X && inrange(ay, y_min, y_max) && inrange(x_max, ax, bx)) {
X *lx++ = x_min;
X *ly = ay;
X *lx++ = x_max;
X *ly = ay;
X intersect = TRUE;
X }
X } else if (ay == -VERYLARGE) {
X /* note we know ax != -VERYLARGE */
X if (inrange(bx, x_min, x_max) && inrange(y_max, ay, by)) {
X *lx++ = bx;
X *ly = y_min;
X *lx++ = bx;
X *ly = y_max;
X intersect = TRUE;
X }
X } else if (by == -VERYLARGE) {
X /* note we know bx != -VERYLARGE */
X if (inrange(ax, x_min, x_max) && inrange(y_max, ay, by)) {
X *lx++ = ax;
X *ly = y_min;
X *lx++ = ax;
X *ly = y_max;
X intersect = TRUE;
X }
X }
X
X return(intersect);
}
X
/* Polar transform of all curves */
/* Original code by John Campbell (CAMP...@NAUVAX.bitnet) */
polar_xform (plots, pcount)
X struct curve_points *plots;
X int pcount; /* count of curves in plots array */
{
X struct curve_points *this_plot;
X int curve; /* loop var, for curves */
X register int i, p_cnt; /* loop/limit var, for points */
X struct coordinate *pnts; /* abbrev. for points array */
X double x, y; /* new cartesian value */
X BOOLEAN anydefined = FALSE;
X double d2r;
X
X if(angles_format == ANGLES_DEGREES){
X d2r = DEG2RAD;
X } else {
X d2r = 1.0;
X }
X
/*
X Cycle through all the plots converting polar to rectangular.
X If autoscaling, adjust max and mins. Ignore previous values.
X If not autoscaling, use the yrange for both x and y ranges.
*/
X if (autoscale_ly) {
X x_min = VERYLARGE;
X y_min = VERYLARGE;
X x_max = -VERYLARGE;
X y_max = -VERYLARGE;
X autoscale_lx = TRUE;
X } else {
X x_min = y_min;
X x_max = y_max;
X }
X
X this_plot = plots;
X for (curve = 0; curve < pcount; this_plot = this_plot->next_cp, curve++) {
X p_cnt = this_plot->p_count;
X pnts = &(this_plot->points[0]);
X
X /* Convert to cartesian all points in this curve. */
X for (i = 0; i < p_cnt; i++) {
X if (pnts[i].type != UNDEFINED) {
X anydefined = TRUE;
X /* modify points to reset origin and from degrees */
X pnts[i].y -= rmin;
X pnts[i].x *= d2r;
X /* convert to cartesian coordinates */
X x = pnts[i].y*cos(pnts[i].x);
X y = pnts[i].y*sin(pnts[i].x);
X pnts[i].x = x;
X pnts[i].y = y;
X if (autoscale_ly) {
X if (x_min > x) x_min = x;
X if (x_max < x) x_max = x;
X if (y_min > y) y_min = y;
X if (y_max < y) y_max = y;
X pnts[i].type = INRANGE;
X } else if(inrange(x, x_min, x_max) && inrange(y, y_min, y_max))
X pnts[i].type = INRANGE;
X else
X pnts[i].type = OUTRANGE;
X }
X }
X }
X
X if (autoscale_lx && anydefined && fabs(x_max - x_min) < zero) {
X /* This happens at least for the plot of 1/cos(x) (vertical line). */
X fprintf(stderr, "Warning: empty x range [%g:%g], ", x_min,x_max);
X if (x_min == 0.0) {
X x_min = -1;
X x_max = 1;
X } else {
X x_min *= 0.9;
X x_max *= 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", x_min,x_max);
X }
X if (autoscale_ly && anydefined && fabs(y_max - y_min) < zero) {
X /* This happens at least for the plot of 1/sin(x) (horiz. line). */
X fprintf(stderr, "Warning: empty y range [%g:%g], ", y_min, y_max);
X if (y_min == 0.0) {
X y_min = -1;
X y_max = 1;
X } else {
X y_min *= 0.9;
X y_max *= 1.1;
X }
X fprintf(stderr, "adjusting to [%g:%g]\n", y_min, y_max);
X }
}
X
/* DRAW_YTICS: draw a regular tic series, y axis */
draw_ytics(start, incr, end)
X double start, incr, end; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace;
X int ltic; /* for mini log tics */
X double lticplace; /* for mini log tics */
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X
X if (end == VERYLARGE) /* for user-def series */
X end = max(y_min,y_max);
X
X /* limit to right side of plot */
X end = min(end, max(y_min,y_max));
X
X /* to allow for rounding errors */
X ticmin = min(y_min,y_max) - SIGNIF*incr;
X ticmax = max(y_min,y_max) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X if ( inrange(ticplace,ticmin,ticmax) )
X ytick(ticplace, yformat, incr, 1.0);
X if (log_y && incr == 1.0) {
X /* add mini-ticks to log scale ticmarks */
X int lstart, linc;
X if ((end - start) >= 10)
X {
X lstart = 10; /* No little ticks */
X linc = 5;
X }
X else if((end - start) >= 5)
X {
X lstart = 4; /* 3 per decade */
X linc = 3;
X }
X else
X {
X lstart = 2; /* 9 per decade */
X linc = 1;
X }
X for (ltic = 2; ltic <= 9; ltic++) {
X lticplace = ticplace+log10((double)ltic);
X if ( inrange(lticplace,ticmin,ticmax) )
X ytick(lticplace, "\0", incr, 0.5);
X }
X }
X }
}
X
/* DRAW_XTICS: draw a regular tic series, x axis */
draw_xtics(start, incr, end)
X double start, incr, end; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace;
X int ltic; /* for mini log tics */
X double lticplace; /* for mini log tics */
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X
X if (end == VERYLARGE) /* for user-def series */
X end = max(x_min,x_max);
X
X /* limit to right side of plot */
X end = min(end, max(x_min,x_max));
X
X /* to allow for rounding errors */
X ticmin = min(x_min,x_max) - SIGNIF*incr;
X ticmax = max(x_min,x_max) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X if ( inrange(ticplace,ticmin,ticmax) )
X xtick(ticplace, xformat, incr, 1.0);
X if (log_x && incr == 1.0) {
X /* add mini-ticks to log scale ticmarks */
X int lstart, linc;
X if ((end - start) >= 10)
X {
X lstart = 10; /* No little ticks */
X linc = 5;
X }
X else if((end - start) >= 5)
X {
X lstart = 4; /* 3 per decade */
X linc = 3;
X }
X else
X {
X lstart = 2; /* 9 per decade */
X linc = 1;
X }
X for (ltic = lstart; ltic <= 9; ltic += linc) {
X lticplace = ticplace+log10((double)ltic);
X if ( inrange(lticplace,ticmin,ticmax) )
X xtick(lticplace, "\0", incr, 0.5);
X }
X }
X }
}
X
/* DRAW_SERIES_YTICS: draw a user tic series, y axis */
draw_series_ytics(start, incr, end)
X double start, incr, end; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace, place;
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X double spacing = log_y ? log10(incr) : incr;
X
X if (end == VERYLARGE)
X end = max(CheckLog(log_y, y_min), CheckLog(log_y, y_max));
X else
X /* limit to right side of plot */
X end = min(end, max(CheckLog(log_y, y_min), CheckLog(log_y, y_max)));
X
X /* to allow for rounding errors */
X ticmin = min(y_min,y_max) - SIGNIF*incr;
X ticmax = max(y_min,y_max) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X place = (log_y ? log10(ticplace) : ticplace);
X if ( inrange(place,ticmin,ticmax) )
X ytick(place, yformat, spacing, 1.0);
X }
}
X
X
/* DRAW_SERIES_XTICS: draw a user tic series, x axis */
draw_series_xtics(start, incr, end)
X double start, incr, end; /* tic series definition */
X /* assume start < end, incr > 0 */
{
X double ticplace, place;
X double ticmin, ticmax; /* for checking if tic is almost inrange */
X double spacing = log_x ? log10(incr) : incr;
X
X if (end == VERYLARGE)
X end = max(CheckLog(log_x, x_min), CheckLog(log_x, x_max));
X else
X /* limit to right side of plot */
X end = min(end, max(CheckLog(log_x, x_min), CheckLog(log_x, x_max)));
X
X /* to allow for rounding errors */
X ticmin = min(x_min,x_max) - SIGNIF*incr;
X ticmax = max(x_min,x_max) + SIGNIF*incr;
X end = end + SIGNIF*incr;
X
X for (ticplace = start; ticplace <= end; ticplace +=incr) {
X place = (log_x ? log10(ticplace) : ticplace);
X if ( inrange(place,ticmin,ticmax) )
X xtick(place, xformat, spacing, 1.0);
X }
}
X
/* DRAW_SET_YTICS: draw a user tic set, y axis */
draw_set_ytics(list)
X struct ticmark *list; /* list of tic marks */
{
X double ticplace;
X double incr = (y_max - y_min) / 10;
X /* global x_min, x_max, xscale, y_min, y_max, yscale */
X
X while (list != NULL) {
X ticplace = (log_y ? log10(list->position) : list->position);
X if ( inrange(ticplace, y_min, y_max) /* in range */
X || NearlyEqual(ticplace, y_min, incr) /* == y_min */
X || NearlyEqual(ticplace, y_max, incr)) /* == y_max */
X ytick(ticplace, list->label, incr, 1.0);
X
X list = list->next;
X }
}
X
/* DRAW_SET_XTICS: draw a user tic set, x axis */
draw_set_xtics(list)
X struct ticmark *list; /* list of tic marks */
{
X double ticplace;
X double incr = (x_max - x_min) / 10;
X /* global x_min, x_max, xscale, y_min, y_max, yscale */
X
X while (list != NULL) {
X ticplace = (log_x ? log10(list->position) : list->position);
X if ( inrange(ticplace, x_min, x_max) /* in range */
X || NearlyEqual(ticplace, x_min, incr) /* == x_min */
X || NearlyEqual(ticplace, x_max, incr)) /* == x_max */
X xtick(ticplace, list->label, incr, 1.0);
X
X list = list->next;
X }
}
X
/* draw and label a y-axis ticmark */
ytick(place, text, spacing, ticscale)
X double place; /* where on axis to put it */
X char *text; /* optional text label */
X double spacing; /* something to use with checkzero */
X double ticscale; /* scale factor for tic mark (0..1] */
{
X register struct termentry *t = &term_tbl[term];
X char ticlabel[101];
X int ticsize = (int)((t->h_tic) * ticscale);
X
X place = CheckZero(place,spacing); /* to fix rounding error near zero */
X if (grid) {
X (*t->linetype)(-1); /* axis line type */
X /* do not put a rectangular grid on a polar plot */
X if( !polar){
X (*t->move)(xleft, map_y(place));
X (*t->vector)(xright, map_y(place));
X }
X (*t->linetype)(-2); /* border linetype */
X }
X if (tic_in) {
X /* if polar plot, put the tics along the axes */
X if( polar){
X (*t->move)(map_x(ZERO),map_y(place));
X (*t->vector)(map_x(ZERO) + ticsize, map_y(place));
X (*t->move)(map_x(ZERO), map_y(place));
X (*t->vector)(map_x(ZERO) - ticsize, map_y(place));
X } else {
X (*t->move)(xleft, map_y(place));
X (*t->vector)(xleft + ticsize, map_y(place));
X (*t->move)(xright, map_y(place));
X (*t->vector)(xright - ticsize, map_y(place));
X }
X } else {
X if( polar){
X (*t->move)(map_x(ZERO), map_y(place));
X (*t->vector)(map_x(ZERO) - ticsize, map_y(place));
X }else{
X (*t->move)(xleft, map_y(place));
X (*t->vector)(xleft - ticsize, map_y(place));
X }
X }
X
X /* label the ticmark */
X if (text == NULL)
X text = yformat;
X
X if( polar){
X (void) sprintf(ticlabel, text, CheckLog(log_y,fabs( place)+rmin));
X if ((*t->justify_text)(RIGHT)) {
X (*t->put_text)(map_x(ZERO)-(t->h_char),
X map_y(place), ticlabel);
X } else {
X (*t->put_text)(map_x(ZERO)-(t->h_char)*(strlen(ticlabel)+1),
X map_y(place), ticlabel);
X }
X } else {
X
X (void) sprintf(ticlabel, text, CheckLog(log_y, place));
X if ((*t->justify_text)(RIGHT)) {
X (*t->put_text)(xleft-(t->h_char),
X map_y(place), ticlabel);
X } else {
X (*t->put_text)(xleft-(t->h_char)*(strlen(ticlabel)+1),
X map_y(place), ticlabel);
X }
X }
}
X
/* draw and label an x-axis ticmark */
xtick(place, text, spacing, ticscale)
X double place; /* where on axis to put it */
X char *text; /* optional text label */
X double spacing; /* something to use with checkzero */
X double ticscale; /* scale factor for tic mark (0..1] */
{
X register struct termentry *t = &term_tbl[term];
X char ticlabel[101];
X int ticsize = (int)((t->v_tic) * ticscale);
X
X place = CheckZero(place,spacing); /* to fix rounding error near zero */
X if (grid) {
X (*t->linetype)(-1); /* axis line type */
X if( !polar){
X (*t->move)(map_x(place), ybot);
X (*t->vector)(map_x(place), ytop);
X }
X (*t->linetype)(-2); /* border linetype */
X }
X if (tic_in) {
X if( polar){
X (*t->move)(map_x(place), map_y(ZERO));
X (*t->vector)(map_x(place), map_y(ZERO) + ticsize);
X (*t->move)(map_x(place), map_y(ZERO));
X (*t->vector)(map_x(place), map_y(ZERO) - ticsize);
X } else{
X (*t->move)(map_x(place), ybot);
X (*t->vector)(map_x(place), ybot + ticsize);
X (*t->move)(map_x(place), ytop);
X (*t->vector)(map_x(place), ytop - ticsize);
X }
X } else {
X if( polar){
X (*t->move)(map_x(place), map_y(ZERO));
X (*t->vector)(map_x(place), map_y(ZERO) - ticsize);
X }else{
X (*t->move)(map_x(place), ybot);
X (*t->vector)(map_x(place), ybot - ticsize);
X }
X }
X
X /* label the ticmark */
X if (text == NULL)
X text = xformat;
X
X if(polar){
X (void) sprintf(ticlabel, text, CheckLog(log_x, fabs(place)+rmin));
X if ((*t->justify_text)(CENTRE)) {
X (*t->put_text)(map_x(place),
X map_y(ZERO)-(t->v_char), ticlabel);
X } else {
X (*t->put_text)(map_x(place)-(t->h_char)*strlen(ticlabel)/2,
X map_y(ZERO)-(t->v_char), ticlabel);
X }
X }else{
X
X (void) sprintf(ticlabel, text, CheckLog(log_x, place));
X if ((*t->justify_text)(CENTRE)) {
X (*t->put_text)(map_x(place),
X ybot-(t->v_char), ticlabel);
X } else {
X (*t->put_text)(map_x(place)-(t->h_char)*strlen(ticlabel)/2,
X ybot-(t->v_char), ticlabel);
X }
X }
}
SHAR_EOF
echo 'File gnuplot/graphics.c is complete' &&
chmod 0644 gnuplot/graphics.c ||
echo 'restore of gnuplot/graphics.c failed'
Wc_c="`wc -c < 'gnuplot/graphics.c'`"
test 42004 -eq "$Wc_c" ||
echo 'gnuplot/graphics.c: original size 42004, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/makefile.ami ==============
if test -f 'gnuplot/makefile.ami' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/makefile.ami (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/makefile.ami (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/makefile.ami' &&
#
# Makefile for the Amiga Pat R. Empleo
# Sept 1991
# Manx Aztec C 5.2 beta version
#
# Usage:
#
# make -f makefile.ami
#
#
X
# where to install help file gnuplot.gih
HELPDEST=GNUPLOT:docs/gnuplot.gih
# Where to send email about bugs and comments (locally)
EMAIL="pixar\!bug-g...@sun.com"
X
#
# Manx Aztec C v5.2 compiler options
#
# -DVFORK We use this switch to invoke fexecv()
#
CC = cc
CFLAGS = -DVFORK -DNOGAMMA -DMEMSET -DMEMCPY -DAMIGA_AC_5 -fa -sab -wosw -MR
X
#
# Manx Aztec C v5.2 linker options
#
LD = ln
LIBS = -lma -lc
X
#
# Terminal (device) support --- see term.h
#
TERMFLAGS = -Iterm
X
#
# List of object files except term.o, version.o
#
OBJS = bitmap.o command.o contour.o eval.o graphics.o graph3d.o help.o \
X internal.o misc.o parse.o plot.o scanner.o \
X setshow.o standard.o util.o
X
#
# List of sources
#
CSOURCE1 = command.c setshow.c
CSOURCE2 = help.c graphics.c graph3d.c internal.c
CSOURCE3 = misc.c eval.c parse.c plot.c readline.c scanner.c standard.c
CSOURCE4 = bitmap.c term.c util.c version.c
CSOURCE5 = term/amiga.trm term/aed.trm term/cgi.trm term/dumb.trm term/dxf.trm \
X term/dxy.trm term/eepic.trm term/epson.trm term/fig.trm \
X term/hp26.trm term/hp2648.trm term/hpgl.trm term/hpljii.trm \
X term/apollo.trm term/gpr.trm
CSOURCE6 = term/impcodes.h term/imagen.trm term/object.h \
X term/iris4d.trm term/kyo.trm term/latex.trm term/pc.trm
CSOURCE7 = term/post.trm term/qms.trm term/regis.trm term/sun.trm \
X term/t410x.trm term/tek.trm term/unixpc.trm term/unixplot.trm \
X term/v384.trm term/x11.trm term/bigfig.trm term/vws.trm gnuplot_x11.c
CSOURCE8 = contour.c
X
#
# Docs
#
DOCS1 = docs/Makefile docs/README docs/checkdoc.c docs/doc2gih.c \
X docs/doc2hlp.c docs/doc2hlp.com docs/doc2ms.c docs/doc2tex.c \
X docs/gnuplot.1 docs/lasergnu.1 docs/toc_entry.sty \
X docs/titlepage.ms docs/titlepage.tex
DOCS2 = docs/gnuplot.doc
DOCS3 = docs/latextut/Makefile docs/latextut/eg1.plt \
X docs/latextut/eg2.plt docs/latextut/eg3.dat docs/latextut/eg3.plt \
X docs/latextut/eg4.plt docs/latextut/eg5.plt docs/latextut/eg6.plt \
X docs/latextut/header.tex docs/latextut/tutorial.tex \
X docs/latextut/linepoint.plt
X
#
# Targets
#
X
default: gnuplot doc
X
gnuplot: $(OBJS) term.o version.o
X $(LD) $(OBJS) term.o version.o $(LIBS) -o gnuplot
X
doc:
X cd docs
X make -f makefile.ami gih
X
#
# Dependencies
#
plot.o: plot.c
X $(CC) $(CFLAGS) plot.c
X
term.o: term.h term.c $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
X $(CC) $(CFLAGS) $(TERMFLAGS) term.c
X
version.o:
X $(CC) $(CFLAGS) -DCONTACT=$(EMAIL) version.c
X
$(OBJS): plot.h
X $(CC) $(CFLAGS) $*.c
X
command.o:
X $(CC) $(CFLAGS) -c command.c -DHELPFILE="$(HELPDEST)"
X
command.o help.o misc.o: help.h
X
command.o graphics.o graph3d.o misc.o plot.o setshow.o term.o: setshow.h
X
bitmap.o term.o: bitmap.h
X
#
# misc
#
clean:
X delete #?.o
X
veryclean: spotless
X
spotless:
X delete #?.o gnuplot
X
SHAR_EOF
chmod 0644 gnuplot/makefile.ami ||
echo 'restore of gnuplot/makefile.ami failed'
Wc_c="`wc -c < 'gnuplot/makefile.ami'`"
test 2916 -eq "$Wc_c" ||
echo 'gnuplot/makefile.ami: original size 2916, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= gnuplot/term.h ==============
if test -f 'gnuplot/term.h' -a X"$1" != X"-c"; then
echo 'x - skipping gnuplot/term.h (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting gnuplot/term.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/term.h' &&
/* GNUPLOT - term.h */
/*
X * term.h: terminal support definitions
X * Edit this file depending on the set of terminals you wish to support.
X * Comment out the terminal types that you don't want or don't have, and
X * uncomment those that you want included. Be aware that some terminal
X * types (eg, SUN, UNIXPLOT) will require changes in the makefile
X * LIBS definition.
X */
X
/* These terminals are not relevant for MSDOS */
#ifndef MSDOS
X
#ifdef AMIGA_LC_5_1
#define AMIGASCREEN /* Amiga custom screen */
X
#else /* AMIGA_LC_5_1 */
X
#ifdef AMIGA_AC_5
#define AMIGASCREEN /* Amiga custom screen */
#endif
#define AED /* AED 512 and AED 767 */
#define BITGRAPH /* BBN BitGraph */
/* #define CGI /* SCO CGI */
/* #define IRIS4D /* IRIS4D series computer */
#define KERMIT /* MS-Kermit Tektronix 4010 emulator */
#define FIG /* Fig graphics language */
#define REGIS /* ReGis graphics (vt125, vt220, vt240, Gigis...) */
#define SELANAR /* Selanar */
/* #define SUN /* Sun Microsystems Workstation */
#define T410X /* Tektronix 4106, 4107, 4109 and 420x terminals */
#define TEK /* Tektronix 4010, and probably others */
/* #define UNIXPC /* unixpc (ATT 3b1 or ATT 7300) */
/* #define UNIXPLOT /* unixplot */
#define VTTEK /* VT-like tek40xx emulators */
/* #define X11 /* X11R4 window system */
X
#endif /* AMIGA_LC_5_1 */
X
#define DXY800A /* Roland DXY800A plotter */
X
#define HP2648 /* HP2648, HP2647 */
#define HP26 /* HP2623A and maybe others */
#define HP75 /* HP7580, and probably other HPs */
#define IMAGEN /* Imagen laser printers (300dpi) (requires -Iterm also) */
X
#define NEC /* NEC CP6 pinwriter printer */
#define PRESCRIBE /* Kyocera Laser printer */
#define QMS /* QMS/QUIC laserprinter (Talaris 1200 and others) */
#define STARC /* Star Color Printer */
#define TANDY60 /* Tandy DMP-130 series 60-dot per inch graphics */
#define V384 /* Vectrix 384 and tandy color printer */
X
#endif /* MSDOS */
X
/* These terminals can be used on any system */
#define DUMB
X
#define HPGL /* HP7475, HP7220 plotters, and (hopefully) lots of others */
X
#define POSTSCRIPT /* Postscript */
X
/* #define DXF /* DXF format for use with AutoCad (Release 10.x) */
X
#define EEPIC /* EEPIC-extended LaTeX driver, for EEPIC users */
#define EMTEX /* LATEX picture environment with EMTEX specials */
#define EPS60 /* Epson-style 60-dot per inch printers */
#define EPSONP /* Epson LX-800, Star NL-10, NX-1000 and lots of others */
#define HPLJII /* HP LaserJet II */
#define LATEX /* LATEX picture environment */
X
/* These are for MSDOS only */
#ifdef MSDOS
#ifdef __TURBOC__
#define ATT6300 /* AT&T 6300 graphics */
#else
#define ATT6300 /* AT&T 6300 graphics */
#define CORONA /* Corona graphics 325 */
#define HERCULES /* IBM PC/Clone with Hercules graphics board */
#endif /* __TURBOC__ */
#endif /* MSDOS */
X
SHAR_EOF
chmod 0644 gnuplot/term.h ||
echo 'restore of gnuplot/term.h failed'
Wc_c="`wc -c < 'gnuplot/term.h'`"
test 3953 -eq "$Wc_c" ||
echo 'gnuplot/term.h: original size 3953, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
rm -f _shar_seq_.tmp
echo You have unpacked the last part