.lm 10
.rm 72
a
.b 14
.c ;HGRAPH Documentation - January 30, 1984
.c ;Version 2.1
.b 2
.c ;Written by
.c ;H. L. McMaken
.b 1
.c ;Applied Mathematical Sciences
.c ;Ames Laboratory - USDOE
.c ;Iowa State University
.b 2
.c ;All rights (and wrongs) reserved
.b 5
The following documents the line drawing routines developed for use on
the LSI 11/23. These routines will work with either the Houston
Instruments DMP-3 or DMP-29 pen plotter (HIPLOT), the Grinnell Systems
GMR 271 image processing system (GRINNELL), or the Visual Products 550
(VISUAL). With minor modifications, it will work with any Tektronixs
4014 compatible graphics terminal.
.comment 

.pg
.c ;UPGRADES FROM VERSION 1.1
.b 2
The major upgrade of V2.1 from V1.1 is its ability to plot on either a
graphics terminal or a pen plotter by the choice of the unit number in
the call to INIPLT. This allows a user to write a program to
interactively edit his/her plot until it "looks right", then send the
edited graph directly to the plotter without relinking or rerunning
the program. This amounts to a tremendous savings in time when working
with a small system. To facilitate this editing process, several new
routines have been added to control a graphics cursor. These routines
will put the cursor at a given position, and read the location of the
cursor. Also, a set of routines have been added to generate legends
for the plots. These include legend writing routines which can be run
interactively for dynamic placement of the legends. All routines have
now been rewritten in FLECS for enhanced readability and modualarity.
.comment 

.pg
.NF
      TABLE OF CONTENTS
.b 3
I.    TERMINOLOGY  . . . . . . . . . . . . . . . . . .   1
.b 1
II.   GETTING STARTED  . . . . . . . . . . . . . . . .   2
.b 1
III.  INITIALIZING AND TERMINATING PLOTS . . . . . . .   4
        INIPLT 
        ENDPLT 
        DMPPLT 
.b 1
IV.   TWO DIMENSIONAL ROUTINES . . . . . . . . . . . .   6
        FRAME  
        WINDOW 
        SCALE  
        AXIS   
        DASHLN 
        LINE 
.b 1
V.    LEGEND WRITING ROUTINES  . . . . . . . . . . . .  12
        INILGN
        ENDLGN
        WRILGN
        CONLGN
        RECLGN
.b 1
VI.   AUXILIARY ROUTINES . . . . . . . . . . . . . . .  15
        MOVETO
        ISCRX 
        ISCRY 
        XWORLD
        YWORLD
        CURPOS
        DRWREC
        CIRCLE
        ERASE 
.b 1
VII.  CONTROLLING PROGRAM INPUT AND OUTPUT . . . . . .  17
        PLTOFF
        PLTON 
.b 1
.tp 5
VIII. CHARACTER READ AND WRITE ROUTINES  . . . . . . .  18
        PLTSTR
        WRTSTR
        REDSTR
        GETSTR
.b 1
.tp 5
IX.   CURSOR CONTROL ROUTINES  . . . . . . . . . . . .  19
        DEFWIN 
        FNDCUR
        PUTCUR
        CURSON
.b 1
.tp 5
X.    SUPPORT ROUTINES . . . . . . . . . . . . . . . .  20
        XAXIS  
        YAXIS 
        LABELX
        LABELY
        DRXTIC
        DRYTIC
        IFRMT 
        TRIML 
        TRIMSP
        ALLOUT
        FNDINT
        MOV1ST
        DRDASH
        VUPORT
        INSECT
.b 1
.tp 7
XI.   MISCELLANEOUS ROUTINES . . . . . . . . . . . . .  22
        PLOT  
        MARKER
        COLTYP
        PENDWN
        PENUP 
        WRITCH
.b 1
.tp 3
XII.  THREE DIMENSIONAL ROUTINES . . . . . . . . . . .  23
        PLOT3D
.b 1
XIII. RUNNING A PROGRAM  . . . . . . . . . . . . . . .  25
.b 1
XIV.  DISPLAYING A DISK PLOT FILE  . . . . . . . . . .  26
.b 1
.tp 5
      APPENDIX A - DEVICE INDEPENDENT ROUTINES
        ALLOUT . . . . . . . . . . . . . . . . . . . .  28
        AXIS   . . . . . . . . . . . . . . . . . . . .  29
        CURPOS . . . . . . . . . . . . . . . . . . . .  30
        DASHLN . . . . . . . . . . . . . . . . . . . .  31
        DRDASH . . . . . . . . . . . . . . . . . . . .  32
        DRWREC . . . . . . . . . . . . . . . . . . . .  34
        DRXTIC . . . . . . . . . . . . . . . . . . . .  35
        DRYTIC . . . . . . . . . . . . . . . . . . . .  36
        ENDLGN . . . . . . . . . . . . . . . . . . . .  37
        FNDINT . . . . . . . . . . . . . . . . . . . .  38
        FRAME  . . . . . . . . . . . . . . . . . . . .  39
        IFRMT  . . . . . . . . . . . . . . . . . . . .  40
        INILGN . . . . . . . . . . . . . . . . . . . .  41
        ISCRX  . . . . . . . . . . . . . . . . . . . .  42
        ISCRY  . . . . . . . . . . . . . . . . . . . .  43
        LABELX . . . . . . . . . . . . . . . . . . . .  44
        LABELY . . . . . . . . . . . . . . . . . . . .  45
        LINE   . . . . . . . . . . . . . . . . . . . .  46
        MOVETO . . . . . . . . . . . . . . . . . . . .  47
        MOV1ST . . . . . . . . . . . . . . . . . . . .  48
        PLTSTR . . . . . . . . . . . . . . . . . . . .  49
        RECLGN . . . . . . . . . . . . . . . . . . . .  50
        SCALE  . . . . . . . . . . . . . . . . . . . .  51
        TRIML  . . . . . . . . . . . . . . . . . . . .  52
        TRIMSP . . . . . . . . . . . . . . . . . . . .  53
        VUPORT . . . . . . . . . . . . . . . . . . . .  54
        WINDOW . . . . . . . . . . . . . . . . . . . .  55
        WRILGN . . . . . . . . . . . . . . . . . . . .  56
        XAXIS  . . . . . . . . . . . . . . . . . . . .  57
        XWORLD . . . . . . . . . . . . . . . . . . . .  58
        YAXIS  . . . . . . . . . . . . . . . . . . . .  59
        YWORLD . . . . . . . . . . . . . . . . . . . .  60
.b 1
.tp 5
      APPENDIX B - HIPLOT AND VISUAL ROUTINES
        CIRCLE . . . . . . . . . . . . . . . . . . . .  62
        COLTYP . . . . . . . . . . . . . . . . . . . .  63
        CONLGN . . . . . . . . . . . . . . . . . . . .  64
        CURSON . . . . . . . . . . . . . . . . . . . .  65
        DEFWIN . . . . . . . . . . . . . . . . . . . .  66
        DMPPLT . . . . . . . . . . . . . . . . . . . .  67
        ENDPLT . . . . . . . . . . . . . . . . . . . .  68
        ERASE  . . . . . . . . . . . . . . . . . . . .  69
        FNDCUR . . . . . . . . . . . . . . . . . . . .  70
        GETSTR . . . . . . . . . . . . . . . . . . . .  71
        INIPLT . . . . . . . . . . . . . . . . . . . .  72
        MARKER . . . . . . . . . . . . . . . . . . . .  74
        PENDWN . . . . . . . . . . . . . . . . . . . .  76
        PENUP  . . . . . . . . . . . . . . . . . . . .  77
        PLOT   . . . . . . . . . . . . . . . . . . . .  78
        PLTOFF . . . . . . . . . . . . . . . . . . . .  79
        PLTON  . . . . . . . . . . . . . . . . . . . .  80
        PUTCUR . . . . . . . . . . . . . . . . . . . .  81
        REDSTR . . . . . . . . . . . . . . . . . . . .  82
        WRITCH . . . . . . . . . . . . . . . . . . . .  83
        WRTSTR . . . . . . . . . . . . . . . . . . . .  84
.b 1
.tp 5
      APPENDIX C - GRINNELL ROUTINES
        CIRCLE . . . . . . . . . . . . . . . . . . . .  87
        COLTYP . . . . . . . . . . . . . . . . . . . .  88
        DMPPLT . . . . . . . . . . . . . . . . . . . .  89
        ENDPLT . . . . . . . . . . . . . . . . . . . .  90
        ERASE  . . . . . . . . . . . . . . . . . . . .  91
        INIPLT . . . . . . . . . . . . . . . . . . . .  92
        MARKER . . . . . . . . . . . . . . . . . . . .  93
        PLOT   . . . . . . . . . . . . . . . . . . . .  94
        PLTOFF . . . . . . . . . . . . . . . . . . . .  95
        PLTON  . . . . . . . . . . . . . . . . . . . .  96
        WRTSTR . . . . . . . . . . . . . . . . . . . .  97
.b 1
      APPENDIX D - QUICK REFERENCE GUIDE . . . . . . . 101
.b 1
      INDEX  . . . . . . . . . . . . . . . . . . . . . 103
.b 1
      LIST OF FIGURES
        PLOTTING DIAGRAM . . . . . . . . . . . . . . .   1
        SIMPLE 2D PLOT . . . . . . . . . . . . . . . .   2
        MULTIPLE FRAME PLOT  . . . . . . . . . . . . .  11
        PLOT WITH LEGEND . . . . . . . . . . . . . . .  13
        3D PLOTS . . . . . . . . . . . . . . . . . . .  24

.comment 

.pg
.nm 0
.f
.c ;I. TERMINOLOGY
.b 2
In order to understand many of the routines included in this document,
one must understand the terminology that is used. The reader will
encounter such phrases as "screen coordinates", "world coordinates",
"nominal inches", "plotting frame", "plotting window", and "plotting
page". To understand these, consider the following diagram:
.COMMENT INCLUDE FIGURE 1
.b 24
The plotting window 
.x plotting window
contains the data to be plotted (the dashed line in the above). This
data is "clipped" so that it will only appear inside the plotting
window. The plotting frame 
.x plotting frame
is a region outside of which no plotting may take place. The plotting
window and the labels for the plotting window are contained within the
plotting frame. The plotting window is defined relative to the lower
left hand corner of the plotting frame. The plotting page 
.x plotting page
is the maximum allowable plotting area. It is dependent on the
device used. For the HIPLOT it is 10.25 by 7.25 units, for the
GRINNELL it is 10.22 by 10.22 units, and for the VISUAL it is
10.24 by 7.8 units. These units are expressed in "nominal inches". 
.x nominal inch
On the HIPLOT these are actual inches. Nominal inches provide a
global coordinate 
.x coordinates, global
system independent of the given device. World coordinates 
.x coordinates, world
are the coordinates associated with the data to be plotted. Screen
coordinates 
.x coordinates, screen
are the coordinates used internally by the plotting device. 
.comment 

.pg
.c ;II. GETTING STARTED.
.b 2 
For the casual user, there are several higher level routines which
should be of interest. These are divided into four catagories:
initializing and terminating plots, two dimensional plots, three
dimensional plots, and writing legends. For more advanced users,
additional categories entitled Auxiliary Routines, Controlling Program
Input and Output, Character Read and Write Routines, and Cursor
Control Routines are included. 
.b 1
To get started, consider the following simple example program. It
first generates the data to be plotted into the x and y arrays. The
next five statements initialize the plotting device and plotting
routines, plot the data, and terminate the plot. These five routines are
in general the only routines one needs to use to create a
two-dimensional plot. A brief description of each routine follows. A
more detailed description follows in subsequent sections.
.B 1
.x examples
.X INIPLT
.X SCALE
.X AXIS
.X LINE
.X ENDPLT
.LIT
      DIMENSION X(41), Y(41)
C
      DO 10 I = 1, 41
      X(I) = .05 * ( I - 1 )
      Y(I) = SIN( 3.141592654 * X(I) )
10    CONTINUE
C
      CALL INIPLT( 99, 10., 7. )
      CALL SCALE( 0., 2., -1., 1. )
      CALL AXIS( .5, .5, 'x', 1, 2, 1, 'sin', 3, 2, 1 )
      CALL LINE( X, Y, 41, 0, 0, 0, 0 )
      CALL ENDPLT
C
      END
.ELI
.B 1
The above produces the following plot.
.COMMENT INCLUDE FIGURE 2
.pg
Subroutine INIPLT
.x INIPLT
initializes the plotting device and plotting routines. The arguments
indicate that the data is to be written to FTN99.DAT, and that the
plotting page is 10 by 7 nominal inches. It defines by default the 
plotting window. (This default plotting window may be changed by a
call to WINDOW). The plotting window defined by INIPLT is 6 by 4.2
nominal inches starting at location (2.,1.4). Subroutine SCALE
.x SCALE
sets up the correspondence between the world coordinates and the
screen coordinates. For this program, the horizontal axis runs from 0
units to 2 units, while the vertical axis runs from -1 units to +1
units. Subroutine AXIS
.x AXIS
draws a box around the plotting window, draws tick marks every .5
units on the horizontal and vertical axes, and labels these tick
marks. It centers a lower case 'x' under the horizontal axis, and a
lower case 'sin' to the left of the vertical axis. Subroutine LINE
.X LINE
connects the points to be plotted by line segments. Subroutine ENDPLT
.x ENDPLT
terminates the plot.
.comment 

.pg
.c ;III. INITIALIZING AND TERMINATING PLOTS.
.X initializing plots
.X terminating plots
.b 2
The following statements initialize and terminate plotting:
.b 1
.lit
SUBROUTINE INIPLT
SUBROUTINE DMPPLT
SUBROUTINE ENDPLT
.eli
.b 1
To start the plot, the user must first initialize the plotting
routines. This requires that the following statement be
executed PRIOR to calling any other plotting routine:
.b 1
SUBROUTINE INIPLT( iunit, xsize, ysize )
.x INIPLT
.b 1
This routine initializes the plot. The variables xsize and
ysize denote the size of the plotting page in nominal 
inches. For the HIPLOT
.X HIPLOT
.x xsize
.x ysize
, this is the size of the paper. HIPLOT has a
.X HIPLOT
maximum length of 10.25 inches and a height of 7.25 inches.
Setting xsize larger than 10.25, or ysize larger than 7.25 may
cause the limit switches to be activated during the plot. This
will cause unpredictable results. No plotting is permitted
outside this area. The
maximum size of the plot on the GRINNELL
.X GRINNELL
 is 10.22 by 10.22. The
maximum size of the plot on the VISUAL
.X VISUAL
 is 10.24 by 7.8. For compatability between devices, bounds within the
common intersection should be chosen. 
.b 1
.x iunit
The variable iunit is the logical unit number selected to contain the
plot commands. When plotting on the GRINNELL 
.X GRINNELL
the variable iunit is ignored. When plotting on either the HIPLOT
or the VISUAL, 
.X HIPLOT
.X VISUAL
setting iunit equal to 7 or 8 sends the plot immediately to the
terminal. When iunit equals 7, graphic commands for the VISUAL are
sent. When iunit equals 8, INIPLT enables the printer port on the
terminal and DM/PL IV plotting commands for the HIPLOT are sent.
Use iunit equal to 8 if your plotter is attached to your printer port.
Setting iunit equal to 9 sends the plot to the queued plotting device.
For iunit equal to 10 to 99, a disk file with name FTNnn.DAT, nn equal
to 10 to 99 is generated. The disk file will contain DM/PL IV plotter
commands for the HIPLOT. It is hoped that at a later date either
an interpreter for DM/PL into VISUAL graphics commands will be
written, or a suitable metafile structure will be implemented. At
present there is no transparent way of generating a disk file of
VISUAL graphics commands (it can however be done).
.b 1
.tp 8
To dump the buffer so that the entire plot may be seen, use the
following routine:
.b 1
SUBROUTINE DMPPLT
.x DMPPLT
.b 1
Subroutine DMPPLT is useful for maintaining synchronized I/O for
.X DMPPLT
interactive plotting, without the hassle of recalling INIPLT and
ENDPLT.
.x INIPLT
.x ENDPLT
.b 1
To terminate a plot, use the following routine:
.b 1
SUBROUTINE ENDPLT
.x ENDPLT
.b 1
This routine terminates the plotting. It must be the last plotting
routine called if the entire plot file is to be viewed. No other
plotting routine may follow without first calling INIPLT. ENDPLT will
disable the printer port when appropriate and close the disk file.
.x INIPLT
.comment 

