[comp.sources.amiga] v90i005: plplot 2.6 - C library for making scientific plots, Part04/12

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (01/15/90)

Submitted-by: Anthony M. Richardson <amr@dukee.egr.duke.edu>
Posting-number: Volume 90, Issue 005
Archive-name: applications/plplot-2.6/part04

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 4 (of 12)."
# Contents:  Amiga/plwindow.c docs/chapter1.tex drivers/hpplot.c
#   include/declare.h src/define.c src/plbox3.c src/plmtex.c
#   src/plot3d.c src/plside3.c src/plstar.c src/plstr.c src/plxybx.c
#   unix/tektronix.c
# Wrapped by tadguy@xanth on Sun Jan 14 18:11:34 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Amiga/plwindow.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Amiga/plwindow.c'\"
else
echo shar: Extracting \"'Amiga/plwindow.c'\" \(3951 characters\)
sed "s/^X//" >'Amiga/plwindow.c' <<'END_OF_FILE'
X#include "plplot.h"
X#include "plamiga.h"
X#include <stdio.h>
X#include <math.h>
X
Xextern struct PLPrefs PLCurPrefs;
X
XPLINT MaxColors;
X
Xextern PLFLT InitWSize, InitHSize;
X
Xstruct Screen *PLScreen;        /* For Custom Screen */
Xstruct Window *PLWindow;
Xstruct RastPort *PLSRPort;      /* Screen rastport */
Xstruct RastPort *PLWRPort;      /* Window rastport */
Xstruct ViewPort *PLVPort;
Xstruct ColorMap *PLCMap;
Xstatic struct TmpRas PLTmpRas;
Xstatic PLANEPTR PLTmpPlane;
X
Xstruct NewWindow NewWindow = {
X   0, 0,
X   0, 0,
X   0, 1,
X   0,
X   0,
X   NULL,
X   NULL,
X   NULL,
X   NULL,                            /* Screen pointer */
X   NULL,
X   205, 120, 1000, 1000,
X   WBENCHSCREEN
X};
X
Xvoid OpenPLWind()
X{
X   short i;
X
X   if(PLCurPrefs.WinType & PLCUST) {
X      struct NewScreen NewScreen = {
X         0, 0, 0, 0, 1,
X         0, 1,
X         HIRES,                        /* default viewmode */
X         CUSTOMSCREEN,
X         NULL,
X         "Plplot Screen",
X         NULL,
X         NULL
X      };
X
X      NewScreen.Height = GfxBase->NormalDisplayRows;
X      NewScreen.Width = GfxBase->NormalDisplayColumns;
X
X      if(PLCurPrefs.ScrType & PLLACE) {
X         NewScreen.ViewModes |= INTERLACE;
X         NewScreen.Height *= 2;
X      }
X      if(!(PLCurPrefs.ScrType & PLHIRES)) {
X         NewScreen.ViewModes &= ~HIRES;
X         NewScreen.Width /= 2;
X      }
X
X      NewScreen.Depth = PLCurPrefs.Depth;
X      NewWindow.Type = CUSTOMSCREEN;
X      if((PLScreen = OpenScreen(&NewScreen)) == NULL) {
X         fprintf(stderr,"Not enough memory for custom screen.\n");
X         CloseLibs();
X         pl_exit();
X      }
X      for(i=0, MaxColors=1; i<PLCurPrefs.Depth; i++)
X         MaxColors *= 2;
X      PLVPort = &(PLScreen->ViewPort);
X      LoadRGB4(PLVPort,&(PLCurPrefs.Color[0]),MaxColors);
X      NewWindow.Screen = PLScreen;
X      if(PLCurPrefs.CWidth == 0 || PLCurPrefs.CHeight == 0) {
X         NewWindow.Width = PLScreen->Width;
X         NewWindow.Height = PLScreen->Height - PLScreen->BarHeight - 1;
X         NewWindow.LeftEdge = 0;
X         NewWindow.TopEdge = PLScreen->BarHeight + 1;
X         PLCurPrefs.CXPos = NewWindow.Width;
X         PLCurPrefs.CYPos = NewWindow.Height;
X         PLCurPrefs.CWidth = NewWindow.Width;
X         PLCurPrefs.CHeight = NewWindow.Height;
X      }
X      else {
X         NewWindow.LeftEdge = PLCurPrefs.CXPos;
X         NewWindow.TopEdge = PLCurPrefs.CYPos;
X         NewWindow.Width = PLCurPrefs.CWidth;
X         NewWindow.Height = PLCurPrefs.CHeight;
X      }
X   }
X   else {
X      MaxColors = 4;
X      NewWindow.LeftEdge = PLCurPrefs.WXPos;
X      NewWindow.TopEdge = PLCurPrefs.WYPos;
X      NewWindow.Width = PLCurPrefs.WWidth;
X      NewWindow.Height = PLCurPrefs.WHeight;
X      NewWindow.Type = WBENCHSCREEN;
X   }
X
X   NewWindow.IDCMPFlags = NEWSIZE|MENUPICK|CLOSEWINDOW;
X   NewWindow.Flags = WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|WINDOWSIZING|
X                     SMART_REFRESH|ACTIVATE;
X   NewWindow.Title = "Plplot 2.0 - Tony Richardson";
X
X   if((PLWindow = OpenWindow(&NewWindow)) == NULL) {
X      fprintf(stderr,"Error opening window.\n");
X      if(PLCurPrefs.WinType & PLCUST)
X         CloseScreen(PLScreen);
X      CloseLibs();
X   }
X
X   if(!(PLCurPrefs.WinType & PLCUST))
X      PLScreen = PLWindow->WScreen;
X
X   PLSRPort = &(PLScreen->RastPort);
X   PLWRPort = PLWindow->RPort;
X   PLVPort = &(PLScreen->ViewPort);
X   PLCMap = PLVPort->ColorMap;
X   PLTmpPlane = AllocRaster(PLScreen->Width,PLScreen->Height);
X   if(PLTmpPlane == NULL) {
X      CloseWindow(PLWindow);
X      if(PLCurPrefs.WinType & PLCUST)
X         CloseScreen(PLScreen);
X      fprintf(stderr,"Out of memory!");
X   }
X   InitTmpRas(&PLTmpRas,PLTmpPlane,RASSIZE(PLScreen->Width,PLScreen->Height));
X   PLWRPort->TmpRas = &PLTmpRas;
X
X   MakePLMenu();
X}
X
Xvoid ClosePLWind()
X{
X   FreeRaster(PLTmpPlane,PLScreen->Width,PLScreen->Height);
X   ClearMenuStrip(PLWindow);
X   CloseWindow(PLWindow);
X   if((PLScreen->Flags & SCREENTYPE) == CUSTOMSCREEN)
X      CloseScreen(PLScreen);
X}
X
END_OF_FILE
if test 3951 -ne `wc -c <'Amiga/plwindow.c'`; then
    echo shar: \"'Amiga/plwindow.c'\" unpacked with wrong size!
