[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP OpenVMS Calling Standard
6.2 String Data TypesString data types are ordinarily described by a string descriptor. Table 6-2 shows how the string data types are defined and encoded for all OpenVMS environments.
6.3 Miscellaneous Data TypesTable 6-3 shows how miscellaneous data types are defined and encoded for all OpenVMS environments.
+VAX specific. 6.4 Reserved Data-Type CodesAll codes from 0 through 191 not otherwise defined in this standard are reserved to Hewlett-Packard. Codes 192 through 255 are reserved for Hewlett-Packard custom systems and for customers for their own use. Table 6-4 lists the data types and codes that are obsolete or reserved to Hewlett-Packard.
1Differs from Alpha IEEE floating because of byte ordering. 2Differs from Alpha IEEE floating because of byte ordering and size. 6.4.1 Facility-Specific Data-Type CodesData-type codes 160 through 191 are reserved to Hewlett-Packard for facility-specific purposes. These codes must not be passed between facilities because different facilities can use the same code for different purposes. These codes might be used by compiler-generated code to pass parameters to the language-specific run-time support procedures associated with that language or with the OpenVMS Debugger. As shown in Table 6-4, data-type codes 31 and 64 are reserved for the COBOL facility. Codes 40 through 51 and 56 are reserved for the OpenVMS Debugger facility.
Figure 6-1 Varying Character String Data Type (DSC$K_DTYPE_VT)---General Format When passed by reference or by descriptor, the address of the varying character string (VT) data type is always the address of the CURLEN field, not the BODY field. When a called procedure modifies a varying character string data type passed by reference or by descriptor, it writes the new length, n, into CURLEN and can modify all bytes of BODY, even those beyond the new length. For example, consider a varying string with a maximum length of seven characters. To represent the string ABC, CURLEN will have a value of 3 and the last four bytes will be undefined, as shown in Figure 6-2. Figure 6-2 Varying Character String Data Type (DSC$K_DTYPE_VT) Format
Chapter 7
|
Unless stated otherwise, all fields in descriptors represented as unsigned quantities are read-only from the point of view of the called procedure, and can be allocated in read-only memory at the option of the calling program. |
If a language processor implements a language-specific data type that is not added to this standard (see Chapter 6), the processor is not required to use a standard descriptor to pass an array of such a data type. However, if a language processor passes an array of such a data type using a standard descriptor, the language processor fills in the DSC$B_DTYPE field with the value 0, indicating that the data-type field is unspecified, rather than using a more general data-type code.
For example, an array of PL/I POINTER data types has the DTYPE field filled in with the value 0 (unspecified data type), rather than with the value 4 (longword [unsigned] data type). The remaining fields are filled in as specified by this standard; for example, DSC$W_LENGTH is filled in with the size in bytes. Because the language-specific data type might be added to the standard in the future, generic application procedures that examine the DTYPE field should be prepared for 0 and for additional data types.
Table 7-1 identifies the classes of argument descriptors for use in standard environments. Each class has two synonymous names---one for 32-bit environments (DSC$) and one for 64-bit environments (DSC64$). Descriptions and formats of each of these descriptors follow.
Descriptor | Code | Class |
---|---|---|
DSC$K_CLASS_S
DSC64$K_CLASS_S |
1 | Fixed-length scalar/string |
DSC$K_CLASS_D
DSC64$K_CLASS_D |
2 | Dynamic string |
DSC$K_CLASS_A
DSC64$K_CLASS_A |
4 | Contiguous array |
DSC$K_CLASS_P
1
DSC64$K_CLASS_P 1 |
5 | Procedure argument descriptor |
DSC$K_CLASS_SD
DSC64$K_CLASS_SD |
9 | Decimal (scalar) string |
DSC$K_CLASS_NCA
DSC64$K_CLASS_NCA |
10 | Noncontiguous array |
DSC$K_CLASS_VS
DSC64$K_CLASS_VS |
11 | Varying string |
DSC$K_CLASS_VSA
DSC64$K_CLASS_VSA |
12 | Varying string array |
DSC$K_CLASS_UBS
DSC64$K_CLASS_UBS |
13 | Unaligned bit string |
DSC$K_CLASS_UBA
DSC64$K_CLASS_UBA |
14 | Unaligned bit array |
DSC$K_CLASS_SB
DSC64$K_CLASS_SB |
15 | String with bounds |
DSC$K_CLASS_UBSB
DSC64$K_CLASS_UBSB |
16 | Unaligned bit string with bounds |
Figure 7-1 shows the descriptor prototype format. There are two forms: one for use with 32-bit addresses and one for use with 64-bit addresses. The two forms are compatible in that the forms can be distinguished dynamically at run time and, except for the size and consequential placement of fields, 32-bit and 64-bit descriptors are identical in content and interpretation.
The 32-bit descriptors are used on all OpenVMS systems. When used on OpenVMS Alpha systems or OpenVMS I64 systems, 32-bit descriptors provide full compatibility with their use on OpenVMS VAX systems. The 64-bit descriptors are used on both OpenVMS Alpha systems and OpenVMS I64 systems---they have no counterparts and are not recognized on OpenVMS VAX systems.
Figure 7-1 Descriptor Prototype Format
The 32-bit descriptors on OpenVMS Alpha systems and OpenVMS I64 systems have no required alignment for compatibility with OpenVMS VAX systems; however, longword alignment generally promotes performance. The 64-bit descriptors on OpenVMS Alpha systems and OpenVMS I64 systems must be quadword aligned.
Table 7-2 describes the fields of the descriptor. In this table and the similar tables for descriptors in later sections, note that most fields have two symbols and one description. The symbol that begins with the prefix DSC$ is used with 32-bit descriptors, while the symbol that begins with the prefix DSC64$ is used with 64-bit descriptors.
In this chapter, it is generally the practice to use only the main part of a field name, without either of the prefixes used in actual code. For example, the length field is referred to using LENGTH rather than mentioning both DSC$W_LENGTH and DSC64$Q_LENGTH. The DSC$ and DSC64$ prefixes are used only when referring to a particular form of descriptor.
The CLASS and DTYPE fields occupy the same offsets in both 32-bit and 64-bit descriptors. Thus, the symbols DSC$B_CLASS and DSC64$B_CLASS have the same definition, as do DSC$B_DTYPE and DSC64$B_DTYPE. Furthermore, these fields are permitted to contain the same values with the same meanings in both 32-bit and 64-bit forms.
The DSC$W_LENGTH and DSC$A_POINTER fields in the 32-bit descriptors correspond in placement to the DSC64$W_MBO (must be 1) and DSC64$L_MBMO (must be -1) fields in the 64-bit descriptors. The values of these fields are used to distinguish whether a given descriptor has the 32-bit or 64-bit form as described later in this section.
When the CLASS field is 0, no more information can be assumed than is shown in Table 7-2.
Symbol | Description |
---|---|
DSC$W_LENGTH
DSC64$Q_LENGTH |
Defines the data item length specific to the descriptor class. |
DSC64$W_MBO | In a 64-bit descriptor, this field must contain the value 1. This field overlays the DSC$W_LENGTH field of a 32-bit descriptor and the value 1 is necessary to correctly distinguish between the two forms (see below). |
DSC$B_DTYPE
DSC64$B_DTYPE |
A data-type code. Data-type codes are listed in Sections 6.1 and 6.2. |
DSC$B_CLASS
DSC64$B_CLASS |
A descriptor class code that identifies the format and interpretation of the other fields of the descriptor as specified in the following sections. This interpretation is intended to be independent of the DTYPE field, except for the data types that are made up of units less than a byte (packed-decimal string [P], aligned bit string [V], and unaligned bit string [VU]). The CLASS code can be used at run time by a called procedure to determine which descriptor is being passed. |
DSC$A_POINTER
DSC64$PQ_POINTER |
The address of the first byte of the data element described. |
DSC64$L_MBMO | In a 64-bit descriptor, this field must contain the value -1 (all 1 bits). Note that this field overlays the DSC$A_POINTER field of a 32-bit descriptor and the value -1 is necessary to correctly distinguish between the two forms (see below). |
As previously mentioned, the MBO field (a word at offset 0) and the MBMO field (a longword at offset 4) are used to distinguish between a 32-bit and 64-bit descriptor. A called routine that is designed to handle both kinds of descriptors must do both of the following:
It may seem sufficient to test just the MBMO field. However, that allows a 32-bit descriptor with a length of 0 and an undefined pointer to be inadvertently treated as a 64-bit descriptor. If the MBMO field contains -1, then 0 and 1 are the only values of the MBO field that have defined interpretations. |
Previous | Next | Contents | Index |