.pg
.C ;IV. TWO DIMENSIONAL PLOTS.
.b 2
For two dimensional plots the following routines should be used.
.b 1
.lit
SUBROUTINE FRAME
SUBROUTINE WINDOW
SUBROUTINE SCALE
SUBROUTINE AXIS
SUBROUTINE DASHLN
SUBROUTINE LINE
.eli
.b 1
These are described below. 
.b 1
SUBROUTINE FRAME( xminf, xmaxf, yminf, ymaxf )
.X FRAME
.x xminf
.x xmaxf
.x yminf
.x ymaxf
.b 1
This routine allows the user to select the plotting frame. No plotting
may take place outside of this region. Subroutine FRAME maps the
origin into the point (xminf,yminf). This routine is useful when
producing multiple plots on a single page. In this case one would like
to make sure that parts of one plot do not overwrite parts of other
plots. By specifying limits, one can control where plotting can take
place. The variables xminf and xmaxf are the minimum and maximum
horizontal dimensions in inches of the allowable plotting area, and
the variables yminf and ymaxf are the minimum and maximum vertical
dimensions. Subroutine FRAME need not be called unless desired.
However, the first call to FRAME must follow INIPLT and preceed calls
.X FRAME
.x INIPLT
.X WINDOW
.X SCALE
to WINDOW and SCALE. Subsequent calls to subroutine FRAME will
automatically update the transformation from world to screen
coordinates using the arguments of the last call to WINDOW and SCALE.
The position of the plotting window will be in the same place relative
to the point (xminf,yminf) as the previous plot. If FRAME is not
called, the origin is taken to be the lower left hand corner of the
plotting page, and the plotting frame is taken to be the plotting page.
.b 1
SUBROUTINE WINDOW( xwin0, xwin1, ywin0, ywin1 )
.X WINDOW
.x xwin0
.x xwin1
.x ywin0
.x ywin1
.b 1
This routine sets up the dimensions of the plotting window. The
variables xwin0, xwin1, ywin0, and ywin1 are the bounds in inches
of this window. The values xwin0, xwin1, ywin0 and ywin1 are given
relative to the last call to FRAME. The default values for xwin0 and
ywin0 are 20% of their respective page size, and the default values for
xwin1 and ywin1 are 80% of their respective page size.
.b 1
SUBROUTINE SCALE( xmin, xmax, ymin, ymax )
.X SCALE
.x xmin
.x xmax
.x ymin
.x ymax
.b 1
This routine sets up the correspondence between the world coordinates and
the screen coordinates. World coordinates are the coordinates
associated with the data to be plotted. Screen coordinates are the
coordinates use by the plotting device. The variables xmin and xmax
represent respectively, the minimum and maximum x-values to be plotted. The
variables ymin and ymax represent respectively, the minimum and maximum
y-values to be plotted. The point (xmin,ymin) will be plotted at
(xwin0,ywin0). The point (xmax,ymax) will be plotted at (xwin1,ywin1).
Values falling outside this range will be clipped. The default
values for (xmin,ymin) and (xmax,ymax) are (0,0) and (1,1),
respectively. A call to SCALE is not needed after a call to WINDOW.
.X SCALE
.X WINDOW
This feature is useful for multiple plots in which the scaling of
the x and y axes do not change. To draw a second plot on the same
page (or screen) the user need only issue a call to WINDOW to move
the plotting window. This will adjust the coordinate transformation
between world and screen coordinates so that the previous values
supplied by SCALE are now plotted at the positions indicated by the
arguments of the call to WINDOW. Note, however, that merely changing 
WINDOW will not guarantee that one plot will not overwrite another
plot. To insure this, the user should use FRAME.
.X SCALE
.X WINDOW
.b 1
.lit
SUBROUTINE AXIS( xtic, ytic, ixtit, ixlen, ixsiz, ixfmt, 
                             iytit, iylen, iysiz, iyfmt )
.eli
.X AXIS
.b 1 
This routine draws the axes for two dimensional plots. The variables
xtic and ytic are the distances in world coordinates between tick
marks on the x and y axes. If xtic or ytic is zero, no tic marks are
drawn on that axis. 
.x xtic
.x ytic
.x ixtit
.x ixlen
.x ixsiz
The variable ixtit is the label for the x-axis.
The variable ixlen is the number of characters in ixtit. The variable
ixsiz is the size (value between 1 and 5) of the x label. For the
HIPLOT
.X HIPLOT
the following sizes are available:
.lm +5
.nf
.b 1
For ixsiz = 1 the characters are 0.105 inch high.
For ixsiz = 2 the characters are 0.140 inch high.
For ixsiz = 3 the characters are 0.210 inch high. 
For ixsiz = 4 the characters are 0.280 inch high.
For ixsiz = 5 the characters are 0.420 inch high. 
.b 1
.tp 7
.lm -5
For the VISUAL the following sizes are available:
.X VISUAL
.lm +5
.b 1
For ixsiz = 1 the characters are 0.093 inch high.
For ixsiz = 2 the characters are 0.147 inch high.
For ixsiz = 3 the characters are 0.187 inch high. 
For ixsiz = 4 the characters are 0.280 inch high.
For ixsiz = 5 the characters are 0.373 inch high. 
.b 1
.tp 7
.lm -5
For the GRINNELL the following sizes are available:
.X GRINNELL
.lm +5
.b 1
For ixsiz = 1 the characters are 0.16 inch high.
For ixsiz = 2 the characters are 0.16 inch high.
For ixsiz = 3 the characters are 0.32 inch high. 
For ixsiz = 4 the characters are 0.32 inch high.
For ixsiz = 5 the characters are 0.32 inch high. 
.b 1
.lm -5
.f
If ixsiz is outside of this range, no labels are written. The variable
ixfmt defines the format of the values on the x-axis. For ixfmt = 0 to
3, the format is taken to be F9.ixfmt. For ixfmt = 4, the format is
G9.2. The variables iytit, iylen, iysiz and iyfmt are defined in a
corresponding way for the y-axis.
.x ixfmt
.x iyfmt
.x iytit
.x iylen
.x iysiz
.b 1
.tp 5
SUBROUTINE DASHLN( x, y, n, icol, isym, isize, inum, lintyp )
.b 1
This subroutine will draw dashed lines of a user controlled color
through the n world coordinate points (x,y). The variables x and y
are n-dimensional arrays. The variable isym is the symbol to be
plotted at the points. The value of isym must be between 0 and 5. 
.x isym
.b 1
.nf
.lm +5
For isym = 0 a plus sign is plotted.
For isym = 1 a cross is plotted.
For isym = 2 a square is plotted.
For isym = 3 a circle is plotted.
For isym = 4 a triangle is plotted
For isym = 5 an hourglass is plotted. 
.lm -5
.f
.b 1
The variable isize is the size of the symbol. The value of isize must
be between 1 and 5. The size of the symbol is shown below.
.x isize
.b 1
.nf
.lm +5
For isize = 1 the symbols are 0.06 inch high.
For isize = 2 the symbols are 0.08 inch high.
For isize = 3 the symbols are 0.12 inch high. 
For isize = 4 the symbols are 0.16 inch high.
For isize = 5 the symbols are 0.24 inch high. 
.lm -5
.f
.b 1
.x inum
A symbol is plotted every abs(inum) points. If inum is negative, only
symbols are plotted. If any of the following are out of range, only a
line is drawn: isym, isize, or inum. The variable icol determines the
color of the line. For the GRINNELL
.x icol
.X GRINNELL
the folowing colors are available:
.nf
.lm +5
.b 1
For icol = 0, a white line is drawn.
For icol = 1, a red line is drawn.
For icol = 2, a orange line is drawn.
For icol = 3, a yellow line is drawn.
For icol = 4, a green line is drawn.
For icol = 5, a blue line is drawn.
For icol = 6, a purple line is drawn.
.lm -5
.f
.b 1
.tp 11
For the HIPLOT
.x HIPLOT
the following association between icol and color is suggested:
.nf
.lm +5
.b 1
For icol = 0, a black line is drawn.
For icol = 1, a red line is drawn.
For icol = 2, a orange line is drawn.
For icol = 3, a lime-green line is drawn.
For icol = 4, a green line is drawn.
For icol = 5, a blue line is drawn.
For icol = 6, a lavender line is drawn.
For icol = 7, a brown line is drawn.
.lm -5
.b 1
The parameter lintyp controls the type of dashed line drawn. 
.x lintyp
.b 1
.lm +5
For lintyp = 0, a solid line is drawn.
For lintyp = 1, a dotted line is drawn.
For lintyp = 2 to 6, a dashed line of increasing 
                     dash length is drawn.
For lintyp = 7, a dash-dot line is drawn.
For lintyp = 8, a dash-dot-dot line is drawn. 
.lm -5
.f
.b 1
SUBROUTINE LINE( x, y, n, icol, isym, isize, inum )
.X LINE
.b 1
This routine draws a solid line through the n world coordinates, (x,y). 
The arguments of LINE are the same as described above for DASHLN, and
is equivalent to calling DASHLN with lintyp = 0.
.X DASHLN
.b 2
The following details the relation between INIPLT, FRAME and WINDOW.
.X FRAME
.X WINDOW
.x INIPLT
.b 1
Subroutine INIPLT sets up the maximum size of the plot (plotting
page). This is either
.x INIPLT
the physical size of the paper for the HIPLOT
.X HIPLOT
(i.e., 10.25 x 7.25 inches), the size of the GRINNELL
.X GRINNELL
screen (i.e., 10.22 x 10.22 nominal inches) or the size of the VISUAL 
.x VISUAL
screen (i.e., 10.24 x 7.8 nominal inches). Within this region you may
futher divide the plotting page by framing certain portions of it.
Within each plotting frame you can specify a plotting window. The
lines drawn as part of the plot of x and y coordinate pairs will be
contained within the plotting window. The labels for the axes will be
contained within the plotting frame. The plotting frame will be
contained within the plotting page (see the section on TERMINOLOGY).
As an example, the following program will divide the plotting page
into four separate regions in which a copy of a plot of sin(x) and
cos(x) from 0 to 6.28 is drawn. The plot produced by this program is
shown below.
.pg
.x examples
.X INIPLT
.X FRAME
.X WINDOW
.X SCALE
.X AXIS
.X DASHLN
.X ENDPLT
.lit
	DIMENSION X(41), S(41), C(41)
C
C	CALCULATE X AND Y VALUES
C
	DO 10 I = 1, 41
	X(I) = .157 * ( I - 1 )
	C(I) = COS( X(I) )
	S(I) = SIN( X(I) )
10	CONTINUE
C
C	SET PHYSICAL PAGE SIZE TO BE 10 X 7 INCHES
C
	CALL INIPLT( 99, 10., 7. )
C
C	SELECT LOWER LEFT HAND QUARTER AS PLOTTING FRAME
C
	CALL FRAME ( 0., 5., 0., 3.5 )
	CALL WINDOW( 1.5, 4.5, 1., 3. )
	CALL SCALE( 0., 6.28, -1., 1. )
	CALL AXIS ( 1., .5, 'x', 1, 2, 0, 'y(x)', 4, 2, 1 )
	CALL DASHLN ( X, C, 41, 0, 0, 0, 0, 1 )
	CALL DASHLN ( X, S, 41, 1, 0, 0, 0, 2 )
C
C	DRAW SECOND PLOT IN UPPER LEFT
C	NOTE THAT FRAME WILL AUTOMATICALLY ADJUST WINDOW AND SCALE
C	FOR YOU
C
	CALL FRAME ( 0., 5., 3.5, 7. )
	CALL AXIS ( 1., .5, 'x', 1, 2, 0, 'y(x)', 4, 2, 1 )
	CALL DASHLN ( X, C, 41, 2, 0, 0, 0, 3 )
	CALL DASHLN ( X, S, 41, 3, 0, 0, 0, 4 )
C
C	DRAW THIRD PLOT IN UPPER RIGHT
C
	CALL FRAME ( 5., 10., 3.5, 7. )
	CALL AXIS ( 1., .5, 'x', 1, 2, 0, 'y(x)', 4, 2, 1 )
	CALL DASHLN ( X, C, 41, 4, 0, 0, 0, 5 )
	CALL DASHLN ( X, S, 41, 5, 0, 0, 0, 6 )
C
C	DRAW FOURTH PLOT IN LOWER RIGHT
C
	CALL FRAME ( 5., 10., 0., 3.5 )
	CALL AXIS ( 1., .5, 'x', 1, 2, 0, 'y(x)', 4, 2, 1 )
	CALL DASHLN ( X, C, 41, 6, 0, 0, 0, 7 )
	CALL DASHLN ( X, S, 41, 6, 0, 0, 0, 8 )
C
C	TERMINATE PLOTTING
C
	CALL ENDPLT
C
	END
.eli
.pg
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
.COMMENT 

.pg
.c ;V. LEGEND WRITING ROUTINES
.X legend 
.B 2
It is often useful to label a graph so that a person can identify
which curve on the graph corresponds to which data set. In labeling
the graph, one would like to associate with each line type, symbol or
color a short phrase which describes what is meant by that particular
curve. Such a label is known as a legend. Legend writing is in general
good plotting practice. There are five routines which help the user to
construct legends. These are:
.b 1
.LIT
SUBROUTINE INILGN
SUBROUTINE ENDLGN
SUBROUTINE WRILGN
SUBROUTINE CONLGN
SUBROUTINE RECLGN
.ELI
.b 1
SUBROUTINE INILGN( xminl, xmaxl, yminl, ymaxl )
.X INILGN
.b 1
This routine initializes the legend writing routines. It should be the
first routine called before attempting to write a legend. It saves all
current plotting parameters and defines a legend frame whose lower
left corner is given by (xminl,yminl) and whose upper right corner is
given by (xmaxl,ymaxl). The parameters xminl, xmaxl, yminl, and ymaxl are
given in nominal inches.
.b 1
SUBROUTINE ENDLGN
.X ENDLGN
.b 1
This routine terminates the legend writing routines. It restores all
plotting parameters to their previous values. This should be the last
legend routine called.
.b 1
SUBROUTINE WRILGN( title, n, icol, isym, inum, lintyp )
.X WRILGN
.b 1
This routine writes the legend. The argument title is a string of
characters of length n which is a description of the curve defined by
the parameters icol, isym, inum and lintyp. These latter parameters
have the same meaning as they do with DASHLN. 
.x DASHLN
The parameter icol defines the color of the line, isym is the symbol
to be plotted, lintyp is the type of line to be plotted and inum
determines whether a line is drawn connecting the symbols. When inum
is positive, both the line and the symbols are drawn. The symbols are
placed at the beginning and the end of the line. When inum is
negative, a single symbol is drawn at the right endpoint. In either
case, the description is placed directly to the right of the right
endpoint. Multiple calls to WRILGN will produce legends directly
beneath each other.
.b 1
The following program demonstrates the above routines.
.b 1
.tp 35
.x examples
.X INIPLT
.X WINDOW
.X SCALE
.X AXIS
.X DASHLN
.X ENDPLT
.X INILGN
.X WRILGN
.X ENDLGN
.LIT
      DIMENSION X(21), Y1(21), Y2(21), Y3(21)
C
C     GENERATE DATA
C
      PI = 4 * ATAN(1.)
      DO 10 I = 1, 21
      X(I) = .05 * ( I - 1 )
      Y1(I) = SIN( PI * X(I) )
      Y2(I) = SIN( 2 * PI * X(I) )
      Y3(I) = SIN( 3 * PI * X(I) )
10    CONTINUE
C
C     DRAW GRAPH
C
      CALL INIPLT( 99, 10., 7. )
      CALL WINDOW( 2., 8., 1., 5. )
      CALL SCALE( 0., 1., -1., 1. )
      CALL AXIS( .5, .5, 'X', 1, 2, 1, 'Y', 1, 2, 1 )
      CALL DASHLN( X, Y1, 21, 0, 0, 0, 0, 8 )
      CALL DASHLN( X, Y2, 21, 0, 3, 3, 5, 0 )
      CALL DASHLN( X, Y3, 21, 0, 5, 3, -1, 0 )
C
C     CONSTRUCT LEGEND
C
      CALL INILGN( 2., 6., 5., 7. )
      CALL WRILGN( 'sin(pi x)', 9, 0, 0, 0, 8 )
      CALL WRILGN( 'sin(2 pi x)', 11, 0, 3, 5, 0 )
      CALL WRILGN( 'sin(3 pi x)', 11, 0, 5, -1, 0 )
      CALL ENDLGN
C
C     TERMINATE PLOTTING
C
      CALL ENDPLT
C
      END
.ELI
.pg
It is often difficult to know beforehand where one would like to
place the legend. To help the user in this process two legend writing
routines have been written to interactively control legend writing.
These are
.b 1
.lit
SUBROUTINE CONLGN( nl, title, n, icol, isym, inum, lintyp,
                                       xstrt, xlen, ystrt )
SUBROUTINE RECLGN( nl, title, n, icol, isym, inum, lintyp,
                                       xstrt, xlen, ystrt )
