int libcox_context_push_aux_data(libcox_context *pCtx,void *pUserData);
void * libcox_context_peek_aux_data(libcox_context *pCtx);
void * libcox_context_pop_aux_data(libcox_context *pCtx);
Push, Peek and Pop auxiliary private data of a user installed command.
These interfaces are available to foreign commands in the case they need a stack for an arbitrary number of auxiliary private data perhaps to keep some state information.
The libcox_context_push_aux_data() routine pushes an arbitrary pointer in the auxiliary data stack.
The libcox_context_peek_aux_data() routine return the last pushed user pointer in the auxiliary data stack.
The libcox_context_pop_aux_data() pops and returns the last pushed user pointer in the auxiliary data stack.
These interfaces accepts as their first argument a pointer to a libcox_context which mean that they are designed to be invoked only from a foreign command. Also note that each registered foreign function have its own auxiliary data stack.
These routines must be called from the same thread in which the application-defined function is running.
Foreign command call context.
libcox_context_push_aux_data() return LIBCOX_OK if the pointer was successfully pushed on the stack. Any other return value indicates failure (Out of memory).
libcox_context_peek_aux_data() and libcox_context_pop_aux_data() return the last pushed user pointer in the auxiliary data stack or NULL if the stack is empty.