HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
G- 15
100 Sint1=-32768
110 Sint2=32767
120 CALL Example(Sint1,Sint2)
121 ! a call with two short integer parameters
130 CALL Example(Real1,Int_arr(*,*))
131 ! invalid real and array parameters
140 Int_arr(2,2)=100000
150 CALL Example(Int_arr(2,2))
151 ! a call with an array element parameter
160 CALL Example(Sint1,Int_arr(1,1),Int2,Sint2,Int1,&
(Sint1),(Sint1+Sint2),&
Int_arr(2,2),(Int1+Sint2),"Beginning of invalid parameters",&
Str$,Real1,Int_arr(*,*))
>run
Number of parameters passed to SIMPLE EXAMPLE is: 0
Number of parameters passed to SIMPLE EXAMPLE is: 2
1 INTEGER -2147483648
2 INTEGER 2147483647
Number of parameters passed to SIMPLE EXAMPLE is: 2
1 SHORT INTEGER -32768
2 SHORT INTEGER 32767
Number of parameters passed to SIMPLE EXAMPLE is: 2
1 Actual parameter to SIMPLE EXAMPLE has an invalid data type.
2 Actual parameter to SIMPLE EXAMPLE must be a scalar.
Number of parameters passed to SIMPLE EXAMPLE is: 1
1 INTEGER 1000000
Number of parameters passed to SIMPLE EXAMPLE is: 13
1 SHORT INTEGER -32768
2 INTEGER 0
3 INTEGER 2147483647
4 SHORT INTEGER 32767
5 INTEGER -2147483648
6 SHORT INTEGER -32768
7 INTEGER -1
8 INTEGER 1000000
9 INTEGER -2147450881
10 Actual parameter to SIMPLE EXAMPLE has an invalid data type.
11 Actual parameter to SIMPLE EXAMPLE has an invalid data type.
12 Actual parameter to SIMPLE EXAMPLE has an invalid data type.
13 Actual parameter to SIMPLE EXAMPLE must be a scalar.
>
Example of a Simple C ANYPARM Procedure
This section contains a C procedure that can be called from HP Business
BASIC/XL using the ANYPARM call interface. This procedure shows how to
define the actual parameter table that the ANYPARM call requires. It
also contains an example procedure that accepts the actual parameter
table as a formal parameter.
#define C_MAX_NUM_PARAMETERS 50
#define C_SINTEGER_TYPE 5 /* identifies BASIC SHORT INTEGER type */
#define C_INTEGER_TYPE 11 /* identifies BASIC INTEGER type */
union u_scalar_value{ /* union to access parameter appropriately */
short sinteger_value;
int integer_value;
} scalar_value;
struct parameter_record{ /* entry in the actual parameter array */
union u_scalar_value *param_address;
short param_type;
short number_of_dimensions;
};
/* simple_example
simple_example is a procedure written to be called by the BASIC ANYPARM
call mechanism. A loop prints the values of scalar 16 and 32 bit integers