HP Pascal/iX Programmer's Guide (31502-90023)
A-: 10
set32_1 : hp3000_32_set1;
set32_2 : hp3000_32_set2;
set32_3 : hp3000_32_set3;
BEGIN
setconvert(set16_1,set32_1); {convert from Pascal/V to HP Pascal}
setconvert(set32_1,set16_1); {convert from HP Pascal to Pascal/V}
setconvert(set16_1,set32_2); {Illegal -- different packings}
setconvert(set16_1,set32_3); {Illegal -- different base types}
setconvert(set16_1,set16_2); {Illegal -- same packing algorithm format}
END.
Strconvert Procedure
The predefined procedure
strconvert
converts a string from Pascal/V
packing algorithm (HP3000_16) format to HP Pascal packing algorithm
(HP3000_32) format. It is enabled by the HP3000_16 compiler option.
Syntax
strconvert(
string1,string2
)
Parameters
string1
The name of the string variable to be converted. The
string variable must be in Pascal/V packing algorithm
(HP3000_16) format.
string2
The name of the string variable into which the converted
string is to be stored. The string variable must be in HP
Pascal packing algorithm (HP3000_32) format.
Example
PROGRAM prog;
$HP3000_16$ {Enables strconvert procedure}
TYPE
str16_20=string[20]; {Pascal/V packing algorithm (HP3000_16)}
str32_40=$HP3000_32$ string[40]; {HP Pascal packing algorithm (HP3000_32)}
VAR
sv32_1,
sv32_2 : str32_40;
sv16_1,
sv16_2 : str16_20;
BEGIN
strconvert(sv16_1,sv32_1);
strconvert(sv32_2,sv32_1); {Illegal}
strconvert(sv16_1,sv16_2); {Illegal}
END.
Pascal/V Packing Algorithm
The Pascal/V packing algorithm is an alternative to the default HP Pascal
packing algorithm that Chapter 5 explains. If you want the compiler to
use the Pascal/V packing algorithm, include the compiler option HP3000_16
in your program (see the
HP Pascal/iX Reference Manual
for more
information on the compiler option HP3000_16). HP3000_16 causes the
compiler to use the Pascal/V packing algorithm, with these exceptions:
* Pointers are allocated four bytes each and are 4-byte-aligned.
* Files are aligned according to the HP Pascal packing algorithm.
File control blocks are determined by the HP Pascal packing