HP 3000 Manuals

FORTRAN and Pascal Data Types [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

FORTRAN and Pascal Data Types 

When a FORTRAN program interfaces with a Pascal program unit, be aware of
the corresponding data types shown in table 8-1.  In particular, note the
differences between character strings and Boolean variables between the
two languages.

          Table 8-1.  HP FORTRAN 77 and HP Pascal Data Types 

-------------------------------------------------------------------------------
|                          |                                                  |
|    HP FORTRAN 77 Type    |                  HP Pascal Type                  |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| INTEGER*4                | INTEGER or integer subrange beyond the range     |
|                          | 0 ..  65535                                      |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| INTEGER*2                | SHORTINT or integer subrange inside the range    |
|                          | 0 ..  65535                                      |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| REAL*4                   | REAL                                             |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| REAL*8                   | LONGREAL                                         |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| BYTE,                    | Integer subrange inside the range 0..255         |
| LOGICAL*1                |                                                  |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| CHARACTER                | CHAR                                             |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| CHARACTER*n              | PACKED ARRAY [1..n] OF CHAR                      |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| LOGICAL*4                | INTEGER or                                       |
|                          | SET (4 bytes)                                    |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| LOGICAL*2                | Integer subrange inside the range 0..65535 or    |
|                          | SET (2 bytes)                                    |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| COMPLEX*8                | RECORD                                           |
|                          | real_part :  REAL;                               |
|                          | imag_part :  REAL;                               |
|                          | END;                                             |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| COMPLEX*16               | RECORD                                           |
|                          | real_part :  LONGREAL;                           |
|                          | imag_part :  LONGREAL;                           |
|                          | END;                                             |
|                          |                                                  |
-------------------------------------------------------------------------------
|                          |                                                  |
| REAL*16                  | No corresponding Pascal data type.               |
|                          |                                                  |
-------------------------------------------------------------------------------

HP FORTRAN 77 has a one-word descriptor that describes the maximum length
of the string while PACs (PACKED ARRAY[1..n] OF CHAR) in Pascal do not.
Therefore, when you pass a character string to a Pascal string, Pascal
expects a pointer to that string only.

Boolean variables also differ between the two languages.  Pascal Boolean
variables are one-byte variables, while FORTRAN logical variables are two
or four bytes (LOGICAL*2 or LOGICAL*4).

Also note the following when a FORTRAN program interfaces with a Pascal
program unit:

   *   HP FORTRAN 77 cannot pass arrays by value, so you cannot call a
       Pascal routine with a value parameter of a type corresponding to
       an HP FORTRAN 77 array type.

   *   All data must be passed through the parameter lists because HP
       FORTRAN 77 cannot specify global variables and Pascal cannot
       specify COMMON blocks.

   *   HP FORTRAN 77 expects parameters to be passed by reference, with
       the exception of the maximum length of a character string, as
       described earlier.

   *   Parameter type checking should be turned off because HP FORTRAN 77
       generates different types of check values from Pascal.

   *   Files and labels cannot be passed between HP FORTRAN 77 and
       Pascal.



MPE/iX 5.0 Documentation