HP 3000 Manuals

Matching Actual and Formal Parameters [ HP FORTRAN 77/iX Programmer's Guide ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Programmer's Guide

Matching Actual and Formal Parameters 

When a procedure or function is identified as an intrinsic, the formal
parameters do not have to be listed.  When an intrinsic is called, the
compiler checks the SYSINTR file to compare the actual parameters with
the formal parameters.  Table 8-5  shows how HP FORTRAN 77/iX actual
parameters are matched to the intrinsic formal parameters.

          Table 8-5.  HP FORTRAN 77/iX and HP Pascal/iX Data Types 

----------------------------------------------------------------------------------
|                          |                          |                          |
|     HP FORTRAN 77/iX     |     Corresponding HP     |       Description        |
|        Data Type         |        Pascal/iX         |                          |
|                          |        Data Type         |                          |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| INTEGER*2                | SHORTINT or range type   | 16-bit signed integer    |
|                          | (User-defined)           | (I16)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| INTEGER*4                | INTEGER or range type    | 32-bit signed integer    |
|                          | (User-defined)           | (I32)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| Not available            | LONGINT or range type    | 64-bit signed integer    |
|                          | (User-defined)           | (I64)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| INTEGER*2                | BOOLEAN or range type    | 16-bit unsigned integer  |
|                          | (User-defined)           | (U16)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| INTEGER*4                | User-defined range type  | 32-bit unsigned integer  |
|                          |                          | (U32)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| Not available            | User-defined range type  | 64-bit unsigned integer  |
|                          |                          | (U64)                    |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| REAL*4                   | REAL                     | 32-bit real (R32)        |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| REAL*8                   | LONGREAL                 | 64-bit real (R64)        |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| LOGICAL*2                | BOOLEAN                  | Boolean (B)              |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| CHARACTER                | CHAR                     | Character (C)            |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| INTEGER*4                | LOCALANYPTR              | 32-bit address (@32)     |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| Not available            | GLOBALANYPTR             | 64-bit address (@64)     |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| Equivalent array type    | ARRAY (any type)         | Array (A)                |
|                          |                          |                          |
----------------------------------------------------------------------------------
|                          |                          |                          |
| Array type               | RECORD (any type)        | Record (REC)             |
|                          |                          |                          |
----------------------------------------------------------------------------------

Example 

           PROGRAM intrinsic_example

           IMPLICIT NONE

           SYSTEM INTRINSIC fopen,read,fgetinfo,fclose,printfileinfo
           SYSTEM INTRINSIC fcontrol

           CHARACTER*36 filename,cmd,fname
           CHARACTER tab*10
           INTEGER*2 ifnum,recsize
           INTEGER*2 tlen,i
           INTEGER*4 eof

      1    FORMAT (1X)
      2    FORMAT (A,'Input file  > ')
      3    FORMAT (1X,'The file ',A8,' has record length of ',I3)
      4    FORMAT (1X,'and contains ',I3,' records.')

           PRINT *, ' '
           tab = '  '
           eof = 0
           recsize = 0
           WRITE(6,1)
           WRITE(6,2) tab
           tlen = read(cmd,-36)

           filename = cmd(1:tlen) // ' '
           PRINT *, 'Input = ', filename

     C     Open the old permanent file with exclusive update access

           ifnum = fopen(filename,1B,105B)

           IF (CCODE()) 5,6,5
      5    STOP 'Open failed'
      6    CALL fcontrol(ifnum,5,0B) ! Call fcontrol to rewind the file

           IF (CCODE())7,8,7
      7    CALL printfileinfo(ifnum)
      8    CALL FGETINFO(ifnum,,,,recsize,,,,,,eof) ! Get file information

           IF (CCODE())10,9,10
      9    WRITE(6,3) filename,recsize
           WRITE(6,4) eof
      10   CALL FCLOSE(ifnum,1,0)

           STOP
           END

Some MPE/iX intrinsics are OPTION EXTENSIBLE, which means that a partial
formal parameter list can be passed to the intrinsic.  The example above
passed a partial parameter list to FOPEN and FGETINFO. The MPE/iX
intrinsic FGETINFO is an option extensible intrinsic with up to 20
parameters.  In the example above, the statement

           CALL FGETINFO(ifnum,,,,recsize,,,,,,eof)

does not use the second through the fourth or the sixth through the tenth
parameters.  Commas must be in the parameter list to inform the compiler
that the first, fifth, and eleventh parameters are the only parameters
being passed.  Also note that you do not have to list any parameters
following the eleventh parameter if they are not needed.



MPE/iX 5.0 Documentation