.eli
.b 1
.X CONLGN
.X RECLGN
The routine CONLGN constructs the legend interactively on a graphics
terminal, and the routine RECLGN reconstructs the legend for any
plotting device. These routines were developed to be used with the
HIPLOT and VISUAL routines.
.X HIPLOT
.X VISUAL
The argument nl is the number of curves to be labeled. The argument
title is a byte array of user defined length. It should be of
sufficient length to contain all the labels for all the legends. The
routine CONLGN will read into title the label typed on the screen. If
more than one label is typed, the beginning of the next label will be
placed in the storage location immediately following the last label.
The routine RECLGN will write title onto the plotting device defined
by iunit. (See the section on Initializing and Terminating Plots). The
argument n is an array of dimension nl containing the length of the
label. The arguments icol, isym, inum and lintyp are arrays of
dimension nl defining the curves to be labeled. The arguments xstrt,
xlen, ystrt are real arrays of dimension nl, defining the starting
location of each sample curve and its length. These arguments are set
by CONLGN and used in RECLGN. They should not be modified by the user.
When CONLGN is called it first turns on the cursor. The user may then
position the cursor to the desired starting location of the first
legend. The user then transmits the location of the cursor to the
program by striking the appropriate key (such as the ENTER key on the
VISUAL). The user will then move the cursor to a second location
horizontally and then transmit the cursor location. If the second
position is to the right of the first position, a line of that length
is drawn. The type of line drawn is defined by the parameters of the
argument list. If the second position is to the left of the first
position, a line is drawn starting from the first position using the
last defined length, thereby allowing the user to start a second column
of legends of the same length as the first column. In either case, the
user may then type in the text used to describe that particular curve.
To construct subsequent legends directly beneath the current legend,
transmit the cursor location without moving the cursor. When you have
labeled your last curve, control will return to the calling routine.
The argument list will contain all the information necessary for
RECLGN to reconstruct the legend exactly as displayed on the graphics
screen.
.comment 

.pg
.C ;VI. AUXILIARY ROUTINES.
.b 2
The following routines allow the user to construct his/her own
specialized plotting routines by gaining access to lower level
routines with a minimum of overhead.
.b 1
.lit
SUBROUTINE MOVETO
FUNCTION ISCRX
FUNCTION ISCRY
FUNCTION XWORLD
FUNCTION YWORLD
SUBROUTINE CURPOS
SUBROUTINE DRWREC
SUBROUTINE CIRCLE
SUBROUTINE ERASE
.eli
.b 1
These are described below.
.b 1
SUBROUTINE MOVETO( xwrld, ywrld, iud, lintyp )
.X MOVETO
.b 1
Subroutine MOVETO will move from the current cursor position to the
world coordinate (xwrld,ywrld) only if it is inside the plotting window.
Otherwise it will move to the intersection of the line segment with
the plotting window. MOVETO will draw a line only when iud is equal to
one. The type of line drawn is determined by lintyp as described in
DASHLN.
.x DASHLN
.b 1
FUNCTION ISCRX( xwrld )
.x ISCRX
.b 1
Function ISCRX converts the x world coordinate into the x screen
coordinate.
.b 1
FUNCTION ISCRY( ywrld )
.x ISCRY
.b 1
Function ISCRY converts the y world coordinate into the y screen
coordinate.
.b 1
FUNCTION XWORLD( ix )
.x XWORLD
.b 1
Function XWORLD converts the x screen coordinate to the x world
coordinate. It is the inverse of ISCRX.
.b 1
FUNCTION YWORLD( iy )
.x YWORLD
.b 1
Function YWORLD converts the y screen coordinate to the y world
coordinate. It is the inverse of ISCRY.
.b 1
.tp 4
SUBROUTINE CURPOS( icurx, icury )
.x CURPOS
.b 1
Subroutine CURPOS returns the current screen coordinates in icurx
and icury.
.b 1
.tp 4
SUBROUTINE DRWREC( xmin, xmax, ymin, ymax, icol )
.X DRWREC
.b 1
Subroutine DRWREC draws a rectangle of color icol, bounded by the
world coordinates xmin, xmax, ymin and ymax.
.b 1
.tp 4
SUBROUTINE CIRCLE( ix, iy, ir )
.X CIRCLE
.b 1
Subroutine CIRCLE draws a circle of radius ir with center at (ix,iy).
The arguments are all in screen coordinates.
.b 1
.tp 4
SUBROUTINE ERASE
.X ERASE
.b 1
Subroutine ERASE has been added to the software package in order to
erase the GRINNELL
.X GRINNELL
 or VISUAL
.X VISUAL
screen without reissuing a call to
INIPLT. This has the advantage of not resetting all of the internal
.x INIPLT
.X WINDOW
.X SCALE
saved parameters generated by calls to WINDOW, SCALE, etc.. This
routine has no effect for plots on the HIPLOT.
.X HIPLOT
.comment 

.pg
.c ;VII. CONTROLLING PROGRAM INPUT AND OUTPUT
.b 2
The user should employ the following routines to control program input
and output so that it does not interfere with plotting.
.b 1
SUBROUTINE PLTOFF
.X PLTOFF
.b 1
Subroutine PLTOFF will disable the printer port when plotting on the
HIPLOT, or will enable the alphanumerics screen on the VISUAL. 
.X HIPLOT
.X VISUAL
When used with PLTON, it allows the user to enter data to the
program while it is plotting data. Innocently typing in data while the 
printer port is enabled can cause erratic behavior on the HIPLOT.
.X HIPLOT
A similar transgression on the VISUAL 
.X VISUAL
results in overwriting the plot.
.B 1
SUBROUTINE PLTON
.X PLTON
.b 1
Subroutine PLTON will enable the printer port when plotting on the
HIPLOT, or will enable the alphagraphics screen on the VISUAL. 
.X HIPLOT
.X VISUAL
.comment 

.pg
.c ;VIII. CHARACTER READ AND WRITE ROUTINES
.B 2
The following routines control reading and writing of character
strings for plots.
.b 1
.lit
SUBROUTINE PLTSTR
SUBROUTINE WRTSTR
SUBROUTINE REDSTR
SUBROUTINE GETSTR
.eli
.b 1
These are described below.
.b 1
SUBROUTINE PLTSTR( ix, iy, str, len, irot, isize )
.X PLTSTR
.b 1
Subroutine PLTSTR will write an alphanumeric string 'str' of length
'len' at screen location given by (ix,iy). The height of the string is
determined by isize (see AXIS 
.X AXIS
for the relevant sizes of the characters). The argument irot
determines the rotation of the string. For irot = 1 the string is
written right side up, for irot = 2 the string is rotated clockwise
through 90 degrees, for irot = 3 the string is rotated 180 degrees,
and for irot = 4 the string is rotated through 270 degress. Subroutine
PLTSTR calls WRTSTR.
.b 1
SUBROUTINE WRTSTR( str, len, irot, isize )
.X WRTSTR
.b 1
This routine writes a string at the current location. The arguments of
WRTSTR are the same as the corresponding arguments for PLTSTR.
.b 1
SUBROUTINE REDSTR( ix, iy, str, len, irot, isize )
.X REDSTR
.b 1
This routine will read a string 'str' of length 'len' at screen location
given by (ix,iy). The height of the string is determined by isize,
and the rotation is determined by irot. REDSTR will read in both the
current cursor location as well as the character string. The arguments
irot and isize must be supplied, the rest of the arguments are
determined by REDSTR. After a call to REDSTR, the cursor will be
positioned at the begining of the current string one line below. The
effect is to mimic a carriage return and line feed. REDSTR calls GETSTR.
.b 1
SUBROUTINE GETSTR( ix, iy, str, len, irot, isize )
.X GETSTR
.B 1
This routine will read a string at screen location (ix,iy). The
arguments ix, iy, irot and isize are supplied to the routine, and str
and len are returned. The difference between GETSTR and REDSTR is that
REDSTR allows you to position the cursor to the desired starting of
the string, while GETSTR does not.
.comment 

.pg
.c ;IX. CURSOR CONTROL ROUTINES
.x cursor
.B 2
.lit
SUBROUTINE DEFWIN
SUBROUTINE FNDCUR
SUBROUTINE PUTCUR
SUBROUTINE CURSON
.eli
.b 1
The ability to control the position of the cursor, and to transmit
this information to a running program is of great help in
interactively constructing a graph. By cursor it is meant the full
screen crosshair cursor on the VISUAL, not the underscore cursor of
the alphagraphics screen. The following routines are the lowest level
routines which interface with the cursor. When the cursor is turned
on, its position may be controlled by the small arrows on the numeric
keypad. To transmit the current screen coordinate, the user should
press the ENTER key located next to the numeric keypad. No other key
will transmit the cursor location. Familiarity with the cursor
positioning keys is essential to properly use the following routines. 
.b 1
SUBROUTINE DEFWIN( xmin, xmax, ymin, ymax )
.x DEFWIN
.b 1
Subroutine DEFWIN defines a window interactively on a graphics screen.
The arguments xmin, xmax, ymin, and ymax are the bounds in inches of
this window. DEFWIN uses the cursor to position these bounds. DEFWIN
can be used to interactively control the plotting page, plotting
frame, plotting window or legend window.
.b 1
SUBROUTINE FNDCUR( ix, iy )
.X FNDCUR
.b 1
This routine reads in the current cursor location. It turns on
the cursor, allows the user to position the cursor, then accepts the
current location when transmitted. The arguments ix and iy are the
screen coordinates of the cursor location.
.b 1
SUBROUTINE PUTCUR( ix, iy )
.X PUTCUR
.b 1
This routine puts the cursor at the screen location given by (ix,iy).
It does not turn the cursor on.
.b 1
SUBROUTINE CURSON
.X CURSON
.b 1
This routine turns the cursor on.
.comment 

.pg
.C ;X. SUPPORT ROUTINES
.B 2
The following routines are used by AXIS and MOVETO to perform 
specialized fuctions. They are supplied to the user so that he/she may
make modifications to perform nonstandard plotting. For instance, a
minor modification in LABELY can convert the y-axis into log(y)-axis,
so that the user can have a log plot. A similar modification to LABELX
will create a log-log plot. Once you have made the change, linking
with this new routine will replace the default routine. These routines
are:
.b 1
.lit
SUBROUTINE XAXIS
SUBROUTINE YAXIS
SUBROUTINE LABELX
SUBROUTINE LABELY
SUBROUTINE DRXTIC
SUBROUTINE DRYTIC
FUNCTION IFRMT
SUBROUTINE TRIML
SUBROUTINE TRIMSP
SUBROUTINE ALLOUT
SUBROUTINE FNDINT
SUBROUTINE MOV1ST
SUBROUTINE DRDASH
SUBROUTINE INSECT
.eli
.b 1
The following nine routines are used by AXIS. Many of the arguments
have the same meaning as in the call to AXIS.
.x AXIS
.b 1
.lit
SUBROUTINE XAXIS( xtic, ixtit, ixlen, ixsiz, ixfmt )
SUBROUTINE YAXIS( ytic, iytit, iylen, iysiz, iyfmt )
.eli
.X XAXIS
.X YAXIS
.b 1
These routines construct the x and y axes. 
.b 1
.lit
SUBROUTINE LABELX( xval, form, iform, is, iy, ichw, ixsiz )
SUBROUTINE LABELY( yval, form, iform, is, iy, ichw, iysiz )
.eli
.X LABELX
.X LABELY
.b 1
These routines label a tic mark at the location (is,iy). The
variables xval and yval are the values to be written at that tic mark.
The argument ichw is the width of a character.
.b 1
.lit
SUBROUTINE DRXTIC( ix, iy, lentic )
SUBROUTINE DRYTIC( ix, iy, lentic )
.eli
.X DRYTIC
.X DRXTIC
.b 1
These routines draw a tic mark of length lentic at screen location 
(ix,iy).
.b 1
FUNCTION IFRMT( form, ifmt )
.X IFRMT
.b 1
This routine determines the format corresponding to the format number
ifmt.
.b 1
SUBROUTINE TRIML( label, n, len )
.x TRIML
.b 1
This routine trims leading blanks from the string LABEL of length N. It 
returns in LEN the length of the trimmed string and in LABEL the string
left justified with all blanks removed.
.b 1
SUBROUTINE TRIMSP( title, len, ist, iend )
.X TRIMSP
.b 1
This routine trims off both leading and trailing blanks for the
centering of axis labels. The argument ist is the first nonblank
character of title, and iend is the last nonblank character. 
.b 1
The following four routines are used in MOVETO.
.b 1
SUBROUTINE ALLOUT( ix, iy, iud )
.X ALLOUT
.b 1
This routine handles the case when both the previous data point and
the current data point are outside the plotting window.
.b 1
SUBROUTINE FNDINT( ix0, iy0, ix, iy )
.X FNDINT
.b 1
This routine finds the intersection with the plotting window when one
data point is outside the plotting window and one data point is inside
the plotting window. The arguments ix and iy may be reset by this
routine.
.b 1
SUBROUTINE MOV1ST( xwrld, ywrld, iud, lintyp )
.X MOV1ST
.b 1
Subroutine MOV1ST moves to the world coordinate (xwrld,ywrld). The
argument lintyp refers to the type of line to be initialized (see DASHLN 
.X DASHLN
for details on the types of lines available). 
.b 1
SUBROUTINE DRDASH( ix, iy, iud )
.X DRDASH
.b 1
This routine will draw a dashed line of the last defined line type
from the current position to the screen coordinate (ix,iy). 
.b 1
SUBROUTINE VUPORT( xmin, xmax, ymin, ymax )
.X VUPORT
.b 1
This routine is equivalent with SCALE.
.x SCALE
It is included for compatibility with version 1.1.
.b 1
SUBROUTINE INSECT( i1, j1, iplot, iplot0, x, y, nx, ny, l )
.x INSECT
.b 1
This routine computes the intersection point of a grid line which is
partially hidden. It is used by PLOT3D.
.x PLOT3D
.COMMENT 

.PG
.C ;XI. MISCELLANEOUS ROUTINES.
.b 2
The following lower level routines have been included for completness.
These routines should not be used unless absolutely needed, as their
function may change without notice.
.b 1
.lit
SUBROUTINE PLOT
SUBROUTINE MARKER
SUBROUTINE COLTYP
SUBROUTINE PENDWN
SUBROUTINE PENUP
SUBROUTINE WRITCH
.eli
.b 1
SUBROUTINE PLOT( ix, iy, iud )
.X PLOT
.b 1
This routine moves to the screen coordinates (ix,iy).
If iud=1, the pen is put down  before moving, otherwise
the pen is put up before moving. It checks to see if the point
is within the plotting page.
.b 1
SUBROUTINE MARKER( isym, isize )
.X MARKER
.b 1
This routine places a marker at the current position. For isym = 0
a plus sign is drawn, for isym = 1 a cross is drawn, for isym = 2
a square is drawn, for isym = 3 a circle is drawn, for isym = 4
a triangle is drawn, and for isym = 5 an hourglass is drawn.
.b 1
SUBROUTINE COLTYP( icol )
.x COLTYP
.b 1
This routine sets the line color. It is inoperative for the VISUAL and
the single pen HIPLOT.
.x VISUAL
.X HIPLOT
.b 1
SUBROUTINE PENDWN
.X PENDWN
.b 1
This routine puts the pen down so it will draw a visible 
line.  It is applicable only for HIPLOT and VISUAL.
.X VISUAL
.X HIPLOT
.b 1
SUBROUTINE PENUP
.X PENUP
.b 1
This routine puts the pen up so no line is drawn.
It is applicable only for HIPLOT and VISUAL.
.b 1
SUBROUTINE WRITCH( ch, n )
.X WRITCH
.B 1
This routine is used by the VISUAL and the HIPLOT to output characters
to either the terminal or a disk file. The argument ch is a byte array
of length n.
.comment 

.pg
.C ;XII. THREE DIMENSIONAL PLOTS.
.X three dimensional plots
.b 2
Three dimensional plots with hidden line removal are handled by the following
routine:
.b 1
SUBROUTINE PLOT3D( f,x,y,nx,ny,xw,yw,xv,yv,zv,line,scale )
.X PLOT3D
.b 1
The variable f is an nx by ny array containing the values of the
surface to be plotted. The variables x and y are also nx by ny
arrays. They are used internally by PLOT3D for storing the x and
y plot coordinates. The variables nx and ny are the dimensions of
the f, x, and y arrays. The variables xw and yw are the
dimensions of the plot in inches. The variables xv, yv and
zv are the location in inches of the point of observation
relative to the grid. The grid is xw by yw. The variable line
chooses which direction(s) the projected grid lines are drawn. If
line = 1, only lines in the x direction are drawn. If line = 2,
only lines in the y direction are drawn. For line = 0, lines are
drawn in both the x and y directions. The variable scale is a
scaling factor for the array f. For scale = 0, a suitable scaling
factor is chosen by PLOT3D. 
.b 1
A sample program is given below.
.b 1
.tp 25
.X examples
.X INIPLT
.X PLOT3D
.X ENDPLT
.lit
	DIMENSION F(21, 11), X(21, 11), Y(21, 11)