fi
# end of 'Amiga/plwindow.c'
fi
if test -f 'docs/chapter1.tex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'docs/chapter1.tex'\"
else
echo shar: Extracting \"'docs/chapter1.tex'\" \(3931 characters\)
sed "s/^X//" >'docs/chapter1.tex' <<'END_OF_FILE'
X\chapter {Introduction}
X\pagenumbering{arabic}
X\section {The PLPLOT Plotting Library}
X
XPLPLOT is a library of C functions that are useful for making
Xscientific plots.
XThe PLPLOT library can be used to create standard x-y plots, semilog plots,
Xlog-log plots, contour plots, 3D plots, mesh plots, bar charts and pie
Xcharts. Multiple graphs (of the same or different sizes) may be placed
Xon a single page with multiple lines in each graph. Different line
Xstyles, widths and colors are supported. A virtually infinite number
Xof distinct area fill patterns may be used. There are almost 2000 characters
Xin the extended character set. This includes four different fonts,
Xthe Greek alphabet and a host of mathematical, musical, and other symbols.
XThe fonts can be scaled to any size for various effects.
X
XSeveral output devices are supported and new devices can be
Xeasily added by writing a small number of device dependent routines.
XThe C source for PLPLOT was written on an Amiga but has been ported
Xto several other systems.
X
XMany of the underlying concepts used in the PLPLOT subroutine package
Xare based on ideas used in Tim Pearson's PGPLOT package originally
Xwritten in VAX-specific Fortran-77.  Sze Tan of the University of
XAuckland originally developed PLPLOT on an IBM PC, and subsequently
Xtransferred it to a number of other machines. Additional features were
Xadded to allow three-dimensional plotting and better access to low-level
Xroutines. The C version of PLPLOT was born when I decided to translate
Xthe package from Fortran in an attempt to teach myself C. In the
Xprocess several of the routines were rewritten to improve efficiency
Xand several new features were
Xadded that allow mesh plotting and area fills. The program structure
Xwas changed somewhat to make it easier to incorporate
Xnew devices.
X
XThis original version of this manual was written by Sze Tan.
X
X\section {Installing and Using the PLPLOT Library}
XThe installation procedure is by necessity system specific and the
Xinstallation guide should be referred to for details. The procedure
Xrequires that all of the routines be compiled and they are then
Xusually placed in a linkable library.
X
XAfter the library has been created, you can write your main program
Xto make the desired PLPLOT calls.
XSeveral example programs are included in this release to help guide
Xyou in creating the main program (Be sure to include plplot.h in your
Xmain program as in the examples.).
X
XYou will then need to compile your program and link it with the
Xplplot library. On a UNIX system this can be done using something similar
Xto (this is system specific)
X\begin{verbatim}
Xcc -o main main.c -lplplot
X\end{verbatim}
Xwhile on an Amiga (with the Lattice C compiler) you might use something
Xlike (this depends on the compiler options you have used when creating
Xthe library)
X\begin{verbatim}
Xlc -o main -Lm+plplot.lib main.c
X\end{verbatim}
X
XIf you have any problems I suggest you see the local C wizard.
X
X\section {Organization of this Manual}
XBecause the library has been ported to so many different systems, this
Xmanual describes the library in general terms.
XSystem specific installation instructions and descriptions of supported
Xdevices are given in the installation manual.
X
XThe PLPLOT library has been designed so that it is easy to write programs
Xproducing graphical output without having to set up large numbers of
Xparameters. However, more precise control of the results may be necessary,
Xand these are accomodated by providing lower-level routines which change
Xthe system defaults. In chapter \ref{simple}, the overall process of
Xproducing
Xa graph using the high-level routines is described. Chapter \ref{advanced}
Xdiscusses the underlying concepts of the plotting process and introduces
Xsome of the more complex routines. The reference section of the manual,
Xchapter \ref{reference} is an alphabetical list of the user-accessible
XPLPLOT functions with detailed descriptions.
X
END_OF_FILE
if test 3931 -ne `wc -c <'docs/chapter1.tex'`; then
    echo shar: \"'docs/chapter1.tex'\" unpacked with wrong size!
fi
# end of 'docs/chapter1.tex'
fi
if test -f 'drivers/hpplot.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'drivers/hpplot.c'\"
else
echo shar: Extracting \"'drivers/hpplot.c'\" \(3614 characters\)
sed "s/^X//" >'drivers/hpplot.c' <<'END_OF_FILE'
X/* This file contains drivers for the HP7475A plotter */
X
X#include "plplot.h"
X#include <stdio.h>
X#include <string.h>
X
X#define PLTX       10299
X#define PLTY        7649
X
Xstatic FILE *OutDev;
Xstatic PLINT orient;
Xstatic PLINT select=0;
Xstatic char FileName[80];
X
Xvoid hp7475setup(xdpi, ydpi, xwid, ywid)
XPLINT xwid, ywid;
XPLFLT xdpi, ydpi;
X{
X}
X
Xvoid hp7475select(ori, name)
XPLINT ori;
Xchar *name;
X{
X   orient = ori;
X   strncpy(FileName,name,sizeof(FileName)-1);
X   FileName[sizeof(FileName)-1] = '\0';
X   select = 1;
X}
X
X/* Set up device specific stuff and initialize the device */
X/* If orient is 0 set up for landscape, otherwise portrait. */
Xvoid hp7475init()
X{
X   char line[80];
X
X   if(!select) {
X      printf("Landscape or portrait orientation? (0 or 1) ");
X      fgets(line,sizeof(line),stdin);
X      if(sscanf(line,"%d",&orient) != 1)
X         orient = 0;
X   }
X
X   /* setpxl() sets the dots/mm in the x and y directions */
X   setpxl(40.,40.);         /* 40 dots/mm or 1016 dots/inch */
X
X   /* setphy() sets the device coordinates. These are integer */
X   /* values. Set up for landscape orientation (long axis of page in the */
X   /* x direction). Origin is in the lower left hand corner. */
X   if(!orient)
X      setphy(0,PLTX,0,PLTY);
X   else
X      setphy(0,PLTY,0,PLTX);
X
X   /* Set default pen color using scol(color). */
X   /* Any default pen color can be used but a black pen is probably best. */
X   scol(1);
X
X   /* Set default pen width using swid(width) */
X   swid(1);
X
X   /* Set device interaction mode using smod(mode). Set mode to 0 for */
X   /* a noninteractive device, Unless you are writing your */
X   /* own Amiga screen driver mode should be 0. */
X   smod(0);
X
X   /* Well that's all the information plplot needs. Let's prompt for a */
X   /* graphics file name. */
X   for(;;) {
X      if(!select) {
X         printf("Enter graphics file name. ");
X         fgets(line,sizeof(line),stdin);
X         if(sscanf(line,"%s",FileName)!=1)
X            continue;
X      }
X
X      if (!(OutDev = fopen(FileName,"w"))) {
X         fprintf(stderr,"Can't open %s.\n",FileName);
X         select = 0;
X      }
X      else
X         break;
X   }
X   select = 0;
X   fprintf(OutDev,"IN; ");
X}
X
X/* Sets to text mode */
Xvoid hp7475text()
X{
X   /* None of the built in fonts are supported yet. */
X}
X
X/* Sets to graphics mode */
Xvoid hp7475graph()
X{
X   /* We're always in graphics mode with this device. */
X}
X
X/* Clears the page */
Xvoid hp7475clear()
X{
X   /* On the HP plotter eject the page. */
X   fprintf(OutDev,"PG; ");
X}
X
Xstatic PLINT xlast, ylast;
X
Xvoid hp7475page()
X{
X   xlast = -100000; ylast = -100000;
X}
X
Xvoid hp7475width(width)
XPLINT width;
X{
X}
X
X/* Change the pen color */
Xvoid hp7475color(color)
XPLINT color;
X{
X   if(color<1 || color>8)
X      fprintf(stderr,"Invalid pen selection.\n");
X   else
X      fprintf(OutDev,"SP %d;",color);
X}
X
X
X/* Draws a line from (x1,y1) to (x2,y2) */
Xvoid hp7475line(x1,y1,x2,y2)
XPLINT x1,y1,x2,y2;
X{
X
X   /* If starting point of this line is the same as the ending point of */
X   /* the previous line then don't raise the pen. (This really speeds up */
X   /* plotting and reduces the size of the file. */
X   if(!orient) {
X      if(x1 == xlast && y1 == ylast)
X         fprintf(OutDev," %d %d",x2,y2);
X      else
X         fprintf(OutDev,"\nPU %d %d PD %d %d",x1,y1,x2,y2);
X   }
X   else {
X      if(x1 == xlast && y1 == ylast)
X         fprintf(OutDev," %d %d",PLTX-y2,x2);
X      else
X         fprintf(OutDev,"\nPU %d %d PD %d %d",PLTX-y1,x1,PLTX-y2,x2);
X   }
X
X   xlast = x2;
X   ylast = y2;
X}
X
X/* Cleanup and close file. */
Xvoid hp7475tidy()
X{
X   fprintf(OutDev,"\nSP0");
X   fclose(OutDev);
X}
X
X
X
END_OF_FILE
if test 3614 -ne `wc -c <'drivers/hpplot.c'`; then
    echo shar: \"'drivers/hpplot.c'\" unpacked with wrong size!
