| EXTERNAL-1
(to EXTERNAL-10) |
Access to user-supplied FORTRAN subroutines |
`Ports' are provided for up to 10 external FORTRAN subroutines. These can access the data by means of common blocks declared in the INCLUDE files STACKCOMM.INC and FLAGCOMM.INC (see appendix F.4 for further details of these include files), and have a single formal parameter which is an error return. Such subroutines can be linked easily to the program, and provide a relatively easy access to user-defined functions. In the near future I think I will define the stack area as a global section, so that user programs can be invoked using the facility for calling VMS commands in the command line.
The external routines are invoked by the commands EXTERNAL-1 through EXTERNAL-10. These ten SPECX commands above give access to the ten subroutines EXTRNL1 through EXTRNL10. They must be subroutines rather than functions, and the only argument is a status return. A typical subroutine might take the form:
SUBROUTINE EXTRNL2(IFAIL)
C This routine is just to demonstrate the form
INTEGER IFAIL
INCLUDE 'FLAGCOMM'
INCLUDE 'STACKCOMM'
IFAIL=0
.
.
.
RETURN
END
Any user input required by the subroutine should be obtained by using the routines GEN_GETtna (where t is the type I or R, n is the number of bytes per word, 4 or 8, and a is equal to A for input of arrays).
Use of the routines is facilitated by defining a commands symbol with an informative name so that information is available through the SHOW-COMMANDS facility. For example, if the purpose of your subroutine is to do some fancy filtering you might define a symbol FANCY-FILTER-SPECTRUM, which contains a single command, EXTERNAL-1.
For further information on external commands, and on how to link and run your private version of SPECX with your own externals, consult Appendix G