C
	PI = 3.141592654
	TYPE 2
	ACCEPT *, IUNIT
C
	CALL INIPLT(IUNIT, 10., 7.)
C
	DO 20 J = 1, 11
	     XX = .1 * (J - 1)
	     DO 10 I = 1, 21
		YY = .1 * (I - 1)
		F(I, J) = COS(PI * XX) * SIN(PI * YY)
10	     CONTINUE
20	CONTINUE
C
	TYPE 1
	ACCEPT *, LINE, XV, YV, ZV
C
	CALL PLOT3D(F,X,Y,21,11,10.,5.,XV,YV,ZV,LINE,0.)
	CALL ENDPLT
C
	STOP
1	FORMAT('$INPUT LINE, XV, YV, ZV? ')
2	FORMAT('$INPUT IUNIT? ')
	END
.eli
.pg
With line = 0, XV = 20, YV = 30 and ZV = 40, the above program
produces the following plot.
.b 1
With line = 0, XV = -10, YV = 30 and ZV = 40, the program produces
this plot.
.comment 

.pg
.C ;XIII. RUNNING A PROGRAM.
.X running a program
.b 2
.X HGRAPH
.X GRPLOT
.X GRLIB
.X HIX
.X VIX
.X GRX
To compile, link and run a program on the 11/23 which will plot on the HIPLOT,
.X HIPLOT
the GRINNELL
.X GRINNELL
or the VISUAL, 
.X VISUAL
the following sequence is used. For the HIPLOT or VISUAL
.X HIPLOT
.X VISUAL
 use, 
.b 1
.lm +5
.lit
FORT filespec
LINK filespec,SY:HGRAPH
RUN filespec
.eli
.lm -5
.b 1
or 
.b 1
.lm +5
HGR filespec
.lm -5
.b 1
For the GRINNELL
.X GRINNELL
use, 
.b 1
.lm +5
.lit
FORT filespec
LINK filespec,SY:GRPLOT,SY:GRLIB
RUN filespec
.eli
.lm -5
.b 1
or
.b 1
.lm +5
GRX filespec
.lm -5
.b 1
The file SY:HGRAPH is an object library containing the device
independent plotting routines and the routines for the HIPLOT and the
VISUAL. The file SY:GRPLOT is an object module containing the
device dependent plotting routines for the GRINNELL. SY:GRLIB is an
object library of routines for the GRINNELL. FLECS listings of the
routines contained in each of the object modules are located on the
system disk as SY:name.FLS.
.b 1
To compile, link and run a program on the VAX which will plot on the
HIPLOT or VISUAL use the following sequence:
.lm +5
.b 1
.lit
FORT filespec
LINK filespec,VAXLB::DRA1:[MCMAKEN.GRAPH]HGRAPH/L
RUN filespec
.eli
.lm -5
A command file which performs the above sequence is
VAXLB::DRA1:[MCMAKEN.GRAPH]HGR.COM. When using the HIPLOT connected to
a printer port, REMEMBER TO SET THE TERMINAL WIDTH TO 132 (SET
TERM/WID=132) before listing the plot file on the terminal.
.comment 

.pg
.C ;XIV. DISPLAYING A DISK PLOT FILE.
.b 2
To display a disk plot file containing the device instructions for
either the HIPLOT or the VISUAL,
.X HIPLOT
.X VISUAL
one should use one of the following.
To display a plot on the VISUAL type,
.B 1
.i 5
TYPE filspec
.b 1
To display a plot on the HIPLOT connected to a printer port type,
.b 1
.i 5
TYPLOT filspec     on the 11/23,
.b 1
or
.b 1
.i 5
@VAXLB::DRA1:[MCMAKEN.GRAPH]TYPLOT filspec     on the VAX.
.b 1
To display a plot on the queued HIPLOT device type,
.b 1
.i 5
HCOPY filspec 
.I 5
HIGO
.b 1
As an example, suppose you generated a plot using the HIPLOT software
with iunit=99. This created a disk file named FTN99.DAT. To display
this file on the queued HIPLOT plotter type the following:
.b 1
.i 5
HCOPY FTN99.DAT
.I 5
HIGO
.b 1
Always make certain that you have both pen and paper installed on the
HIPLOT.
.COMMENT 

.PG
.lm 0
.rm 72
.c ;APPENDIX A - DEVICE INDEPENDENT ROUTINES
.B 2
.LIT
        SUBROUTINE ALLOUT 
        SUBROUTINE AXIS   
        SUBROUTINE CURPOS 
        SUBROUTINE DASHLN 
        SUBROUTINE DRDASH 
        SUBROUTINE DRWREC 
        SUBROUTINE DRXTIC 
        SUBROUTINE DRYTIC 
        SUBROUTINE ENDLGN 
        SUBROUTINE FNDINT 
        SUBROUTINE FRAME  
        FUNCTION IFRMT  
        SUBROUTINE INILGN 
        FUNCTION ISCRX  
        FUNCTION ISCRY  
        SUBROUTINE LABELX 
        SUBROUTINE LABELY 
        SUBROUTINE LINE   
        SUBROUTINE MOVETO 
        SUBROUTINE MOV1ST 
        SUBROUTINE PLTSTR 
        SUBROUTINE RECLGN 
        SUBROUTINE SCALE  
        SUBROUTINE TRIML  
        SUBROUTINE TRIMSP 
        SUBROUTINE VUPORT 
        SUBROUTINE WINDOW 
        SUBROUTINE WRILGN 
        SUBROUTINE XAXIS  
        FUNCTION XWORLD 
        SUBROUTINE YAXIS  
        FUNCTION YWORLD 
.ELI
.PG
.X ALLOUT
.LIT
      SUBROUTINE ALLOUT( IX, IY, IUD )
      INTEGER ISCX(2), ISCY(2), IX1(2), IY1(2)
      LOGICAL INSIDE, START_NEW
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /CHKBON/ INSIDE, START_NEW, LINNTP, LIN1, DASH
      EQUIVALENCE ( ISCX(1), IASCR ), ( ISCX(2), IBSCR )
      EQUIVALENCE ( ISCY(1), ICSCR ), ( ISCY(2), IDSCR )
C       
      INSECT = 0
      IF ( IX .NE. IXCUR )
      .  IXMAX = MAX0( IX, IXCUR )
      .  IXMIN = MIN0( IX, IXCUR )
      .  DO ( IS = 1, 2 )
      .  .  IF( ISCX(IS) .GE. IXMIN .AND. ISCX(IS) .LE. IXMAX )
      .  .  .  XSL = ( IY - IYCUR ) / FLOAT( IX - IXCUR )
      .  .  .  IY0 = XSL * ( ISCX(IS) - IX ) + IY
      .  .  .  IF ( IY0 .GE. ICSCR .AND. IY0 .LE. IDSCR )
      .  .  .  .  INSECT = INSECT + 1
      .  .  .  .  IX1(INSECT) = ISCX(IS)
      .  .  .  .  IY1(INSECT) = IY0
      .  .  .  ...FIN
      .  .  ...FIN
      .  ...FIN
      ...FIN
      IF ( IY .NE. IYCUR .AND. INSECT .LT. 2 )
      .  IYMAX = MAX0( IY, IYCUR )
      .  IYMIN = MIN0( IY, IYCUR )
      .  DO ( IS = 1, 2 )
      .  .  IF( ISCY(IS) .GE. IYMIN .AND. ISCY(IS) .LE. IYMAX )
      .  .  .  YSL = ( IX - IXCUR ) / FLOAT( IY - IYCUR )
      .  .  .  IX0 = YSL * ( ISCY(IS) - IY ) + IX
      .  .  .  IF ( IX0 .GE. IASCR .AND. IX0 .LE. IBSCR )
      .  .  .  .  INSECT = INSECT + 1
      .  .  .  .  IX1(INSECT) = IX0
      .  .  .  .  IY1(INSECT) = ISCY(IS)
      .  .  .  .  IF( INSECT.EQ.2.AND.IX1(1).EQ.IX1(2) ) INSECT=1
      .  .  .  ...FIN
      .  .  ...FIN
      .  ...FIN
      ...FIN
      IF ( INSECT .EQ. 2 )
      .  IXCUR = IX1(1)
      .  IYCUR = IY1(1)
      .  CALL DRDASH ( IX1(1), IY1(1), 0 )
      .  CALL DRDASH ( IX1(2), IY1(2), IUD )
      ...FIN
      INSIDE = .FALSE.
C       
      RETURN
      END
.ELI
.PG
.X AXIS
.LIT
      SUBROUTINE AXIS( XTIC, YTIC, IXTIT, IXLEN, IXSIZ, IXFMT,
     1                             IYTIT, IYLEN, IYSIZ, IYFMT )
      BYTE IXTIT(IXLEN), IYTIT(IYLEN)
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
C       
      CALL DRWREC( XMINW, XMAXW, YMINW, YMAXW, 0 )
      CALL XAXIS( XTIC, IXTIT, IXLEN, IXSIZ, IXFMT )
      CALL YAXIS( YTIC, IYTIT, IYLEN, IYSIZ, IYFMT )
C       
      RETURN
      END
.ELI
.PG
.X CURPOS
.LIT
      SUBROUTINE CURPOS( ICURX, ICURY )
      COMMON /HCURPO/ IXCUR, IYCUR
C       
      ICURX = IXCUR
      ICURY = IYCUR
C       
      RETURN
      END
.ELI
.PG
.X DASHLN
.LIT
      SUBROUTINE DASHLN( X, Y, N, ICOL, ISYM, ISIZE, INUM, LINTYP )
      LOGICAL DRAW_MARK, DRAW_LINE, INSIDE, START_NEW
      DIMENSION X(N), Y(N)
      COMMON /CHKBON/ INSIDE, START_NEW, LINNTP, LIN1, DASH
C       
      DRAW_MARK = ISIZE .GE. 1 .AND. ISIZE .LE. 5
      DRAW_MARK = DRAW_MARK .AND. ISYM .GE. 0 .AND. ISYM .LE. 5
      DRAW_MARK = DRAW_MARK .AND. INUM .NE. 0
      DRAW_LINE = INUM .GE. 0
C       
      IF ( DRAW_LINE )
      .  START_NEW = .TRUE.
      .  CALL COLTYP(ICOL)
      .  CALL MOVETO(X(1), Y(1), 0, LINTYP)
      .  DO ( I = 2, N ) CALL MOVETO(X(I), Y(I), 1, LINTYP)
      ...FIN
C       
      IF ( DRAW_MARK )
      .  START_NEW = .TRUE.
      .  ITEMP = IABS(INUM)
      .  CALL COLTYP(ICOL)
      .  DO ( I = 1, N, ITEMP )
      .  .  CALL MOVETO(X(I), Y(I), 0, LINTYP)
      .  .  IF ( INSIDE ) CALL MARKER(ISYM, ISIZE)
      .  ...FIN
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X DRDASH
.LIT
      SUBROUTINE DRDASH( IX, IY, IUD )
      INTEGER LIND(11)
      LOGICAL INSIDE, START_NEW
      REAL IDASH(11), ISPACE(11)
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /LINDAT/ IDASH, ISPACE
      COMMON /CHKBON/ INSIDE, START_NEW, LINNTP, LIN1, DASH
      DATA LIND / 1, 2, 3, 4, 5, 6, 9, 10, 7, 11, 8 /
      DATA IDASH/.02, .04, .08, .16, .24, .32, .16, .16, .04, .04, .04/
      DATA ISPACE/.08, .08, .08, .08, .12, .16, .08, .08, .08, .08, .08/
      DATA LINNTP, LIN1 / 0, 0 /
C       
      WHEN ( IUD .EQ. 1 .AND. LINNTP .NE. 0 )
      .  DX = IX - X0
      .  DY = IY - Y0
      .  DS = SQRT( DX * DX + DY * DY )
      .  IF ( DS .GT. 0. )
      .  .  C = DX / DS
      .  .  S = DY / DS
      .  ...FIN
      .  WHILE ( DS .GT. 0. )
      .  .  WHEN ( DASH .GT. 0. )
      .  .  .  DDS = AMIN1 ( DS, DASH )
      .  .  .  DS = DS - DDS
      .  .  .  DASH = DASH - DDS
      .  .  .  IF( DASH .LE. 0. ) SPACE = SCRX * ISPACE(LIN1)
      .  .  .  X0 = X0 + DDS * C
      .  .  .  Y0 = Y0 + DDS * S
      .  .  .  IX0 = X0 + .5
      .  .  .  IY0 = Y0 + .5
      .  .  .  CALL PLOT( IX0, IY0, 1 )
      .  .  ...FIN
      .  .  ELSE
      .  .  .  DDS = AMIN1 ( DS, SPACE )
      .  .  .  DS = DS - DDS
      .  .  .  SPACE = SPACE - DDS
      .  .  .  IF( SPACE .LE. 0. )
      .  .  .  .  LIN1 = LIND(LIN1)
      .  .  .  .  DASH = SCRX * IDASH(LIN1)
      .  .  .  ...FIN
      .  .  .  X0 = X0 + DDS * C
      .  .  .  Y0 = Y0 + DDS * S
      .  .  .  IX0 = X0 + .5
      .  .  .  IY0 = Y0 + .5
      .  .  .  CALL PLOT( IX0, IY0, 0 )
      .  .  ...FIN
      .  ...FIN
      ...FIN
      ELSE
      .  CALL PLOT( IX, IY, IUD )
      ...FIN
      X0 = IX
      Y0 = IY
C       
      RETURN
      END
.ELI
.PG
.X DRWREC
.LIT
      SUBROUTINE DRWREC( XMIN, XMAX, YMIN, YMAX, ICOL )
C       
      CALL COLTYP(ICOL)
      CALL MOVETO(XMIN, YMIN, 0, 0)
      CALL MOVETO(XMAX, YMIN, 1, 0)
      CALL MOVETO(XMAX, YMAX, 1, 0)
      CALL MOVETO(XMIN, YMAX, 1, 0)
      CALL MOVETO(XMIN, YMIN, 1, 0)
C       
      RETURN
      END
.ELI
.PG
.X DRXTIC
.LIT
      SUBROUTINE DRXTIC( IX, IY, LENTIC )
C       
      CALL PLOT(IX, IY, 0)
      CALL PLOT(IX, IY + LENTIC, 1)
C       
      RETURN
      END
.ELI
.PG
.X DRYTIC
.LIT
      SUBROUTINE DRYTIC( IX, IY, LENTIC )
C       
      CALL PLOT(IX, IY, 0)
      CALL PLOT(IX + LENTIC, IY, 1)
C       
      RETURN
      END
.ELI
.PG
.X ENDLGN
.LIT
      SUBROUTINE ENDLGN
      COMMON /HFRAME/ I1(4)
      COMMON /HSCALE/ X1(4)
      COMMON /HWINDO/ SCRX, SCRY, I2(6)
      COMMON /WORLD/ X2(4)
      COMMON /SAVPAR/ J1(4), Y1(4), J2(6), Y2(4)
C       
      DO ( I = 1, 6 ) I2(I) = J2(I)
      DO ( I = 1, 4 )
      .  I1(I) = J1(I)
      .  X1(I) = Y1(I)
      .  X2(I) = Y2(I)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X FNDINT
.LIT
      SUBROUTINE FNDINT( IX0, IY0, IX, IY )
      LOGICAL INX, INY
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
C       
      INX = IX .GE. IASCR .AND. IX .LE. IBSCR
      INY = IY .GE. ICSCR .AND. IY .LE. IDSCR
      IF ( .NOT. INX )
      .  XSL = (IY - IY0) / FLOAT(IX - IX0)
      .  WHEN ( IX .GT. IBSCR ) IX = IBSCR
      .  ELSE IX = IASCR
      .  IY = XSL * (IX - IX0) + IY0
      .  INY = IY .GE. ICSCR .AND. IY .LE. IDSCR
      ...FIN
      IF ( .NOT. INY )
      .  YSL = (IX - IX0) / FLOAT(IY - IY0)
      .  WHEN( IY .GT. IDSCR ) IY = IDSCR
      .  ELSE IY = ICSCR
      .  IX = YSL * (IY - IY0) + IX0
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X FRAME
.LIT
      SUBROUTINE FRAME( XMINF, XMAXF, YMINF, YMAXF )
      COMMON /PAGSIZ/ XBOND, YBOND
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
C       
      XN = AMAX1 ( 0., XMINF )
      XX = AMIN1 ( XBOND, XMAXF )
      YN = AMAX1 ( 0., YMINF )
      YX = AMIN1 ( YBOND, YMAXF )
      IXMINF = SCRX * XN
      IXMAXF = SCRX * XX
      IYMINF = SCRY * YN
      IYMAXF = SCRY * YX
