Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
E77790.pdf
Скачиваний:
2
Добавлен:
16.05.2024
Размер:
1.29 Mб
Скачать

4.4 STRUCTURE and UNION (VAX Fortran)

Example: p = LOC( x )

Example: Use Cray pointers as described above.

SUBROUTINE sub ( n ) COMMON pool(100000) INTEGER blk(128), word64

REAL a(1000), b(n), c(100000-n-1000)

POINTER ( pblk, blk ), (ia, a ), ( ib, b ), & ( ic, c ), ( address, word64 )

DATA address / 64 / pblk = 0

ia = LOC( pool ) ib = ia + 4000 ic = ib + n

...

Remarks about the above example:

word64 refers to the contents of absolute address 64

blk is an array that occupies the first 128 words of memory

a is an array of length 1000 located in blank common

b follows a and is of length n

c follows b

a, b, and c are associated with pool

word64 is the same as blk(17) because Cray pointers are byte address and the integer elements of blk are each 4 bytes long

4.4STRUCTURE and UNION (VAX Fortran)

To aid the migration of programs from legacy FORTRAN 77, f95 accepts VAX Fortran STRUCTURE and UNION statements, a precursor to the “derived types” in Fortran 95. For syntax details see the FORTRAN 77 Language Reference manual.

The field declarations within a STRUCTURE can be one of the following:

A substructure— either another STRUCTURE declaration, or a record that has been previously defined.

A UNION declaration.

A TYPE declaration, which can include initial values.

A derived type having the SEQUENCE attribute. (This is particular to f95 only.)

178 Oracle Developer Studio 12.6: Fortran User's Guide • July 2017

Соседние файлы в предмете Информационные и сетевые технологии