PGPLOT Installation Instructions: Windows 95/NT with PowerStation Fortran

Version 5.2.0

The following notes are based on information received from P. A. Seeger, C. T. Dum, and Joe Walston. Please send any suggestions for improvement to Tim Pearson.

Supported system: Microsoft Windows 95 or Windows NT with Microsoft PowerStation Fortran 4.0. Note: applications developed in this Fortran will not execute under DOS or Windows 3.x (no, not even with WIN32s).

Once PGPLOT.LIB is built, applications are most easily compiled using the Microsoft Developer Studio. The application type must be "QuickWin", or it must be compiled with command line option "/MW". Programs execute in a text window, with the graphical output in up to 8 separate child windows. Cursor functions (including rubber-band modes) are implemented with the mouse.

Installation Instructions

  1. Download PGPLOT by your favorite method from URL:

  2. Uncompress the file (gunzip) and extract the files from the tar archive (tar cv). Versions of gunzip and tar for Windows are available on the Web. One program that will handle both steps is WinZip. It is available from and many other web sites.

    The files in the tar archive are organized in a hierarchical directory structure, with the top level directory called PGPLOT. You will need the files from the following directories:

    The other SYS_* directories can be ignored.

    The directory PGPLOT\SYS_WIN contains system-specific files for this operating system and compiler:

         W9DRIV.F    (screen driver)
  3. Then follow the instructions in PGPLOT\SYS_WIN\AAAREAD.ME (below). These instructions apply to both Microsoft PowerStation Fortran and Compaq/Digital Visual Fortran. Note that for PowerStation Fortran, you must edit the file W9DRIV.F.
                   PGPLOT 5.2.0  for  Windows95/98/NT
                and Microsoft / Digital / Compaq Fortran
                     P. A. Seeger, August 27, 1998
                    (document revised July 15, 2000)
                     (Based on C. T. Dum, May 1995)

The following notes describe the porting of Tim Pearson's PGPLOT 5.2.0
to Microsoft Windows95/98 (or WindowsNT), using Microsoft Developer Studio 
and the corresponding Fortran compiler.  The 32-bit Windows systems 
are easy to use, but most importantly remove the severe memory restrictions
of DOS.  The size of applications which can be linked with PGPLOT.LIB is 
limited only by total physical and virtual memory.  The graphics libraries
MSFLIB (Microsoft) or DFLIB (Digital/Compaq) also include many additional 
(system) functions known from C.  Even for an old-fashioned command-line 
Fortran programer (like PAS), it is relatively easy to add features like 
dialog boxes and custom menus.

Once PGPLOT.LIB is built, applications are most easily compiled using 
the Microsoft Developer Studio.  The application type must be "QuickWin",
or it must be compiled with command line option "/MW".  Programs execute 
in a text window, with the graphical output in up to 8 separate child 
windows.  Cursor functions (including rubber-band modes) are implemented 
by moving the mouse and typing a keyboard key.  There are three versions
of the Developer Studio.  You MUST have the same version for Fortran and 
for C++ in order to mix languages.  Although the Fortran code is the same,
the user interface is slightly different.  The versions are
   Developer Studio 4.0, Microsoft PowerStation Fortran 4.0
   Developer Studio 5.0, Digital Visual Fortran 5.0
   Developer Studio 6.0, Digital Visual Fortran 6.0
                      or Compaq Visual Fortran 6.1
NOTE: applications developed in these Fortrans will NOT execute under 
   DOS or Windows 3.x (no, not even with WIN32s installed).

The steps in building PGPLOT.LIB are the following: 

