HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

G-: 16
and prints error messages for all other entries in the actual parameter
table.
*/
simple_example(num_params, p_actual_param_table)
int num_params;
struct parameter_record p_actual_param_table[];
{
int param_index;
printf("Number of parameters passed to SIMPLE EXAMPLE is:%3d\n",
num_params);
if (num_params > C_MAX_NUM_PARAMETERS) {
printf("Too many actual parameters passed to SIMPLE EXAMPLE.\n");
printf("Maximum number is: %d\n", C_MAX_NUM_PARAMETERS);
exit(0);
}
for (param_index = 0; param_index < num_params; param_index++){
printf("%3d ", (param_index+1));
if (p_actual_param_table[param_index].number_of_dimensions == 0){
switch (p_actual_param_table[param_index].param_type){
case C_SINTEGER_TYPE:
printf("SHORT INTEGER %d\n", (*p_actual_param_table[param_index].
param_address).sinteger_value);
break;
case C_INTEGER_TYPE:
printf("INTEGER %d\n", (*p_actual_param_table[param_index].
param_address).integer_value
);
break;
default:
printf("Actual parameter to SIMPLE EXAMPLE has an invalid");
printf(" data type.\n");
}
} else {
printf("Actual parameter to SIMPLE EXAMPLE must be a scalar.\n");
}
}
}
Calling the C External SIMPLE_EXAMPLE
Assume that the C program presented in the previous section is in the
file, CPROG. To add the SIMPLE_EXAMPLE procedure to the local executable
library named XL, do the following:
:ccxl cprog
:linkeditor
linked>buildxl xl
linked>addxl from=$oldpass; to=xl
linked>exit
:
The output from the C procedure is the same as that from the Pascal
procedure in the previous section.
Pascal Data Structures for ANYPARM Calls
This section contains a Pascal program that illustrates type and constant
definitions required for ANYPARM externals.
$title 'ANYPARM.DECLS.BASIC/ANYPARM Data Declarations',page$
{----------------------------------------------------------------------------}
{ ANYPARM EXTERNAL DATA DECLARATIONS }
{----------------------------------------------------------------------------}
{----------------------------------------------------------------------------}
{ Constants related to the machine and operating system. }
{----------------------------------------------------------------------------}
const