[comp.sys.sun] GPLOT/PLOTCAP info

dredge@hitchrack.stanford.edu (dredge) (02/16/89)

ZOW!  I've add several requests for gplot/plotcap this morning.  I
answered the first couple and then ...  Following is a (not so) brief
description of the package.  Please note that we turn our software over to
the University and they handle distribution.  I have nothing to do with
it.  At the end of this article is the phone and FAX of the licensing
office.

Thanks for the interest,
Michael Eldredge

			P L O T C A P

The plotting package here has 3 levels.  It was developed to work with our
IC simulation programs.  This has been an active program since about 1981.
The idea was (1) provide a simple set of routines to get graphics done;
(2) let the exact same sequence of calls plot the (mostly the) same image
on any device (raster line printer, graphics terminal, postscript, troff,
X, etc...) modulo resolution and color; (3) make the addition of a new
device as painless as possible.  In particular, the person maintaining the
graphics code doesn't what to know anything about the application
programmers code.  A new device in the PLOTCAP is immediately available to
*all* programs on the next execution without recompilation.  Writing an
entry for a new device is very easy (easier for me, being the author, but
easy).  We have been very successful, given these goals.  It has been
ported to many Unix systems, VMS, VM/CMS and MVS and several other
systems.

The package is composed of 3 levels:

2. The "gplot" library.  This is a library of functions that represent a
simple subset of what people like to do plotting. (eg: move, draw, fill,
set line type, set fill pattern, clear, etc.)  It also includes pseudo-
functions like clipping, scaling, rotating, translating, etc...  There are
basically 3 functions:  setpdev(), setpfil(), gplot2().  The library is
fully implemented in C.  There are cover functions to call the C code from
Fortran (and there is a fortran compatibility version that is pretty close
but doesn't use the PLOTCAP data base).  gplot2() is the major routine
with 4 parameters, a command (eg: G_MOVE, G_DRAW, G_CLEAR, G_SCALE,
G_LINE, ...), a sub-command (eg:  the line type to which to switch, or
whether to clip on logical or physical bounds) and 2 floating point
variables (usually the X and Y values, eg: scale factors).  The functions
that cannot be implemented by the specific hardware is handled in software
so that the plot (modulo resolution and color, etc) will look the same on
an HP2648, Printronix raster lineprinter, Apple LaserWriter, TEK color
printer or whatever is defined.

1. The "plotcap" data base.  The (main C version of the) gplot library
uses the "plotcap" data base which describes the different capabilities of
devices.  This includes information like pixels per unit, output port,
raster or vector type, etc.. and it also contains ``programs'' the can
manipulate (say) a pixel location to create the necessary escape sequence
for the device.  These ``programs'' are loaded at run time and executed by
an internal machine.  Thus, any program that has included the library has
access to all devices in the data base and if a new one is added, all
immediately have access to the new device.  Also, at any given time, the
program only has the "driver" for the in-use device loaded and no others.
Thus, the programs remain small.

3. The "dplot" program. A simple plotting utility program that can plot
columns of data on any of the "plotcap" devices.  It handles axes and
labels and size, etc....

There is also another library (called "high2") that has some 2-D higher
level plotting routines: axis-plot-2d (axplt2()), symbol-drawing-2d
(symbl2()), good-axis-tic-spacing-guesser (axtcs2()), etc.....

Currently defined devices in plotcap ("/usr/local/lib/plotcap.std")
include:

	imagen, ditroff (to include in di-troff source files), a few
	meta-file formats, hp 2563 lineprinter, hp 2648 terminals, hp
	9872 lineprinter, hp think-jet, Apple LaserWriter, Printronix
	Lineprinter, Tek 4100 series color terminals, DEC vt240,
	X-windows and SunView.

Most devices can also do limited input returning cursor locations.

The manual pages are in Unix 'man' format, but the lineprinter, formatted
versions are also on the distribution tape. The manuals are gplot(3L),
gplot2(3L), high2(3L), plotcap(5L).

I HAVE NOTHING TO DO WITH DISTRIBUTING THE SOFTWARE.  THAT (as well as all
other Stanford software) IS HANDLED BY:

	The Office of Technology Licensing
	TEL: (415) 723-0651
	FAX: (415) 725-7295

Michael Eldredge
Stanford Integrated Circuits Lab