1. Download PGPLOT 5.2.0 by your favorite method.  I decompressed ver. 
   5.0.3 on VAX-VMS system, and ver. 5.1.beta from a Unix machine 
   ("uncompress" followed by "tar -xcf").  But I have now acquired
   WinZip (Nico Mak Computing, Inc., which performs Gunzip
   and tar in the PC (very good program - I even sent them the $29 fee!).
   Just make the file name "PGPLOT52.TGZ" and open it in WinZip.

2. Create an appropriate subdirectory structure; e.g.
   where x: is either C: or another hard disk in your system.  Extract 
   files from the corresponding subdirectories of the downloaded .TGZ file.
   Note: The copy of GRGFIL.F from the \SRC folder must be omitted in favor
   of the copy in \SYS_WIN to get an appropriate default directory.
   (Personal preference note: I also copy \APPLICAT\PLOT10\PLOT10.F into 
   the \SRC subdirectory.)  

   The files in \SYS_WIN should include
      AAAREAD.ME   (this file)
      AAAREAD.ME2  (information for C programmers)
      GIDRIV.F     (Fortran90 version of GIF driver, without "C" calls)
      GRGFIL.F     (replace the version in \SRC)
      GRSY00.F     (not system dependent)
      PGBIND.MAK   (see AAAREAD.ME2 for discussion)
      W9DRIV.F     (the driver itself, with attached subroutines)

   The file W9DRIV.F as included is appropriate for Digital or Compaq.  
   To convert to Microsoft, replace the fourth line
   This same change must be made in subroutines GRW900 and GRW901.

3. If you did not use C: in step 2, create a directory C:\PGPLOT and copy
   RGB.TXT to it from x:\PGPLOT.  You also need to compile and execute the
   program PGPACK from subdirectory x:\PGPLOT\FONTS to convert file 
   GRFONT.TXT to binary file GRFONT.DAT.  To run PGPACK in the Windows
   environment, put this statement before the READs:
         OPEN (5, FILE='x:\pgplot\fonts\grfont.txt')
   Likewise the OPEN statement for the output can be modified:
         OPEN (2, FILE='c:\pgplot\grfont.dat')
   The output file is different for Microsoft and Digital/Compaq.  (The 
   directory with these two files can be elsewhere if identified by
   environment variable PGPLOT_DIR, or the full [path]filenames can be
   given in environment variables PGPLOT_RGB and PGPLOT_FONT.)

4. In the Developer Studio, in the File/New menu, Create a new Project 
   Workspace of Type "Static Library", Name PGPLOT, Location 
   x:\MSDEV\PROJECTS\  (ver. 4) or  
   x:\Program Files\DevStudio\MyProjects\  (ver. 5) or
   x:\Program Files\Microsoft Visual Studio\MyProjects\  (ver. 6).
   Use the Insert/"Files into Project..." (ver. 4)  or
           Project/Add to Project/Files... (vers. 5/6)
   and the search box to associate the following files with the project:
   (The dependent *.INC files will be included automatically.)

5. Build the project.  For Digital/Compaq, the following compiler option
   is required for GIDRIV.F (because Digital changed the default for length
   of direct-access records from bytes to 4-byte words):
   This option is set as follows:
      Project/Settings/Fortran tab
      Settings For: All Configurations
      Source files: Gidriv.f
      Category: Fortran Data
      ver. 5, check: Use Bytes as Units for Unformatted Files 
      ver. 6, Data Options
              check: Use Bytes as RECL= unit for Unformatted Files
   The remaining default compiler options are suitable; in particular, 
   the Debug configuration is not optimized, but the Release configuration
   uses full optimization.  (If the choice of "Release" is not apparent, 
   use Build/Set Active Configuration...)  From the Build menu, choose 
   "Build PGPLOT.LIB".  Expect 7 Warning messages with ver. 4, or 2 with 
   vers. 5/6.  When both Debug and Release have successfully completed, I
   like to copy the Release version of the library so that subsequent 
   applications can find it more easily:  
           to    x:\MSDEV\LIB
   ver. 5, from  x:\Program Files\DevStudio\MyProjects\PGPLOT\RELEASE
           to    x:\Program Files\DevStudio\DF\LIB
   ver. 6,
    from x:\Program Files\Microsoft Visual Studio\MyProjects\PGPLOT\RELEASE
    to   x:\Program Files\Microsoft Visual Studio\DF98\LIB

6. Run the examples.  In the same Project Workspace, use File/New and the
   Projects tab (or if using ver. 4, Insert/Project...) to create a
   "QuickWin Application", Name EXAMPLES.  Then use Project/Dependencies
   (ver. 4, Build/Subprojects...) to specify that PGPLOT is a subproject of
   EXAMPLES.  One at a time, use Project/Add to Project/Files... (ver. 4,
   Insert/Files into Project...) to select a file from x:\PGPLOT\EXAMPLES.
   (The previous file may be deleted from the FileView window when success-
   fully completed.)  From the Build menu, choose "Execute EXAMPLES.EXE".
   The first page of the first test (PGDEMO1.F) should be a parabola.  If 
   there is no text on the plot, then you have not successfully created or
   located the file GRFONT.DAT (see step 3 above).  If windows are created
   but neither graphics nor text appear, the problem may be that the 
   display is set to a mode which doesn't use the SVGA color registers; 
   decrease the color palette to 16M or fewer colors.  After successfully
   testing the library, you may delete all of the PGPLOT folders from  
   x:\MSDEV\PROJECTS  (ver. 4) or from
   x:\Program Files\DevStudio\MyProjects\  (ver. 5) or from
   x:\Program Files\Microsoft Visual Studio\MyProjects\  (ver. 6).

7. Drivers for Windows95/NT, PostScript, GIF, LaTeX, and the Null driver
   are included by default. If you add additional drivers (which may 
   require debugging to eliminate perceived syntax errors etc.) to the 
   library, then the CASE structure in subroutine GREXEC.F must also be 
   modified to reflect the changes; also, NDEV must reflect the total 
   number of drivers.  The default graphic window size for device type 
   "/W9" is 800*600 with 236 colors (SVGA); 20 colors are reserved for 
   system use.  The default can be changed by setting an environment 
   variable (either in AUTOEXEC.BAT, or from a command line before 
   starting the application) as follows: 
      SET PGPLOT_VIDEO=VGA  (or V),   640 * 480
                       SVGA (or S),   800 * 600
                       XGA  (or X),  1024 * 768
                       ZGA  (or Z),  1280 * 1024
   Modes may also be selected by using alternate device types
   "/WV", "/WS", "/WX", or "/WZ".  Modes exceeding the capability of your
   Windows screen driver will be reduced to the maximum available.  For
   an example of the 236-color modes, see PGDEMO4.  For an example of
   different resolutions, try using "Menu/WV" for the first window and
   "Graphs/WX" for the second window in PGDEMO13.  (Note the use of the 
   device specification to name the window.)

8. The cursor is emulated by an interrupt driven mouse routine (see
   GRW901 in file W9DRIV.F).  The cursor moves continuously whenever
   the window is selected, but the position is not returned to the
   calling program until a key has been struck, and the character is
   also returned.  Control then returns to the "text" window for any
   additional input or processing.  If you lose track, there is a status 
   message at the bottom of the frame window which tells you which 
   window is waiting for input (except, see Note in previous section).
   The color of the cursor may be dim against some backgrounds 
   (especially green in the default palette), but you can usually see it
   at the tip of the mouse arrow while you move it around.  You might 
   try using PGBAND mode 7 for the cursor to improve visibility.  See 
   especially programs PGDEMO5 and PGDEMO6.

9. Plots can be clipped and copied to other applications, such as Word.
   Unfortunately, black is black and white is white, so printing uses a
   lot of ink and the white lines tend to disappear.  One option is to 
   exchange palette colors 0 and 1 in PGPLOT with 
      CALL PGSCR(0, 1., 1., 1.)    !black becomes white
      CALL PGSCR(1, 0., 0., 0.)    !white becomes black
   before making the version to be printed; another is to cut and paste 
   to a utility (I use Paint-Shop-Pro) in which you can adjust the color 
   palette; and a third way is to specify either the "" or 
   "filename.gif/GI" device and write a file.  (Note: this might be a 
   good use for a custom menu entry in your application.)  Yet another 
   option is to create a second device window and change the color 
   palette only in that window.  (See PGDEMO13 for an example of multiple
   simultaneous windows.)

10. Finally, this port has been thoroughly tested (starting with earlier
   versions of PGPLOT, and using the Microsoft compiler), but no 
   responsibility for any damages is accepted (by either [PAS], [CTD], 
   or even [TJP])!  User input concerning "features" of the driver or
   this document is welcomed.

*** Frequently Asked Questions ***

A. "A window is created, but nothing appears in it."
   Most new graphics driver cards do not emulate color registers when 
   they run in "True Color (32 bit)" mode.  You will have to reset the
   Display Properties (Settings tab) to a smaller number of colors, such
   as "High Color (16 bit)."

B. "Graphs appear, but no labels."
   Review step 3 above.  The version of file GRFONT.DAT for your compiler
   must be in directory C:\PGPLOT\.

C. "All of the demo programs work, except PGDEMO3 gives a Linker error."
   There is a bug in PGDEMO3 that is only picked up by these compilers.
   About 27 lines from the end of PGDEMO3.F, the statement
      CALL PGVSTD(0.05,0.95,0.05,0.95)
   must be replaced with

D. "I can't read the hardcopy files created with "/GI".
   Review step 5 above.  Some applications (namely Paint-Shop-Pro) will 
   read files written when the code is compiled without this option, but 
   most will not.  If you read the file in Paint-Shop-Pro and then save 
   it, other applications will be able to read it.

Using the C binding

The PGPLOT C binding (cpgplot) allows the Fortran PGPLOT library to be called from C programs, using C calling conventions. The following instructions apply to Other compilers may use different calling conventions and will require a different version of the C binding.

To build the cpgplot binding library, you will need the following files:

These files can be located anywhere convenient.

To build the library, from a console (DOS) window type

This will create cpgplot.lib and cpgplot.h.

The makefile compiles pgbind.c (no unusual compiler flags are needed) to produce the pgbind program. It then produces the C wrapper functions (one file per wrapper) and the cpgplot.h header file using:

   pgbind ms -w -h pgbind_prototypes
The cpg*.c files are then compiled and gathered into a library.

To use cpgplot in your programs, you should include cpgplot.h at the top of all C files that use cpgplot functions, and link your programs with both of cpgplot.lib and pgplot.lib.

For further information about using the C binding, see file

or the Web page

Tim Pearson, California Institute of Technology, tjp·
Copyright © 1997-2002 California Institute of Technology