HP1000 Directive [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
HP1000 Directive
The HP1000 directive specifies options for compatibility with FORTRAN 7X,
which is the version of FORTRAN 77 on the HP 1000 computer.
Syntax
[ARRAYS ]
$HP1000 [ALIGNMENT ] [ON ]
[STRING_MOVE] [OFF]
[DO_LOOP ]
Default Off.
Specify OFF or do not use the directive if your
program does not rely on specific data layout or
the ripple effect of the STRING_MOVE option and if
it has no string array initializations in DATA
statements. If used with no other parameters, the
ON option turns on all the options.
Location The HP1000 directive must appear before any
nondirective statements in a program unit.
Toggling/ Duration Cannot be toggled after the appearance of
nondirective statements in a program unit.
ARRAYS Option
The ARRAYS option causes arrays to be handled as they are in FORTRAN 7X.
Using this option, you can reference an array element without specifying
all of the subscripts. The option also modifies the way that character
strings are assigned to integer arrays in DATA statements. Normally HP
FORTRAN 77/iX requires that all subscripts be specified when accessing an
array element in a program. If the ARRAYS option is turned on, you can
omit one or more of the subscript specifiers from the list. The first
element number for that dimension is assumed for omitted specifiers.
For example, for the real array RARRAY(5,5,5):
R = RARRAY(4)
is equivalent to:
R = RARRAY(4,1,1)
and for the array IARRAY(10,-5:5):
IARRAY(1) = 10
is equivalent to:
IARRAY(1,-5) = 10
In HP FORTRAN 77/iX, when you initialize an integer array with character
strings, you must specify a separate string for each array element. For
example:
INTEGER iarray(5)
DATA iarray/'abcd','efgh','ijkl','mnop','qrst'/
With the ARRAYS option, you can initialize more than one array element
with a single string. For example, the following allows you to
initialize the entire preceding array:
INTEGER iarray(5)
DATA iarray/'abcdefghijklmnopqrst'/
If the string is not long enough to initialize the entire array, as many
elements as possible are initialized with the first string. If there is
another string, it is used starting with the next element. If there are
not enough strings, the remainder of the array is blank-filled. For
example:
INTEGER iarray(10)
DATA iarray/'abcdef','ijkl','mnopqrstuvwxyz'/
results in:
iarray(1)= 'abcd'
iarray(2)= 'ef Delta Delta '
iarray(3)= 'ijkl'
iarray(4)= 'mnop'
iarray(5)= 'qrst'
iarray(6)= 'uvwx'
iarray(7)= 'yz Delta Delta '
iarray(8)= ' Delta Delta Delta Delta '
iarray(9)= ' Delta Delta Delta Delta '
iarray(10)=' Delta Delta Delta Delta '
(where each Delta represents a blank).
ALIGNMENT Option
The ALIGNMENT option of the HP1000 directive aligns data on 16-bit
boundaries, rather than on the HP FORTRAN 77/iX boundary formats shown in
the following table:
------------------------------------------------------------------------------------------------
| | | |
| Alignment | HP1000 Alignment Format | HP FORTRAN 77/HP-UX |
| | | Alignment Format |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| 8-bit | Character | Character |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| 16-bit | LOGICAL*2, LOGICAL*4, INTEGER*2, | INTEGER*2, LOGICAL*2 |
| | INTEGER*4, REAL*4, REAL*8, REAL*16, | |
| | COMPLEX*8, COMPLEX*16 | |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| 32-bit | | LOGICAL*4, INTEGER*4, REAL*4, |
| | | COMPLEX*8 |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| 64-bit | | REAL*8, REAL*16, COMPLEX*16 |
| | | |
------------------------------------------------------------------------------------------------
Use this option when you need the data layout specified by either
EQUIVALENCE or COMMON statements to be exactly the same as in a FORTRAN
77 (FORTRAN 7X) program, such as when calling database intrinsics. Using
the ALIGNMENT option may cause degradation in run-time performance.
Exercise caution when changing the directive between program units of a
single program. In particular, mixing a specification for HP1000
alignment and native alignment can produce unpredictable results.
STRING_MOVE Option
The STRING_MOVE option causes assignments of character variables to be
done byte-by-byte, which creates a ripple effect when the source and
target are overlapped. For example,
CHARACTER*12 a
a(1:1) = '*'
a(2:12) = a(1:11)
results in a having the value:
'** Delta Delta Delta Delta Delta Delta Delta Delta
Delta Delta '
if STRING_MOVE is off.
If STRING_MOVE is on, the result in a is:
'************'
DO_LOOP Option
The DO_LOOP option causes the compiler to allow the DO loop control index
to be modified within the range of the loop, as for FORTRAN 7X.
Modification of the DO loop index does not affect the number of times the
loop executes because the index value is established when the loop is
entered. For example, the loop in the following program executes five
times, even though the value of I is modified within the loop:
Example
$HP1000 DO_LOOP ON
PROGRAM showdo
DO i = 1,5 ! This loop will execute five times.
PRINT *, i
i = i + 25
END DO
END
Output:
1
27
53
79
105
MPE/iX 5.0 Documentation