C       
      IDX = IXMINF - IXORIG
      IDY = IYMINF - IYORIG
      IXORIG = IXMINF
      IYORIG = IYMINF
C       
C      MOVE WINDOW INTO FRAME
C       
      IASCR = IASCR + IDX
      IBSCR = IBSCR + IDX
      ICSCR = ICSCR + IDY
      IDSCR = IDSCR + IDY
      XCONST = XCONST + IDX
      YCONST = YCONST + IDY
C       
      RETURN
      END
.ELI
.PG
.X IFRMT
.LIT
      FUNCTION IFRMT( FORM, IFMT )
      INTEGER FMT(2) , EMT, NUM(5), FORM(3)
      DATA FMT / '(F', '9.' /
      DATA EMT / '(G' /
      DATA NUM / '0)', '1)', '2)', '3)', '2)' /
C       
      IFORM = MAX0( 0, IFMT )
      FORM(1) = FMT(1)
      FORM(2) = FMT(2)
      FORM(3) = NUM( MIN0( 5 , IFORM + 1) )
      IF ( IFORM .GT. 3 ) FORM(1) = EMT
      IFRMT = IFORM
C       
      RETURN
      END
.ELI
.PG
.X INILGN
.LIT
      SUBROUTINE INILGN( XMIN, XMAX, YMIN, YMAX )
      COMMON /HFRAME/ I1(4)
      COMMON /HSCALE/ X1(4)
      COMMON /HWINDO/ SCRX, SCRY, I2(6)
      COMMON /WORLD/ X2(4)
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
      COMMON /SAVPAR/ J1(4), Y1(4), J2(6), Y2(4)
      COMMON /LGND/ YSTRT, DELY, DELX, X(2)
C       
      DO ( I = 1, 6 ) J2(I) = I2(I)
      DO ( I = 1, 4 )
      .  J1(I) = I1(I)
      .  Y1(I) = X1(I)
      .  Y2(I) = X2(I)
      ...FIN
C       
      CALL FRAME( XMIN, XMAX, YMIN, YMAX )
      CALL WINDOW( 0., XMAX - XMIN, 0., YMAX - YMIN )
      CALL VUPORT( 0., 1., 0., 1. )
      DELY = YWORLD( ICHH(2) ) - YWORLD(0)
      DELX = XWORLD( ICHW(2) ) - XWORLD(0)
      YSTRT = .99 - DELY
      X(1) = .05
      X(2) = .2
C       
      RETURN
      END
.ELI
.PG
.X ISCRX
.LIT
      FUNCTION ISCRX( XWRLD )
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
C       
      X = AMIN1( XWRLD * XSLOPE + XCONST, 32767. )
      X = AMAX1 ( X, -32767. )
      ISCRX = IFIX( X + .5 )
C       
      RETURN
      END
.ELI
.PG
.X ISCRY
.LIT
      FUNCTION ISCRY( YWRLD )
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
C       
      Y = AMIN1 ( YWRLD * YSLOPE + YCONST, 32767. )
      Y = AMAX1 ( Y, -32767. )
      ISCRY = IFIX ( Y + .5 )
C       
      RETURN
      END
.ELI
.PG
.X LABELX
.LIT
      SUBROUTINE LABELX( XVAL, FORM, IFORM, IS, IY, ICHW, IXSIZ )
      BYTE LABEL(9)
      INTEGER FORM(3)
C       
      IF ( IXSIZ .NE. 0 )
      .  ENCODE ( 9 , FORM, LABEL ) XVAL
      .  CALL TRIML(LABEL, 9, LEN)
      .  IF ( IFORM .EQ. 0 ) LEN = LEN - 1
      .  IXL = LEN * ICHW
      .  IX = IS - IXL / 2
      .  CALL PLTSTR(IX, IY, LABEL , LEN , 1 , IXSIZ)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X LABELY
.LIT
      SUBROUTINE LABELY( YVAL, FORM, IFORM, IS, IY, ICHW, IYSIZ )
      BYTE LABEL(9)
      INTEGER FORM(3)
      COMMON /YLABEL/ IXMIN
C       
      IF ( IYSIZ .NE. 0 )
      .  ENCODE ( 9 , FORM, LABEL ) YVAL
      .  CALL TRIML ( LABEL, 9, LEN )
      .  IF ( IFORM .EQ. 0 ) LEN = LEN - 1
      .  IX = IS - ( LEN + 1 ) * ICHW
      .  IXMIN = MIN0( IXMIN, IX )
      .  CALL PLTSTR(IX, IY, LABEL , LEN , 1 , IYSIZ)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X LINE
.LIT
      SUBROUTINE LINE( X, Y, N, ICOL, ISYM, ISIZE, INUM )
      DIMENSION X(N), Y(N)
C       
      CALL DASHLN(X, Y, N, ICOL, ISYM, ISIZE, INUM, 0 )
C       
      RETURN
      END
.ELI
.PG
.X MOVETO
.LIT
      SUBROUTINE MOVETO( XWRLD, YWRLD, IUD, LINTYP )
      LOGICAL CURRENT_INSIDE, INX, INY, PREVIOUS_INSIDE, START_NEW
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /CHKBON/ PREVIOUS_INSIDE, START_NEW, LINNTP, LIN1, DASH
C       
      WHEN ( START_NEW .OR. LINNTP .NE. LINTYP )
      .  CALL MOV1ST(XWRLD, YWRLD, IUD, LINTYP)
      .  START_NEW = .FALSE.
      ...FIN
      ELSE
      .  IXC = ISCRX( XWRLD )
      .  IYC = ISCRY( YWRLD )
      .  IX = IXC
      .  IY = IYC
      .  INX = IX .GE. IASCR .AND. IX .LE. IBSCR
      .  INY = IY .GE. ICSCR .AND. IY .LE. IDSCR
      .  CURRENT_INSIDE = INX .AND. INY
      .  WHEN ( CURRENT_INSIDE .OR. PREVIOUS_INSIDE )
      .  .  IF ( .NOT. ( CURRENT_INSIDE .AND. PREVIOUS_INSIDE ) )
      .  .  .  IX0 = IXCUR
      .  .  .  IY0 = IYCUR
      .  .  .  WHEN ( PREVIOUS_INSIDE )
      .  .  .  .  PREVIOUS_INSIDE = .FALSE.
      .  .  .  .  CALL FNDINT( IX0, IY0, IX, IY )
      .  .  .  ...FIN
      .  .  .  ELSE
      .  .  .  .  PREVIOUS_INSIDE = .TRUE.
      .  .  .  .  CALL FNDINT( IX, IY, IX0, IY0 )
      .  .  .  .  IXCUR = IX0
      .  .  .  .  IYCUR = IY0
      .  .  .  .  CALL DRDASH(IX0, IY0, 0)
      .  .  .  ...FIN
      .  .  ...FIN
      .  .  CALL DRDASH(IX, IY, IUD)
      .  ...FIN
      .  ELSE
      .  .  CALL ALLOUT( IX, IY, IUD )
      .  ...FIN
      .  IXCUR = IXC
      .  IYCUR = IYC
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X MOV1ST
.LIT
      SUBROUTINE MOV1ST( XWRLD, YWRLD, IUD, LINTYP )
      LOGICAL INSIDE, INX, INY, START_NEW
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /CHKBON/ INSIDE, START_NEW, LINNTP, LIN1, DASH
      COMMON /LINDAT/ RDASH(11), RSPACE(11)
C       
      IX = ISCRX( XWRLD )
      IY = ISCRY( YWRLD )
      INX = IX .GE. IASCR .AND. IX .LE. IBSCR
      INY = IY .GE. ICSCR .AND. IY .LE. IDSCR
      INSIDE = INX .AND. INY
      WHEN ( LINTYP .GT. 0 )
      .  LINNTP = MIN0( MAX0( LINTYP, 1 ), 8 )
      .  DASH = SCRX * RDASH(LINNTP)
      ...FIN
      ELSE
      .  LINNTP = 0
      ...FIN
      LIN1 = LINNTP
      IF ( INSIDE ) CALL DRDASH( IX, IY, IUD )
      IXCUR = IX
      IYCUR = IY
C       
      RETURN
      END
.ELI
.PG
.X PLTSTR
.LIT
      SUBROUTINE PLTSTR( IX, IY, STR, LEN, IROT, ISIZE )
      BYTE STR(LEN)
      LOGICAL INX, INY
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
C       
      INX = IX .GE. IXMINF .AND. IX .LE. IXMAXF
      INY = IY .GE. IYMINF .AND. IY .LE. IYMAXF
      IF ( INX .AND. INY )
      .  CALL PLOT ( IX, IY, 0 )
      .  CALL WRTSTR ( STR, LEN, IROT, ISIZE )
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X RECLGN
.LIT
      SUBROUTINE RECLGN( NL, TITLE, N, ICOL, ISYM, INUM, LINTYP,
     1                   XSTRT, XLEN, YSTRT )
      BYTE TITLE(1)
      DIMENSION XSTRT(NL), XLEN(NL), YSTRT(NL)
      INTEGER N(NL), ICOL(NL), ISYM(NL), INUM(NL), LINTYP(NL)
      COMMON /PAGSIZ/ XBOND, YBOND
      COMMON /LGND/ YSTART, DELY, DELX, X(2)
C       
      CALL INILGN( 0., XBOND, 0., YBOND )
      IST = 1
      DO  ( I = 1, NL )
      .  X(1) = XSTRT(I)
      .  X(2) = XSTRT(I) + XLEN(I)
      .  YSTART = YSTRT(I)
      .  CALL WRILGN(TITLE(IST),N(I),ICOL(I),ISYM(I),INUM(I),LINTYP(I))
      .  IST = IST + N(I)
      ...FIN
      CALL ENDLGN
C       
      RETURN
      END
.ELI
.PG
.X SCALE
.LIT
      SUBROUTINE SCALE( XMIN, XMAX, YMIN, YMAX )
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
C       
      XMINW = XMIN
      XMAXW = XMAX
      YMINW = YMIN
      YMAXW = YMAX
C       
      XSLOPE = (IBSCR - IASCR) / (XMAX - XMIN)
      YSLOPE = (IDSCR - ICSCR) / (YMAX - YMIN)
      XCONST = - XSLOPE * XMIN + FLOAT(IASCR)
      YCONST = - YSLOPE * YMIN + FLOAT(ICSCR)
C       
      RETURN
      END
.ELI
.PG
.X TRIML
.LIT
      SUBROUTINE TRIML( LABEL, N, LEN )
      BYTE LABEL(N)
C       
      I = 1
      WHILE ( I .LT. N .AND. LABEL(I) .EQ. ' ' ) I = I + 1
      LEN = 0
      DO ( J = I, N )
      .  LEN = LEN + 1
      .  LABEL(LEN) = LABEL(J)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X TRIMSP
.LIT
      SUBROUTINE TRIMSP( TITLE, LEN, IST, IEND )
      BYTE TITLE(LEN)
C       
      IST = 1
      IEND = LEN
      WHILE ( IST .LT. LEN .AND. TITLE(IST) .EQ. ' ' ) IST = IST + 1
      WHILE ( IEND .GT. IST .AND. TITLE(IEND) .EQ. ' ' ) IEND = IEND - 1
C       
      RETURN
      END
.ELI
.PG
.X VUPORT
.LIT
      SUBROUTINE VUPORT( XMIN, XMAX, YMIN, YMAX )
C       
      CALL SCALE(XMIN, XMAX, YMIN, YMAX)
C       
      RETURN
      END
.ELI
.PG
.X WINDOW
.LIT
      SUBROUTINE WINDOW( XWIN0, XWIN1, YWIN0, YWIN1 )
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
C       
      IASCR = SCRX * XWIN0 + IXORIG
      IBSCR = SCRX * XWIN1 + IXORIG
      ICSCR = SCRY * YWIN0 + IYORIG
      IDSCR = SCRY * YWIN1 + IYORIG
C       
      CALL SCALE( XMINW, XMAXW, YMINW, YMAXW )
C       
      RETURN
      END
.ELI
.PG
.X WRILGN
.LIT
      SUBROUTINE WRILGN( TITLE, N, ICOL, ISYM, INUM, LINTYP )
      BYTE TITLE(N)
      DIMENSION X(2), Y(2)
      COMMON /LGND/ YSTRT, DELY, DELX, XX(2)
      DATA XX / .05, .2 /
C       
      Y(1) = YSTRT
      Y(2) = YSTRT
      X(2) = XX(2)
      CONDITIONAL
      .  ( INUM .LT. 0 )
      .  .  NUM = -2
      .  .  X(1) = XX(2)
      .  ...FIN
      .  ( INUM .GT. 0 )
      .  .  NUM = 1
      .  .  X(1) = XX(1)
      .  ...FIN
      .  ( INUM .EQ. 0 )
      .  .  NUM = 0
      .  .  X(1) = XX(1)
      .  ...FIN
      ...FIN
      CALL DASHLN( X, Y, 2, ICOL, ISYM, 2, NUM, LINTYP )
      IX = ISCRX( X(2) + DELX )
      IY = ISCRY( YSTRT - .5 * DELY )
      CALL PLTSTR( IX, IY, TITLE, N, 1, 2 )
      YSTRT = YSTRT - DELY
C       
      RETURN
      END
.ELI
.PG
.X XAXIS
.LIT
      SUBROUTINE XAXIS( XTIC, IXTIT, IXLEN, IXSIZ, IXFMT )
      BYTE IXTIT(IXLEN)
      INTEGER FORM(3)
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
C       
      WHEN ( IXSIZ .GE. 1 .AND. IXSIZ .LE. 5 ) IXS = IXSIZ
      ELSE                                     IXS = 0
      IF ( XTIC .NE. 0. )
      .  IS = IASCR
      .  IY = ICSCR - ICHH(MAX0( IXS, 1 )) * 2
      .  LENTIC = SCRX / 4
      .  XVAL = XMINW
      .  IFORM = IFRMT( FORM, IXFMT )
      .  XMAX = AMAX1( XMINW, XMAXW )
      .  XMIN = AMIN1( XMINW, XMAXW )
      .  IW = ICHW(MAX0(IXS,1))
      .  WHILE ( XVAL .LE. XMAX .AND. XVAL .GE. XMIN )
      .  .  WHEN ( XVAL .EQ. XMINW )
      .  .  .  CALL LABELX( XVAL, FORM, IFORM, IS, IY, IW, IXS )
      .  .  ...FIN
      .  .  ELSE
      .  .  .  IS = ISCRX( XVAL )
      .  .  .  IF( IS .NE. IBSCR ) CALL DRXTIC(IS, ICSCR, LENTIC)
      .  .  .  CALL LABELX( XVAL, FORM, IFORM, IS, IY, IW, IXS )
      .  .  ...FIN
      .  .  XVAL = XVAL + XTIC
      .  ...FIN
      ...FIN
C       
C      CENTER HORIZONTAL TITLE AND PLOT
C       
      IF( IXS .NE. 0 )
      .  CALL TRIMSP( IXTIT, IXLEN, IST, IEND )
      .  IXLN = IEND + 1 - IST
      .  IXL = IXLN * ICHW(IXS)
      .  IX = (IASCR + IBSCR - IXL) / 2
      .  IY = ICSCR - 4 * ICHH(IXS)
      .  CALL PLTSTR(IX, IY, IXTIT(IST), IXLN, 1, IXS)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X XWORLD
.LIT
      FUNCTION XWORLD( IX )
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
C       
      XWORLD = ( IX - XCONST ) / XSLOPE
C       
      RETURN
      END
.ELI
.PG
.X YAXIS
.LIT
      SUBROUTINE YAXIS( YTIC, IYTIT, IYLEN, IYSIZ, IYFMT )
      BYTE IYTIT(IYLEN)
      INTEGER FORM(3)
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
      COMMON /YLABEL/ IXMIN
C       
      WHEN ( IYSIZ .GE. 1 .AND. IYSIZ .LE. 5 ) IYS = IYSIZ
      ELSE                                     IYS = 0
      IXMIN = IASCR
      IF ( YTIC .NE. 0. )
      .  IX = IASCR
      .  IS = ICSCR
      .  LENTIC = SCRY / 4
      .  IFORM = IFRMT( FORM, IYFMT )
      .  YVAL = YMINW
      .  IHGT = ICHH(MAX0(IYS,1)) / 2
      .  IY = IS - IHGT
      .  IW = ICHW(MAX0(IYS,1))
      .  YMAX = AMAX1( YMINW, YMAXW )
      .  YMIN = AMIN1( YMINW, YMAXW )
      .  WHILE ( YVAL .LE. YMAX .AND. YVAL .GE. YMIN )
      .  .  WHEN ( YVAL .EQ. YMINW )
      .  .  .  CALL LABELY( YVAL, FORM, IFORM, IASCR, IY, IW, IYS )
      .  .  ...FIN
      .  .  ELSE
      .  .  .  IS = ISCRY( YVAL )
      .  .  .  IY = IS - IHGT
      .  .  .  IF( IDSCR .NE. IS ) CALL DRYTIC( IASCR, IS, LENTIC )
      .  .  .  CALL LABELY( YVAL, FORM, IFORM, IASCR, IY, IW, IYS )
      .  .  ...FIN
      .  .  YVAL = YVAL + YTIC
      .  ...FIN
      ...FIN
