Chapter 8. Fortran 95 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 95 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 95 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 95. 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 95 variable or array name.

The PLplot library comes with a set of Fortran 95 interface routines that allow the exact same call syntax (usually) regardless of whether calling from C or Fortran 95. In some cases, this means the subroutine name exceeds 8 characters in length. Nearly every Fortran 95 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 95 representation to that typically used in C. This includes:

This all seems a little messy, but is very user friendly. Fortran 95 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 95 programmer.

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