The int value of NPAR is passed as the first item in the CSUB parameter list so the CSUB can know the number of arguments in the CALL statement. Omitted OPTIONAL arguments are passed as NULL pointers. The CSUB can use the value of NPAR to determine the number of passed arguments or it can test the argument pointer values before they are used. For example:
if( NPAR > 4 )
*b = result; /* OK for use */
else
return( 143 ); /* missing OPTIONAL argument */
if( b )
*b = result; /* OK for use */
else
return( 143 ); /* missing OPTIONAL argument */
This section described how HTBasic passes CALL arguments to the CSUB, how to define data and dimension table pointers, and how to handle OPTIONAL arguments.