This function can be used to get arguments simple and fast in extension modules.
All functionality of this function can be individually programmed using the
besXXX macros. Here it is to ease the programming of extension modules for most of
This function should be called like
iError = besGETARGS "ldz",&l1,&d1,&s besGETARGE
The macro besGETARGS (read GET ARGument Start) hides the complexity of the
function call and the macro besGETARGE (read Get ARGument End) simply closes the
The first argument is format string. Each character specifies how the next argument
should be treated.
int basext_GetArgsF(pSupportTable pSt,
The following characters are recognized:
- i the next argument of the function call should point to a long variable.
The ScriptBasic argument will be converted to long using the macro
besCONVERT2LONG and will be stored in the long variable.
- r the same as l except that the argument should point a double and the
basic argument is converted to double using besCONVERT2DOUBLE.
- z the next argument should point to a char * pointer. The function takes
the next BASIC argument as string, converts it to zero terminated string
allocating space for it. These variables SHOULD be released by the caller
using the macro besFREE.
- s the next argument should point to a unsigned char * pointer. The function takes
the next BASIC argument as string, converting it in case conversion is needed, and
sets the unsigned char * pointer to point to the string. This format character
should be used together with the character l
- l the next argument should point to a long and the value of the variable
will be the length of the last string atgument (either z or s).
If there was no previous string argument the value returned will be zero.
- p the next argument should point to a void * pointer. The BASIC argument value
should be a string of sizeof(void *) characters that will be copied into the
pointer argument. If the argument is not string or has not the proper size the function
- [ The arguments following this character are optional. Optional arguments may be
unspecified. This is the case when the BASIC function call has less number of
arguments or when the actual argument value is undef. In case of optional
arguments the undef values are converted to zero value of the appropriate
type. This means 0 in case of long, 0.0 in case of double, NULL in case of pointer
and zero length string in case of strings.
- ] Arguments following this character are mandatory (are not optional). When the
function starts to process the arguments they are mandatory by default. Using this
notation you can enclode the optional arguments between [ and ]. For example
the format string "ii[z]" means two long arguments and an optional zero terminated
- * The argument is skipped. This may be used during development of a function.
The return value of the function is zero in case there is no error or the error code.