HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
G-: 14
{-----------------------------------------------------------}
for param_index := 1 to num_params do
begin {for loop processing of the actual parameters }
write( tstfil, param_index:3, ' ' );
if p_actual_param_table^[param_index].number_of_dimensions
= 0 then
begin {process scalar actual parameters }
with p_actual_param_table^[param_index].param_address^ do
{sinteger_value}
{integer_value }
case p_actual_param_table^[param_index].param_type of
c_sinteger_type:
writeln( tstfil, 'SHORT INTEGER ', sinteger_value:1 );
c_integer_type:
writeln( tstfil, 'INTEGER ', integer_value:1 );
otherwise
write( tstfil, 'Actual parameter to SIMPLE EXAMPLE has an');
writeln( tstfil, 'invalid data type.');
end {case }
end {process scalar actual parameters }
else
begin {process actual parameters that are arrays }
write( tstfil, 'Actual parameter to SIMPLE EXAMPLE must ');
writeln( tstfil, 'be a scalar.')
end {process actual parameters that are arrays }
end {for loop processing of the actual parameters }
end {simple_example's parameter array is large enough }
end; {procedure simple_example }
begin {simple_anyparm_program }
end. {simple_anyparm_program }
Example of a Simple ANYPARM Call
Assume that the Pascal program presented above is in the file, PASPROG.
To add the SIMPLE_EXAMPLE procedure to the local executable library named
XL, do the following:
:pasxl pasprog
:linkeditor
linked>buildxl xl
linked>addxl from=$oldpass; to=xl
linked>exit
:
Consult the
HPLink Editor/XL Reference Manual
for more information.
Enter the HP Business BASIC/XL interpreter, specifying your group
executable library. (Refer to "The Interpreter" in chapter 2). Within
the interpreter, enter and execute the following program:
>list
! testany
10 ANYPARM EXTERNAL Example ALIAS "simple_example"
20 INTEGER Int1,Int2 ! variable declarations
30 SHORT INTEGER Sint1,Sint2
40 REAL Real1
50 DIM INTEGER Int_arr(2,2)
60 CALL Example ! a call with no parameters
70 Int1=-2147483648
80 Int2=2147483647
90 CALL Example(Int1,Int2) ! a call with two integer parameters