Chapter 10. Fortran 77 Language

As discussed in the preceding section, PLplot's integer representation is a PLINT and its floating point representation is a PLFLT. To the Fortran 77 user, this most commonly translates to a type integer and type real, respectively. This is somewhat system dependent (and up to the installer of the package) so you should check the release notes to be sure, or just try it and see what happens.

Because the PLplot kernel is written in C, standard C syntax is used in the description of each PLplot function. Thus to understand this manual it is helpful to know a little about C, but fortunately the translation is very easy and can be summarized here. As an example, the routine plline call from C would look like:


      plline(n,x,y);
    
while from Fortran 77 it would look like:

      call plline(n,x,y)
    
typically with n declared as type integer and x, y declared as type real (arrays in this case). Each C language type used in the text translates roughly as follows:

PLFLTreal
PLINTinteger
char *character
PLFLT *real or real array
PLFLT **real array
"string"'string'
array[0]array(1)

In C there are two ways to pass a variable --- by value (the default) or by reference (pointer), whereas only the latter is used by Fortran 77. Therefore when you see references in the text to either an ordinary argument or a pointer argument (e.g. *data), you simply use an ordinary Fortran 77 variable or array name.

The PLplot library comes with a set of Fortran 77 interface routines that allow the exact same call syntax (usually) regardless of whether calling from C or Fortran 77. In some cases, this means the subroutine name exceeds 8 characters in length. Nearly every Fortran 77 compiler available today allows subroutine names longer than 8 characters, so this should not be a problem (although if it ever is, in principle a truncated name could be defined for that platform).

These "stub" routines handle transforming the data from the normal Fortran 77 representation to that typically used in C. This includes:

This all seems a little messy, but is very user friendly. Fortran 77 and C programmers can use the same basic interface to the library, which is a powerful plus for this method. The fact that stub routines are being used is completely transparent to the Fortran 77 programmer.

For more information on calling PLplot from Fortran 77, please see the example Fortran 77 programs (/examples/f77/x??f.f) through distributed with PLplot.