fi
# end of 'drivers/hpplot.c'
fi
if test -f 'include/declare.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'include/declare.h'\"
else
echo shar: Extracting \"'include/declare.h'\" \(3664 characters\)
sed "s/^X//" >'include/declare.h' <<'END_OF_FILE'
X/*
X* Global variables for C plotting package
X*
X* device  :  Graphics device number
X* termin  :  Zero for noninteractive device, non-zero for terminal
X* graphx  :  Zero if currently in text mode, non-zero for graphics mode
X* currx   :  Physical x-coordinate of current point
X* curry   :  Physical y-coordinate of current point
X* vpp...  :  Viewport boundaries in physical coordinates
X* spp...  :  Subpage  boundaries in physical coordinates
X* clp...  :  Clip     boundaries in physical coordinates
X* phy...  :  Physical device limits in physical coordinates
X* nsub.   :  Number of subpages on physical device
X* cursub  :  Current subpage
X* um.     :  Number of micrometres in a pixel
X* font    :  Current default font
X* colour  :  Current default colour
X* width   :  Current pen width
X* mark    :  Array of mark lengths in micrometres for broken lines
X* space   :  Array of space lengths in micrometres for broken lines
X* nms     :  Number of elements for current broken line style
X* timecnt :  Timer for broken lines
X* alarm   :  Alarm indicating change of broken line status
X* pendn   :  Flag indicating if pen is up or down
X* curel   :  Current element within broken line
X* inclin  :  Array of inclinations in tenths of degree for fill lines
X* delta   :  Array of spacings in micrometers between fill lines
X* nps     :  Number of distinct line styles for fills
X* level   :  Initialization level
X*
X* spd...  :  Subpage  boundaries in normalized device coordinates
X* vpd...  :  Viewport boundaries in normalized device coordinates
X* vpw...  :  Viewport boundaries in world coordinates
X* .pmm    :  Number of pixels to a millimetre
X* wp....  :  Transformation variables for world  to physical conversion
X* dp....  :  Transformation variables for device to physical conversion
X* mp....  :  Transformation variables for millimetres from bottom left
X*             hand corner to physical coordinates
X* wm....  :  Transformation variables for world coordinates to mm
X* chr...  :  Character default height and current (scaled) height
X* sym...  :  Symbol    default height and current (scaled) height
X* maj...  :  Major tick default height and current (scaled) height
X* min...  :  Minor tick default height and current (scaled) height
X* base3.  :  World coordinate size of base for 3-d plot
X* basec.  :  Position of centre of base for 3-d plot
X* dom...  :  Minimum and maximum values for domain
X* zzscl   :  Vertical (z) scale for 3-d plot
X* ran..   :  Minimum and maximum z values for 3-d plot
X* c..     :  Coordinate transformation from 3-d to 2-d
X*/
X
Xextern PLINT device, termin, graphx;
Xextern PLINT currx,  curry;
Xextern PLINT vppxmi, vppxma, vppymi, vppyma;
Xextern PLINT sppxmi, sppxma, sppymi, sppyma;
Xextern PLINT clpxmi, clpxma, clpymi, clpyma;
Xextern PLINT phyxmi, phyxma, phyymi, phyyma;
Xextern PLINT nsubx,  nsuby, cursub;
Xextern PLINT umx,    umy;
Xextern PLINT font,   colour, width, style;
Xextern PLINT mark[], space[], nms, timecnt;
Xextern PLINT alarm,  pendn,  curel;
Xextern PLINT inclin[], delta[], nps;
Xextern PLINT level;
X
Xextern PLFLT spdxmi, spdxma, spdymi, spdyma;
Xextern PLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
Xextern PLFLT vpwxmi, vpwxma, vpwymi, vpwyma;
Xextern PLFLT xpmm,   ypmm;
Xextern PLFLT wpxscl, wpxoff, wpyscl, wpyoff;
Xextern PLFLT dpxscl, dpxoff, dpyscl, dpyoff;
Xextern PLFLT mpxscl, mpxoff, mpyscl, mpyoff;
Xextern PLFLT wmxscl, wmxoff, wmyscl, wmyoff;
Xextern PLFLT chrdef, chrht;
Xextern PLFLT symdef, symht;
Xextern PLFLT majdef, majht;
Xextern PLFLT mindef, minht;
Xextern PLFLT base3x, base3y, basecx, basecy;
Xextern PLFLT domxmi, domxma, domymi, domyma;
Xextern PLFLT zzscl,  ranmi,  ranma;
Xextern PLFLT cxx,    cxy,    cyx,    cyy,   cyz;
END_OF_FILE
if test 3664 -ne `wc -c <'include/declare.h'`; then
    echo shar: \"'include/declare.h'\" unpacked with wrong size!
fi
# end of 'include/declare.h'
fi
if test -f 'src/define.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/define.c'\"
else
echo shar: Extracting \"'src/define.c'\" \(3491 characters\)
sed "s/^X//" >'src/define.c' <<'END_OF_FILE'
X/*
X* Global variables for C plotting package
X*
X* device  :  Graphics device number
X* termin  :  Zero for noninteractive device, non-zero for terminal
X* graphx  :  Zero if currently in text mode, non-zero for graphics mode
X* currx   :  Physical x-coordinate of current point
X* curry   :  Physical y-coordinate of current point
X* vpp...  :  Viewport boundaries in physical coordinates
X* spp...  :  Subpage  boundaries in physical coordinates
X* clp...  :  Clip     boundaries in physical coordinates
X* phy...  :  Physical device limits in physical coordinates
X* nsub.   :  Number of subpages on physical device
X* cursub  :  Current subpage
X* um.     :  Number of micrometres in a pixel
X* font    :  Current default font
X* colour  :  Current default colour
X* width   :  Current pen width
X* mark    :  Array of mark lengths in micrometres for broken lines
X* space   :  Array of space lengths in micrometres for broken lines
X* nms     :  Number of elements for current broken line style
X* timecnt :  Timer for broken lines
X* alarm   :  Alarm indicating change of broken line status
X* pendn   :  Flag indicating if pen is up or down
X* curel   :  Current element within broken line
X* inclin  :  Array of inclinations in tenths of degree for fill lines
X* delta   :  Array of spacings in micrometers between fill lines
X* nps     :  Number of distinct line styles for fills
X* level   :  Initialization level
X*
X* spd...  :  Subpage  boundaries in normalized device coordinates
X* vpd...  :  Viewport boundaries in normalized device coordinates
X* vpw...  :  Viewport boundaries in world coordinates
X* .pmm    :  Number of pixels to a millimetre
X* wp....  :  Transformation variables for world  to physical conversion
X* dp....  :  Transformation variables for device to physical conversion
X* mp....  :  Transformation variables for millimetres from bottom left
X*             hand corner to physical coordinates
X* wm....  :  Transformation variables for world coordinates to mm
X* chr...  :  Character default height and current (scaled) height
X* sym...  :  Symbol    default height and current (scaled) height
X* maj...  :  Major tick default height and current (scaled) height
X* min...  :  Minor tick default height and current (scaled) height
X* base3.  :  World coordinate size of base for 3-d plot
X* basec.  :  Position of centre of base for 3-d plot
X* dom...  :  Minimum and maximum values for domain
X* zzscl   :  Vertical (z) scale for 3-d plot
X* ran..   :  Minimum and maximum z values for 3-d plot
X* c..     :  Coordinate transformation from 3-d to 2-d
X*/
X
X#include "plplot.h"
X
XPLINT device, termin, graphx;
XPLINT currx,  curry;
XPLINT vppxmi, vppxma, vppymi, vppyma;
XPLINT sppxmi, sppxma, sppymi, sppyma;
XPLINT clpxmi, clpxma, clpymi, clpyma;
XPLINT phyxmi, phyxma, phyymi, phyyma;
XPLINT nsubx,  nsuby, cursub;
XPLINT umx,    umy;
XPLINT font,   colour, width, style;
XPLINT mark[10], space[10], nms, timecnt;
XPLINT alarm,  pendn,  curel;
XPLINT inclin[2], delta[2], nps;
XPLINT level=0;
X
XPLFLT spdxmi, spdxma, spdymi, spdyma;
XPLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
XPLFLT vpwxmi, vpwxma, vpwymi, vpwyma;
XPLFLT xpmm,   ypmm;
XPLFLT wpxscl, wpxoff, wpyscl, wpyoff;
XPLFLT dpxscl, dpxoff, dpyscl, dpyoff;
XPLFLT mpxscl, mpxoff, mpyscl, mpyoff;
XPLFLT wmxscl, wmxoff, wmyscl, wmyoff;
XPLFLT chrdef, chrht;
XPLFLT symdef, symht;
XPLFLT majdef, majht;
XPLFLT mindef, minht;
XPLFLT base3x, base3y, basecx, basecy;
XPLFLT domxmi, domxma, domymi, domyma;
XPLFLT zzscl,  ranmi,  ranma;
XPLFLT cxx,    cxy,    cyx,    cyy,   cyz;
X
END_OF_FILE
if test 3491 -ne `wc -c <'src/define.c'`; then
    echo shar: \"'src/define.c'\" unpacked with wrong size!
