The special data attributes for dummy arguments in routines of certain extrinsic types are MAP_TO, LAYOUT, and PASS_BY. These may only appear in data types statements declaring dummy arguments within explicit interfaces to procedures of appropriate extrinsic types. In particular, all of these attributes have been defined for extrinsic interfaces of type LANGUAGE = "0DC"0D (Section ), and the latter two have been defined for extrinsic interfaces of type LANGUAGE = "0DF77"0D (Section ).
The purpose of this language extension is to increase the flexibility of the EXTRINSIC interface mechanism to facilitate argument passing between procedures written in different programming languages. These three attributes provide a convenient way to pass data between nearly equivalent data type representations and array layouts, as well as to allow for different data passing conventions and options. It should be noted, however, that these mechanisms are by no means expected to address the problems of full equivalence between data types and implementations of different languages.
In particular, the MAP_TO attribute is designed to provide a standard, portable mechanism for passing arguments between data types (in different languages) that have substantial overlap but not necessarily identical ranges of values or an identical machine representation. The programmer, not the language implementer, retains the responsibility for determining whether or not any actual argument's value will be adequately represented in the new data type, or whether that value may be altered in successive operations involved in conversion first to the new language, in operations within the extrinsic procedure, and then potentially in conversion back to the original language. The LAYOUT attribute is used in cases when the ordering of array elements within one or more processors may need to be changed when passing them as arguments between procedures of different languages. Finally, the PASS_BY attribute is designed to offer more detailed control of passing mechanisms for arguments to allow for differences between language implementations, to choose between distinct passing options offered in the non-HPF language, and to enable passing implementation-specific data structures when it is desired to convey HPF mapping information along with data values to non-HPF procedures.
These attributes are specified by an extension of the syntax rule R503 for attr-spec in the Fortran standard. Rule R501 for type-declaration-stmt is not changed except to refer to the extended attr-spec. The first two constraints below are repeated without change from the Fortran standard for clarity, since they apply generally to all attributes. The remaining constraints in the Fortran standard following rules R501 through R506 are specific to attributes already defined in the standard and will also be assumed but not repeated here.
These changes to Fortran syntax are made in anticipation of such extensions being considered for addition to the standard language in the next revision, as language interoperability is an area of active interest to the full Fortran community.
H1101 type-declaration-stmt-extended is type-spec [ [ , attr-spec-extended ] ... :: ] entity-decl-list H1102 attr-spec-extended is PARAMETER
or DIMENSION ( array-spec )
or INTENT ( intent-spec )
or MAP_TO ( map-to-spec )
or LAYOUT ( layout-spec )
or PASS_BY ( pass-by-spec )
H1103 map-to-spec is scalar-char-initialization-expr H1104 layout-spec is scalar-char-initialization-expr H1105 pass-by-spec is scalar-char-initialization-expr
The definition of characteristics of a dummy data object as given in F95:22.214.171.124 and extended in Section 8.15 is further extended to include the dummy data object's MAP_TO, LAYOUT, and PASS_BY attributes.
In the MAP_TO attribute, values of map-to-spec are intended to describe how the data type of the named actual argument is mapped to the data type of the dummy argument in the extrinsic procedure. An example is given in Section
For a given extrinsic type that allows the MAP_TO attribute, the set of permitted values for the map-to-spec will be specified. If the range of permitted values of the type and mapped-to type differ, and the value of the actual argument or some subobject of the actual argument is not within the permitted range of the mapped-to type, the value of the associated dummy argument or subobject becomes undefined. Conversely, if the value of the dummy argument or some subobject of the dummy is not within the permitted range of values of the associated actual argument, and the associated actual argument is a variable, the value of the associated actual argument or subobject of the actual becomes undefined.
If there is a mismatch between the precision, representation method, range of permitted values, or storage sequence between the type of the dummy argument and the permitted mapped-to type of the dummy argument, the compiler shall ensure that, for the duration of the reference to the extrinsic, the dummy argument is represented in a manner that is compatible with the expectations of the callee for an object of the permitted mapped-to type. Upon return from the procedure, the compiler shall ensure that the value of an actual argument that is a variable is restored to the specified type and kind.
In the LAYOUT attribute, any permitted values of layout-spec for a given extrinsic interface are intended to describe how the data layout of the named actual argument is mapped to the data layout of the dummy argument in the extrinsic procedure. An example is given in Section . If no LAYOUT attribute is specified for a dummy array argument, the data layout shall be the same as if it were being passed to an HPF procedure of the same model, unless another default layout is defined for the given extrinsic type.
In the PASS_BY attribute, any permitted values of pass-by-spec for a given extrinsic interface indicate a choice of mechanism used to associate the named actual argument with the dummy argument in the extrinsic procedure. Examples are given in Sections and . If no PASS_BY attribute is specified, the argument association mechanism is implementation dependent, based on the compiler's knowlege of the extrinsic language processor.