For records of type VARIABLE, SYSTEM_VARIABLE and HEAP_DATA, the final segment of data in the record is the data itself (VARDATA). For all of these record types, the data format is the same.
For ``simple'' data types (as defined above), and arrays of simple data types, the data usually appears in its native format. However, some data types are translated into a slightly different form for the SAVE format. The following table specifies how this transformation is performed.
|IDL Type||Storage Type & Format|
|BYTE||BYTE_DATA (see below)|
|Signed or Unsigned INT (16-bit)||(U)LONG (32-bit) IEEE|
|Signed or Unsigned INT (32-bit)||(U)LONG (32-bit) IEEE|
|Signed or Unsigned INT (64-bit)||(U)LONG64 (64-bit) IEEE|
|FLOAT (32-bit)||FLOAT (32-bit) IEEE|
|DOUBLE (64-bit)||DOUBLE (64-bit) IEEE|
|COMPLEX (32-bit)||2FLOAT (32-bit) IEEE|
|DCOMPLEX (64-bit)||2DOUBLE (64-bit) IEEE|
|STRING||STRING_DATA (see below)|
|POINTER||LONG (32-bit) IEEE (see below)|
The alignment of the start of all types is on a 32-bit boundary. Array storage formats are packed as closely as possible, with no padding between array elements.
Byte values stored in variables have the following special BYTE_DATA format. Unlike other formats, the byte format appears to have a single 32-bit LENGTH header which indicates the number of bytes, followed by the byte data itself, and finally followed by a number of pad bytes in order to pad the stream to the next 32-bit boundary. The LENGTH information is redundant since length information can also be derived from the type descriptors.
|LONG||LENGTH||Number of bytes stored|
|BYTE LENGTH||BYTES||Byte data values|
|BYTEN||PAD||Padding bytes, to align stream to next 32-bit boundary. If the stream is already on a 32-bit boundary, then no PAD bytes appear.|
String data stored in variables also have a special format, different than the raw STRING format described in previous sections. The layout is given by STRING_DATA below.
|LONG2||LENGTH||Length of the string in bytes (length repeated)|
|BYTE LENGTH||CHARS||Characters of string, expressed as bytes. If the string is empty, i.e., if LENGTH is zero, then no CHARS are present. There is no zero termination.|
|BYTEN||PAD||Padding bytes, to align stream to next 32-bit boundary. If the stream is already on a 32-bit boundary, or if LENGTH is zero, then no PAD bytes appear.|
The difference between STRING and STRING_DATA is that the LENGTH field is repeated twice rather than appearing only once for the STRING data type. String arrays are also packed together as tightly as possible.
Pointers are another special case. Pointers are stored as long integers. The integer is the same heap index value that appears in the HEAP_HEADER table of contents record, and the HEAP_DATA record. A pointer value of 3, for example, refers to the heap variable whose index value is also 3. Note that it is possible for more than one pointer to refer to the same heap variable.
Structures are obviously composed of more simple data types and (possibly) other structures. The individual components of a structure are stored, in order, packed on 32-bit boundaries.