VMS Help PASCAL, Attributes *Conan The Librarian (sorry for the slow response - running on an old VAX) |
An attribute is an identifier that directs the Compaq Pascal compiler to change its behavior in some way. When an attribute is not explicitly stated, the compiler follows the default rules to assign properties to program elements. However, using attributes to override the defaults allows additional control over the properties of data items, routines, and compilation units. Syntax of a Compaq Pascal attribute: [ {identifier1 [[ ( { constant-expression | identifier2 } ,...) ]] },... ] The 'identifier1' is the name of the attribute. The 'constant-expression' is a compile-time integer expression that qualifies several of the Compaq Pascal attributes. The 'identifier2' is the name of an option available in one of the following cases: o With the CHECK, OPTIMIZE, or KEY attributes o With COMMON and PSECT attributes, indicating the name of a storage area o With the GLOBAL, EXTERNAL, WEAK_GLOBAL, and WEAK_EXTERNAL attributes, indicating an external name A list of attributes can appear anywhere in the VAR, TYPE, and CONST declaration sections, and anywhere in a program that a type, a type identifier, or the heading of a routine or compilation unit is legal. However, only one attribute from a particular class can appear in a given attribute list. The names of attributes, when used in a suitable context, cannot conflict with other identifiers with the same name in the program. Syntactically, an attribute list can appear before a VAR, TYPE, and CONST section in the declaration section. In this case, the attributes would apply to all elements in that particular section. However, at this time, Compaq Pascal only allows you to use the HIDDEN attribute in this way. Some attributes require a special form of constant expression called a name string. The syntax of a name string differs from that of other strings in Compaq Pascal only in that a name string cannot use the extended-string syntax. See the "Compaq Pascal Language Reference Manual" for the complete description of attributes.
1 - ALIGN |
The ALIGN attribute controls the default alignment rules in a compilation unit or for a TYPE or VAR declaration section. The ALIGN attribute takes a single keyword parameter that has the same name and meaning as the keywords for the /ALIGN qualifier. Note that specifying the ALIGN attribute overrides any value you previously specified with the /ALIGN qualifier. Syntax: [ALIGN(keyword)] You can specify the following keywords: Value Action Default Information ----- ------ ------- ----------- Alpha_AXP Uses natural alignment when Default on OpenVMS Alpha positioning record fields systems. or array components. Natural alignment is when a record field or an array component is positioned on a boundary based on its size. For example, 32-bit integers are aligned on the nearest 32-bit boundary. VAX Uses byte alignment when pos- Default on OpenVMS VAX itioning record fields or array systems. components. Record fields or array components larger than 32 bits are positioned on the nearest byte boundary. On OpenVMS VAX systems, when you specify a value of Alpha_AXP, automatic variables are aligned on longword boundaries instead of quadword boundaries. This occurs because the largest allowable alignment for the stack is longword alignment.
2 - Alignment |
Alignment attributes indicate whether the object should be aligned on a specific address boundary in memory.
2.1 - ALIGNED
The ALIGNED attribute indicates the object is to be aligned on a specific memory boundary. Syntax: ALIGNED [[( n )]] The default alignment of an object depends on its size. The constant expression n must denote an integer. If you omit n, the default is 0, indicating byte alignment. An aligned object is aligned on the memory boundary indicated by n. The constant expression n indicates that the address of the object must end in at least n zeros. ALIGNED(0) specifies byte alignment, ALIGNED(1) specifies word alignment, ALIGNED(2) specifies longword alignment, ALIGNED(3) specifies quadword alignment, ALIGNED(4) specifies octaword alignment, ALIGNED(9), specifies 512-byte alignment, and ALIGNED(13) specifies 8192-byte alignment. See the "Compaq Pascal Language Reference Manual" for the complete description of using the ALIGNED attribute.
2.2 - UNALIGNED
The UNALIGNED attribute specifies that an object can be aligned on any bit boundary. An UNALIGNED variable cannot have an allocation size greater than 32 bits. See the "Compaq Pascal Language Reference Manual" for the complete description of using the UNALIGNED attribute.
3 - Allocation |
Allocation attributes indicate the form of storage that the object should occupy.
3.1 - AUTOMATIC
The AUTOMATIC attribute specifies that storage for the variable be allocated each time the program enters the routine in which the variable is declared. The storage is deallocated each time the program exits from that routine. An automatic variable exists as long as the declaring routine remains active. See the "Compaq Pascal Language Reference Manual" for the complete description of using the AUTOMATIC attribute.
3.2 - AT
The AT attribute specifies that Compaq Pascal allocates no storage for the object (storage has already been allocated) and that it resides at the exact, specfied address. Syntax: AT( n ) The exact address is specified by the constant expression n. Variables representing machine-dependent entities are frequently given the AT attribute. See the "Compaq Pascal Language Reference Manual" for the complete description of using the AT attribute.
3.3 - COMMON
The COMMON attribute specifies that storage for a variable be allocated in an overlaid program section called a common block. Syntax: COMMON [[(identifier)]] The 'identifier' indicates the name of the common block. It is passed in uppercase on OpenVMS systems. If you omit the identifier, the name of the variable is used as the name of the common block. This attribute allows you to share variables with other Compaq languages, such as FORTRAN. See the "Compaq Pascal Language Reference Manual" for the complete description of using the COMMON attribute.
3.4 - PSECT
The PSECT attribute is useful for placing static variables and executable blocks in program sections that will be shared among executable images. Syntax: [PSECT(identifier)] The 'identifier' designates the program section in which storage for a variable, routine, or compilation is to be allocated. It is passed in uppercase on OpenVMS systems. If you omit the identifier, the name of the variable is used as the name of the common block. The identifier designates the compilation unit in which storage for a variable is to be allocated.
3.5 - STATIC
The STATIC attribute causes Compaq Pascal to create a static object, which is allocated only once and which exists as long as the executable image in which it is allocated remains active. See the "Compaq Pascal Language Reference Manual" for the complete description of using the STATIC attribute.
4 - ASYNCHRONOUS |
The ASYNCHRONOUS attribute indicates that a routine may be called by an asynchronous event (such as a condition handler). Since such an event can alter the values of variables within the routine upredictably, this attribute forces the routine to reference only local variables or variables declared with the VOLATILE attribute. See the "Compaq Pascal Language Reference Manual" for the complete description of using the ASYNCHRONOUS attribute.
5 - CHECK |
The CHECK attribute specifies error-checking options that are to be enabled during program execution. Syntax: CHECK [[( {identifier},... )]] An identifier specifies an option to be enabled. If you omit the list of options, all available positive options are enabled. ALL Enables all forms of checking. NONE Suppresses all checking code. [NO]BOUNDS Verifies that an index expression is within the bounds of an array's index type and that character-string sizes are compatible with the operations being performed and that schema types are compatible. [NO]CASE_SELECTORS Verifies that the value of a case selector is contained in the corresponding case label list. [NO]DECLARATIONS Verifies that schema definitions yield valid types and that uses of GOTO from one block to an enclosing block are correct. [NO]OVERFLOW Verifies that the result of an integer computation does not exceed the machine representation. [NO]POINTERS Verifies that the value of a pointer variable is not NIL. [NO]SUBRANGE Verifies that values assigned to variables of subrange types are within the subrange; verifies that a set expression is assignment compatible with a set variable. See the "Compaq Pascal Language Reference Manual" for the complete description of using the CHECK attribute.
6 - ENUMERATION_SIZE |
The ENUMERATION_SIZE attribute controls the allocation of unpacked enumerated data types and Boolean data types, which are considered to be an enumerated type containing two elements. Note that specifying this attribute overrides any value that you previously specified with the /ENUMERATION_SIZE qualifier. Syntax: [ENUMERATION_SIZE(keyword)] You can specify the following keywords: Keyword Action Default Information ------- ---------------------------- ------------------- BYTE Allocates unpacked enumerated Default on OpenVMS VAX types with fewer than 255 systems. elements in a 8-bit byte. Otherwise, the enumerated types are allocated in a 16-bit word. LONG Allocates unpacked enumerated Default on OpenVMS Alpha types in a 32-bit longword. systems.
7 - ENVIRONMENT |
The ENVIRONMENT attribute can be applied to compilation units and causes the unit's program or module level declarations and definitions to be saved. Syntax: ENVIRONMENT [[( name-string )]] If the 'name string' is omitted, the name of the source file is used as the environment file name with the default file type PEN. The declarations and definitions made at the outermost level of the compilation unit (provided they do not have the AUTOMATIC or HIDDEN attribute) are saved in a newly created environment file. If the name string is specified, you must include a legal file specification. See the "Compaq Pascal Language Reference Manual" for the complete description of using the ENVIRONMENT attribute.
8 - FLOAT |
The FLOAT attribute indicates the type of precision to use for objects of type REAL and DOUBLE. Syntax: [FLOAT(keyword)] You can specify the following float types for keywords: o D_FLOAT - REAL=FLOATING, DOUBLE=D_FLOATING o G_FLOAT - REAL=F_FLOATING, DOUBLE=G_FLOATING o IEEE_FLOAT - REAL=S_FLOATING, DOUBLE=T_FLOATING
9 - HIDDEN |
The HIDDEN attribute prevents information concerning a constant definition or a type, variable, procedure, or function declaration from being included in a generated environment file. The HIDDEN attribute can be used only on objects at the outermost level of the compilation unit. It is possible to prevent all declarations within a declaration section from being included in the environment file by preceding the reserved word CONST, TYPE, or VAR with the HIDDEN attribute.
10 - IDENT |
The IDENT attribute can be used to qualify the name of a compilation unit. In the absence of an IDENT attribute, the string '01' is supplied to the linker. Syntax: IDENT( name-string ) The 'name-string' can contain additional information whose use is implementation specific. The Compaq Pascal compiler uses this string to supply identification information to the linker.
11 - INHERIT |
The INHERIT attribute indicates the environment file or files to be inherited by a compilation unit. The environment files specified by the INHERIT attribute must already have been created in compilation units (by either the ENVIRONMENT attribute or a compilation switch). Syntax: INHERIT( {name-string},... ) The compilation unit inherits one or more environment files named by the file specifications in the name strings. The default file type for an inherited environment file is .PEN.
12 - INITIALIZE |
The INITIALIZE attribute can be applied to procedures to indicate that the procedure is to be called before the main program is entered. A compilation unit might include any number of INITIALIZE procedures, all of which are called in an unspecified order before the main program is entered. See the "Compaq Pascal Language Reference Manual" for the complete description of using the INITIALIZE attribute.
13 - KEY |
The KEY attribute can be applied to record fields to indicate that the field is to be used as a key field when the record is part of an indexed file. Syntax: KEY [[( n [[, {options},... ]] )]] KEY [[( {options},... )]] The 'n' represents the key number. A key number of 0 indicates that the field is the primary key of the record. All other key numbers indicate alternate keys. The key number must be a constant expression that denotes an integer value in the range from 0 through 254. See the "Compaq Pascal Language Reference Manual" for the complete description of using the KEY attribute.
13.1 - Options
You can specify certain characteristics of the record key by listing the desired options on the KEY attribute. With these options, you can control the order of the collating sequence and you can allow changes or duplicates on a key. See the "Compaq Pascal Language Reference Manual" for the complete description of using these options.
13. 1.1 - ASCENDING
This option, along with DESCENDING, allows you to specify the collating sequence for the key field. By default, the primary key and alternate key are ASCENDING. When creating a new file, Pascal will create the key with the collating order specified. When opening an existing file, the Run-Time Library will verify that the existing key matches the collating order specified. If neither ASCENDING or DESCENDING is specified when opening an existing file, both types will be accepted.
13. 1.2 - CHANGES
This option allows you to specify that changes can be performed on the key. The default for the primary key is NOCHANGES and the default for alternate keys is CHANGES. You can override the CHANGES on alternate keys with NOCHANGES. It is illegal to specify CHANGES on the primary key. When opening an existing file, the Pascal Run-Time Library ignores this option.
13. 1.3 - DESCENDING(see ASCENDING)
13. 1.4 - DUPLICATES
This option allows you to specify that duplicates of the key are allowed. The default for the primary key is NODUPLICATES and the default for alternate keys is DUPLICATES. When opening an existing file, the Pascal Run-Time Library ignores this option.
14 - LIST |
The LIST attribute can be applied to a formal parameter of a routine and indicates that the routine can be called with multiple actual parameters that correspond to the last formal parameter named in the routine heading. You can also use the ARGUMENT and ARGUMENT_LIST_LENGTH predeclared routines when writing procedures and functions that use the LIST attribute. See the "Compaq Pascal Language Reference Manual" for the complete description of using the LIST attribute.
15 - Optimize |
The optimization attributes indicate whether the Compaq Pascal compiler should optimize code.
15.1 - OPTIMIZE
The OPTIMIZE attribute specifies optimization options that are to be enabled during compilation of a compilation unit or routine. Syntax: OPTIMIZE [[( {identifier},... )]] All options are enabled by default. ALL Enables all OPTIMIZE options. NONE Disables all OPTIMIZE options. [NO]INLINE Enables inline expansion of user-defined routines. See the "Compaq Pascal Language Reference Manual" for the complete description of using the OPTIMIZE attribute.
15.2 - NOOPTIMIZE
The NOOPTIMIZE attribute prohibits the compiler from optimizing code for the compilation unit or routine. The NOOPTIMIZE attribute guarantees left-to-right evaluation order with full evaluation of both operands of the AND and OR Boolean operators to aid in diagnosing all potential programming errors. If you wish to have short circuit evaluation even with the NOOPTIMIZE attribute, then use the AND_THEN and OR_ELSE Boolean operators. See the "Compaq Pascal Language Reference Manual" for the complete description of using the NOOPTIMIZE attribute.
16 - Parameter |
The parameter passing attributes indicate the passing mechanism to be used for a parameter.
16.1 - CLASS_A
The CLASS_A attribute causes a formal parameter to be passed by an array descriptor that describes contiguous arrays of atomic data types or contiguous arrays of fixed-length strings. This is the default mechanism for conformant array parameters on OpenVMS VAX systems. This attribute is illegal on parameters of schema types. See the "Compaq Pascal Language Reference Manual" for the complete description of using the CLASS_A attribute.
16.2 - CLASS_NCA
The CLASS_NCA attribute causes a formal parameter to be passed by a noncontiguous array descriptor. This attribute is illegal on parameters of schema types. This is the default mechanism for conformant array parameters on OpenVMS Alpha systems.
16.3 - CLASS_S
The CLASS_S attribute causes a formal parameter to be passed by a single descriptor form that is used for scalar data and fixed-length strings. This attribute allows routines written in Compaq Pascal to accept actual parameters from languages that generate CLASS_S descriptors. See the "Compaq Pascal Language Reference Manual" for the complete description of using the CLASS_S attribute.
16.4 - IMMEDIATE
The IMMEDIATE attribute causes a formal parameter value in a routine declaration to be passed by immediate value. See the "Compaq Pascal Language Reference Manual" for the complete description of using the IMMEDIATE attribute.
16.5 - REFERENCE
The REFERENCE attribute causes the formal parameter in a routine to be passed by reference using foreign parameters. See the "Compaq Pascal Language Reference Manual" for the complete description of using the REFERENCE attribute.
17 - PEN_CHECKING_STYLE |
The PEN_CHECKING_STYLE attribute selects the desired compile-time and link-time checking to perform when the generate environment file is inherited. PEN_CHECKING_STYLE( option ) COMPILATION_TIME Uses the compilation time of the environment file in all subsequent compile-time and link-time checking for users of this environment file. This is the default. IDENT_STRING Uses the [IDENT()] string of the environment file in all subsequent compile-time and link-time checking for users of this environment file. NONE Disables all compile-time and link-time checking for users of this environment file.
18 - POS |
POS forces the field (of a packed or unpacked record) to a specific bit position within the record. Syntax: POS( n ) The constant expression 'n' specifies the bit location, relative to the beginning of the record, at which the field begins. See the "Compaq Pascal Language Reference Manual" for the complete description of using the POS attribute.
19 - READONLY |
The READONLY attribute specifies that an object can be read by a program, but cannot have values assigned to it. See the "Compaq Pascal Language Reference Manual" for the complete description of using the READONLY attribute.
20 - Size |
Size attributes indicate the amount of storage to be reserved for the object.
20.1 - BIT
The BIT attribute specifies the amount of storage in bits to be received by the object. Syntax: BIT [[( n )]] The optional constant 'n' indicates the number of bit storage units. It must denote a positive integer. If you omit n, the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the BIT attribute.
20.2 - BYTE
The BYTE attribute specifies the amount of storage in bytes to be received by the object. Syntax: BYTE [[( n )]] The optional constant 'n' indicates the number of byte storage units. It must denote a positive integer. If you omit 'n', the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the BYTE attribute.
20.3 - WORD
The WORD attribute specifies the amount of storage in words to be received by the object. Syntax: WORD [[( n )]] The optional constant 'n' indicates the number of word storage units. It must denote a positive integer. If you omit n, the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the WORD attribute.
20.4 - LONG
The LONG attribute specifies the amount of storage in longwords to be received by the object. Syntax: LONG [[( n )]] The optional constant 'n' indicates the number of longword storage units. It must denote a positive integer. If you omit 'n', the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the LONG attribute.
20.5 - QUAD
The QUAD attribute specifies the amount of storage in quadwords to be received by the object. Syntax: QUAD [[( n )]] The optional constant 'n' indicates the number of quadword storage units. It must denote a positive integer. If you omit 'n', the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the QUAD attribute.
20.6 - OCTA
The OCTA attribute specifies the amount of storage in octawords to be received by the object. Syntax: OCTA [[( n )]] The optional constant 'n' indicates the number of octaword storage units. It must denote a positive integer. If you omit 'n', the default value is 1. See the "Compaq Pascal Language Reference Manual" for the complete description of using the OCTA attribute.
21 - TRUNCATE |
The TRUNCATE attribute indicates that an actual parameter list for a routine can be truncated at the point that the attribute was specified. This attribute can be specified on a formal parameter in a routine declaration, and can be used with the PRESENT function. See the "Compaq Pascal Language Reference Manual" for the complete description of using the TRUNCATE attribute.
22 - UNBOUND |
The UNBOUND attribute specifies that a routine does not access automatic variables outside the scope in which it is declared. That is, the bound procedure value of an unbound routine does not include the static scope pointer. This attribute can be applied to routines and formal routine parameters. See the "Compaq Pascal Language Reference Manual" for the complete description of using the UNBOUND attribute.
23 - UNSAFE |
The UNSAFE attribute indicates that an object can accept values of any type without type checking. The exact properties of an unsafe object depend on the object's machine representation. See the "Compaq Pascal Language Reference Manual" for the complete description of using the UNSAFE attribute.
24 - VALUE |
The VALUE attribute causes the variable to be a reference to an external constant or to be the defining point of a global constant. See the "Compaq Pascal Language Reference Manual" for the complete description of using the VALUE attribute.
25 - Visibility |
The visibility attributes indicate the ability of an object to be shared by compilation units.
25.1 - LOCAL
The LOCAL attribute indicates that an object is unavailable to other independently compiled units. By default, all variables and routines are local. See the "Compaq Pascal Language Reference Manual" for the complete description of using the LOCAL attribute.
25.2 - GLOBAL
The GLOBAL attribute provides a strong definition of a variable or routine so that other independently compiled units can refer to it. Syntax: [GLOBAL] or, [GLOBAL(idenifier)] or, [GLOBAL('string-literal')] The 'identifier' is the name of the identifier passed to the linker. It is passed in uppercase on OpenVMS systems. If you omit the identifier, the name of the variable is used. The 'string-literal' is a specified string literal that is passed unmodified to the linker. See the "Compaq Pascal Language Reference Manual" for the complete description of using the GLOBAL attribute.
25.3 - EXTERNAL
The EXTERNAL attribute indicates a variable or routine that is assumed to be global in another independently compiled unit. Syntax: [EXTERNAL] or, [EXTERNAL(identifer)] or, [EXTERNAL('string-literal')] The 'identifer' is the name of the identifier passed to the linker. It is passed in uppercase on OpenVMS systems. If you omit the identifier, the name of the variable is used. The 'string-literal' passes a specified string-literal to the linker unmodified.
25.4 - WEAK_EXTERNAL
The WEAK_EXTERNAL attribute specifies that a variable or routine is not critical to the linking operation. To resolve a weak reference, the linker searches only the named input modules. You can specify an identifier with this attribute to indicate the name by which the corresponding object is known to the linker. Syntax: [WEAK_EXTERNAL] or, [WEAK_EXTERNAL(identifier)] or, [WEAK_EXTERNAL('string-literal')] The 'identifier' is the name of the identifier passed to the linker. If you omit the identifier, the name of the variable is used. The 'string-literal' is the name of the string literal that is passed to the linker unmodified. Compilation units cannot have the EXTERNAL or WEAK_EXTERNAL attribute.
25.5 - WEAK_GLOBAL
The WEAK_GLOBAL attribute specifies that an object is linked only when it is specifically included in the linking operation. To resolve a weak reference, the linker searches only the named input modules. You can specify an identifier to indicate the name by which the corresponding object is known to the linker. Syntax: [WEAK_GLOBAL] or, [WEAK_GLOBAL(identifier)] or, [WEAK_GLOBAL('string_literal')] The 'identifier' is the name of the identifier passed to the linker. If you omit the identifier, the name of the variable is used. The 'string-literal' passes a specified string literal to the linker unmodified. See the "Compaq Pascal Language Reference Manual" for the complete description of using the WEAK_GLOBAL attribute.
26 - VOLATILE |
The VOLATILE attribute indicates to the compiler that the value of an object is subject to change at unusual points in program execution. Normally, during execution, an object's value generally changes only when another value is assigned to it, when it is passed as a writeable VAR parameter, when it is read into by a READ, READLN, or READV procedure, or when it is used as the control variable of a FOR loop. In addition, the compiler expects to evaluate the object only when it appears in an expression. The value of a volatile object may change as the result of an action not directly specified in the program. Thus, the compiler assumes that the value of a volatile object can be changed or evaluated at any time during program execution. Consequently, a volatile object does not participate in any optimization based on assumptions about its value. The behavior of many device registers, and modifications by asynchronous processes and exception handlers, are two examples that demonstrate volatile behavior. See the "Compaq Pascal Language Reference Manual" for the complete description of using the VOLATILE attribute.
27 - WRITEONLY |
The WRITEONLY attribute specifies that an object can have values assigned to it but cannot be read by a program. See the "Compaq Pascal Language Reference Manual" for the complete description of using the WRITEONLY attribute.
|