HP Pascal/iX Programmer's Guide (31502-90023)

9- 16
sum : small_int;
PROCEDURE splprc (VAR cstr : char_str;
inta : small_int;
intb : small_int;
VAR total : small_int); EXTERNAL SPL;
BEGIN
a_str := 'Add these 2 numbers:';
int1 := 25;
int2 := 15;
writeln(a_str,int1,int2);
splprc(a_str,int1,int2,sum);
writeln(a_str,sum);
END.
SPL routine:
$CONTROL SUBPROGRAM
BEGIN
PROCEDURE splprc(cstr,int1,int2,sum);
VALUE int1,int2;
INTEGER int1,int2,sum;
BYTE ARRAY cstr;
BEGIN
sum := int1 + int2;
MOVE cstr := "Sum of two numbers: ";
END;
END.
Example 2
The Pascal program Pascal_SPL_V calls splprv, an external SPL routine
with variable parameters.
Pascal program:
$HP3000_16$
PROGRAM Pascal_SPL_V (input,output);
TYPE
char_str = PACKED ARRAY [1..20] OF char;
small_int = -32768..32767;
VAR
a_str : char_str;
int1,
int2,
sum : small_int;
PROCEDURE splprv (VAR cstr : char_str;
inta : small_int;
intb : small_int;
VAR total : small_int);
EXTERNAL SPL VARIABLE;
BEGIN
a_str := 'Add these 2 numbers:';
int1 := 25;
int2 := 15;
writeln(a_str,int1,int2);
splprv(a_str,int1,int2,sum);
writeln(a_str,sum);
END.
SPL routine with variable parameters:
$CONTROL SUBPROGRAM