C       
C      CENTER VERTICAL TITLE AND PLOT
C       
      IF ( IYS .NE. 0 )
      .  CALL TRIMSP( IYTIT, IYLEN, IST, IEND )
      .  IYLN = IEND + 1 - IST
      .  IX = IXMIN - ICHH(IYS)
      .  IYL = IYLN * ICHW(IYS)
      .  IY = (ICSCR + IDSCR - IYL) / 2
      .  CALL PLTSTR(IX, IY, IYTIT(IST), IYLN, 4, IYS)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X YWORLD
.LIT
      FUNCTION YWORLD( IY )
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
C       
      YWORLD = ( IY - YCONST ) / YSLOPE
C       
      RETURN
      END
.ELI
.COMMENT 

.PG
.C ;APPENDIX B - HIPLOT AND VISUAL ROUTINES
.B 2
.LIT
        SUBROUTINE CIRCLE 
        SUBROUTINE COLTYP 
        SUBROUTINE CONLGN 
        SUBROUTINE CURSON 
        SUBROUTINE DEFWIN 
        SUBROUTINE DMPPLT 
        SUBROUTINE ENDPLT 
        SUBROUTINE ERASE  
        SUBROUTINE FNDCUR 
        SUBROUTINE GETSTR 
        SUBROUTINE INIPLT 
        SUBROUTINE MARKER 
        SUBROUTINE PENDWN 
        SUBROUTINE PENUP  
        SUBROUTINE PLOT   
        SUBROUTINE PLTOFF 
        SUBROUTINE PLTON  
        SUBROUTINE PUTCUR 
        SUBROUTINE REDSTR 
        SUBROUTINE WRITCH 
        SUBROUTINE WRTSTR 
.ELI
.PG
.X CIRCLE
.LIT
      SUBROUTINE CIRCLE( IX, IY, IR )
      BYTE MES(16)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
1     FORMAT( 'CC', I4, ',', I4, I5 )
2     FORMAT( A1, '/', I3, ';', I3, ';', I2, ';0A' )
C       
      WHEN ( VISUAL )
      .  CALL PENDWN
      .  ENCODE( 15, 2, MES ) 27, IX, IY, IR
      .  DO ( I = 1, 15 ) IF( MES(I) .EQ. ' ' ) MES(I) = '0'
      .  CALL WRITCH( MES, 15 )
      ...FIN
      ELSE
      .  ENCODE( 16, 1, MES ) IX, IY, IR
      .  CALL WRITCH( MES, 16 )
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X COLTYP
.LIT
      SUBROUTINE COLTYP( ICOL )
      BYTE MES(2)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
C       
      IF( .NOT. VISUAL )
      .  ITYPE = ICOL + 1
      .  ITYPE = MIN0(ITYPE, 8)
      .  ITYPE = MAX0(ITYPE, 1)
      .  MES(1) = 'P'
      .  MES(2) = ITYPE + 48
      .  CALL WRITCH(MES, 2)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X CONLGN
.LIT
      SUBROUTINE CONLGN( NL, TITLE, N, ICOL, ISYM, INUM, LINTYP,
     1                   XSTRT, XLEN, YSTRT )
      BYTE TITLE(1)
      DIMENSION XSTRT(NL), XLEN(NL), YSTRT(NL)
      INTEGER N(NL), ICOL(NL), ISYM(NL), INUM(NL), LINTYP(NL)
      LOGICAL VISUAL
      COMMON /LGND/ YSTART, DELY, DELX, X(2)
      COMMON /PAGSIZ/ XBOND, YBOND
      COMMON /CRSPOS/ IXX, IYY
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA IXX, IYY, XST, XLN / -100, -100, -1., .15 /
C       
      IF( VISUAL )
      .  CALL INILGN( 0., XBOND, 0., YBOND )
      .  CALL DRWREC( 0., 1., 0., 1., 0 )
      .  X(2) = XWORLD(IXX) - DELX
      .  X(1) = X(2) - XLN
      .  YSTART = YWORLD(IYY) + .5 * DELY
      .  IST = 1
      .  DO ( I = 1, NL )
      .  .  XLEN(I) = X(2) - X(1)
      .  .  XSTRT(I) = X(1)
      .  .  YSTRT(I) = YSTART
      .  .  CALL FNDCUR( IX, IY )
      .  .  IF( IX .NE. IXX .OR. IY .NE. IYY )
      .  .  .  XSTRT(I) = XWORLD(IX)
      .  .  .  YSTRT(I) = YWORLD(IY)
      .  .  .  CALL FNDCUR( IX, IY )
      .  .  .  XLEN(I) = XWORLD(IX) - XSTRT(I)
      .  .  .  IF( XLEN(I) .LT. 0. ) XLEN(I) = XLN
      .  .  ...FIN
      .  .  X(1) = XSTRT(I)
      .  .  X(2) = XLEN(I) + XSTRT(I)
      .  .  YSTART = YSTRT(I)
      .  .  CALL WRILGN('', 0, ICOL(I), ISYM(I), INUM(I), LINTYP(I))
      .  .  CALL CURPOS( IX, IY )
      .  .  CALL GETSTR( IX, IY, TITLE(IST), N(I), 1, 2 )
      .  .  IST = IST + N(I)
      .  .  XST = XSTRT(I)
      .  .  XLN = XLEN(I)
      .  ...FIN
      .  CALL ENDLGN
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X CURSON
.LIT
      SUBROUTINE CURSON
      BYTE ESC, FF, SUB, ENQ, CHAR
      COMMON /HBYTE/ ESC, FF, SUB, ENQ, CHAR
C       
      CALL WRITCH(ESC, 1)
      CALL WRITCH(SUB, 1)
      CALL DMPPLT
C       
      RETURN
      END
.ELI
.PG
.X DEFWIN
.LIT
      SUBROUTINE DEFWIN( XMIN, XMAX, YMIN, YMAX )
      BYTE ESC, FF, SUB, ENQ, CHAR
      INTEGER IX, IY, JX, JY, B
      LOGICAL VISUAL
      COMMON /HBYTE/ ESC, FF, SUB, ENQ, CHAR
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
C       
      IF( VISUAL )
      .  CALL FNDCUR(IX, IY)
      .  CALL FNDCUR(JX, JY)
      .  IXN = MIN0( IX, JX )
      .  IXX = MAX0( IX, JX )
      .  IYN = MIN0( IY, JY )
      .  IYX = MAX0( IY, JY )
      .  XMIN = IXN / 75.
      .  XMAX = IXX / 75.
      .  YMIN = IYN / 75.
      .  YMAX = IYX / 75.
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X DMPPLT
.LIT
      SUBROUTINE DMPPLT
      BYTE VTBUFR(128)
      INTEGER VTPOS, VTBUFL
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /VTBUF/ VTBUFR, VTPOS, VTBUFL
1     FORMAT( 1X, 128A1 )
2     FORMAT( '+', 128( A1, $ ) )
C       
      WHEN ( VISUAL ) WRITE(LUNPLT, 2) ( VTBUFR(I), I = 1, VTPOS )
      ELSE            WRITE(LUNPLT, 1) ( VTBUFR(I), I = 1, VTPOS )
      VTPOS = 0
C       
      RETURN
      END
.ELI
.PG
.X ENDPLT
.LIT
      SUBROUTINE ENDPLT
      BYTE MES(12)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA MES /'P','0','E','F','3','0','0','0',',','0',' ','@'/
C       
      WHEN ( VISUAL )
      .  CALL PLTOFF
      .  CALL DMPPLT
      ...FIN
      ELSE
      .  CALL WRITCH(MES, 12 )
      .  IF( LUNPLT .EQ. ITTNUM ) CALL PLTOFF
      .  CALL DMPPLT
      ...FIN
      IF ( LUNPLT .NE. ITTNUM ) CLOSE( UNIT = LUNPLT )
C       
      RETURN
      END
.ELI
.PG
.X ERASE
.LIT
      SUBROUTINE ERASE
      BYTE MES(2)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA MES / 27, 12 /
C       
      IF( VISUAL ) CALL WRITCH(MES, 2)
C       
      RETURN
      END
.ELI
.PG
.X FNDCUR
.LIT
      SUBROUTINE FNDCUR( IX, IY )
      BYTE ESC, FF, SUB, ENQ, CHAR
      COMMON /HBYTE/ ESC, FF, SUB, ENQ, CHAR
      BYTE HIGHX, LOWX, HIGHY, LOWY
1     FORMAT( 5A1 )
C       
      CALL CURSON
      READ(5, 1) HIGHX, LOWX, HIGHY, LOWY, CHAR
      IF ( CHAR .NE. 8 )
      .  HIGHX = LOWX
      .  LOWX = HIGHY
      .  HIGHY = LOWY
      .  LOWY = CHAR
      ...FIN
      IHIGHX = HIGHX .AND. 31
      ILOWX = LOWX .AND. 31
      IHIGHY = HIGHY .AND. 31
      ILOWY = LOWY .AND. 31
      IX = IHIGHX * 32 + ILOWX
      IY = IHIGHY * 32 + ILOWY
C       
      RETURN
      END
.ELI
.PG
.X GETSTR
.LIT
      SUBROUTINE GETSTR( IX, IY, STR, LEN, IROT, ISIZE )
      BYTE STR(80)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
1     FORMAT( Q, 80A1)
C       
      IF( VISUAL )
      .  CALL PLTSTR( IX, IY, '', 0, IROT, ISIZE )
      .  CALL DMPPLT
      .  READ(5,1) LEN, (STR(J), J = 1, LEN )
      .  ISZ = MIN0( 5, MAX0( 1, ISIZE ) )
      .  ID = ICHH(2)
      .  IXX = IX + ID * ( IABS( MOD( IROT - 1, 4 ) - 1 ) - 1 )
      .  IYY = IY + ID * ( 1 - IABS( MOD( IROT - 1, 4 ) - 2 ) )
      .  CALL PUTCUR( IXX, IYY )
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X INIPLT
.LIT
      SUBROUTINE INIPLT( IUNIT, XSIZE, YSIZE )
      BYTE ESC, FF, SUB, ENQ, CHAR, MES(10), TRANS(2), VTBUFR(128)
      INTEGER VTPOS, VTBUFL
      INTEGER VCHR_WIDTH(5), VCHR_HEIGHT(5)
      INTEGER HCHR_WIDTH(5), HCHR_HEIGHT(5)
      LOGICAL VISUAL
      COMMON /PAGSIZ/ XBOND, YBOND
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
      COMMON /PENPOS/ IUPDWN
      COMMON /HBYTE/ ESC, FF, SUB, ENQ, CHAR
      COMMON /VTBUF/ VTBUFR, VTPOS, VTBUFL
      DATA MES / ';', ':', 'E', 'H', 'H', 'O', 'U', 'A', 'L', '0' /
      DATA FF , ENQ, SUB, ESC, TRANS / 12, 5, 26, 27, 29, 77 /
      DATA VCHR_WIDTH, VCHR_HEIGHT / 7,10,20,30,40, 10,15,30,45,60 /
      DATA HCHR_WIDTH, HCHR_HEIGHT / 18,24,36,48,72, 24,36,54,72,108 /
      DATA IASCR, IBSCR, ICSCR, IDSCR, IXORIG, IYORIG, XCONST, YCONST
     1    / 6 * 0, 2 * 0. /
C       
      ITTNUM = 7
      LUNPLT = IUNIT
      VISUAL = LUNPLT .EQ. ITTNUM
      VTBUFL = 128
      VTPOS = 0
      IUPDWN = 0
      WHEN ( VISUAL )
      .  CALL WRITCH(TRANS, 2)
      .  CALL ERASE
      .  SCRX = 75.
      .  SCRY = 75.
      .  DO ( I = 1, 5 )
      .  .  ICHW(I) = VCHR_WIDTH(I)
      .  .  ICHH(I) = VCHR_HEIGHT(I)
      .  ...FIN
      ...FIN
      ELSE
      .  IF ( IUNIT .EQ. 8 )
      .  .  LUNPLT = ITTNUM
      .  .  CALL PLTON
      .  ...FIN
      .  CALL WRITCH(MES, 10 )
      .  SCRX = 200.
      .  SCRY = 200.
      .  DO ( I = 1, 5 )
      .  .  ICHW(I) = HCHR_WIDTH(I)
      .  .  ICHH(I) = HCHR_HEIGHT(I)
      .  ...FIN
      ...FIN
      XBOND = XSIZE
      YBOND = YSIZE
      XMINW = 0.
      XMAXW = 1.
      YMINW = 0.
      YMAXW = 1.
      CALL FRAME( 0., XSIZE, 0., YSIZE )
      CALL WINDOW( .2 * XSIZE, .8 * XSIZE, .2 * YSIZE, .8 * YSIZE )
C       
      RETURN
      END
.ELI
.PG
.X MARKER
.LIT
      SUBROUTINE MARKER( ISYM, ISIZE )
      BYTE MES(4)
      INTEGER MARK_SIZE(5)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA MARK_SIZE / 2, 3, 4, 6, 9 /
1     FORMAT('M ', 2I1)
C       
      ISZ = MAX0( MIN0(ISIZE, 5), 1 )
      MRK = MIN0( MAX0(ISYM, 0), 5 )
      WHEN ( VISUAL )
      .  IW = MARK_SIZE(ISZ)
      .  CALL CURPOS( IX, IY )
      .  SELECT ( MRK )
      .  .  (0)  !  PLUS SIGN
      .  .  .  CALL PLOT( IX-IW, IY, 0 )
      .  .  .  CALL PLOT( IX+IW, IY, 1 )
      .  .  .  CALL PLOT( IX, IY-IW, 0 )
      .  .  .  CALL PLOT( IX, IY+IW, 1 )
      .  .  ...FIN
      .  .  (1)  !  CROSS
      .  .  .  CALL PLOT( IX-IW, IY-IW, 0 )
      .  .  .  CALL PLOT( IX+IW, IY+IW, 1 )
      .  .  .  CALL PLOT( IX+IW, IY-IW, 0 )
      .  .  .  CALL PLOT( IX-IW, IY+IW, 1 )
      .  .  ...FIN
      .  .  (2)  !  SQUARE
      .  .  .  CALL PLOT( IX-IW, IY-IW, 0 )
      .  .  .  CALL PLOT( IX+IW, IY-IW, 1 )
      .  .  .  CALL PLOT( IX+IW, IY+IW, 1 )
      .  .  .  CALL PLOT( IX-IW, IY+IW, 1 )
      .  .  .  CALL PLOT( IX-IW, IY-IW, 1 )
      .  .  ...FIN
      .  .  (3)  !  CIRCLE
      .  .  .  CALL CIRCLE( IX, IY, IW )
      .  .  ...FIN
      .  .  (4)  !  TRIANGLE
      .  .  .  CALL PLOT( IX-IW, IY-IW, 0 )
      .  .  .  CALL PLOT( IX+IW, IY-IW, 1 )
      .  .  .  CALL PLOT( IX, IY+IW, 1 )
      .  .  .  CALL PLOT( IX-IW, IY-IW, 1 )
      .  .  ...FIN
      .  .  (5)  !  HOURGLASS
      .  .  .  CALL PLOT( IX-IW, IY-IW, 0 )
      .  .  .  CALL PLOT( IX+IW, IY+IW, 1 )
      .  .  .  CALL PLOT( IX-IW, IY+IW, 1 )
      .  .  .  CALL PLOT( IX+IW, IY-IW, 1 )
      .  .  .  CALL PLOT( IX-IW, IY-IW, 1 )
      .  .  ...FIN
      .  ...FIN
      ...FIN
      ELSE
      .  ENCODE( 4, 1, MES ) ( ISZ + 2 ) / 2, MRK
      .  IF ( MOD( ISZ, 2 ) .EQ. 1 )
      .  .  MES(2) = MES(3)
      .  .  MES(3) = '+'
      .  ...FIN
      .  CALL WRITCH(MES, 4)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X PENDWN
.LIT
      SUBROUTINE PENDWN
      BYTE MESH(2), MESV(5)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /PENPOS/ IUPDWN
      DATA MESH, MESV / 'D', ' ', 27, '/', '0', 'd', 29 /
