Working with the stack
The Native Interface provides two sets of macros for accessing the stack: `pop' and `push'. These macros must be used in order to obtain the values of the arguments for subroutines and parameters and to return the results of functions to Mosel.
Macros for taking objects from the stack:
XPRM_POP_INT(XPRMcontext ctx)
XPRM_POP_REAL(XPRMcontext ctx)
XPRM_POP_STRING(XPRMcontext ctx)
XPRM_POP_REF(XPRMcontext ctx)
Macros for putting objects onto the stack:
XPRM_PUSH_INT(XPRMcontext ctx, i)
XPRM_PUSH_REAL(XPRMcontext ctx, r)
XPRM_PUSH_STRING(XPRMcontext ctx, s)
XPRM_PUSH_REF(XPRMcontext ctx, r)
Only the basic types integer, real and string are passed directly to and from the stack. Boolean values are treated as integers. All other types are passed by reference (macros XPRM_POP_REF and XPRM_POP_REF).