HP 3000 Manuals

Built-In Functions [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

Built-In Functions 

Arguments of a FORTRAN subprogram are passed by reference, except for
character variables, which are passed by descriptor.  To call subprograms
written in another language, you might have to pass arguments that are
different from those used by FORTRAN. To handle this difference, HP
FORTRAN 77/iX has built-in functions, as summarized below:

-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
|     Intrinsic     |            Description             |            Restrictions            |
|     Function      |                                    |                                    |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
| %VAL(arg)         | Passes the argument as an          | arg can be a constant, variable,   |
|                   | immediate value.  If the argument  | array element, or an expression.   |
|                   | is shorter than 32 bits, it is     |                                    |
|                   | sign-extended to a 32-bit value.   |                                    |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
| %REF(arg)         | Passes the address of the value.   | arg can be a numeric value, a      |
|                   |                                    | character expression, an array, an |
|                   |                                    | array element, or a procedure      |
|                   |                                    | name.                              |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
| %LOC(value)       | Returns the internal address of a  | value can be a variable name, an   |
|                   | storage element.  The result is of | array element name, an array name, |
|                   | type INTEGER*4.  %LOC is           | a character substring name, or an  |
|                   | equivalent to the FORTRAN          | external procedure name.           |
|                   | intrinsic BADDRESS.                |                                    |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------

These functions are extensions to the ANSI standard.

To change the form of the argument, the built-in functions can be used in
the argument list of a CALL statement or a function reference, as shown
below.

          Examples                                     Notes 

--------------------------------------------------------------------------------------

CALL routine(%VAL(a),k)      Passes the argument a as an immediate value.

CALL routine2(%REF(a))       Passes the argument a by reference.


NOTE The built-in functions %VAL or %REF can only be called in the actual argument list.


MPE/iX 5.0 Documentation