C       
      WHEN ( VISUAL )
      .  CALL WRITCH( MESV, 5 )
      ...FIN
      ELSE
      .  IF( IUPDWN .EQ. 0 ) CALL WRITCH(MESH, 2)
      .  IUPDWN = 1
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X PENUP
.LIT
      SUBROUTINE PENUP
      BYTE MESH(2), MESV(5)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /PENPOS/ IUPDWN
      DATA MESH, MESV / 'U', ' ', 27, '/', '1', 'd', 28 /
C       
      WHEN ( VISUAL )
      .  CALL WRITCH( MESV, 5 )
      ...FIN
      ELSE
      .  IF( IUPDWN .EQ. 1 ) CALL WRITCH(MESH, 2)
      .  IUPDWN = 0
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X PLOT
.LIT
      SUBROUTINE PLOT( IX, IY, IUD )
      BYTE LOWY, HIGHY, LOWX, HIGHX, YL, YH, XL, XH
      BYTE MES(10)
      LOGICAL VISUAL
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA YL, YH, XL, XH / 96, 32, 64, 32 /
1     FORMAT( I4, ',', I4, 1X )
C       
      IX0 = IX
      IY0 = IY
C       
C      CHECK TO SEE IF IN BOUNDS
C       
      CONDITIONAL
      .  ( IX0 .LT. IXMINF ) IX0 = IXMINF
      .  ( IX0 .GT. IXMAXF ) IX0 = IXMAXF
      ...FIN
      CONDITIONAL
      .  ( IY0 .LT. IYMINF ) IY0 = IYMINF
      .  ( IY0 .GT. IYMAXF ) IY0 = IYMAXF
      ...FIN
      WHEN (IUD .EQ. 1) CALL PENDWN
      ELSE CALL PENUP
C       
      WHEN ( .NOT. VISUAL )
      .  ENCODE( 10, 1, MES ) IX0, IY0
      .  CALL WRITCH(MES, 10)
      ...FIN
      ELSE
      .  MES(2) = MOD( IYCUR, 32 ) .OR. YL
      .  MES(1) = ( IYCUR / 32 ) .OR. YH
      .  MES(4) = MOD( IXCUR, 32 ) .OR. XL
      .  MES(3) = ( IXCUR / 32 ) .OR. XH
      .  MES(6) = MOD( IY0, 32 ) .OR. YL
      .  MES(5) = ( IY0 / 32 ) .OR. YH
      .  MES(8) = MOD( IX0, 32 ) .OR. XL
      .  MES(7) = ( IX0 / 32 ) .OR. XH
      .  CALL WRITCH(MES, 8)
      ...FIN
      IXCUR = IX0
      IYCUR = IY0
C       
      RETURN
      END
.ELI
.PG
.X PLTOFF
.LIT
      SUBROUTINE PLTOFF
      BYTE MES(6)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA MES/ 27, '[', '?', '6', 'i', ' '/
C       
      WHEN ( .NOT. VISUAL )
      .  CALL WRITCH(MES,6)
      ...FIN
      ELSE
      .  CALL WRITCH(24, 1)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X PLTON
.LIT
      SUBROUTINE PLTON
      BYTE MES(6)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      DATA MES/ 27, '[', '?', '7', 'i', ' '/
C       
      WHEN ( .NOT. VISUAL )
      .  CALL WRITCH(MES,6)
      ...FIN
      ELSE
      .  CALL WRITCH(31,1)
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X PUTCUR
.LIT
      SUBROUTINE PUTCUR( IX, IY)
      BYTE ESC, FF, SUB, ENQ, CHAR
      LOGICAL VISUAL
      COMMON /HBYTE/ ESC, FF, SUB, ENQ, CHAR
      COMMON /CRSPOS/ IXX, IYY
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
C       
      IF( VISUAL )
      .  CALL PLOT( IX, IY, 0 )
      .  CALL WRITCH( ESC, 1 )
      .  CALL WRITCH( '/', 1 )
      .  CALL WRITCH( 'f', 1 )
      .  CALL WRITCH( ' ', 1 )
      .  IXX = IX
      .  IYY = IY
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X REDSTR
.LIT
      SUBROUTINE REDSTR( IX, IY, STR, LEN, IROT, ISIZE )
      BYTE STR(1)
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
C       
      IF( VISUAL )
      .  CALL FNDCUR( IX, IY )
      .  CALL GETSTR( IX, IY, STR, LEN, IROT, ISIZE )
      ...FIN
C       
      RETURN
      END
.ELI
.PG
.X WRITCH
.LIT
      SUBROUTINE WRITCH( CH, N )
      BYTE VTBUFR(128), CH(N)
      INTEGER VTPOS, VTBUFL
      LOGICAL VISUAL
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /VTBUF/ VTBUFR, VTPOS, VTBUFL
C       
      IF( VTPOS + N .GT. VTBUFL ) CALL DMPPLT
      DO ( I = 1, N )
      .  VTPOS = VTPOS + 1
      .  VTBUFR(VTPOS) = CH(I)
      ...FIN
      IF ( VTPOS .GE. VTBUFL ) CALL DMPPLT
C       
      RETURN
      END
.ELI
.PG
.X WRTSTR
.LIT
      SUBROUTINE WRTSTR( STR, LEN, IROT, ISIZE )
      BYTE STR(LEN), MES(93), IPLS(2), INUM(5)
      LOGICAL VISUAL, INX, INY
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /DEVICE/ VISUAL, LUNPLT, ITTNUM
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
      DATA INUM, IPLS / ':', '0', '1', '2', '3', ' ', '+' /
1     FORMAT('$Warning  string ', 100A1)
2     FORMAT('  is out of bounds and will not be plotted')
3     FORMAT( 'S', 2I1, A1 )
C       
      ISZ = MIN0( MAX0( ISIZE, 1 ), 5 )
      IX = ICHW(ISZ) * LEN
      IY = ICHH(ISZ)
      IRT = MOD(IROT - 1, 4) + 1
      IRRT = MOD( 12 - 2 * IRT , 8 )
      ISX = IABS(IRT - 3) - 1
      ISY = IABS(IRT - 2) - 1
      IXL = ISX * IX - ISY * IY + IXCUR
      IYL = ISX * IY + ISY * IX + IYCUR
      INX = IXL .GE. IXMINF .AND. IXL .LE. IXMAXF
      INY = IYL .GE. IYMINF .AND. IYL .LE. IYMAXF
      WHEN ( INX .AND. INY )
      .  IXCUR = IXL + ISY * IY
      .  IYCUR = IYL - ISX * IY
      .  MINLEN = MIN0( LEN, 80 )
      .  WHEN ( .NOT. VISUAL )
      .  .  ENCODE(4,3,MES) IRT, (ISZ+2)/2, IPLS(MOD(ISZ,2)+1)
      .  .  DO ( I = 1, MINLEN ) MES(I + 4 ) = STR(I)
      .  .  MES( MINLEN + 5 ) = 95
      .  .  NUMCH = MINLEN + 5
      .  ...FIN
      .  ELSE
      .  .  MES(1) = 27
      .  .  MES(2) = 47
      .  .  MES(3) = 48
      .  .  MES(4) = 100
      .  .  MES(5) = 31
      .  .  MES(6) = 27
      .  .  WHEN ( ISZ .EQ. 1 ) MES(7) = '0'
      .  .  ELSE                MES(7) = '9'
      .  .  MES(8) = 27
      .  .  MES(9) = INUM(ISZ)
      .  .  MES(10) = 27
      .  .  MES(11) = 47
      .  .  MES(12) = IRRT + 48
      .  .  MES(13) = 101
      .  .  DO ( I = 1, MINLEN ) MES(I + 13) = STR(I)
      .  .  NUMCH = MINLEN + 13
      .  ...FIN
      .  CALL WRITCH(MES, NUMCH)
      ...FIN
      ELSE
      .  WHEN ( LUNPLT .EQ. ITTNUM )
      .  .  CALL PLTOFF
      .  .  CALL DMPPLT
      .  .  TYPE 1, (STR(I), I = 1, LEN)
      .  .  TYPE 2
      .  .  CALL PLTON
      .  ...FIN
      .  ELSE
      .  .  TYPE 1, (STR(I), I = 1, LEN)
      .  .  TYPE 2
      .  ...FIN
      ...FIN
C       
      RETURN
      END
.ELI
.COMMENT 

.pg
.C ;APPENDIX C - GRINNELL ROUTINES
.B 2
.LIT
        SUBROUTINE CIRCLE 
        SUBROUTINE COLTYP 
        SUBROUTINE DMPPLT 
        SUBROUTINE ENDPLT 
        SUBROUTINE ERASE  
        SUBROUTINE INIPLT 
        SUBROUTINE MARKER 
        SUBROUTINE PLOT   
        SUBROUTINE PLTOFF 
        SUBROUTINE PLTON  
        SUBROUTINE WRTSTR 
.ELI
.PG
.x CIRCLE
.lit
      SUBROUTINE CIRCLE( IX, IY, IR )
      PIN = .3141592654
      CALL PLOT( IX+IR, IY, 0 )
      R = IR + .5
      DO 10 I = 1, 20
      IXS = IX + R * COS( PIN * I )
      IYS = IY + R * SIN( PIN * I )
      CALL PLOT( IXS, IYS, 1 )
10    CONTINUE
C
      RETURN
      END
.eli
.pg
.x COLTYP
.lit
      SUBROUTINE COLTYP (ITYP)
C
C     THIS SUBROUTINE SETS THE LINE TYPE
C
      COMMON/COLOR/ISC
C
      ITYPE = MIN0(ITYP, 8)
      ITYPE = MAX0(ITYPE, 0)
      ISC = ITYPE + 1
      RETURN
      END
.eli
.pg
.x DMPPLT
.lit
      SUBROUTINE DMPPLT
      CALL GRSBFD
      RETURN
      END
.eli
.pg
.x ENDPLT
.lit
      SUBROUTINE ENDPLT
      CALL GRSEND
      RETURN
      END
.eli
.pg
.x ERASE
.lit
      SUBROUTINE ERASE
C
C     ERASES THE ENTIRE SCREEN AND SETS IT TO THE BACKGROUND COLOR
C
      CALL GRFER("7777, "7777, 0)
      RETURN
      END
.eli
.pg
.x INIPLT
.lit
      SUBROUTINE INIPLT(IUNIT,X,Y)
      COMMON /PAGSIZ/ XBOND, YBOND
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HSCALE/ XSLOPE, XCONST, YSLOPE, YCONST
      COMMON /HWINDO/ SCRX,SCRY,IXORIG,IYORIG,IASCR,IBSCR,ICSCR,IDSCR
      COMMON /WORLD/ XMINW, XMAXW, YMINW, YMAXW
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
      DATA IASCR, IBSCR, ICSCR, IDSCR, IXORIG, IYORIG, XCONST, YCONST 
     1    / 6 * 0, 2 * 0. /
      INTEGER DATA(8)
      COMMON/GRBUFR/IBUFL,IBUF(1000)
      DATA DATA,IBUFL/512,4095,15,111,255,240,3840,2309,1000/
C
      CALL GRSINI
      CALL GRFER("7777,"7777,0)
      CALL GRLWR(1,DATA,0,8,0)
C
      SCRX = 50.
      SCRY = 50.
C
      ICHW(1) = 7
      ICHW(2) = 7
      ICHW(3) = 14
      ICHW(4) = 14
      ICHW(5) = 14
      ICHH(1) = 9
      ICHH(2) = 9
      ICHH(3) = 18
      ICHH(4) = 18
      ICHH(5) = 18
C
      XBOND = X
      YBOND = Y
      XMINW = 0.
      XMAXW = 1.
      YMINW = 0.
      YMAXW = 1.
C
      CALL FRAME( 0., X, 0., Y )
      CALL WINDOW( .2 * X, .8 * X, .2 * Y, .8 * Y )
C
      RETURN
      END
.eli
.pg
.x MARKER
.lit
      SUBROUTINE MARKER( ISYM, ISIZE )
      INTEGER MARK(5)
      DATA MARK / 1, 2, 3, 4, 6 /
C
      ISZ = MAX0( MIN0(ISIZE, 5), 1 )
      MRK = MIN0( MAX0(ISYM, 0), 5 )
      IW = MARK(ISZ)
      CALL CURPOS( IX, IY )
      IF( MRK .NE. 0. ) GOTO 100
      CALL PLOT( IX-IW, IY, 0 )
      CALL PLOT( IX+IW, IY, 1 )
      CALL PLOT( IX, IY-IW, 0 )
      CALL PLOT( IX, IY+IW, 1 )
      RETURN
100   IF( MRK .NE. 1 ) GOTO 200
      CALL PLOT( IX-IW, IY-IW, 0 )
      CALL PLOT( IX+IW, IY+IW, 1 )
      CALL PLOT( IX+IW, IY-IW, 0 )
      CALL PLOT( IX-IW, IY+IW, 1 )
      RETURN
200   IF( MRK .NE. 2 ) GOTO 300
      CALL PLOT( IX-IW, IY-IW, 0 )
      CALL PLOT( IX+IW, IY-IW, 1 )
      CALL PLOT( IX+IW, IY+IW, 1 )
      CALL PLOT( IX-IW, IY+IW, 1 )
      CALL PLOT( IX-IW, IY-IW, 1 )
      RETURN
300   IF( MRK .NE. 3 ) GOTO 400
      CALL CIRCLE( IX, IY, IW )
      RETURN
400   IF( MRK .NE. 4 ) GOTO 500
      CALL PLOT( IX-IW, IY-IW, 0 )
      CALL PLOT( IX+IW, IY-IW, 1 )
      CALL PLOT( IX, IY+IW, 1 )
      CALL PLOT( IX-IW, IY-IW, 1 )
      RETURN
500   CALL PLOT( IX-IW, IY-IW, 0 )
      CALL PLOT( IX+IW, IY+IW, 1 )
      CALL PLOT( IX-IW, IY+IW, 1 )
      CALL PLOT( IX+IW, IY-IW, 1 )
      CALL PLOT( IX-IW, IY-IW, 1 )
C
      RETURN
      END
.eli
.pg
.x PLOT
.lit
      SUBROUTINE PLOT(IXO ,IYO ,IP)
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HCURPO/ IXCUR, IYCUR
C
      COMMON/COLOR/ISC
      INTEGER IDATA(4)
      IX = IXO
      IY = IYO
C
C     CHECK TO SEE IF IN BOUNDS
C     
      IF( IX .LT. IXMINF ) IX = IXMINF
      IF( IX .GT. IXMAXF ) IX = IXMAXF
      IF( IY .LT. IYMINF ) IY = IYMINF
      IF( IY .GT. IYMAXF ) IY = IYMAXF
C
C     SAVE CURRENT COORDINATES
C
200   IXCUR = IX
      IYCUR = IY
C
C     PLOT POINT
C
      IDATA(3)=IX
      IDATA(4)=IY
      IF(IP.EQ.1)CALL GRFVL(1,ISC,0,1,IDATA,2)
      IDATA(1)=IX
      IDATA(2)=IY
      RETURN
      END
.eli
.pg
.x PLTOFF
.lit
      SUBROUTINE PLTOFF
      RETURN
      END
.eli
.pg
.x PLTON
.lit
      SUBROUTINE PLTON
      RETURN
      END
.eli
.pg
.x WRTSTR
.lit
      SUBROUTINE WRTSTR(STR, LEN, IROT, ISIZE)
C
C     SUBROUTINE "WRITE STRING"
C     LEN IS THE LENGTH OF THE STRING
C     IROT DETERMINES THE ROTATION OF THE STRING (1 - 4), 1 IS
C     RIGHT SIDE UP, 2 IS ROTATED 90 DEGREES CLOCKWISE, ETC.
C     STRING IS CHECKED TO SEE IF IN IS IN BOUNDS
C
      COMMON /HFRAME/ IXMINF, IXMAXF, IYMINF, IYMAXF
      COMMON /HCURPO/ IXCUR, IYCUR
      COMMON /CHRSIZ/ ICHW(5), ICHH(5)
