Up | Previous | Next | Title Page | Contents

2.4 FORTRAN Calling Sequence

The Run-Time Library has two entry points (called language bindings) for every routine. One is designed to be called from FORTRAN only, and the other is designed to be called from C only. The FORTRAN routines start with “x”, as in xvread, xladd, etc.

2.4.1 Character Strings

Most RTL routines take characters strings as arguments. They appear in parameter names, key words, messages, and many other places. Under the old RTL, strings could be passed in either of two ways: as FORTRAN CHARACTER*n variables, or as BYTE or LOGICAL*1 arrays. The array method will no longer work.
All FORTRAN-callable RTL routines accept character strings only in FORTRAN CHARACTER*n format. CHARACTER*n variables and constants have a length associated with them (the “n”), which the RTL uses to find the end of the string, and to make sure that buffer overflow does not occur on output strings. Byte arrays can’t be used, since in FORTRAN there is no way for the RTL to find the end of the string. Arrays of CHARACTER*1 will not work; the RTL will think the string being passed in is one character long.

2.4.2 FORTRAN Data Types

The standard FORTRAN definitions for each of the VICAR pixel data types are listed below in Table 6: FORTRAN declarations for pixel types. The data types that may be passed in to the RTL, and the FORTRAN declarations for each type, are listed below in Table 8: FORTRAN declarations for Run-Time Library arguments.
Pixel Type
FORTRAN Declaration
BYTE
BYTE
HALF
INTEGER*2
FULL
INTEGER*4
REAL
REAL*4
DOUB
REAL*8
COMP
COMPLEX*8

Note the use of the “*n” form, even where not strictly necessary. This is intentional; please use the form shown for all pixel data.

Table 6: FORTRAN declarations for pixel types

RTL Argument Type
FORTRAN Declaration
integer
INTEGER
string
CHARACTER*n
value
INTEGER, CHARACTER*n, REAL, or DOUBLE PRECISION
integer array
INTEGER x(m)
string array
CHARACTER*n x(m)
value array
array of any “value” type above
pixel buffer
pixel pointer
N/A

The “*n” is not used for arguments, except for strings. This helps to distinguish pixel data (which uses “*n”) from other types of data.

Table 8: FORTRAN declarations for Run-Time Library arguments


Up | Previous | Next | Title Page | Contents