Function _partype() Foundation
Determines the type of a parameter or the number of parameters.
ULONG _partype(XppParamList pList, ULONG ulIndex);
When ulIndex is equal to NULL the number of parameters passed to the actual function is returned. If ulIndex is not equal to NULL, _parType() returns the type of the parameter and whether the parameter was passed by reference.
_partype() is used to determine the type of a parameter before its value is accessed. (In CA-Clipper the function _parinfo() was used to do this).
It should be noted that for some types more then one bit is masked in the return value. Furthermore, the numeric value representing a type may change in future Xbase++ versions. Because of these reasons the return value should be tested with one of the macros defined in the header file xpppar.h. The following table lists the macros and the types for which the macro evaluates to true:
Macro | Type | Meaning |
---|---|---|
XPP_IS_UNDEF() | XPP_UNDEF | NIL |
XPP_IS_CHAR() | XPP_CHARACTER or | Character string |
XPP_MEMO | ||
XPP_IS_MEMO() | XPP_MEMO | Memo character string |
XPP_IS_NUM() | XPP_NUMERIC or | Numeric |
XPP_DOUBLE | ||
XPP_IS_FLOAT() | XPP_DOUBLE | Floating point |
XPP_IS_LOGIC() | XPP_LOGICAL | Logical |
XPP_IS_DATE() | XPP_DATE | Date |
XPP_IS_ARRAY() | XPP_ARRAY | Array |
XPP_IS_BLOCK() | XPP_BLOCK | Code block |
XPP_IS_OBJECT() | XPP_OBJECT | Object |
XPP_IS_REFPAR() | Parameter was passed | |
by reference |
/*
Test whether a parameter was passed by reference and change its
value.
*/
#include <xpppar.h>
if ( XPP_IS_REFPAR( _partype(<pList>, 6) ) )
{
_storc("This string is returned to Xbase++.",
<pList>, 6);
}
/*
get the number of parameters
*/
#define PCOUNT(paramList) _partype(paramList, 0)
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.