C
      BYTE STR(LEN)
      BYTE CHARB(886)
      INTEGER CHAR(223), LENGTH(223), MATRIX(8)
      DATA CHARB/
     1 "370,"220,"160," 20,"340,"210,"210,"210,"370,"210,"210,"160,
     1 "360,"210,"210,"360,"200,"200,"200,"360,"210,"210,"360,"210,
     1 "210,"360,"170,"200,"200,"200,"170,"160,"210,"200,"200,"200,
     1 "210,"160,"170,"210,"210,"170," 10," 10," 10,"360,"210,"210,
     1 "210,"210,"210,"360,"170,"200,"370,"210,"160,"370,"200,"200,
     1 "360,"200,"200,"370,"100,"100,"100,"340,"100,"110," 60,"200,
     1 "200,"200,"360,"200,"200,"370,"160,"210," 10,"170,"210,"210,
     1 "170,"160,"210,"270,"200,"200,"210,"160,"210,"210,"210,"360,
     1 "200,"200,"200,"210,"210,"210,"370,"210,"210,"210,"160," 40,
     1 " 40,"140," 00," 40,"370," 40," 40," 40," 40," 40,"370,"140,
     1 "220," 20," 20," 20," 20," 00," 20,"140,"220," 20," 20," 20,
     1 " 20," 70,"210,"220,"340,"240,"220,"200,"200,"210,"220,"240,
     1 "300,"240,"220,"210,"340,"100,"100,"100,"100,"100,"300,"370,
     1 "200,"200,"200,"200,"200,"200,"210,"250,"250,"370,"220,"210,
     1 "210,"210,"250,"250,"330,"210,"210,"210,"210,"310,"260,"210,
     1 "230,"230,"250,"310,"310,"210,"160,"210,"210,"210,"160,"160,
     1 "210,"210,"210,"210,"210,"160,"200,"200,"200,"360,"210,"210,
     1 "360,"200,"200,"200,"360,"210,"210,"360," 10," 10," 10,"170,
     1 "210,"210,"170,"150,"220,"250,"210,"210,"210,"160,"200,"200,
     1 "200,"310,"260,"210,"220,"240,"360,"210,"210,"360,"360," 10,
     1 "160,"200,"170,"160,"210," 10,"160,"200,"210,"160," 60,"110,
     1 "100,"100,"340,"100,"100," 40," 40," 40," 40," 40," 40,"370,
     1 "170,"210,"210,"210,"210,"160,"210,"210,"210,"210,"210,"210,
     1 " 40,"120,"210,"210,"210," 40," 40,"120,"120,"210,"210,"210,
     1 "210,"330,"250,"210,"210,"210,"330,"250,"250,"210,"210,"210,
     1 "210,"120," 40,"120,"210,"210,"210,"120," 40,"120,"210,"210,
     1 "160,"210," 10,"170,"210,"210,"210," 40," 40," 40," 40,"120,
     1 "210,"210,"370,"100," 40," 20,"370,"370,"200,"100," 40," 20,
     1 " 10,"370,"370,"210,"210,"120,"120," 40," 40," 40," 00," 40,
     1 " 40," 40," 40," 40,"120,"120,"120,"120,"120,"370,"120,"370,
     1 "120,"120," 40,"360," 50,"160,"240,"170," 40,"210,"200,"100,
     1 " 40," 20," 10,"210,"170,"220,"250,"140,"120,"120," 40,"100,
     1 " 40," 40," 40,"100,"100,"100,"100,"100,"100,"100," 40,"100,
     1 " 40," 40," 40," 40," 40," 40," 40,"100,"120," 40,"370," 40,
     1 "120," 40," 40,"370," 40," 40,"100," 40," 40,"370," 40,"200,
     1 "100," 40," 20," 10,"160,"210,"310,"250,"230,"210,"160,"160,
     1 " 40," 40," 40," 40,"140," 40,"370,"100," 40," 20," 10,"210,
     1 "160,"160,"210," 10," 60," 10,"210,"160," 20," 20,"370,"220,
     1 "120," 60," 20,"160,"210," 10," 10,"360,"200,"370,"160,"210,
     1 "210,"360,"200,"210,"160,"100,"100,"100," 40," 20," 10,"370,
     1 "160,"210,"210,"160,"210,"210,"160,"160,"210," 10,"170,"210,
     1 "210,"160," 40," 00," 00," 40,"100," 40," 40," 00," 40," 20,
     1 " 40,"100," 40," 20,"370," 00," 00,"370,"100," 40," 20," 40,
     1 "100," 40," 00," 40," 20," 10,"210,"160,"170,"200,"270,"250,
     1 "270,"210,"160,"160,"100,"100,"100,"100,"100,"100,"100,"160,
     1 " 10," 20," 40,"100,"200,"160," 20," 20," 20," 20," 20," 20,
     1 " 20,"160,"210,"120," 40,"377," 40,"100,"100," 70," 20,"174,
     1 "222,"222,"222,"174," 20," 70,"314,"110,"110,"204,"204,"204,
     1 "170,"374,"100," 40," 20," 10," 20," 40,"100,"374,"340,"100,
     1 "100,"100,"100,"100,"100,"104,"374,"356,"104,"104," 50," 50,
     1 " 20," 20,"204,"374,"204," 00,"170," 00,"204,"374,"204," 70,
     1 " 20," 20," 70,"124,"124,"124,"222," 70," 70," 20," 20," 20,
     1 " 20," 50," 50,"252,"104,"356,"104,"104,"104,"104,"104,"104,
     1 "104,"376,"170,"204,"200,"200,"160,"200,"204,"170,"170,"204,
     1 "204,"204,"264,"204,"204,"170,"140,"220,"220," 20," 20," 20,
     1 " 20," 20," 20," 20," 20," 20," 20," 20," 20," 20," 20," 20,
     1 " 20," 20," 20," 20," 20," 20," 20," 20," 20," 22," 22," 14,
     1 " 20," 20," 20," 20," 20," 20," 20," 20," 20,"154,"220,"220,
     1 "220,"220,"150,"200,"200,"360,"210,"210,"360,"210,"210,"160,
     1 "140," 20,"160,"200,"200,"160,"100,"100," 70,"100,"160,"210,
     1 "210,"160," 40,"100,"100," 70,"160,"200,"200,"340,"200,"200,
     1 "160,"100,"100,"160,"250,"250,"160," 20," 20," 40," 40," 20,
     1 " 20," 30,"224,"144," 04," 04," 04," 44," 44," 44,"244,"130,
     1 "140,"220,"200,"100,"100," 40,"104,"110," 50," 60,"250,"144,
     1 "210,"210,"110,"120," 60," 40," 40,"100,"200,"200,"350,"220,
     1 "220,"220,"220,"220,"300,"240,"220,"110,"110,"310,"140,"220,
     1 "210,"210,"110," 60," 40," 50," 50," 50,"250,"170,"140,"220,
     1 "220,"360,"220,"220,"140,"200,"200,"200,"340,"220,"220,"220,
     1 "140,"160,"210,"210,"210,"210,"174," 40," 40," 40," 40,"240,
     1 "170," 30," 44," 44," 44,"244,"144,"154,"272,"222,"222,"202,
     1 "104,"114," 52," 20," 20,"250,"144," 40," 40,"160,"250,"250,
     1 "250," 40," 40,"140,"220," 20,"140,"200,"200,"100,"170,"200,
     1 " 30," 40," 40," 40,"100," 40," 40," 40," 30,"300," 40," 40,
     1 " 40," 20," 40," 40," 40,"300," 20,"250,"100,"  0
     1 /
      DATA CHAR/
     1 30 * 886,
     1 886,886,346,353,356,363,370,377,384,387,396,405,410,415,418,
     1 419,420,425,432,439,446,453,460,467,474,481,488,495,499,504,
     1 509,513,518,525,006,020,032,046,058,072,086,100,113,128,142,
     1 156,168,180,192,206,220,232,244,258,270,282,294,306,320,332,
     1 532,541,546,555,558,886,001,013,027,039,053,065,079,093,107,
     1 120,135,149,163,175,187,199,213,227,239,251,265,277,289,301,
     1 313,327,865,685,874,883,886,886,886,886,886,886,886,886,886,
     1 15 * 886,
     1 886,886,886,886,886,886,886,886,886,886,886,886,603,339,639,
     1 562,587,886,886,655,886,596,886,886,886,630,647,886,578,886,
     1 621,886,571,886,612,886,886,886,886,886,886,559,694,700,709,
     1 719,727,734,742,749,757,886,763,769,777,785,791,797,803,810,
     1 818,824,830,886,836,842,848,856,886,886,886,886,886
     1 /
      DATA LENGTH/
     1 4122,4122,4122,-3094,3*4122,-10256,12*4122,-3102,9*4122,
     1 4122,4122,4218,4158,4218,4218,4218,4218,4158,4248,
     1 4248,4187,4187,4154,4125,4122,4187,4218,4218,4218,
     1 4218,4218,4218,4218,4218,4218,4218,4171,4186,4187,
     1 4171,4187,4218,4218,4218,4218,4218,4218,4218,4218,
     1 4218,4218,4218,4218,4218,4218,4218,4218,4218,4218,
     1 4218,4218,4218,4218,4218,4218,4218,4218,4218,4218,
     1 4248,4187,4248,4156,4122,4122,4186,4218,4186,4218,
     1 4186,4218,4216,4218,4202,4232,4218,4218,4186,4186,
     1 4186,4216,4216,4186,4186,4218,4186,4186,4186,4186,
     1 4216,4186,4248,4248,4248,4156,4122,4122,4122,4122,
     1 4122,4122,4122,4122,4122,4122,4122,4122,4122,4122,
     1 20*4122,
     1 4122,4122,4250,4218,4234,4250,4250,4122,4122,4576,
     1 4122,4218,4122,4122,4122,4250,4234,4122,4250,4122,
     1 4250,4122,4218,4122,4250,4122,4122,4122,4122,4122,
     1 4122,4158,4202,4248,4264,4234,4218,4234,4218,4232,
     1 4202,0026,4202,4234,4232,4202,4202,4202,4218,4232,
     1 4202,4202,4202,4122,4202,4202,4234,4248,4122,4122,
     1 4122,4122,4122
     1 /
C
C     CHECK TO SEE IF IN BOUNDS
C
      ISZ = MAX0(ISIZE, 1)
      ISZ = MIN0(ISZ, 5)
      ID = 0
      IF ( ISZ .GE. 3 ) ID = 1
      LEN1 = LEN
      DO 5 I = 1, LEN
      IF ( STR(I) .EQ. 96 ) LEN1 = LEN1 - 1
      IF ( STR(I) .LE. 31 ) LEN1 = LEN1 - 1
      IF ( STR(I) .EQ. 8 ) LEN1 = LEN1 - 1
5     CONTINUE
      IXW = ICHW(ISZ) * LEN1 
      IYW = ICHH(ISZ)
      IRT = MOD(MAX0(IROT - 1, 0), 4) + 1
      ISX = IABS(IRT - 3) - 1
      ISY = IABS(IRT - 2) - 1
      IXL = ISX * IXW - ISY * IYW + IXCUR
      IYL = ISX * IYW + ISY * IXW + IYCUR
      IF( IXL .LT. IXMINF .OR. IXL .GT. IXMAXF ) GOTO 100
      IF( IYL .LT. IYMINF .OR. IYL .GT. IYMAXF ) GOTO 100
C
C     PLOT STRING
C
      IX = IXCUR
      IY = IYCUR
      IESC = 0
      LNX = MOD ( ( ID + 1 ) * ISX + 1024, 1024 ) 
      LNY = MOD ( ( ID + 1 ) * ISY + 1024, 1024 )
      DO 20 I = 1 , LEN
         NCHAR = STR(I)
         NCHAR = NCHAR .AND. "377
         NCHAR = NCHAR + IESC
         IESC = 96
         IF ( NCHAR .EQ. 96 ) GOTO 20
         IESC = 0
         N = LENGTH( NCHAR )
         IOFF = ( MOD( IABS(N) , 16 ) - 10 ) * ( ID + 1 )
         IDX = N / 16
         N = MOD( IABS(IDX) , 64 )
         ISTR = CHAR( NCHAR )
         JJ = 0
         IXL = IX - IOFF * ISY
         IYL = IY + IOFF * ISX
         DO 15 II = 1, N
      	NCHAR = CHARB(II + ISTR - 1) .AND. "377
      	DO 10 J = 1, 8
      	NTWO = 2 ** ( 8 - J )
      	MATRIX(J) = NCHAR / NTWO
      	NCHAR = MOD ( NCHAR , NTWO )
10       CONTINUE
         CALL GRWDW(MATRIX,IXL,IYL,LNX,LNY,8,ID,ID,1,0)
         IXL = IXL - ISY * ( ID + 1 )
         IYL = IYL + ISX * ( ID + 1 )
15       CONTINUE
         INC = ( 3 + IDX / 64 ) * ( ID + 1 )
C
         IF ( INC .NE. 0 ) GOTO 17
      	IX = IX - IOFF * ISY
      	IY = IY + IOFF * ISX
C
17       IX = IX + INC * ISX
         IY = IY + INC * ISY
20    CONTINUE
      IXCUR = IX + ISY * IYW
      IYCUR = IY - ISX * IYW
      RETURN
C
C     STRING IS OUT OF BOUNDS
C
100   TYPE 1, (STR(I), I = 1, LEN)
      TYPE 2
C
      RETURN
1     FORMAT('$WARNING  string ', 100a1)
2     FORMAT('  is out of bounds and will not be plotted')
      END
.eli
.comment 

.pg
.NF
.c ;APPENDIX D - QUICK REFERENCE GUIDE
.b 2
SUBROUTINE ALLOUT( ix, iy, iud )
SUBROUTINE AXIS( xtic, ytic, ixtit, ixlen, ixsiz, ixfmt,
                             iytit, iylen, iysiz, iyfmt )
.b 1
SUBROUTINE CIRCLE( ix, iy, ir )
SUBROUTINE COLTYP( icol )
SUBROUTINE CONLGN( nl, title, n, icol, isym, inum, lintyp,
                                       xstrt, xlen, ystrt )
SUBROUTINE CURPOS( icurx, icury )
SUBROUTINE CURSON
.b 1
SUBROUTINE DASHLN( x, y, n, icol, isym, isize, inum, lintyp )
SUBROUTINE DEFWIN( xmin, xmax, ymin, ymax )
SUBROUTINE DMPPLT
SUBROUTINE DRDASH( ix, iy, iud )
SUBROUTINE DRWREC( xmin, xmax, ymin, ymax, icol )
SUBROUTINE DRXTIC( ix, iy, lentic )
SUBROUTINE DRYTIC( ix, iy, lentic )
.b 1
SUBROUTINE ENDLGN
SUBROUTINE ENDPLT
SUBROUTINE ERASE
.b 1
SUBROUTINE FNDCUR( ix, iy )
SUBROUTINE FNDINT( ix0, iy0, ix, iy )
SUBROUTINE FRAME( xminf, xmaxf, yminf, ymaxf )
.b 1
SUBROUTINE GETSTR( ix, iy, str, len, irot, isize )
.b 1
FUNCTION IFRMT( form, ifmt )
FUNCTION ISCRX( xwrld )
FUNCTION ISCRY( ywrld )
SUBROUTINE INILGN( xmin, xmax, ymin, ymax )
SUBROUTINE INIPLT( iunit, xsize, ysize )
SUBROUTINE INSECT( i1, j1, iplot, iplot0, x, y, nx, ny, l )
.b 1
SUBROUTINE LABELX( xval, form, iform, is, iy, ichw, ixsiz )
SUBROUTINE LABELY( yval, form, iform, is, iy, ichw, iysiz )
SUBROUTINE LINE( x, y, n, icol, isym, isize, inum )
.b 1
SUBROUTINE MARKER( isym, isize )
SUBROUTINE MOVETO( xwrld, ywrld, iud, lintyp )
SUBROUTINE MOV1ST( xwrld, ywrld, iud, lintyp )
.b 1
SUBROUTINE PENDWN
SUBROUTINE PENUP
SUBROUTINE PLOT( ix, iy, iud )
SUBROUTINE PLOT3D( f, x, y, nx, ny, xw, yw, xv, yv, zv, l, s )
SUBROUTINE PLTOFF
SUBROUTINE PLTON
SUBROUTINE PLTSTR( ix, iy, str, len, irot, isize )
SUBROUTINE PUTCUR( ix, iy )
.b 1
SUBROUTINE RECLGN( nl, title, n, icol, isym, inum, lintyp,
                                       xstrt, xlen, ystrt )
SUBROUTINE REDSTR( ix, iy, str, len, irot, isize )
.b 1
SUBROUTINE SCALE( xmin, xmax, ymin, ymax )
.b 1
SUBROUTINE TRIML( label, n, len )
SUBROUTINE TRIMSP( title, len, ist, iend )
.b 1
SUBROUTINE VUPORT( xmin, xmax, ymin, ymax )
.b 1
SUBROUTINE WINDOW( xwin0, xwin1, ywin0, ywin1 )
SUBROUTINE WRILGN( title, n, icol, isym, inum, lintyp )
SUBROUTINE WRITCH( ch, n )
SUBROUTINE WRTSTR( str, len, irot, isize )
.b 1
FUNCTION XWORLD( ix )
SUBROUTINE XAXIS( xtic, ixtit, ixlen, ixsiz, ixfmt )
.b 1
FUNCTION YWORLD( iy )
SUBROUTINE YAXIS( ytic, iytit, iylen, iysiz, iyfmt )
.pg
.c ;INDEX
.b 2
.px