fi
# end of 'src/define.c'
fi
if test -f 'src/plbox3.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plbox3.c'\"
else
echo shar: Extracting \"'src/plbox3.c'\" \(4058 characters\)
sed "s/^X//" >'src/plbox3.c' <<'END_OF_FILE'
X/* Draws axes and axis labels for 3-d plots */
X
X#include "plplot.h"
X
Xextern PLINT zbackflag, zbcolor;
Xextern PLFLT zticksp;
X
Xvoid plbox3(xopt,xlabel,xtick,nsubx,yopt,ylabel,ytick,nsuby,
X            zopt,zlabel,ztick,nsubz)
Xchar *xopt, *xlabel, *yopt, *ylabel, *zopt, *zlabel;
XPLINT nsubx, nsuby, nsubz;
XPLFLT xtick, ytick, ztick;
X{
X      PLFLT dx,dy,tx,ty,ux,uy;
X      PLFLT xmin,xmax,ymin,ymax,zmin,zmax,zscale;
X      PLFLT cxx,cxy,cyx,cyy,cyz;
X      PLINT ln, level, font;
X
X      glev(&level);
X      if (level < 3) plexit("Please set up window before calling plbox3");
X
X      gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
X      gdom(&xmin,&xmax,&ymin,&ymax);
X      grange(&zscale,&zmin,&zmax);
X
X      /* We have to wait until after the plot is drawn to draw back */
X      /* grid so store this stuff. */
X      zbackflag = stsearch(zopt,'d');
X      if(zbackflag) {
X         /* save tick spacing and color */
X         zticksp = ztick;
X         gatt(&font,&zbcolor);
X      }
X
X      if (cxx >= 0.0 && cxy <= 0.0) {
X        ln= stsearch(xopt,'n');
X        tx=w3wcx(xmin,ymin,zmin);
X        ty=w3wcy(xmin,ymin,zmin);
X        ux=w3wcx(xmax,ymin,zmin);
X        uy=w3wcy(xmax,ymin,zmin);
X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmin,xmax,xtick,nsubx,0);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
X             w3wcy(xmax,ymin,zmax),zmin,zmax,ztick,nsubz);
X        tx=w3wcx(xmin,ymax,zmin);
X        ty=w3wcy(xmin,ymax,zmin);
X        ux=w3wcx(xmin,ymin,zmin);
X        uy=w3wcy(xmin,ymin,zmin);
X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymax,ymin,ytick,nsuby,ln);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
X             w3wcy(xmin,ymax,zmax),zmin,zmax,ztick,nsubz);
X
X      }
X      else if (cxx <= 0.0 && cxy <= 0.0) {
X        ln=stsearch(yopt,'n');
X        tx=w3wcx(xmin,ymax,zmin);
X        ty=w3wcy(xmin,ymax,zmin);
X        ux=w3wcx(xmin,ymin,zmin);
X        uy=w3wcy(xmin,ymin,zmin);
X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymax,ymin,ytick,nsuby,0);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
X             w3wcy(xmin,ymin,zmax),zmin,zmax,ztick,nsubz);
X        tx=w3wcx(xmax,ymax,zmin);
X        ty=w3wcy(xmax,ymax,zmin);
X        ux=w3wcx(xmin,ymax,zmin);
X        uy=w3wcy(xmin,ymax,zmin);
X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmax,xmin,xtick,nsubx,ln);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
X             w3wcy(xmax,ymax,zmax),zmin,zmax,ztick,nsubz);
X
X      }
X      else if (cxx <= 0.0 && cxy >= 0.0) {
X        ln= stsearch(xopt,'n');
X        tx=w3wcx(xmax,ymax,zmin);
X        ty=w3wcy(xmax,ymax,zmin);
X        ux=w3wcx(xmin,ymax,zmin);
X        uy=w3wcy(xmin,ymax,zmin);
X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmax,xmin,xtick,nsubx,0);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
X             w3wcy(xmin,ymax,zmax),zmin,zmax,ztick,nsubz);
X        tx=w3wcx(xmax,ymin,zmin);
X        ty=w3wcy(xmax,ymin,zmin);
X        ux=w3wcx(xmax,ymax,zmin);
X        uy=w3wcy(xmax,ymax,zmin);
X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymin,ymax,ytick,nsuby,ln);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
X             w3wcy(xmax,ymin,zmax),zmin,zmax,ztick,nsubz);
X      }
X      else if (cxx >= 0.0 && cxy >= 0.0) {
X        ln= stsearch(yopt,'n');
X        tx=w3wcx(xmax,ymin,zmin);
X        ty=w3wcy(xmax,ymin,zmin);
X        ux=w3wcx(xmax,ymax,zmin);
X        uy=w3wcy(xmax,ymax,zmin);
X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymin,ymax,ytick,nsuby,0);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
X             w3wcy(xmax,ymax,zmax),zmin,zmax,ztick,nsubz);
X        tx=w3wcx(xmin,ymin,zmin);
X        ty=w3wcy(xmin,ymin,zmin);
X        ux=w3wcx(xmax,ymin,zmin);
X        uy=w3wcy(xmax,ymin,zmin);
X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmin,xmax,xtick,nsubx,ln);
X        dx = ux - tx;
X        dy = uy - ty;
X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
X             w3wcy(xmin,ymin,zmax),zmin,zmax,ztick,nsubz);
X
X      }
X}
X
END_OF_FILE
if test 4058 -ne `wc -c <'src/plbox3.c'`; then
    echo shar: \"'src/plbox3.c'\" unpacked with wrong size!
fi
# end of 'src/plbox3.c'
fi
if test -f 'src/plmtex.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plmtex.c'\"
else
echo shar: Extracting \"'src/plmtex.c'\" \(3972 characters\)
sed "s/^X//" >'src/plmtex.c' <<'END_OF_FILE'
X/* Prints out "text" at specified position relative to viewport       */
X/* (may be inside or outside)                                         */
X
X/* side   String which is one of the following:                       */
X/*        B or b  :  Bottom of viewport                               */
X/*        T or t  :  Top of viewport                                  */
X/*        L or l  :  Left of viewport                                 */
X/*        R or r  :  Right of viewport                                */
X/*        LV or lv : Left of viewport, vertical text                  */
X/*        RV or rv : Right of viewport, vertical text                 */
X/* disp   Displacement from specified edge of viewport, measured      */
X/*         outwards from the viewport in units of the current         */
X/*         character height. The CENTRELINES of the characters are    */
X/*         aligned with the specified position.                       */
X/* pos    Position of the reference point of the string relative      */
X/*         to the viewport edge, ranging from 0.0 (left-hand edge)    */
X/*         to 1.0 (right-hand edge)                                   */
X/* just   Justification of string relative to reference point         */
X/*         just = 0.0 => left hand edge of string is at reference     */
X/*         just = 1.0 => right hand edge of string is at reference    */
X/*         just = 0.5 => centre of string is at reference             */
X
X#include "plplot.h"
X
Xvoid plmtex(side,disp,pos,just,text)
Xchar *side, *text;
XPLFLT disp, pos, just;
X{
X      PLINT clpxmi, clpxma, clpymi, clpyma;
X      PLINT sppxmi, sppxma, sppymi, sppyma;
X      PLINT vert, refx, refy;
X      PLFLT shift, xform[4];
X      PLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
X      PLFLT chrdef, chrht;
X      PLFLT mpxscl, mpxoff, mpyscl, mpyoff;
X      PLINT level;
X
X      glev(&level);
X      if (level < 2) plexit("Please set up viewport before calling plmtex.");
X
X      /* Open clip limits to subpage limits */
X
X      gclp(&clpxmi,&clpxma,&clpymi,&clpyma);
X      gspp(&sppxmi,&sppxma,&sppymi,&sppyma);
X      sclp(sppxmi,sppxma,sppymi,sppyma);
X
X      gvpd(&vpdxmi,&vpdxma,&vpdymi,&vpdyma);
X      gmp(&mpxscl,&mpxoff,&mpyscl,&mpyoff);
X      gchr(&chrdef,&chrht);
X
X      shift = 0.0;
X      if (just!=0.0) shift = just * plstrl(text);
X
X      if (stsearch(side,'b')) {
X        vert = 0;
X        refx = dcpcx((PLFLT)(vpdxmi + (vpdxma-vpdxmi) * pos)) - shift*mpxscl;
X        refy = mmpcy((PLFLT)(dcmmy(vpdymi) - disp * chrht));
X      }
X      else if (stsearch(side,'t')) {
X        vert = 0;
X        refx = dcpcx((PLFLT)(vpdxmi + (vpdxma-vpdxmi) * pos)) - shift*mpxscl;
X        refy = mmpcy((PLFLT)(dcmmy(vpdyma) + disp * chrht));
X      }
X      else if (stindex(side,"LV")!=-1 || stindex(side,"lv")!=-1) {
X        vert = 0;
X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos));
X        refx = mmpcx((PLFLT)(dcmmx(vpdxmi) - disp * chrht - shift));
X      }
X      else if (stindex(side,"RV")!=-1 || stindex(side,"rv")!=-1) {
X        vert = 0;
X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos));
X        refx = mmpcx((PLFLT)(dcmmx(vpdxma) + disp * chrht - shift));
X      }
X      else if (stsearch(side,'l')) {
X        vert = 1;
X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos)) - shift*mpyscl;
X        refx = mmpcx((PLFLT)(dcmmx(vpdxmi) - disp * chrht));
X      }
X      else if (stsearch(side,'r')) {
X        vert = 1;
X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos)) - shift*mpyscl;
X        refx = mmpcx((PLFLT)(dcmmx(vpdxma) + disp * chrht));
X      }
X      else {
X        sclp(clpxmi,clpxma,clpymi,clpyma);
X        return;
X      }
X
X      if (vert != 0) {
X        xform[0] = 0.0;
X        xform[1] = -1.0;
X        xform[2] = 1.0;
X        xform[3] = 0.0;
X      }
X      else {
X        xform[0] = 1.0;
X        xform[1] = 0.0;
X        xform[2] = 0.0;
X        xform[3] = 1.0;
X      }
X      plstr(0,xform,refx,refy,text);
X      sclp(clpxmi,clpxma,clpymi,clpyma);
X}
END_OF_FILE
if test 3972 -ne `wc -c <'src/plmtex.c'`; then
    echo shar: \"'src/plmtex.c'\" unpacked with wrong size!
