HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
MODULE PROCEDURE
Chapter 10 401
MODULE PROCEDURE
Specifies module procedures in a generic interface.
Syntax
MODULE PROCEDURE
module-procedure-name-list
module-procedure-name-list
is a comma-separated list of
module-procedure-name
s.
Description
A MODULE PROCEDURE statement appears within an interface block. It is used when the
specification is generic and a specific procedure is defined within the module rather than as an
external procedure. The MODULE PROCEDURE statement only names the subprograms; it does
not contain the definition of the interface. The named subprograms must be defined within
the current module or within another module that is accessible by use association.
Examples
MODULE path
! module data environment; module procedures contained in this
! module have access to this data environment
REAL x, y, z
! Generic name substance for procedures air and water
INTERFACE substance
MODULE PROCEDURE air, water
END INTERFACE
INTERFACE OPERATOR (*)
MODULE PROCEDURE rational_multiply
END INTERFACE
...
! Module procedures are preceded by CONTAINS
CONTAINS
SUBROUTINE air (contents)
...
END SUBROUTINE air
SUBROUTINE water (x, a, z)
! x is a dummy argument, y is from the module data
! environment
a = x + y
...
END SUBROUTINE water
FUNCTION rational_multiply (x, y)
TYPE (rational) :: rational_multiply