XEQ( ) |
In-line Subprogram Execute |
XEQ(subprog$,expression, [ arglist | * ] ,…[,ERR=stmtref])
* |
(Asterisk) Indicates that program will be PERFORMed rather than CALLed; thus, all variables will be passed. |
arglist |
Comma-separated list of arguments to pass to the subprogram. |
expression |
Expression will be evaluated after the call and used as the return value for the function. |
subprog$ |
Name of the subprogram to call. Maximum string size 8KB. |
stmtref |
Program line number or statement label to which to transfer control. |
Evaluated value in expression after executing in-line CALL or PERFORM.
The XEQ( ) function executes an in-line CALL or PERFORM directive. When PxPlus encounters the XEQ( ) function, the subprogram named in the function will be CALLed with any arguments supplied. If an * (asterisk) is specified, the subprogram is PERFORMed instead. After the subprogram exits, the XEQ( ) function evaluates the expression and returns it.
The primary advantage of XEQ( ) is in single-line Global functions. Consider the following:
0010 CALL "GETDTE",DT,DATE$ | |
|
0020 PRINT "Date:",DATE$ |
0010 PRINT "Date:",XEQ("GETDTE",_D$,DT,_D$) | |
| |
|
DEF FN%DTE$(_DT)=XEQ("GETDTE",_D$,_DT,_D$) |
Then: |
0010 PRINT "Date:",FN%DTE$(DT) |
(The ability to have the XEQ function PERFORM a program instead of CALL was added in PxPlus v 7.00.)