fi
# end of 'src/plmtex.c'
fi
if test -f 'src/plot3d.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plot3d.c'\"
else
echo shar: Extracting \"'src/plot3d.c'\" \(4067 characters\)
sed "s/^X//" >'src/plot3d.c' <<'END_OF_FILE'
X/* Plots a 3-d representation of the function z[x][y]. The x values */
X/* are stored as x[0..nx-1], the y values as y[0..ny-1], and the */
X/* z values are in the 2-d array z[][0..ly-1]. The integer "opt" */
X/* specifies: */
X/*  opt = 1:  Draw lines parallel to x-axis */
X/*  opt = 2:  Draw lines parallel to y-axis */
X/*  opt = 3:  Draw lines parallel to both axes */
X
X#include "plplot.h"
X#include <math.h>
X
X#ifdef PLSTDC
X#include <stdlib.h>
X#else
Xextern char *malloc();
Xextern void free();
X#endif
X
Xextern PLINT *oldhiview;
XPLINT zbackflag=0, zbcolor;
XPLFLT zticksp;
X
Xvoid plot3d(x,y,z,ly,nx,ny,opt,side)
XPLINT ly, nx, ny, opt, side;
XPLFLT *x, *y, *z;
X{
X      PLINT b, color, font;
X      PLFLT cxx, cxy, cyx, cyy, cyz;
X      PLINT init;
X      PLINT *work;
X      PLINT i, ix, iy;
X      PLINT level;
X
X      glev(&level);
X      if (level < 3) plexit("Please set up window before calling plot3d");
X
X      if (opt<1 || opt>3) plexit("Bad option in plot3d");
X      if (nx<=0 || ny<=0 || ly<ny) plexit("Bad array dimensions in plot3d.");
X
X      /* Check that points in x and in y are strictly increasing */
X
X      for (i=0; i<nx-1; i++)
X        if (x[i]>=x[i+1]) plexit("X array must be strictly increasing in plot3d");
X
X      for (i=0; i<ny-1; i++)
X        if (y[i]>=y[i+1]) plexit("Y array must be strictly increasing in plot3d");
X
X      work = (PLINT *)malloc(4*max(nx,ny)*sizeof(PLINT));
X      if(!work)
X         plexit("Out of memory in plot3d.");
X      b = 2*max(nx,ny)+1;
X      gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
X      init = 1;
X
X      if (cxx >= 0.0 && cxy <= 0.0) {
X        if (opt != 2) {
X          for (iy=2; iy<=ny; iy++)  {
X            plt3zz(1,iy,1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X            init = 0;
X          }
X        }
X        else  {
X          plt3zz(1,ny,1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X          init = 0;
X        }
X        if (opt != 1)
X          for (ix=1; ix<=nx-1; ix++)
X            plt3zz(ix,ny,1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X        else
X          plt3zz(1,ny,1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X      }
X      else if (cxx <= 0.0 && cxy <= 0.0) {
X        if (opt != 1) {
X          for (ix=2; ix<=nx; ix++) {
X            plt3zz(ix,ny,-1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X            init = 0;
X          }
X        }
X        else  {
X          plt3zz(nx,ny,-1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X          init = 0;
X        }
X        if (opt != 2)
X          for (iy=ny; iy>=2; iy--)
X            plt3zz(nx,iy,-1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X        else
X          plt3zz(nx,ny,-1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X      }
X      else if (cxx <= 0.0 && cxy >= 0.0) {
X        if (opt != 2) {
X          for (iy=ny-1; iy>=1; iy--) {
X            plt3zz(nx,iy,-1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X            init = 0;
X          }
X        }
X        else {
X          plt3zz(nx,1,-1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X          init = 0;
X        }
X        if (opt != 1)
X          for (ix=nx; ix>=2; ix--)
X            plt3zz(ix,1,-1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X        else
X          plt3zz(nx,1,-1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X      }
X      else if (cxx >= 0.0 && cxy >= 0.0) {
X        if (opt != 1) {
X          for (ix=nx-1; ix>=1; ix--) {
X            plt3zz(ix,1,1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X            init = 0;
X          }
X        }
X        else  {
X          plt3zz(1,1,1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X          init = 0;
X        }
X        if (opt != 2)
X          for (iy=1; iy<=ny-1; iy++)
X            plt3zz(1,iy,1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X        else
X          plt3zz(1,1,1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
X      }
X
X      free((VOID *)work);
X
X      if(side)
X         plside3a(x,y,z,ly,nx,ny,opt);
X
X      if(zbackflag) {
X         gatt(&font,&color);
X         plcol(zbcolor);
X         plgrid3a(zticksp);
X         plcol(color);
X      }
X
X      free((VOID *)oldhiview);
X}
END_OF_FILE
if test 4067 -ne `wc -c <'src/plot3d.c'`; then
    echo shar: \"'src/plot3d.c'\" unpacked with wrong size!
fi
# end of 'src/plot3d.c'
fi
if test -f 'src/plside3.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plside3.c'\"
else
echo shar: Extracting \"'src/plside3.c'\" \(3295 characters\)
sed "s/^X//" >'src/plside3.c' <<'END_OF_FILE'
X/* This routine draws sides around the front of the 3d plot so that */
X/* it does not appear to float */
X
X#include "plplot.h"
X
Xvoid plside3a(x,y,z,ly,nx,ny,opt)
XPLINT nx, ny, ly, opt;
XPLFLT *x, *y, *z;
X{
X    PLINT i;
X    PLFLT cxx, cxy, cyx, cyy, cyz;
X    PLFLT xmin, ymin, zmin, xmax, ymax, zmax, zscale;
X    PLFLT tx, ty, ux, uy;
X
X    gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
X    gdom(&xmin,&xmax,&ymin,&ymax);
X    grange(&zscale,&zmin,&zmax);
X
X    if (cxx >= 0.0 && cxy <= 0.0)  {
X        /* Get x, y coordinates of legs and plot */
X        if (opt != 1) {
X            for (i=0; i<nx; i++)  {
X                tx = w3wcx(*(x+i),*y,zmin);
X                ty = w3wcy(*(x+i),*y,zmin);
X                ux = w3wcx(*(x+i),*y,*(z+i*ly));
X                uy = w3wcy(*(x+i),*y,*(z+i*ly));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X
X        if (opt != 2) {
X            for (i=0; i<ny; i++)  {
X                tx = w3wcx(*x,*(y+i),zmin);
X                ty = w3wcy(*x,*(y+i),zmin);
X                ux = w3wcx(*x,*(y+i),*(z+i));
X                uy = w3wcy(*x,*(y+i),*(z+i));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X    }
X    else if(cxx <= 0.0  && cxy <= 0.0)  {
X        if (opt != 1 )  {
X            for (i=0; i<nx; i++)  {
X                tx = w3wcx(*(x+i),*(y+ny-1),zmin);
X                ty = w3wcy(*(x+i),*(y+ny-1),zmin);
X                ux = w3wcx(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
X                uy = w3wcy(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X
X        if (opt != 2)  {
X            for (i=0; i<ny; i++)  {
X                tx = w3wcx(*x,*(y+i),zmin);
X                ty = w3wcy(*x,*(y+i),zmin);
X                ux = w3wcx(*x,*(y+i),*(z+i));
X                uy = w3wcy(*x,*(y+i),*(z+i));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X    }
X    else if(cxx <= 0.0  && cxy >= 0.0)  {
X        if (opt != 1)  {
X            for (i=0; i<nx; i++)  {
X                tx = w3wcx(*(x+i),*(y+ny-1),zmin);
X                ty = w3wcy(*(x+i),*(y+ny-1),zmin);
X                ux = w3wcx(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
X                uy = w3wcy(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X
X        if (opt != 2)  {
X            for (i=0; i<ny; i++)  {
X                tx = w3wcx(*(x+nx-1),*(y+i),zmin);
X                ty = w3wcy(*(x+nx-1),*(y+i),zmin);
X                ux = w3wcx(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
X                uy = w3wcy(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X    }
X    else if(cxx >= 0.0  && cxy >= 0.0)  {
X        if (opt != 1)  {
X            for (i=0; i<nx; i++)  {
X                tx = w3wcx(*(x+i),*y,zmin);
X                ty = w3wcy(*(x+i),*y,zmin);
X                ux = w3wcx(*(x+i),*y,*(z+i*ly));
X                uy = w3wcy(*(x+i),*y,*(z+i*ly));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X
X        if (opt != 2)  {
X            for (i=0; i<ny; i++)  {
X                tx = w3wcx(*(x+nx-1),*(y+i),zmin);
X                ty = w3wcy(*(x+nx-1),*(y+i),zmin);
X                ux = w3wcx(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
X                uy = w3wcy(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
X                pljoin(tx,ty,ux,uy);
X            }
X        }
X    }
X}
END_OF_FILE
if test 3295 -ne `wc -c <'src/plside3.c'`; then
    echo shar: \"'src/plside3.c'\" unpacked with wrong size!
fi
# end of 'src/plside3.c'
fi
if test -f 'src/plstar.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plstar.c'\"
else
echo shar: Extracting \"'src/plstar.c'\" \(3806 characters\)
sed "s/^X//" >'src/plstar.c' <<'END_OF_FILE'
X#include "plplot.h"
X#include "declare.h"
X#include "dispatch.h"
X#include <stdio.h>
X
X/* Asks for number of plotting device, and call plbeg to divide the */
X/* page into nx by ny subpages */
Xvoid plstar(nx,ny)
XPLINT nx, ny;
X{
X   PLINT dev, i;
X   char response[10];
X   extern PLINT npldrivers;
X   extern DISPATCH_TABLE  plDispatchTable[];
X
X   if(level != 0)
X      plend();
X
X   dev = 0;
X   while(dev<1 || dev>npldrivers) {
X      printf("\nPlotting Options:\n");
X      for(i=0; i<npldrivers;i++)
X         printf(" <%2d> %s\n",i+1,plDispatchTable[i].pl_MenuStr);
X      printf("\nEnter device number: ");
X      fgets(response,sizeof(response),stdin);
X      if(sscanf(response,"%d",&dev) != 1) {
X         printf("Invalid device number.");
X         dev = 0;
X      }
X   }
X   plbeg(dev,nx,ny);
X}
X
Xstatic pagesetup=0, select=0;
X
X/* Initializes the graphics device "dev"  */
Xvoid grbeg(dev)
XPLINT dev;
X{
X   PLINT phyxmi, phyxma, phyymi, phyyma;
X   PLINT mk=0, sp=0;
X   PLINT inc=0, del=2000;
X
X   /* Set device number, graphics mode and font */
X   device = dev;
X   graphx = 0;
X   font = 1;
X
X   /* Start by initializing device */
X   if(pagesetup) {
X      grsetup();
X      pagesetup = 0;
X   }
X   if(select) {
X      grselect();
X      select = 0;
X   }
X   grinit();
X   grpage();
X
X   /* Set default sizes */
X   plschr((PLFLT)4.0,(PLFLT)1.0);
X   plssym((PLFLT)4.0,(PLFLT)1.0);
X   plsmaj((PLFLT)3.0,(PLFLT)1.0);
X   plsmin((PLFLT)1.5,(PLFLT)1.0);
X
X   /* Switch to graphics mode and set color */
X   grgra();
X   grcol();
X   grwid();
X
X   /* Load standard font */
X   plfontld(0);
X   plprec(0,0);
X   plstyl(0,&mk,&sp);
X   plpat(1,&inc,&del);
X
X   gphy(&phyxmi,&phyxma,&phyymi,&phyyma);
X   /* Set clip limits. */
X   sclp(phyxmi,phyxma,phyymi,phyyma);
X}
X
Xstatic PLINT orient, xwidth, ywidth;
Xstatic PLFLT xdpi, ydpi;
Xchar FileName[80];
X
Xvoid plsetup(xpmm,ypmm,xwid,ywid)
XPLINT xwid, ywid;
XPLFLT xpmm, ypmm;
X{
X   xdpi = xpmm;
X   ydpi = ypmm;
X   xwidth = xwid;
X   ywidth = ywid;
X   pagesetup = 1;
X}
X
Xvoid plselect(ori, file)
XPLINT ori;
Xchar *file;
X{
X   orient = ori;
X   strncpy(FileName,file,sizeof(FileName)-1);
X   FileName[sizeof(FileName)-1] = '\0';
X   select = 1;
X}
X
Xvoid grsetup()
X{
X   if(plDispatchTable[device-1].pl_setup)
X      (*plDispatchTable[device-1].pl_setup)(xdpi,ydpi,xwidth,ywidth);
X}
X
Xvoid grselect()
X{
X   if(plDispatchTable[device-1].pl_select)
X      (*plDispatchTable[device-1].pl_select)(orient, FileName);
X}
X
X/* Initializes the graphics device */
Xvoid grinit()
X{
X   if(plDispatchTable[device-1].pl_init)
X      (*plDispatchTable[device-1].pl_init)();
X}
X
X/* Clears the graphics screen */
Xvoid grclr()
X{
X   if(plDispatchTable[device-1].pl_clear)
X      (*plDispatchTable[device-1].pl_clear)();
X}
X
Xvoid grpage()
X{
X   if(select) {
X      grselect();
X      select = 0;
X   }
X   if(plDispatchTable[device-1].pl_page)
X      (*plDispatchTable[device-1].pl_page)();
X}
X
X/* Sets up the line colour to value in global variable "colour" */
Xvoid grcol()
X{
X   if(plDispatchTable[device-1].pl_color)
X      (*plDispatchTable[device-1].pl_color)(colour);
X}
X
Xvoid grwid()
X{
X   if(plDispatchTable[device-1].pl_width)
X      (*plDispatchTable[device-1].pl_width)(width);
X}
X
X/* Switches to graphics mode */
Xvoid grgra()
X{
X   if(plDispatchTable[device-1].pl_graph)
X      (*plDispatchTable[device-1].pl_graph)();
X
X   graphx = 1;
X}
X
X/* Draws a line from (x1,x2) to (x2,y2), used by genlin() */
Xvoid grline(x1,y1,x2,y2)
XPLINT x1,y1,x2,y2;
X{
X   if(plDispatchTable[device-1].pl_line)
X      (*plDispatchTable[device-1].pl_line)( x1,y1, x2,y2);
X}
X
X/* Switches to text mode */
Xvoid grtext()
X{
X   if(plDispatchTable[device-1].pl_text)
X      (*plDispatchTable[device-1].pl_text)();
X
X   graphx = 0;
X}
X
X/* Called by plend to tidy up graphics device */
Xvoid grtidy()
X{
X   if(plDispatchTable[device-1].pl_tidy)
X      (*plDispatchTable[device-1].pl_tidy)();
X}
X
END_OF_FILE
if test 3806 -ne `wc -c <'src/plstar.c'`; then
    echo shar: \"'src/plstar.c'\" unpacked with wrong size!
fi
# end of 'src/plstar.c'
fi
if test -f 'src/plstr.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plstr.c'\"
else
echo shar: Extracting \"'src/plstr.c'\" \(3667 characters\)
sed "s/^X//" >'src/plstr.c' <<'END_OF_FILE'
X/* Prints out a "string" at reference position with physical         */
X/* coordinates (refx,refy). The coordinates of the vectors defining  */
X/* the string are passed through the linear mapping defined by the   */
X/* 2 x 2 matrix xform() before being plotted.                        */
X/* The reference position is at the left-hand edge of the string. If */
X/* base = 1, it is aligned with the baseline of the string. If       */
X/* base = 0, it is aligned with the centre of the character box.     */
X
X/* Note, all calculations are done in terms of millimetres. These */
X/* are scaled as necessary before plotting the string on the page */
X
X#include "plplot.h"
X#include <math.h>
X
Xvoid plstr(base,xform,refx,refy,string)
XPLINT base, refx, refy;
Xchar *string;
XPLFLT *xform;
X{
X   short int *symbol;
X   SCHAR *xygrid;
X   PLINT ch, cx, cy, i, k, length, level, penup;
X   PLINT xbase, ybase, ydisp, lx, ly, style;
X   PLINT oline, uline;
X   PLFLT width, xorg, yorg, x, y, def, ht, dscale, scale;
X   PLFLT xscl, xoff, yscl, yoff;
X
X   width = 0.0;
X   oline = 0;
X   uline = 0;
X
X   gchr(&def,&ht);
X   dscale = 0.05*ht;
X   scale = dscale;
X   gmp(&xscl,&xoff,&yscl,&yoff);
X
X   /* Line style must be continuous */
X
X   gnms(&style);
X   snms(0);
X
X   pldeco(&symbol,&length,string);
X   xorg = 0.0;
X   yorg = 0.0;
X   level = 0;
X
X   for (i=0; i<length; i++)  {
X     ch = symbol[i];
X     if (ch == -1) {
X       level = level + 1;
X       yorg = yorg + 16.0 * scale;
X       scale = dscale * pow(0.75,(double)abs(level));
X     }
X     else if (ch == -2) {
X       level = level - 1;
X       scale = dscale * pow(0.75,(double)abs(level));
X       yorg = yorg - 16.0 * scale;
X     }
X     else if (ch == -3)
X       xorg = xorg - width * scale;
X     else if (ch == -4)
X       oline = !oline;
X     else if (ch == -5)
X       uline = !uline;
X     else  {
X       if (plcvec(ch,&xygrid)) {
X         xbase = xygrid[2];
X         width = xygrid[3] - xbase;
X         if (base == 0) {
X           ybase = 0;
X           ydisp = xygrid[0];
X         }
X         else  {
X           ybase = xygrid[0];
X           ydisp = 0;
X         }
X         k = 4;
X         penup = 1;
X         while(1) {
X           cx = xygrid[k++];
X           cy = xygrid[k++];
X           if(cx == 64 && cy == 64)
X              break;
X           if (cx == 64 && cy == 0)
X             penup = 1;
X           else {
X             x = xorg + (cx - xbase) * scale;
X             y = yorg + (cy - ybase) * scale;
X             lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
X             ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
X             if (penup != 0) {
X               movphy(lx,ly);
X               penup = 0;
X             }
X             else
X               draphy(lx,ly);
X           }
X         }
X
X         if (oline) {
X           x = xorg;
X           y = yorg + (30+ydisp)*scale;
X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
X           movphy(lx,ly);
X           x = xorg + width*scale;
X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
X           draphy(lx,ly);
X         }
X         if (uline) {
X           x = xorg;
X           y = yorg + (-5+ydisp)*scale;
X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
X           movphy(lx,ly);
X           x = xorg + width*scale;
X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
X           draphy(lx,ly);
X         }
X         xorg = xorg + width*scale;
X       }
X     }
X   }
X   snms(style);
X}
END_OF_FILE
if test 3667 -ne `wc -c <'src/plstr.c'`; then
    echo shar: \"'src/plstr.c'\" unpacked with wrong size!
fi
# end of 'src/plstr.c'
fi
if test -f 'src/plxybx.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'src/plxybx.c'\"
else
echo shar: Extracting \"'src/plxybx.c'\" \(4010 characters\)
sed "s/^X//" >'src/plxybx.c' <<'END_OF_FILE'
X/* This draws a sloping line from (wx1,wy1) to (wx2,wy2)             */
X/*  which represents an axis of a 3-d graph with data values from    */
X/*  "vmin" to "vmax". Depending on "opt", vertical ticks and/or      */
X/*  subticks are placed on the line at major tick interval "tick"    */
X/*  with "nsub" subticks between major ticks. If "tick" and/or       */
X/*  "nsub" is zero, automatic tick positions are computed            */
X
X/* B: Draw box boundary                                              */
X/* I: Inverts tick marks (i.e. drawn downwards)                      */
X/* L: Logarithmic axes, major ticks at decades, minor ticks at units */
X/* N: Write numeric label                                            */
X/* T: Draw major tick marks                                          */
X/* S: Draw minor tick marks                                          */
X/* U: Write label on line                                            */
X
X#include "plplot.h"
X#include <stdio.h>
X#include <math.h>
X
X#define  betw(c,a,b)  ((a <= c && c <= b) || (b <= c && c <= a))
X
Xstatic PLFLT xlog[8] =
X  {0.301030,0.477121,0.602060,0.698970,0.778151,0.845098,0.903090,0.954243};
X
Xvoid plxybx(opt,label,wx1,wy1,wx2,wy2,vmin,vmax,tick,nsub,nolast)
Xchar *opt, *label;
XPLFLT wx1, wy1, wx2, wy2, vmin, vmax, tick;
XPLINT nsub, nolast;
X{
X      static char string[40];
X      PLINT lb,li,ll,ln,ls,lt,lu;
X      PLINT major, minor, mode, prec;
X      PLINT i, i1, i2, i3, i4;
X      PLINT nsub1;
X      PLFLT xpmm, ypmm, defmaj, defmin, htmaj, htmin, tick1;
X      PLFLT pos, tn, tp, temp;
X      PLFLT dwx, dwy, lambda;
X
X      dwx = wx2 - wx1;
X      dwy = wy2 - wy1;
X
X/* Tick and subtick sizes in device coords */
X
X      gpixmm(&xpmm,&ypmm);
X      gmaj(&defmaj,&htmaj);
X      gmin(&defmin,&htmin);
X
X      major=max(round(htmaj*ypmm),1);
X      minor=max(round(htmin*ypmm),1);
X
X      tick1=tick;
X      nsub1=nsub;
X
X      lb=stsearch(opt,'b');
X      li=stsearch(opt,'i');
X      ll=stsearch(opt,'l');
X      ln=stsearch(opt,'n');
X      ls=stsearch(opt,'s');
X      lt=stsearch(opt,'t');
X      lu=stsearch(opt,'u');
X
X      if (lu) plxytx(wx1,wy1,wx2,wy2,(PLFLT)3.2,(PLFLT)0.5,(PLFLT)0.5,label);
X      if (!lb) return;
X
X      if (ll) tick1 = 1.0;
X      if (lt) pldtik(vmin,vmax,&tick1,&nsub1,&mode,&prec);
X
X      if (li) {
X        i1 = minor;
X        i2 = 0;
X        i3 = major;
X        i4 = 0;
X      }
X      else  {
X        i1 = 0;
X        i2 = minor;
X        i3 = 0;
X        i4 = major;
X      }
X
X/* Draw the line */
X
X      movwor(wx1,wy1);
X      if (lt) {
X        tp=tick1*floor(vmin/tick1);
Xlab2:
X        tn=tp+tick1;
X        if (ls) {
X          if (ll) {
X            for (i=0; i<=7; i++)  {
X              temp=tp+xlog[i];
X              if (betw(temp,vmin,vmax)) {
X                lambda = (temp-vmin)/(vmax-vmin);
X                plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i1,i2);
X              }
X            }
X          }
X          else  {
X            for(i=1; i <= nsub1-1; i++)  {
X              temp=tp+i*(tn-tp)/nsub1;
X              if (betw(temp,vmin,vmax)) {
X                lambda = (temp-vmin)/(vmax-vmin);
X                plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i1,i2);
X              }
X            }
X          }
X        }
X        temp=tn;
X        if (betw(temp,vmin,vmax)) {
X          lambda = (temp-vmin)/(vmax-vmin);
X          plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i3,i4);
X          tp=tn;
X          goto lab2;
X        }
X      }
X
X      drawor(wx2,wy2);
X
X/* Label the line */
X
X      if (ln && lt) {
X        tp=tick1*floor(vmin/tick1);
Xlab82:
X        tn=tp+tick1;
X        if (nolast && !betw(tn+tick1,vmin,vmax)) return;
X        if (betw(tn,vmin,vmax)) {
X          if (!ll)
X            plform(tn,mode,prec,string);
X          else
X            sprintf(string,"10#u%-d",round(tn));
X          pos=(tn-vmin)/(vmax-vmin);
X          if (ln) plxytx(wx1,wy1,wx2,wy2,(PLFLT)1.5,pos,(PLFLT)0.5,string);
X          tp=tn;
X          goto lab82;
X        }
X      }
X}
END_OF_FILE
if test 4010 -ne `wc -c <'src/plxybx.c'`; then
    echo shar: \"'src/plxybx.c'\" unpacked with wrong size!
fi
# end of 'src/plxybx.c'
fi
if test -f 'unix/tektronix.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/tektronix.c'\"
else
echo shar: Extracting \"'unix/tektronix.c'\" \(4130 characters\)
sed "s/^X//" >'unix/tektronix.c' <<'END_OF_FILE'
X#include "plplot.h"
X#include <stdio.h>
X#include <limits.h>
X
X/* This file contains the tektronix dependent routines for use with plplot. */
X
X#define TEKX   1023
X#define TEKY    779
X
X/* Define graphics control characters. */
X#define FF   12
X#define CAN  24
X#define ESC  27
X#define GS   29
X#define US   31
X
Xstatic FILE *OutFile;
Xstatic int select=0;
Xstatic int porient;
Xstatic char FileName[80];
X
Xvoid tektsetup(xdpi,ydpi,xwid,ywid)
XPLFLT xdpi, ydpi;
XPLINT xwid, ywid;
X{
X   /* ignore */
X}
X
Xvoid tekfsetup(xdpi,ydpi,xwid,ywid)
XPLFLT xdpi, ydpi;
XPLINT xwid, ywid;
X{
X}
X
Xvoid tektinit()
X{
X      smod(1);   /* an interactive device */
X      OutFile = stdout;
X      teksetup(0);
X}
X
Xvoid tekfinit()
X{
X      char response[80];
X      int ori;
X
X      smod(0);  /* not an interactive terminal */
X      if(!select) {
X         printf("Landscape or portrait orientation? (0 or 1): ");
X         fgets(response,sizeof(response),stdin);
X         if(sscanf(response,"%d",&ori) != 1)
X            ori = 0;   /* carriage return defaults to landscape */
X      }
X      
X      OutFile = NULL;
X      while(!OutFile) {
X         if(!select) {
X            printf("Enter graphics command storage file name. ");
X            fgets(response,sizeof(response),stdin);
X            if(sscanf(response,"%s",FileName) != 1)  {
X                printf("Invalid entry.n");
X                continue;
X            }
X         }
X         select =0;
X         if ((OutFile = fopen(FileName,"w")) == NULL) 
X             printf("Can't open %s.\n",FileName);
X      }
X      teksetup(ori);
X}
X
Xteksetup(portrait)
Xint portrait;
X{
X      /* set default pen color*/
X      scol(1);
X      porient = portrait;
X
X      if(!portrait) {
X         /* set device resolution in dots/mm */
X         setpxl(4.771*16,4.653*16);
X         /* set page size */
X         setphy(0,TEKX*16,0,TEKY*16);
X      }
X      else {
X         /* set device resolution in dots/mm */
X         setpxl(4.653*16,4.771*16);
X         /* set page size */
X         setphy(0,TEKY*16,0,TEKX*16);
X      }
X      fprintf(OutFile,"%c",GS);
X}
X
X/* Sets the tektronix to text mode */
Xvoid tektext()
X{
X    fprintf(OutFile,"%c",US);
X}
X
X/* Sets the tektronix to graphics mode */
Xvoid tekgraph()
X{
X    /* Nothing has to be done here */
X}
X
X/* Clears the tektronix screen */
Xvoid tektclear()
X{
X     putchar('\007');
X     fflush(stdout);
X     while(getchar() != '\n')
X        ;
X     fprintf(OutFile,"%c%c",ESC,FF);
X}
X
Xvoid tekfclear()
X{
X     fprintf(OutFile,"%c%c",ESC,FF);
X}
X
Xvoid tektselect(ori,file)
XPLINT ori;
Xchar *file;
X{
X}
X
Xvoid tekfselect(ori,file)
XPLINT ori;
Xchar *file;
X{
X   porient = ori;
X   strncpy(FileName,file,sizeof(FileName)-1);
X   FileName[sizeof(FileName)-1] = '\0';
X   select = 1;
X}
X
X/* Change color */
Xvoid tekcolor(colour)
XPLINT colour;
X{
X}
X
Xstatic PLINT xold, yold;
X
Xvoid tekpage()
X{
X   xold = -100000;
X   yold = -100000;
X}
X
X
X/* Change pen width */
Xvoid tekwidth(width)
XPLINT width;
X{
X}
X
X/* Draws a line in the current colour from (x1,y1) to (x2,y2) */
Xvoid tekline(x1a,y1a,x2a,y2a)
XPLINT x1a,y1a,x2a,y2a;
X{
X    int x1,y1,x2,y2,hy,ly,hx,lx;
X
X    x1a >>= 4;
X    y1a >>= 4;
X    x2a >>= 4;
X    y2a >>= 4;
X
X    if(!porient) {
X       x1 = x1a;
X       y1 = y1a;
X       x2 = x2a;
X       y2 = y2a;
X    }
X    else {
X       x1 = TEKX - y1a;
X       y1 = x1a;
X       x2 = TEKX - y2a;
X       y2 = x2a;
X    }
X
X    /* If continuation of previous line just send new point */
X    if(x1 == xold && y1 == yold) {
X       hy = y2/32 + 32;
X       ly = y2 - (y2/32)*32 + 96;
X       hx = x2/32 + 32;
X       lx = x2 - (x2/32)*32 + 64;
X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
X    }
X    else {
X       fprintf(OutFile,"%c",GS);
X       hy = y1/32 + 32;
X       ly = y1 - (y1/32)*32 + 96;
X       hx = x1/32 + 32;
X       lx = x1 - (x1/32)*32 + 64;
X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
X       hy = y2/32 + 32;
X       ly = y2 - (y2/32)*32 + 96;
X       hx = x2/32 + 32;
X       lx = x2 - (x2/32)*32 + 64;
X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
X    }
X    xold = x2;
X    yold = y2;
X}
X
X/* Close file */
Xvoid tekftidy()
X{
X   fclose(OutFile);
X}
X
Xvoid tekttidy()
X{
X   tektclear();
X   fprintf(OutFile,"%c%c",US,CAN);
X   fflush(OutFile);
X}
X
END_OF_FILE
if test 4130 -ne `wc -c <'unix/tektronix.c'`; then
    echo shar: \"'unix/tektronix.c'\" unpacked with wrong size!
fi
# end of 'unix/tektronix.c'
fi
echo shar: End of archive 4 \(of 12\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
	amiga@cs.odu.edu	
or	amiga@xanth.cs.odu.edu	( obsolescent mailers may need this address )
or	...!uunet!xanth!amiga	( very obsolescent mailers need this address )

Comments, questions, and suggestions s should be addressed to ``amiga-request''
(only use ``amiga'' for submissions) at the above addresses.