                    PGPLOT on NeXT Computers

                        Allyn F. Tennant
                   Marshall Space Flight Center
                          1999-Feb-23

OVERVIEW:
This directory contains an update of the Next backend needed for PGPLOT.
This version has been tested only with OpenStep 4.2 for Mach on Intel
hardware.  In theory it should work with any OpenStep implementation,
but you have been warned.  The updates include:

1) The nexsup routine needed by nedriv.f no longer uses any Next
specific code.  It has been rewritten to use standard UNIX internet
stream sockets.  This has two big advantages.  First, if the next
driver nedriv.f is included in the pgplot library, no additional Next
specific libraries are required making it easier to link PGPLOT programs
that use this driver.  Second, it is now possible for nedriv.f on
any system, and have it send display PostScript over the network to
be viewed on an OpenStep system.  This does not use X Windows.

2) pgview itself no longer uses .nib files from the Interface Builder.
This removes the need for any NeXT proprietary software.


SUPPORTED CONFIGURATIONS:

f2c_cc   This intended is for people who have the Next Development
         and only want to install a minimal Fortran.  By default the
         demo programs are not linked with the X11 libraries.  If you
         wish to include an X11 driver, then you will need to edit
         f2c_cc.conf to add the needed libraries to the LIBS definition.

g77_gcc  Uses the GNU compilers.  In theory, this should actually work
         with GNUStep the GNU implementation of OpenStep.  By default
         the demo programs are linked with the X11 libraries.  If you
         don't have those libraries installed then you will need
         to edit g77_gcc.conf to make LIBS a blank string.


X WINDOWS:
If you have installed an X window packate, the /XWIND and/or /XSERVE
drivers compile fine on OpenStepm.  If the linker complains that the
setpgid is not defined in the pgxwin_server program, you should edit
pgxwin_server.c and just comment out the call to setpgid(0,0).  The
pgxwin_server will run fine without this, although aborting the PGPLOT
program, via a ^C, may also abort the server.


MAKE PGPLOT:
You should now refer to the standard PGPLOT documentation to create
a makefile, and then compile PGPLOT.  In brief you will need to create
a directory where you can build PGPLOT, create a drivers.list file
(make sure you include the NEXT driver!) and then use the

$(PGPLOT)/makemake $(PGPLOT) openstep f2c_cc

where $(PGPLOT) is the directory containing the PGPLOT source.  Then
type make and wait.  This will create the library, demos, help files,
and the pgview program.  If you have asked for the XWIND driver, the
pgxwin_server program should also be created.

Note, the makefile will no longer create pgview.  To create this
program

cd sys_openstep/pgview
gnumake

I.e., you must use the Next supplied gnumake and not make.  If you
wish to use make then you can try

make -f makef

should work.  This fails to build an application directory that a
user can double click on, but otherwise works fine.

For best results you should install pgview.app into the /LocalApps
directory.  Use the following commands to do this:

strip pgview.app/pgview
cp -pr pgview.app /LocalApps

Using 'strip' will reduce the size of the program by a factor 6 which
improves startup time.


ENVIRONMENT VARIABLES:
PGVIEW   if the viewer is not running when you select the /next then
         nedriv tries to open /LocalApp/pgview.app/pgview.  If you
         have installed the viewer anywhere else, the PGVIEW should
         contain the full path to the pgview program itself.

DISPLAY  This is often set and used by X-Window based systems.  nedriv.f
         uses DISPLAY in the same way.  In brief, if DISPLAY is defined
         then nedriv will attempt to connect to a pgview on the machine
         specified.  This does *not* use X-windows in any manner, I just
         happen to use the same environment variable.  Also if the
         string contains a colon, it and everything following is ignored.


NETWORK ACCESS:
Since the interprocess communication between PGPLOT and the viewer
now uses internet sockets it is no longer necessary for the PGPLOT
program and the viewer to run on the same system.  In fact the viewer
sees all communications as coming from the network.  By default. PGPLOT
and pgview both connect to "localhost" which is the so called loopback.
Thus if both PGPLOT and the viewer are running on the same machine,
they will always be able to communicate via localhost.  The viewer
also figures out the name and IP address of your machine and allows
access from there.  In general this address is not used.  It is only
provided since it is functionally equivalent to using "localhost"
and to allow for users who have set the DISPLAY environment variable
to be the actual name of the local machine.

The first time a remote system tries to connect to pgview, pgview
will put up an alert panel telling you the name of the remote system
and giving you a chance to either accept or reject the connection
attempt.  Clearly if you don't recognize the remote machine you should
reject the connection.  This tends to (rightfully :-) hang the remote
program.  Once you have allowed a connection from a machine then that
name will be listed in the Hosts submenu and any program/user on that
machine will be able to connect to pgview with no further prompting.

All machines that can access the viewer are listed in the "Hosts"
submenu found on the main pgview menu.  If you click on one of the
machines listed, an alert panel will pop up asking if you want
to remove that system.  If you click yes, then that name will be
removed from the hosts submenu, and any further connection attempts
from that machine will result another alert panel asking you to
accept or reject the connection.

For the experts, pgview listens port 7974 for connection attempts.
Use of this port for other activities is discouraged.


USEFUL TIPS WHEN USING PGVIEW:
If the environment variable PGVIEW is defined and PGPLOT fails to
connect with a server, then the PGPLOT program will *always* try running
the program specified in PGVIEW and reconnecting.  Thus PGVIEW could
actually point to a shell script which could do anything including
using rsh to start pgview on a remote system.  You are only limited
by your imagination and your network security policies.

Remember that as part of the standard NeXT interface, holding down
the alternate key while clicking in the title bar will bring the window
to the top without making it key.

Use the main menu to select either a Portrait or Landscape window.
Although the window can be resized, PGPLOT produces slightly different
output depending on the original aspect ratio of the plot.  These
aspect ratios were selected to match the aspect ratios of the /PS
and /VPS devices.  If you start with a Landscape window, then no matter
how you resize the window with the resize bar, PGPLOT will still assume
the same aspect ratio when drawing.  In other words, you first create
a plot and then resize window, it will look exactly the same as if you
had first first resized the window and then created the plot.

When PGPLOT starts, it plots to the most recently active viewer window
i.e., the last key window.  The viewer will not allow you to change
the active plot window while a plot is in progress.  If pgplot has
not closed the plot (by sending an end_picture) then the window is
marked as "edited" and you will not be able to delete the window.


BUG REPORTS:

Please send bug-reports/suggestions/thank-you notes (but not money)
to:

Internet:  allyn.tennant@msfc.nasa.gov

Do NOT send NextMail to that address.  Like all free support, you get
what you pay for.
