HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
G- 9
The data structure that HP Business BASIC/XL uses to store strings
consists of two parts:
1. A dope vector that (in the MPE XL environment) consists of one 4
byte word to indicate the maximum number of characters allowed in
the string (the declared length) and one 4 byte word to indicate
the actual number of characters currently in the string.
2. The characters in the string.
The address that is passed to an ANYPARM EXTERNAL is the address of the
dope vector, not the address of the first character. The structure of
the string in memory is:
Address in the
actual parameter table
references
| +---------------------------------------+
-----> | maximum length |
|---------------------------------------|
| actual length |
|---------------------------------------|
char- | first| second | third | fourth |
acters: |---------------------------------------|
| fifth | sixth | seventh| eighth |
|---------------------------------------|
| . |
| . |
| . |
+---------------------------------------+
NOTE HP Business BASIC/XL always reserves an extra byte at the end of
all strings, including each element of string arrays. When
computing the size of an element, this extra byte must be taken
into account. For example, in a string array dimensioned with
eight characters per string, each element will take up 20 bytes.
The actual number of bytes used to store a string can easily be
calculated by the following formula:
bytes_required = 8 + maximum_length +( 4 - ((maximum_length + 4) MOD 4))
Arrays
All arrays are preceded by a dope vector that describes pertinent
information concerning the number of elements in the array and the number
of dimensions. The address of the array in the actual parameter table
passed to the external procedure is that of the first word in the array's
dope vector.
Array dope vectors contain the following information:
1. The address of the first word of the data portion of the array.
2. The total number of elements (not words or bytes) in the array.
3. For each dimension:
a. The total number of elements in the dimension.
b. The lower bound for the dimension.
There can be up to six dimensions in an array.
The array dope vector has the following structure: