libmawk_call_function.3libmawk - Man Page

call an user defined (script) function


#include <libmawk.h>

int libmawk_call_function(mawk_state_t *MAWK, const char *fname, CELL *res, const char *argtpes, ...);

int libmawk_call_functionp(mawk_state_t *MAWK, const char *fname, CELL *res, const char *argtpes, void **args);


The libmawk_call_function() function looks up an user defined awk function called fname , fills the stack with arguments converted from the varargs and calls the function. The libmawk_call_functionp() performs the same action but avoids using vararg by requiring an array of generic pointers to the function arguments.

Argtype is a zero terminated string for both functions, each character corresponding to an argument. Type characters are described in libmawk_set_cell() manual page.

If res is non-NULL, it is cell_destroyed (regardless of errors) and the return value of the user function is copied into it. The caller shall run libmawk_cell_destroy on it.

Argument m is a libmawk context previously returned by libmawk_initialize() or libmawk_initialize_stage3().

Return Value

A pointer to the cell returned by the user function. The cell returnedmust be destroyed by the application using libmawk_cell_destroy.

See Also

libmawk_initialize_stage(3libmawk), libmawk_initialize(3libmawk), libmawk_cell_destroy(3libmawk), libmawk_set_cell(3libmawk),


2009-08-10 libmawk manual