HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
G- 13
const
c_max_num_parameters = 50;
type
t_parameter_record = packed record
param_address : tp_scalar_value;
param_type : shortint;
number_of_dimensions: shortint;
end;
t_actual_parameter_array = array [1..c_max_num_parameters] of
t_parameter_record;
tp_actual_parameter_array = ^t_actual_parameter_array;
{*******************************************************************}
{* }
{* SIMPLE_EXAMPLE }
{* }
{*SIMPLE_EXAMPLE is a procedure written to accept an actual }
{*parameter table as the formal parameter to the procedure. The }
{*purpose of the procedure is to write to a file the values of }
{*all scalar actual parameters that have either an INTEGER or }
{*SHORT INTEGER BASIC data type format. }
{*Actual parameters are processed in a for loop in which }
{*the value of each valid parameter is written to $STDLIST. }
{*******************************************************************}
procedure simple_example(
num_params : integer;
p_actual_param_table : tp_actual_parameter_array
);
var
param_index : integer;
{references entry in actual parameter table }
tstfil : text;
{text file to which output is to be written }
begin {procedure_example }
{-------------------------------------------------------------------}
{TESTFILE is opened in append mode so that information written to }
{ the file by previous calls is not overwritten. }
{-------------------------------------------------------------------}
append( tstfil, '$STDLIST' );
writeln( tstfil
, 'Number of parameters passed to SIMPLE EXAMPLE is: '
, num_params:2
);
{-------------------------------------------------------------------}
{Check to ensure that the number of actual parameters passed can be }
{processed by the external. }
{-------------------------------------------------------------------}
if num_params > c_max_num_parameters then
begin {too many parameters to process }
writeln( tstfil, ' Too many actual parameters passed to SIMPLE EXAMPLE.' );
writeln( tstfil, ' Maximum number is: ',
c_max_num_parameters:1 )
end {too many parameters to process }
else
begin {simple_example's parameter array is large enough }
{-----------------------------------------------------------}
{Process each of the entries in the actual parameter table }
{referenced by the formal parameter, p_actual_parameter_array.}