Silverfrost Logo About Us | Contact Us
 

Attributes

The .NET environment allows so called "attributes" to be attached to a variety of program entities - such as routine names. These attributes can hold any amount of arbitrary information that can be interrogated at run time.

The FTN95 ATTRIBUTE statement is used to attach attributes to parts of a Fortran program. For example:

ATTRIBUTE(CLASS="Salford.Fortran.SalfordUserInfoAttribute",(/20,30,40/),TARGET="ROUTINE")

This will attach an attribute to the routine in which it is contained. Possible values for TARGET are:

"ROUTINE" - Attach attribute to routine under construction.

"CLASS" - Attach attribute to the containing class.

"ASSEMBLY" (the default target) - Attach attribute to the assembly as a whole.

The extra, non-keyword, arguments must be constant expressions and supply arguments to the attribute. In the above example one 3-element integer array argument is supplied.

If the routine contains an ASSEMBLY_INTERFACE statement, then TARGET="ROUTINE" attaches the attribute to the interface routine (which will be the externally visible name).

Attributes are classes and must already exist in the .NET environment or be created in C#, for example. For convenience, FTN95 provides the SalfordUserInfoAttribute (as used above), and this can take a scalar or 1-dimensional array of type INTEGER, REAL, DOUBLE, LOGICAL (converted to bool), or CHARACTER (converted to string).

 

 

Copyright © 1999-2017 Silverfrost Limited