1.14 – PACK
cDEC$ PACK Specifies the memory starting addresses of derived-type items. It takes the following form: cDEC$ PACK:[{1 | 2 | 4}] c Is one of the following: C (or c), !, or *. Items of derived types and record structures are aligned in memory on the smaller of two sizes: the size of the type of the item, or the current alignment setting. The current alignment setting can be 1, 2, 4, or 8 bytes. The default initial setting is 8 bytes (unless a compiler option specifies otherwise). By reducing the alignment setting, you can pack variables closer together in memory. The PACK directive lets you control the packing of derived-type or record structure items inside your program by overriding the current memory alignment setting. For example, if CDEC$ PACK:1 is specified, all variables begin at the next available byte, whether odd or even. Although this slightly increases access time, no memory space is wasted. If CDEC$ PACK:4 is specified, INTEGER(1), LOGICAL(1), and all character variables begin at the next available byte, whether odd or even. INTEGER(2) and LOGICAL(2) begin on the next even byte; all other variables begin on 4-byte boundaries. If the PACK directive is specified without a number, packing reverts to the compiler option setting (if any), or the default setting of 8. The directive can appear anywhere in a program before the derived-type definition or record structure definition. It cannot appear inside a derived-type or record structure definition. For compatibility, !MS$PACK can be used in place of cDEC$ PACK. Examples: Consider the following: ! Use 4-byte packing for this derived type ! Note PACK is used outside of the derived-type definition !DEC$ PACK:4 TYPE pair INTEGER a, b END TYPE ! revert to default or compiler option !DEC$ PACK:
1.15 – PSECT
cDEC$ PSECT /common-name/ attr [,attr,...] Lets you modify several characteristics of a common block. Specify the name of a common block, preceded and followed by a slash, and one of the following keywords ("attr"): o ALIGN=val or ALIGN=keyword Specifies alignment for the common block. "val" must be a constant ranging from 0 through 16. The specified number is interpreted as a power of 2. The value of the expression is the alignment in bytes. "keyword" is one of the following: Keyword Equivalent to "val" BYTE 0 WORD 1 LONG 2 QUAD 3 OCTA 4 PAGE [see note] Alpha: 16 Intel: 12 note: Range for Alpha is 0 to 16; for Intel, 0 to 12. The default is octaword alignment (4). o GBL Specifies global scope. This is the default scope. o LCL Specifies local scope. This keyword is opposite to GBL and cannot appear with it. o [NO]MULTILANGUAGE Controls whether the compiler pads the size of overlaid psects (program sections) to ensure compatibility when the psect is shared by code created by other OpenVMS compilers. When a psect generated by a Fortran common block is overlaid with a psect consisting of a C structure, linker error messages can occur. This is because the sizes of the psects are inconsistent; the C structure is padded, but the Fortran common block is not. Specifying MULTILANGUAGE ensures that VSI Fortran follows a consistent psect size allocation scheme that works with HP C psects shared across multiple images. Psects shared in a single image do not have a problem. The default is NOMULTILANGUAGE. This is also the default behavior of HP Fortran 77 and is sufficient for most applications. To specify MULTILANGUAGE for all COMMON blocks in a module, use compiler option /ALIGN=COMMON=MULTILANGUAGE. (For more information, see the HP Fortran for OpenVMS User Manual.) o [NO]SHR Determines whether the contents of a common block can be shared by more than one process. The default is NOSHR. o [NO]WRT Determines whether the contents of a common block can be modified during program execution. The default is WRT. Global or local scope is significant for an image that has more than one cluster. Program sections with the same name that are from different modules in different clusters are placed in separate clusters if local scope is in effect. They are placed in the same cluster if global scope is in effect. If one program unit changes one or more characteristics of a common block, all other units that reference that common block must also change those characteristics in the same way. Default characteristics apply if you do not modify them with a PSECT directive. See the "OpenVMS Linker Utility Manual" for detailed information about default attributes of common blocks.
1.16 – REAL
cDEC$ REAL Specifies the default real kind. It takes the following form: cDEC$ REAL:{4 | 8 | 16} c Is one of the following: C (or c), !, or *. The REAL directive specifies a size of 4 (KIND=4), 8 (KIND=8), or 16 (KIND=16) bytes for default real numbers. When the REAL directive is effect, all default real variables are of the kind specified in the directive. Only numbers specified or implied as REAL without KIND are affected. The REAL directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directive cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it. For compatibility, !MS$REAL can be used in place of cDEC$ REAL. Consider the following: REAL r ! a 4-byte REAL WRITE(*,*) KIND(r) CALL REAL8( ) WRITE(*,*) KIND(r) ! still a 4-byte REAL ! not affected by setting in subroutine END SUBROUTINE REAL8( ) !DEC$ REAL:8 REAL s ! an 8-byte REAL WRITE(*,*) KIND(s) END SUBROUTINE
1.17 – STRICT and NOSTRICT
cDEC$ STRICT cDEC$ NOSTRICT The STRICT directive disables language features not found in the language standard specified on the command line (Fortran 95 or Fortran 90). The NOSTRICT directive (the default) enables these language features. The "c" in cDEC$ is one of the following: a C (or c), !, or *. If STRICT is specified and no language standard is specified on the command line, the default is to disable features not found in Fortran 90. The STRICT and NOSTRICT directives can appear only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directives cannot appear between program units, or at the beginning of internal subprograms. They do not affect any modules invoked with the USE statement in the program unit that contains them. For compatibility, !MS$STRICT and !MS$NOSTRICT can be used in place of cDEC$ STRICT and cDEC$ NOSTRICT. Examples: Consider the following: ! NOSTRICT by default TYPE stuff INTEGER(4) k INTEGER(4) m CHARACTER(4) name END TYPE stuff TYPE (stuff) examp DOUBLE COMPLEX cd ! non-standard data type, no error cd =(3.0D0, 4.0D0) examp.k = 4 ! non-standard component designation, ! no error END SUBROUTINE STRICTDEMO( ) !DEC$ STRICT TYPE stuff INTEGER(4) k INTEGER(4) m CHARACTER(4) name END TYPE stuff TYPE (stuff) samp DOUBLE COMPLEX cd ! ERROR cd =(3.0D0, 4.0D0) samp.k = 4 ! ERROR END SUBROUTINE
1.18 – TITLE and SUBTITLE
cDEC$ TITLE string cDEC$ SUBTITLE string The TITLE directive lets you specify a string and place it in the title field of a listing header. Similarly, SUBTITLE lets you place a specified string in the subtitle field of a listing header. The "string" is a character constant containing up to 31 printable characters. To enable TITLE and SUBTITLE directives, you must specify the /LIST compiler option. When TITLE or SUBTITLE appears on a page of a listing file, the specified string appears in the listing header of the following page. If two or more of either directive appear on a page, the last directive is the one in effect for the following page. If either directive does not specify a string, no change occurs in the listing file header. For compatibility, !MS$TITLE: and !MS$SUBTITLE: can be used in place of cDEC$ TITLE and cDEC$ SUBTITLE.
1.19 – UNROLL
cDEC$ UNROLL The UNROLL directive tells the compiler's optimizer how many times to unroll a DO loop. It can only be applied to iterative DO loops. The UNROLL directive takes the following form: cDEC$ UNROLL [(n)] c Is one of the following: C (or c), !, or *. n Is an integer constant. The range of "n" is 0 through 255. The UNROLL directive must precede the DO statement for each DO loop it affects. No source code lines, other than the following, can be placed between the UNROLL directive statement and the DO statement: o An IVDEP directive o Placeholder lines o Comment lines o Blank lines If "n" is specified, the optimizer unrolls the loop "n" times. If "n" is omitted, or if it is outside the allowed range, the optimizer picks the number of times to unroll the loop. The UNROLL directive overrides any setting of loop unrolling from the command line.